This commit is contained in:
Mario Fetka
2026-05-22 12:46:01 +02:00
parent 3b8664cb77
commit b2da728f4b
3 changed files with 39 additions and 34 deletions

17
login.c
View File

@@ -103,6 +103,7 @@ static int get_raw_str(uint8 *s, int maxlen, int doecho)
static void getstr(char *what, char *str, int rsize, int doecho)
{
fprintf(stdout, "%s: ", what);
fflush(stdout);
get_raw_str(str, rsize, doecho);
fprintf(stdout, "\n");
}
@@ -121,7 +122,6 @@ int func_login(int argc, char *argv[], int mode)
uint8 uname[200];
uint8 upasswd[200];
SEARCH_VECTOR save_drives;
int password_given = 0;
if (argc > 1) {
if (argv[1][0] == '-') {
@@ -135,26 +135,23 @@ int func_login(int argc, char *argv[], int mode)
remove_nwpathes();
if (argc > 1) strmaxcpy(uname, argv[1], sizeof(uname) -1);
else uname[0]='\0';
if (argc > 2) {
strmaxcpy(upasswd, argv[2], sizeof(upasswd) -1);
password_given = 1;
} else upasswd[0]='\0';
if (argc > 2) strmaxcpy(upasswd, argv[2], sizeof(upasswd) -1);
else upasswd[0]='\0';
while (result) {
if (!uname[0]) getstr("Login", uname, sizeof(uname)-1, 1);
if (uname[0]) {
upstr(uname);
if (!password_given) {
upstr(upasswd);
if ((result = do_object_login(uname, 0x1, upasswd, option)) < 0 && !*upasswd) {
getstr("Password", upasswd, sizeof(upasswd)-1, 0);
upstr(upasswd);
password_given = 1;
} else upstr(upasswd);
result = do_object_login(uname, 0x1, upasswd, option);
result = do_object_login(uname, 0x1, upasswd, option);
}
if (result < 0) {
fprintf(stdout, "Login incorrect\n\n");
uname[0] = '\0';
upasswd[0] = '\0';
password_given = 0;
}
} else break;
}