]> sjero.net Git - wget/blobdiff - src/ftp-basic.c
[svn] Added NTLM support.
[wget] / src / ftp-basic.c
index 011268b2d58b11ef2f372b7a0f201cc5b0483312..592dd59adac304cee0993ba35f66c8fbac90f51c 100644 (file)
@@ -93,10 +93,11 @@ ftp_response (int fd, char **ret_line)
 static char *
 ftp_request (const char *command, const char *value)
 {
-  char *res = (char *)xmalloc (strlen (command)
-                               + (value ? (1 + strlen (value)) : 0)
-                               + 2 + 1);
-  sprintf (res, "%s%s%s\r\n", command, value ? " " : "", value ? value : "");
+  char *res;
+  if (value)
+    res = concat_strings (command, " ", value, "\r\n", (char *) 0);
+  else
+    res = concat_strings (command, "\r\n", (char *) 0);
   if (opt.server_response)
     {
       /* Hack: don't print out password.  */
@@ -122,10 +123,7 @@ ftp_login (int csock, const char *acc, const char *pass)
   /* Get greeting.  */
   err = ftp_response (csock, &respline);
   if (err != FTPOK)
-    {
-      xfree (respline);
-      return err;
-    }
+    return err;
   if (*respline != '2')
     {
       xfree (respline);
@@ -160,7 +158,7 @@ ftp_login (int csock, const char *acc, const char *pass)
       xfree (respline);
       return FTPLOGREFUSED;
     }
-#ifdef USE_OPIE
+#ifdef ENABLE_OPIE
   {
     static const char *skey_head[] = {
       "331 s/key ",
@@ -197,7 +195,7 @@ ftp_login (int csock, const char *acc, const char *pass)
         pass = skey_response (skey_sequence, seed, pass);
       }
   }
-#endif /* USE_OPIE */
+#endif /* ENABLE_OPIE */
   xfree (respline);
   /* Send PASS password.  */
   request = ftp_request ("PASS", pass);
@@ -492,7 +490,7 @@ ftp_pasv (int csock, ip_address *addr, int *port)
   assert (addr != NULL);
   assert (port != NULL);
 
-  memset (addr, 0, sizeof (ip_address));
+  xzero (*addr);
 
   /* Form the request.  */
   request = ftp_request ("PASV", NULL);
@@ -560,7 +558,7 @@ ftp_lpsv (int csock, ip_address *addr, int *port)
   assert (addr != NULL);
   assert (port != NULL);
 
-  memset (addr, 0, sizeof (ip_address));
+  xzero (*addr);
 
   /* Form the request.  */
   request = ftp_request ("LPSV", NULL);