318 |
printf ("%d %s\r\n", CODE_INFORMATION, |
printf ("%d %s\r\n", CODE_INFORMATION, |
319 |
access_level_str (user_access)); |
access_level_str (user_access)); |
320 |
} |
} |
321 |
else if (ac == 2) |
else if ((ac == 1) || (ac == 2)) |
322 |
{ |
{ |
323 |
if (databaseValid (currentDatabase)) |
if (databaseValid (currentDatabase)) |
324 |
{ |
{ |
325 |
if (gnatsdChdb (databaseName (currentDatabase), av[0], av[1], 0, |
if (gnatsdChdb (databaseName (currentDatabase), av[0], ac == 2 ? av[1] : "", 0, |
326 |
&err) != 0) |
&err) != 0) |
327 |
{ |
{ |
328 |
print_server_errors (err); |
print_server_errors (err); |
339 |
free (currentPassword); |
free (currentPassword); |
340 |
} |
} |
341 |
currentUsername = xstrdup (av[0]); |
currentUsername = xstrdup (av[0]); |
342 |
currentPassword = xstrdup (av[1]); |
if (ac == 2) |
343 |
|
{ |
344 |
|
currentPassword = xstrdup (av[1]); |
345 |
|
} |
346 |
|
else |
347 |
|
{ |
348 |
|
currentPassword = (char *)""; |
349 |
|
} |
350 |
printf ("%d Current database is not valid; use CHDB to set the database\r\n", |
printf ("%d Current database is not valid; use CHDB to set the database\r\n", |
351 |
CODE_OK); |
CODE_OK); |
352 |
} |
} |
353 |
} |
} |
354 |
else |
else |
355 |
{ |
{ |
356 |
printf ("%d Need two arguments, username and password\r\n", |
printf ("%d Need one or two arguments, username and optionally a password\r\n", |
357 |
CODE_CMD_ERROR); |
CODE_CMD_ERROR); |
358 |
} |
} |
359 |
} |
} |
598 |
free (currentUsername); |
free (currentUsername); |
599 |
} |
} |
600 |
currentUsername = xstrdup (username); |
currentUsername = xstrdup (username); |
601 |
} |
|
|
|
|
|
if (passwd != NULL) |
|
|
{ |
|
602 |
if (currentPassword != NULL) |
if (currentPassword != NULL) |
603 |
{ |
{ |
604 |
free (currentPassword); |
free (currentPassword); |
605 |
} |
} |
606 |
currentPassword = xstrdup (passwd); |
if (passwd != NULL) |
607 |
|
{ |
608 |
|
currentPassword = xstrdup (passwd); |
609 |
|
} |
610 |
|
else |
611 |
|
{ |
612 |
|
currentPassword = NULL; |
613 |
|
} |
614 |
} |
} |
615 |
|
|
616 |
if (currentUsername == NULL) |
if (currentUsername == NULL) |
681 |
const char *user = NULL; |
const char *user = NULL; |
682 |
const char *passwd = NULL; |
const char *passwd = NULL; |
683 |
|
|
684 |
if (ac != 1 && ac != 3) |
if (ac != 1 && ac != 2 && ac != 3) |
685 |
{ |
{ |
686 |
printf ("%d One or three arguments required.\r\n", CODE_CMD_ERROR); |
printf ("%d One, two, or three arguments required.\r\n", CODE_CMD_ERROR); |
687 |
return; |
return; |
688 |
} |
} |
689 |
|
|
692 |
user = av[1]; |
user = av[1]; |
693 |
passwd = av[2]; |
passwd = av[2]; |
694 |
} |
} |
695 |
|
else if (ac == 2) |
696 |
|
{ |
697 |
|
user = av[1]; |
698 |
|
} |
699 |
|
|
700 |
if (gnatsdChdb (av[0], user, passwd, 0, &err) != 0) |
if (gnatsdChdb (av[0], user, passwd, 0, &err) != 0) |
701 |
{ |
{ |
1801 |
CODE_INFORMATION); |
CODE_INFORMATION); |
1802 |
printf ("%d- SUBM submit a new PR\r\n", |
printf ("%d- SUBM submit a new PR\r\n", |
1803 |
CODE_INFORMATION); |
CODE_INFORMATION); |
1804 |
printf ("%d- CHDB <database> [<user> <passwd>]\r\n", |
printf ("%d- CHDB <database> [<user> [<passwd>]]\r\n", |
1805 |
CODE_INFORMATION); |
CODE_INFORMATION); |
1806 |
printf ("%d- change GNATS ROOT to <database>\r\n", |
printf ("%d- change GNATS ROOT to <database>\r\n", |
1807 |
CODE_INFORMATION); |
CODE_INFORMATION); |
1808 |
printf ("%d- USER <name> <passwd> Sets the current user\r\n", |
printf ("%d- USER <name> [<passwd>] Sets the current user\r\n", |
1809 |
CODE_INFORMATION); |
CODE_INFORMATION); |
1810 |
printf ("%d- USER Report current access level\r\n", |
printf ("%d- USER Report current access level\r\n", |
1811 |
CODE_INFORMATION); |
CODE_INFORMATION); |