diff lib/rfc959.c @ 298:6e0b9ca541e2

2003-10-26 Brian Masney <masneyb@gftp.org> * lib/rfc959.c - convert the PASS command from UTF8 using gftp_convert_from_utf8()
author masneyb
date Mon, 27 Oct 2003 01:40:08 +0000
parents e5ce6f15290f
children 6da95954fe41
line wrap: on
line diff
--- a/lib/rfc959.c	Mon Oct 27 01:22:45 2003 +0000
+++ b/lib/rfc959.c	Mon Oct 27 01:40:08 2003 +0000
@@ -186,7 +186,7 @@
 static char *
 parse_ftp_proxy_string (gftp_request * request)
 {
-  char *startpos, *endpos, *newstr, *newval, tempport[6], *proxy_config,
+  char *startpos, *endpos, *newstr, *newval, tempport[6], *proxy_config, *utf8,
        savechar;
   size_t len;
   int tmp;
@@ -283,10 +283,22 @@
         }
       else
         {
-          len += strlen (newval);
+          utf8 = gftp_string_from_utf8 (request, newval);
+          if (utf8 != NULL)
+            len += strlen (utf8);
+          else
+            len += strlen (newval);
+
           newstr = g_realloc (newstr, sizeof (char) * (len + 1));
           strcat (newstr, startpos);
-          strcat (newstr, newval);
+
+          if (utf8 != NULL)
+            {
+              strcat (newstr, utf8);
+              g_free (utf8);
+            }
+          else
+            strcat (newstr, newval);
         }
    
       *endpos = savechar;
@@ -420,7 +432,7 @@
 static int
 rfc959_connect (gftp_request * request)
 {
-  char tempchar, *startpos, *endpos, *tempstr, *email, *proxy_hostname;
+  char tempchar, *startpos, *endpos, *tempstr, *email, *proxy_hostname, *utf8;
   int ret, resp, ascii_transfers, proxy_port;
   rfc959_parms * parms;
 
@@ -489,7 +501,15 @@
 
       if (resp == '3')
 	{
-	  tempstr = g_strconcat ("PASS ", request->password, "\r\n", NULL);
+          utf8 = gftp_string_from_utf8 (request, request->password);
+          if (utf8 != NULL)
+            {
+              tempstr = g_strconcat ("PASS ", utf8, "\r\n", NULL);
+              g_free (utf8);
+            }
+          else
+            tempstr = g_strconcat ("PASS ", request->password, "\r\n", NULL);
+
 	  resp = rfc959_send_command (request, tempstr, 1);
 	  g_free (tempstr);
           if (resp < 0)