Plan 9 from Bell Labs’s /usr/web/sources/contrib/quanstro/root/sys/src/cmd/ssh/authsrvtis.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#include "ssh.h"

static AuthInfo*
authsrvtisfn(Conn *conn, Msg *m)
{
	char *s;
	AuthInfo *ai;
	Chalstate *c;

	free(m);
	if((c = auth_challenge("proto=p9cr user=%q role=server", conn->user)) == nil){
		sshlog("auth_challenge failed for %s", conn->user);
		return nil;
	}
	s = smprint("Challenge: %s\nResponse: ", c->chal);
	if(s == nil){
		auth_freechal(c);
		return nil;
	}
	m = allocmsg(conn, SSH_SMSG_AUTH_TIS_CHALLENGE, 4+strlen(s));
	putstring(m, s);
	sendmsg(m);
	free(s);

	m = recvmsg(conn, 0);
	if(m == nil){
		auth_freechal(c);
		return nil;
	}
	if(m->type != SSH_CMSG_AUTH_TIS_RESPONSE){
		/*
		 * apparently you can just give up on
		 * this protocol and start a new one.
		 */
		unrecvmsg(conn, m);
		return nil;
	}

	c->resp = getstring(m);
	c->nresp = strlen(c->resp);
	ai = auth_response(c);
	auth_freechal(c);
	return ai;
}

Authsrv authsrvtis = 
{
	SSH_AUTH_TIS,
	"tis",
	SSH_CMSG_AUTH_TIS,
	authsrvtisfn,
};

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].