patches/gftp-06-g11n-ssh-login.diff
author Jon Tibble <meths@btinternet.com>
Sat, 06 Oct 2012 16:11:50 +0100
branchs11express-2010-11
changeset 22109 db10202d5f6d
parent 18110 93461edb1490
permissions -rw-r--r--
Added tag oi_151a_prestable7 for changeset 25dee50cecca
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18110
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
     1
--- gftp-2.0.19/lib/sshv2.c.orig	2008-01-25 08:28:32.000000000 +0900
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
     2
+++ gftp-2.0.19/lib/sshv2.c	2008-12-09 14:32:52.172140155 +0900
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
     3
@@ -379,6 +379,7 @@ sshv2_start_login_sequence (gftp_request
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
     4
                            N_("Enter passphrase for key '"),
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
     5
                            N_("Password"),
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
     6
                            N_("password"),
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
     7
+                           N_("Password: "),
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
     8
                            NULL};
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
     9
   char *tempstr, *temp1str, *pwstr, *yesstr = "yes\n", *securid_pass;
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    10
   int wrotepw, ok, maxfd, ret, clear_tempstr, pwidx;
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    11
@@ -463,15 +464,26 @@ sshv2_start_login_sequence (gftp_request
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    12
         continue;
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    13
 
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    14
       tempstr[diff + rd] = '\0'; 
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    15
-      request->logging_function (gftp_logging_recv, request, "%s", tempstr + diff);
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    16
+      temp1str = g_locale_to_utf8 (tempstr + diff, -1, NULL, NULL, NULL);
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    17
+      if (temp1str == NULL)
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    18
+        temp1str = g_strdup (tempstr);
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    19
+      request->logging_function (gftp_logging_recv, request, "%s", temp1str);
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    20
+      g_free (temp1str);
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    21
       rem -= rd;
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    22
       diff += rd;
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    23
 
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    24
+      temp1str = g_locale_to_utf8 (tempstr, -1, NULL, NULL, NULL);
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    25
+      if (temp1str == NULL)
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    26
+        temp1str = g_strdup (tempstr);
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    27
+
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    28
       /* See if we are at the enter password prompt... */
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    29
       for (pwidx = 0; pwstrs[pwidx] != NULL; pwidx++)
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    30
         {
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    31
-          if (strstr (tempstr, pwstrs[pwidx]) != NULL ||
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    32
-              strstr (tempstr, _(pwstrs[pwidx])) != NULL)
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    33
+          if (strstr (temp1str, pwstrs[pwidx]) != NULL ||
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    34
+#ifdef __sun
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    35
+              strstr (tempstr, dgettext ("SUNW_OST_SYSOSPAM", pwstrs[pwidx])) != NULL ||
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    36
+#endif
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    37
+              strstr (temp1str, _(pwstrs[pwidx])) != NULL)
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    38
             break;
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    39
         }
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    40
 
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    41
@@ -482,6 +494,7 @@ sshv2_start_login_sequence (gftp_request
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    42
           if (wrotepw)
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    43
             {
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    44
               ok = SSH_ERROR_BADPASS;
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    45
+              g_free (temp1str);
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    46
               break;
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    47
             }
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    48
 
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    49
@@ -489,6 +502,7 @@ sshv2_start_login_sequence (gftp_request
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    50
           if (gftp_fd_write (request, pwstr, strlen (pwstr), ptymfd) < 0)
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    51
             {
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    52
               ok = 0;
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    53
+              g_free (temp1str);
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    54
               break;
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    55
             }
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    56
         }
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    57
@@ -496,13 +510,15 @@ sshv2_start_login_sequence (gftp_request
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    58
                strstr (tempstr, _("(yes/no)?")) != NULL)
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    59
         {
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    60
           clear_tempstr = 1;
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    61
-          if (!gftpui_protocol_ask_yes_no (request, request->hostname, tempstr))
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    62
+          if (!gftpui_protocol_ask_yes_no (request, request->hostname, temp1str))
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    63
             {
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    64
               ok = SSH_ERROR_QUESTION;
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    65
+              g_free (temp1str);
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    66
               break;
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    67
             }
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    68
           else
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    69
             {
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    70
+              g_free (temp1str);
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    71
               if (gftp_fd_write (request, yesstr, strlen (yesstr), ptymfd) < 0)
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    72
                 {
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    73
                   ok = 0;
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    74
@@ -521,9 +537,11 @@ sshv2_start_login_sequence (gftp_request
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    75
           if (securid_pass == NULL || *securid_pass == '\0')
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    76
             {
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    77
               ok = SSH_ERROR_BADPASS;
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    78
+              g_free (temp1str);
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    79
               break;
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    80
             }
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    81
 
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    82
+          g_free (temp1str);
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    83
           temp1str = g_strconcat (securid_pass, "\n", NULL);
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    84
 
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    85
           ret = gftp_fd_write (request, temp1str, strlen (temp1str), ptymfd);
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    86
@@ -543,6 +561,7 @@ sshv2_start_login_sequence (gftp_request
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    87
         {
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    88
           len += SSH_LOGIN_BUFSIZE;
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    89
           rem += SSH_LOGIN_BUFSIZE;
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    90
+          g_free (temp1str);
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    91
           tempstr = g_realloc (tempstr, len);
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    92
           continue;
93461edb1490 2010-06-10 Christian Kelly <[email protected]>
chrisk
parents:
diff changeset
    93
         }