Mercurial > gftp.yaz
diff src/text/gftp-text.c @ 166:a4bf947e9e22
2003-5-27 Brian Masney <masneyb@gftp.org>
* Makefile.am configure.in autogen.sh - build fixes
* src/text/gftp-text.c - if the protocol we are connecting to
doesn't need a username/password, don't prompt the user for one
author | masneyb |
---|---|
date | Tue, 27 May 2003 18:03:20 +0000 |
parents | 5c952c5cb438 |
children | d40f9db52cdf |
line wrap: on
line diff
--- a/src/text/gftp-text.c Sat May 24 15:15:32 2003 +0000 +++ b/src/text/gftp-text.c Tue May 27 18:03:20 2003 +0000 @@ -337,28 +337,39 @@ if (request->username == NULL) { - if ((pos = gftp_text_ask_question ("Username [anonymous]", 1, tempstr, - sizeof (tempstr))) != NULL) + if (request->need_userpass) { - gftp_set_username (request, pos); - if (request->password) + if ((pos = gftp_text_ask_question ("Username [anonymous]", 1, tempstr, + sizeof (tempstr))) != NULL) { - g_free (request->password); - request->password = NULL; + gftp_set_username (request, pos); + if (request->password) + { + g_free (request->password); + request->password = NULL; + } + } + else + gftp_set_username (request, "anonymous"); + + if (strcmp (request->username, "anonymous") != 0 && + (request->password == NULL || *request->password == '\0')) + { + if ((pos = gftp_text_ask_question ("Password", 0, tempstr, + sizeof (tempstr))) == NULL) + return (1); + gftp_set_password (request, pos); } } else - gftp_set_username (request, "anonymous"); + { + request->username = g_strdup (""); + if (request->password != NULL) + g_free (request->password); + request->password = g_strdup (""); + } } - if (strcmp (request->username, "anonymous") != 0 && - (request->password == NULL || *request->password == '\0')) - { - if ((pos = gftp_text_ask_question ("Password", 0, tempstr, - sizeof (tempstr))) == NULL) - return (1); - gftp_set_password (request, pos); - } gftp_connect (request); return (1);