Mercurial > gftp.yaz
comparison lib/rfc959.c @ 838:57aad6d4b304
2006-10-31 Brian Masney <masneyb@gftp.org>
WARNING: The CVS version of gFTP is currently broken, especially for
international users. This will be fixed in a few days.
* lib/gftp.h lib/local.c lib/misc.c lib/protocols.c lib/rfc959.c
src/gtk/misc-gtk.c src/text/gftp-text.c - added length argument to
gftp_string_from_utf8() and gftp_string_to_utf8()
* src/uicommon/gftpui.c - warning fixes
author | masneyb |
---|---|
date | Wed, 01 Nov 2006 02:05:25 +0000 |
parents | f2772ac00751 |
children | 8263cc35c027 |
comparison
equal
deleted
inserted
replaced
837:36e0867c4ef9 | 838:57aad6d4b304 |
---|---|
196 rfc959_generate_and_send_command (gftp_request * request, const char *command, | 196 rfc959_generate_and_send_command (gftp_request * request, const char *command, |
197 const char *argument, int read_response, | 197 const char *argument, int read_response, |
198 int dont_try_to_reconnect) | 198 int dont_try_to_reconnect) |
199 { | 199 { |
200 char *tempstr, *utf8; | 200 char *tempstr, *utf8; |
201 size_t destlen; | |
201 int resp; | 202 int resp; |
202 | 203 |
203 if (argument != NULL) | 204 if (argument != NULL) |
204 { | 205 { |
205 utf8 = gftp_string_from_utf8 (request, argument); | 206 utf8 = gftp_string_from_utf8 (request, argument, &destlen); |
206 if (utf8 != NULL) | 207 if (utf8 != NULL) |
207 { | 208 { |
208 tempstr = g_strconcat (command, " ", utf8, "\r\n", NULL); | 209 tempstr = g_strconcat (command, " ", utf8, "\r\n", NULL); |
209 g_free (utf8); | 210 g_free (utf8); |
210 } | 211 } |
223 static char * | 224 static char * |
224 parse_ftp_proxy_string (gftp_request * request) | 225 parse_ftp_proxy_string (gftp_request * request) |
225 { | 226 { |
226 char *startpos, *endpos, *newstr, *newval, tempport[6], *proxy_config, *utf8, | 227 char *startpos, *endpos, *newstr, *newval, tempport[6], *proxy_config, *utf8, |
227 savechar; | 228 savechar; |
228 size_t len; | 229 size_t len, destlen; |
229 intptr_t tmp; | 230 intptr_t tmp; |
230 | 231 |
231 g_return_val_if_fail (request != NULL, NULL); | 232 g_return_val_if_fail (request != NULL, NULL); |
232 | 233 |
233 gftp_lookup_request_option (request, "proxy_config", &proxy_config); | 234 gftp_lookup_request_option (request, "proxy_config", &proxy_config); |
317 newstr = g_realloc (newstr, (gulong) sizeof (char) * (len + 1)); | 318 newstr = g_realloc (newstr, (gulong) sizeof (char) * (len + 1)); |
318 strcat (newstr, startpos); | 319 strcat (newstr, startpos); |
319 } | 320 } |
320 else | 321 else |
321 { | 322 { |
322 utf8 = gftp_string_from_utf8 (request, newval); | 323 utf8 = gftp_string_from_utf8 (request, newval, &destlen); |
323 if (utf8 != NULL) | 324 if (utf8 != NULL) |
324 len += strlen (utf8); | 325 len += strlen (utf8); |
325 else | 326 else |
326 len += strlen (newval); | 327 len += strlen (newval); |
327 | 328 |
348 | 349 |
349 static int | 350 static int |
350 rfc959_getcwd (gftp_request * request) | 351 rfc959_getcwd (gftp_request * request) |
351 { | 352 { |
352 char *pos, *dir, *utf8; | 353 char *pos, *dir, *utf8; |
354 size_t destlen; | |
353 int ret; | 355 int ret; |
354 | 356 |
355 ret = rfc959_send_command (request, "PWD\r\n", 1, 0); | 357 ret = rfc959_send_command (request, "PWD\r\n", 1, 0); |
356 if (ret < 0) | 358 if (ret < 0) |
357 return (ret); | 359 return (ret); |
387 *pos = '\0'; | 389 *pos = '\0'; |
388 | 390 |
389 if (request->directory) | 391 if (request->directory) |
390 g_free (request->directory); | 392 g_free (request->directory); |
391 | 393 |
392 utf8 = gftp_string_to_utf8 (request, dir); | 394 utf8 = gftp_string_to_utf8 (request, dir, &destlen); |
393 if (utf8 != NULL) | 395 if (utf8 != NULL) |
394 request->directory = utf8; | 396 request->directory = utf8; |
395 else | 397 else |
396 request->directory = g_strdup (dir); | 398 request->directory = g_strdup (dir); |
397 | 399 |
1716 | 1718 |
1717 static int | 1719 static int |
1718 rfc959_chmod (gftp_request * request, const char *file, mode_t mode) | 1720 rfc959_chmod (gftp_request * request, const char *file, mode_t mode) |
1719 { | 1721 { |
1720 char *tempstr, *utf8; | 1722 char *tempstr, *utf8; |
1723 size_t destlen; | |
1721 int ret; | 1724 int ret; |
1722 | 1725 |
1723 g_return_val_if_fail (request != NULL, GFTP_EFATAL); | 1726 g_return_val_if_fail (request != NULL, GFTP_EFATAL); |
1724 g_return_val_if_fail (file != NULL, GFTP_EFATAL); | 1727 g_return_val_if_fail (file != NULL, GFTP_EFATAL); |
1725 g_return_val_if_fail (request->datafd > 0, GFTP_EFATAL); | 1728 g_return_val_if_fail (request->datafd > 0, GFTP_EFATAL); |
1726 | 1729 |
1727 utf8 = gftp_string_from_utf8 (request, file); | 1730 utf8 = gftp_string_from_utf8 (request, file, &destlen); |
1728 if (utf8 != NULL) | 1731 if (utf8 != NULL) |
1729 { | 1732 { |
1730 tempstr = g_strdup_printf ("SITE CHMOD %o %s\r\n", mode, utf8); | 1733 tempstr = g_strdup_printf ("SITE CHMOD %o %s\r\n", mode, utf8); |
1731 g_free (utf8); | 1734 g_free (utf8); |
1732 } | 1735 } |
1747 | 1750 |
1748 static int | 1751 static int |
1749 rfc959_site (gftp_request * request, int specify_site, const char *command) | 1752 rfc959_site (gftp_request * request, int specify_site, const char *command) |
1750 { | 1753 { |
1751 char *tempstr, *utf8; | 1754 char *tempstr, *utf8; |
1755 size_t destlen; | |
1752 int ret; | 1756 int ret; |
1753 | 1757 |
1754 g_return_val_if_fail (request != NULL, GFTP_EFATAL); | 1758 g_return_val_if_fail (request != NULL, GFTP_EFATAL); |
1755 g_return_val_if_fail (command != NULL, GFTP_EFATAL); | 1759 g_return_val_if_fail (command != NULL, GFTP_EFATAL); |
1756 g_return_val_if_fail (request->datafd > 0, GFTP_EFATAL); | 1760 g_return_val_if_fail (request->datafd > 0, GFTP_EFATAL); |
1757 | 1761 |
1758 utf8 = gftp_string_from_utf8 (request, command); | 1762 utf8 = gftp_string_from_utf8 (request, command, &destlen); |
1759 if (utf8 != NULL) | 1763 if (utf8 != NULL) |
1760 { | 1764 { |
1761 if (specify_site) | 1765 if (specify_site) |
1762 tempstr = g_strconcat ("SITE ", utf8, "\r\n", NULL); | 1766 tempstr = g_strconcat ("SITE ", utf8, "\r\n", NULL); |
1763 else | 1767 else |