summaryrefslogtreecommitdiff
path: root/sys/src/cmd/ssh.c
diff options
context:
space:
mode:
authoraiju <devnull@localhost>2017-04-24 16:04:09 +0000
committeraiju <devnull@localhost>2017-04-24 16:04:09 +0000
commitf8eb5a1d13c1911c95fd26fbbc300e74aee558af (patch)
tree795876edc03497f56b328fee8f12048cda429a33 /sys/src/cmd/ssh.c
parent1f6a604c23b0a5cad68c8692e990a76c250e17df (diff)
ssh: add "none" method to find out list of acceptable methods
Diffstat (limited to 'sys/src/cmd/ssh.c')
-rw-r--r--sys/src/cmd/ssh.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/sys/src/cmd/ssh.c b/sys/src/cmd/ssh.c
index de59cbe02..a486c9fb4 100644
--- a/sys/src/cmd/ssh.c
+++ b/sys/src/cmd/ssh.c
@@ -673,6 +673,32 @@ if(debug)
}
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 @@ Next0: switch(recvpkt()){
break;
}
- if(pubkeyauth() < 0 && passauth() < 0 && kbintauth() < 0)
+ if(noneauth() < 0 && pubkeyauth() < 0 && passauth() < 0 && kbintauth() < 0)
sysfatal("auth: %r");
recv.pkt = MaxPacket;