diff src/text/gftp-text.c @ 169:d40f9db52cdf

2003-6-8 Brian Masney <masneyb@gftp.org> * lib/https.c lib/options.h lib/sslcommon.c - make sure USE_SSL is defined before using any SSL functions * lib/gftp.h lib/protocols.c lib/rfc2068.c lib/sshv2.c lib/sslcommon.c lib/rfc959.c - make sure we use request->datafd for the connection. Removed sockfd from gftp_request structure * lib/rfc959.c - add data_connection to rfc959_parms structure. Use this for the FTP data connection * src/text/gftp-text.c - fixes for username/password prompt * src/gtk/misc-gtk.c src/gtk/transfer.c - s/sockfd/datafd/g * configure.in - added lib/Makefile (forgot to commit last time) * Makefile.am - added intl to SUBDIRS
author masneyb
date Sun, 08 Jun 2003 15:49:02 +0000
parents a4bf947e9e22
children 4c288d05b26a
line wrap: on
line diff
--- a/src/text/gftp-text.c	Sun Jun 08 15:04:40 2003 +0000
+++ b/src/text/gftp-text.c	Sun Jun 08 15:49:02 2003 +0000
@@ -335,42 +335,29 @@
       return (1);
     }
 
-  if (request->username == NULL)
+  if (request->need_userpass)
     {
-      if (request->need_userpass)
+      if (request->username == NULL || *request->username == '\0')
         {
           if ((pos = gftp_text_ask_question ("Username [anonymous]", 1, tempstr, 
                                              sizeof (tempstr))) != 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);
+              gftp_set_password (request, NULL);
             }
         }
-      else
+
+      if (request->username != NULL &&
+          strcmp (request->username, "anonymous") != 0 && 
+          (request->password == NULL || *request->password == '\0'))
         {
-          request->username = g_strdup ("");
-          if (request->password != NULL)
-            g_free (request->password);
-          request->password = g_strdup ("");
+          if ((pos = gftp_text_ask_question ("Password", 0, tempstr, 
+                                             sizeof (tempstr))) == NULL)
+            return (1);
+          gftp_set_password (request, pos);
         }
     }
 
-
   gftp_connect (request);
   return (1);
 }