aboutsummaryrefslogtreecommitdiff
path: root/ssh/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh/client.c')
-rw-r--r--ssh/client.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ssh/client.c b/ssh/client.c
index 0adfffb..fc4ad96 100644
--- a/ssh/client.c
+++ b/ssh/client.c
@@ -200,6 +200,7 @@ int main(int argc, char **argv) {
printf("Connected.\n");
+retry_userauth:
switch (ssh_userauth_none(session, NULL)) {
case SSH_AUTH_ERROR:
fprintf(stderr, "Error authenticating: %s\n", ssh_get_error(session));
@@ -214,7 +215,11 @@ int main(int argc, char **argv) {
break;
case SSH_AUTH_AGAIN:
- assert(false);
+ if (ssh_get_status(session) & (SSH_CLOSED | SSH_CLOSED_ERROR)) {
+ fprintf(stderr, "Socket unexpectedly closed!\n");
+ return 1;
+ }
+ goto retry_userauth;
}
printf("Authenticated.\n");