diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-09-05 22:32:47 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-09-05 22:32:47 +0000 |
commit | 772191eebf6a62b3fe9de2482c910de8c79000d5 (patch) | |
tree | eea109f48afccf4e7cab1ea695e65fec36d1cf5e /kerberosIV | |
parent | a30f0def118756a387cba2c5eac41a702277da77 (diff) |
make sure that va_start() has matching va_end()
Diffstat (limited to 'kerberosIV')
-rw-r--r-- | kerberosIV/src/appl/ftp/ftp/ftp.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/kerberosIV/src/appl/ftp/ftp/ftp.c b/kerberosIV/src/appl/ftp/ftp/ftp.c index 300866ddfda..b78f9b8e731 100644 --- a/kerberosIV/src/appl/ftp/ftp/ftp.c +++ b/kerberosIV/src/appl/ftp/ftp/ftp.c @@ -32,7 +32,7 @@ */ #include "ftp_locl.h" -RCSID ("$KTH: ftp.c,v 1.60 1999/10/28 19:32:17 assar Exp $"); +RCSID ("$KTH: ftp.c,v 1.60.2.1 2000/06/23 02:45:40 assar Exp $"); struct sockaddr_storage hisctladdr_ss; struct sockaddr *hisctladdr = (struct sockaddr *)&hisctladdr_ss; @@ -193,8 +193,9 @@ login (char *host) printf ("Name (%s:%s): ", host, myname); else printf ("Name (%s): ", host); - fgets (tmp, sizeof (tmp) - 1, stdin); - tmp[strlen (tmp) - 1] = '\0'; + *tmp = '\0'; + if (fgets (tmp, sizeof (tmp) - 1, stdin) != NULL) + tmp[strlen (tmp) - 1] = '\0'; if (*tmp == '\0') user = myname; else @@ -203,24 +204,26 @@ login (char *host) strlcpy(username, user, sizeof(username)); n = command("USER %s", user); if (n == CONTINUE) { - if(sec_complete) - pass = myname; - else if (pass == NULL) { + if (pass == NULL) { char prompt[128]; if(myname && - (!strcmp(user, "ftp") || !strcmp(user, "anonymous"))){ + (!strcmp(user, "ftp") || !strcmp(user, "anonymous"))) { snprintf(defaultpass, sizeof(defaultpass), "%s@%s", myname, mydomain); snprintf(prompt, sizeof(prompt), "Password (%s): ", defaultpass); - }else{ + } else if (sec_complete) { + pass = myname; + } else { *defaultpass = '\0'; snprintf(prompt, sizeof(prompt), "Password: "); } - pass = defaultpass; - des_read_pw_string (tmp, sizeof (tmp), prompt, 0); - if (tmp[0]) - pass = tmp; + if (pass == NULL) { + pass = defaultpass; + des_read_pw_string (tmp, sizeof (tmp), prompt, 0); + if (tmp[0]) + pass = tmp; + } } n = command ("PASS %s", pass); } @@ -282,6 +285,7 @@ command (char *fmt,...) printf("PASS XXXX"); else vfprintf(stdout, fmt, ap); + va_end(ap); va_start(ap, fmt); } sec_vfprintf(cout, fmt, ap); |