ref: 73d4febd1a0bc7ca718c72b27cbff6750cfff171
parent: 71edda030d34edc2a34c31cae36970d937b21e2a
author: aiju <devnull@localhost>
date: Mon Apr 24 12:04:09 EDT 2017
ssh: add "none" method to find out list of acceptable methods
--- a/sys/src/cmd/ssh.c
+++ b/sys/src/cmd/ssh.c
@@ -673,6 +673,32 @@
}
int
+noneauth(void)
+{+ static char authmeth[] = "none";
+
+ if(!authok(authmeth))
+ return -1;
+
+ sendpkt("bsss", MSG_USERAUTH_REQUEST,+ user, strlen(user),
+ service, strlen(service),
+ authmeth, sizeof(authmeth)-1);
+
+Next0: switch(recvpkt()){+ default:
+ dispatch();
+ goto Next0;
+ case MSG_USERAUTH_FAILURE:
+ werrstr("authentication needed");+ authfailure(authmeth);
+ return -1;
+ case MSG_USERAUTH_SUCCESS:
+ return 0;
+ }
+}
+
+int
pubkeyauth(void)
{static char authmeth[] = "publickey";
@@ -1171,7 +1197,7 @@
break;
}
- if(pubkeyauth() < 0 && passauth() < 0 && kbintauth() < 0)
+ if(noneauth() < 0 && pubkeyauth() < 0 && passauth() < 0 && kbintauth() < 0)
sysfatal("auth: %r");recv.pkt = MaxPacket;
--
⑨