Mercurial > gftp.yaz
comparison 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 |
comparison
equal
deleted
inserted
replaced
297:6d088dfece0b | 298:6e0b9ca541e2 |
---|---|
184 | 184 |
185 | 185 |
186 static char * | 186 static char * |
187 parse_ftp_proxy_string (gftp_request * request) | 187 parse_ftp_proxy_string (gftp_request * request) |
188 { | 188 { |
189 char *startpos, *endpos, *newstr, *newval, tempport[6], *proxy_config, | 189 char *startpos, *endpos, *newstr, *newval, tempport[6], *proxy_config, *utf8, |
190 savechar; | 190 savechar; |
191 size_t len; | 191 size_t len; |
192 int tmp; | 192 int tmp; |
193 | 193 |
194 g_return_val_if_fail (request != NULL, NULL); | 194 g_return_val_if_fail (request != NULL, NULL); |
281 newstr = g_realloc (newstr, sizeof (char) * (len + 1)); | 281 newstr = g_realloc (newstr, sizeof (char) * (len + 1)); |
282 strcat (newstr, startpos); | 282 strcat (newstr, startpos); |
283 } | 283 } |
284 else | 284 else |
285 { | 285 { |
286 len += strlen (newval); | 286 utf8 = gftp_string_from_utf8 (request, newval); |
287 if (utf8 != NULL) | |
288 len += strlen (utf8); | |
289 else | |
290 len += strlen (newval); | |
291 | |
287 newstr = g_realloc (newstr, sizeof (char) * (len + 1)); | 292 newstr = g_realloc (newstr, sizeof (char) * (len + 1)); |
288 strcat (newstr, startpos); | 293 strcat (newstr, startpos); |
289 strcat (newstr, newval); | 294 |
295 if (utf8 != NULL) | |
296 { | |
297 strcat (newstr, utf8); | |
298 g_free (utf8); | |
299 } | |
300 else | |
301 strcat (newstr, newval); | |
290 } | 302 } |
291 | 303 |
292 *endpos = savechar; | 304 *endpos = savechar; |
293 endpos += 3; | 305 endpos += 3; |
294 startpos = endpos; | 306 startpos = endpos; |
418 | 430 |
419 | 431 |
420 static int | 432 static int |
421 rfc959_connect (gftp_request * request) | 433 rfc959_connect (gftp_request * request) |
422 { | 434 { |
423 char tempchar, *startpos, *endpos, *tempstr, *email, *proxy_hostname; | 435 char tempchar, *startpos, *endpos, *tempstr, *email, *proxy_hostname, *utf8; |
424 int ret, resp, ascii_transfers, proxy_port; | 436 int ret, resp, ascii_transfers, proxy_port; |
425 rfc959_parms * parms; | 437 rfc959_parms * parms; |
426 | 438 |
427 g_return_val_if_fail (request != NULL, GFTP_EFATAL); | 439 g_return_val_if_fail (request != NULL, GFTP_EFATAL); |
428 g_return_val_if_fail (request->protonum == GFTP_FTP_NUM, GFTP_EFATAL); | 440 g_return_val_if_fail (request->protonum == GFTP_FTP_NUM, GFTP_EFATAL); |
487 if (resp < 0) | 499 if (resp < 0) |
488 return (GFTP_ERETRYABLE); | 500 return (GFTP_ERETRYABLE); |
489 | 501 |
490 if (resp == '3') | 502 if (resp == '3') |
491 { | 503 { |
492 tempstr = g_strconcat ("PASS ", request->password, "\r\n", NULL); | 504 utf8 = gftp_string_from_utf8 (request, request->password); |
505 if (utf8 != NULL) | |
506 { | |
507 tempstr = g_strconcat ("PASS ", utf8, "\r\n", NULL); | |
508 g_free (utf8); | |
509 } | |
510 else | |
511 tempstr = g_strconcat ("PASS ", request->password, "\r\n", NULL); | |
512 | |
493 resp = rfc959_send_command (request, tempstr, 1); | 513 resp = rfc959_send_command (request, tempstr, 1); |
494 g_free (tempstr); | 514 g_free (tempstr); |
495 if (resp < 0) | 515 if (resp < 0) |
496 return (GFTP_ERETRYABLE); | 516 return (GFTP_ERETRYABLE); |
497 } | 517 } |