mirror of
https://github.com/0intro/conterm
synced 2024-11-21 21:31:23 +03:00
cpu: fix p9any v.2 negotiation
This commit is contained in:
parent
a568eea78d
commit
7211f00b30
23
cpu.c
23
cpu.c
@ -29,7 +29,7 @@ static AuthInfo *p9any(int);
|
|||||||
static char *system;
|
static char *system;
|
||||||
static int cflag;
|
static int cflag;
|
||||||
extern int dbg;
|
extern int dbg;
|
||||||
extern char* base; // fs base for devroot
|
extern char* base; // fs base for devroot
|
||||||
|
|
||||||
static char *srvname = "ncpu";
|
static char *srvname = "ncpu";
|
||||||
static char *ealgs = "rc4_256 sha1";
|
static char *ealgs = "rc4_256 sha1";
|
||||||
@ -169,14 +169,14 @@ cpumain(int argc, char **argv)
|
|||||||
if(mountfactotum() < 0){
|
if(mountfactotum() < 0){
|
||||||
if(secstoreserver == nil)
|
if(secstoreserver == nil)
|
||||||
secstoreserver = authserver;
|
secstoreserver = authserver;
|
||||||
if(havesecstore(secstoreserver, user)){
|
if(havesecstore(secstoreserver, user)){
|
||||||
s = secstorefetch(secstoreserver, user, nil);
|
s = secstorefetch(secstoreserver, user, nil);
|
||||||
if(s){
|
if(s){
|
||||||
if(strlen(s) >= sizeof secstorebuf)
|
if(strlen(s) >= sizeof secstorebuf)
|
||||||
sysfatal("secstore data too big");
|
sysfatal("secstore data too big");
|
||||||
strcpy(secstorebuf, s);
|
strcpy(secstorebuf, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((err = rexcall(&data, system, srvname)))
|
if((err = rexcall(&data, system, srvname)))
|
||||||
@ -560,6 +560,7 @@ p9any(int fd)
|
|||||||
|
|
||||||
if((afd = open("/mnt/factotum/ctl", ORDWR)) >= 0)
|
if((afd = open("/mnt/factotum/ctl", ORDWR)) >= 0)
|
||||||
return p9anyfactotum(fd, afd);
|
return p9anyfactotum(fd, afd);
|
||||||
|
werrstr("");
|
||||||
|
|
||||||
if(readstr(fd, buf, sizeof buf) < 0)
|
if(readstr(fd, buf, sizeof buf) < 0)
|
||||||
fatal(1, "cannot read p9any negotiation");
|
fatal(1, "cannot read p9any negotiation");
|
||||||
@ -582,8 +583,8 @@ p9any(int fd)
|
|||||||
if(write(fd, buf2, strlen(buf2)+1) != strlen(buf2)+1)
|
if(write(fd, buf2, strlen(buf2)+1) != strlen(buf2)+1)
|
||||||
fatal(1, "cannot write user/domain choice in p9any");
|
fatal(1, "cannot write user/domain choice in p9any");
|
||||||
if(v2){
|
if(v2){
|
||||||
if(readstr(fd, buf, sizeof buf) != 3)
|
if(readstr(fd, buf, sizeof buf) < 0)
|
||||||
fatal(1, "cannot read OK in p9any");
|
fatal(1, "cannot read OK in p9any: got %d %s", n, buf);
|
||||||
if(memcmp(buf, "OK\0", 3) != 0)
|
if(memcmp(buf, "OK\0", 3) != 0)
|
||||||
fatal(1, "did not get OK in p9any");
|
fatal(1, "did not get OK in p9any");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user