gettext: fix build with gcc-14; enhance test environment
[oi-userland.git] / components / desktop / gftp / patches / 06-g11n-ssh-login.patch
blob84c94e8cb151f2ae6381f28d9d6c9950608da2d7
1 --- gftp-2.9.1b/lib/sshv2.c.old 2024-07-01 22:23:14.745126840 -0400
2 +++ gftp-2.9.1b/lib/sshv2.c 2024-07-01 22:23:49.182914494 -0400
3 @@ -390,7 +390,7 @@
4 static char *pwstrs[] = { "Enter passphrase for RSA key",
5 "Enter passphrase for key '",
6 "Password",
7 - "password",
8 + "Password:",
9 NULL };
10 char *tempstr, *temp1str, *pwstr, *yesstr = "yes\n", *securid_pass;
11 int wrotepw, ok, maxfd, ret, clear_tempstr, pwidx;
12 @@ -463,15 +464,26 @@ sshv2_start_login_sequence (gftp_request
13 continue;
15 tempstr[diff + rd] = '\0';
16 - request->logging_function (gftp_logging_recv, request, "%s", tempstr + diff);
17 + temp1str = g_locale_to_utf8 (tempstr + diff, -1, NULL, NULL, NULL);
18 + if (temp1str == NULL)
19 + temp1str = g_strdup (tempstr);
20 + request->logging_function (gftp_logging_recv, request, "%s", temp1str);
21 + g_free (temp1str);
22 rem -= rd;
23 diff += rd;
25 + temp1str = g_locale_to_utf8 (tempstr, -1, NULL, NULL, NULL);
26 + if (temp1str == NULL)
27 + temp1str = g_strdup (tempstr);
29 /* See if we are at the enter password prompt... */
30 for (pwidx = 0; pwstrs[pwidx] != NULL; pwidx++)
32 - if (strstr (tempstr, pwstrs[pwidx]) != NULL ||
33 - strstr (tempstr, _(pwstrs[pwidx])) != NULL)
34 + if (strstr (temp1str, pwstrs[pwidx]) != NULL ||
35 +#ifdef __sun
36 + strstr (tempstr, dgettext ("SUNW_OST_SYSOSPAM", pwstrs[pwidx])) != NULL ||
37 +#endif
38 + strstr (temp1str, _(pwstrs[pwidx])) != NULL)
39 break;
42 @@ -482,6 +494,7 @@ sshv2_start_login_sequence (gftp_request
43 if (wrotepw)
45 ok = SSH_ERROR_BADPASS;
46 + g_free (temp1str);
47 break;
50 @@ -489,6 +502,7 @@ sshv2_start_login_sequence (gftp_request
51 if (gftp_fd_write (request, pwstr, strlen (pwstr), ptymfd) < 0)
53 ok = 0;
54 + g_free (temp1str);
55 break;
58 @@ -496,13 +510,15 @@ sshv2_start_login_sequence (gftp_request
59 strstr (tempstr, _("(yes/no)?")) != NULL)
61 clear_tempstr = 1;
62 - if (!gftpui_protocol_ask_yes_no (request, request->hostname, tempstr))
63 + if (!gftpui_protocol_ask_yes_no (request, request->hostname, temp1str))
65 ok = SSH_ERROR_QUESTION;
66 + g_free (temp1str);
67 break;
69 else
71 + g_free (temp1str);
72 if (gftp_fd_write (request, yesstr, strlen (yesstr), ptymfd) < 0)
74 ok = 0;
75 @@ -521,9 +537,11 @@ sshv2_start_login_sequence (gftp_request
76 if (securid_pass == NULL || *securid_pass == '\0')
78 ok = SSH_ERROR_BADPASS;
79 + g_free (temp1str);
80 break;
83 + g_free (temp1str);
84 temp1str = g_strconcat (securid_pass, "\n", NULL);
86 ret = gftp_fd_write (request, temp1str, strlen (temp1str), ptymfd);
87 @@ -543,6 +561,7 @@ sshv2_start_login_sequence (gftp_request
89 len += SSH_LOGIN_BUFSIZE;
90 rem += SSH_LOGIN_BUFSIZE;
91 + g_free (temp1str);
92 tempstr = g_realloc (tempstr, len);
93 continue;