Mercurial > gftp.yaz
diff lib/misc.c @ 65:4b5fec7711e9
2002-11-25 Brian Masney <masneyb@gftp.org>
* lib/misc.c (ssh_start_login_sequence) - fixes for when the initial
SSH banner is bigger than 200 characters
* lib/local.c (local_connect) - set request->hostname to local
filesystem
* lib/protocols.c (gftp_parse_url) - don't include 2 slashes for
the directory when parsing a local URL
* src/gtk/chmod_dialog.c (chmod_dialog) - allow multiple files to be
selected
* src/gtk/dnd.c - small fixes
author | masneyb |
---|---|
date | Tue, 26 Nov 2002 14:58:13 +0000 |
parents | 41b71c4e5076 |
children | cd3e457cbc85 |
line wrap: on
line diff
--- a/lib/misc.c Sat Nov 23 14:34:25 2002 +0000 +++ b/lib/misc.c Tue Nov 26 14:58:13 2002 +0000 @@ -857,14 +857,14 @@ char * ssh_start_login_sequence (gftp_request * request, int fd) { - char *tempstr, *pwstr, *key_pos, *tmppos; - size_t rem, len, diff, lastdiff; + char *tempstr, *pwstr, *tmppos; + size_t rem, len, diff, lastdiff, key_pos; int wrotepw, ok; ssize_t rd; rem = len = SSH_LOGIN_BUFSIZE; - key_pos = tempstr = g_malloc0 (len + 1); - diff = lastdiff = 0; + tempstr = g_malloc0 (len + 1); + key_pos = diff = lastdiff = 0; wrotepw = 0; ok = 1; @@ -881,20 +881,9 @@ ok = 0; break; } - - tempstr[diff + rd] = '\0'; rem -= rd; diff += rd; - if (rem <= 1) - { - tempstr = g_realloc (tempstr, len + SSH_LOGIN_BUFSIZE); - - request->logging_function (gftp_logging_recv, request->user_data, - "%s", tempstr + lastdiff); - lastdiff = diff; - len += SSH_LOGIN_BUFSIZE; - rem = SSH_LOGIN_BUFSIZE; - } + tempstr[diff] = '\0'; if (diff > 11 && strcmp (tempstr + diff - 10, "password: ") == 0) { @@ -911,10 +900,11 @@ break; } } - else if ((tmppos = strstr (key_pos, "Enter passphrase for RSA key")) != NULL || - ((tmppos = strstr (key_pos, "Enter passphrase for key '")) != NULL)) + else if (diff > 2 && strcmp (tempstr + diff - 2, ": ") == 0 && + ((tmppos = strstr (tempstr + key_pos, "Enter passphrase for RSA key")) != NULL || + ((tmppos = strstr (tempstr + key_pos, "Enter passphrase for key '")) != NULL))) { - key_pos = tmppos + 1; + key_pos = diff; if (wrotepw) { ok = SSH_ERROR_BADPASS; @@ -928,13 +918,23 @@ break; } } - else if (diff >= 10 && strcmp (tempstr + diff - 10, "(yes/no)? ") == 0) + else if (diff > 10 && strcmp (tempstr + diff - 10, "(yes/no)? ") == 0) { ok = SSH_ERROR_QUESTION; break; } else if (diff >= 5 && strcmp (tempstr + diff - 5, "xsftp") == 0) break; + else if (rem <= 1) + { + request->logging_function (gftp_logging_recv, request->user_data, + "%s", tempstr + lastdiff); + len += SSH_LOGIN_BUFSIZE; + rem += SSH_LOGIN_BUFSIZE; + lastdiff = diff; + tempstr = g_realloc (tempstr, len); + continue; + } } g_free (pwstr);