| plan 9 kernel history: overview | file list | diff list |
2001/0807/port/auth.c (diff list | history)
| 2001/0529/sys/src/9/port/auth.c:11,16 – 2001/0807/sys/src/9/port/auth.c:11,41 (short | long | prev | next) | ||
| 1993/0330 | char evekey[DESKEYLEN]; char hostdomain[DOMLEN]; | |
| 2001/0807 | struct Session { char *authlist; }; Session* allocsession(char *authlist) { Session *s; s = smalloc(sizeof(*s)); s->authlist = nil; kstrdup(&s->authlist, authlist); return s; } void freesession(Session *s) { if(s == nil) return; free(s->authlist); free(s); } | |
| 1993/0330 | /* * return true if current user is eve */ | |
| 2001/0529/sys/src/9/port/auth.c:111,146 – 2001/0807/sys/src/9/port/auth.c:136,151 | ||
| 2001/0527 | return m; | |
| 1993/0330 | } | |
| 2001/0527 |
| |
| 2001/0807 | void sendsession(Chan *c) | |
| 1993/0330 | { | |
| 2001/0527 | Fcall f; uchar *msg; | |
| 1993/0330 |
| |
| 2001/0807 | uint n, m; | |
| 2001/0527 | uvlong oo; | |
| 1993/0330 | ||
| 2001/0527 |
| |
| 1993/0330 |
| |
| 1999/0331 |
| |
| 1993/0330 |
| |
| 2001/0527 |
| |
| 1993/0330 |
| |
| 2001/0527 | f.type = Tsession; f.tag = NOTAG; | |
| 2001/0529 | msg = smalloc(8192+IOHDRSZ); | |
| 2001/0527 | if(waserror()){ free(msg); | |
| 2001/0529/sys/src/9/port/auth.c:156,161 – 2001/0807/sys/src/9/port/auth.c:161,167 | ||
| 2001/0527 | unlock(c); | |
| 1993/0330 | ||
| 2001/0527 | m = devtab[c->type]->write(c, msg, n, oo); | |
| 2001/0807 | print("session sent\n"); | |
| 1993/0731 | ||
| 2001/0527 | if(m < n){ lock(c); | |
| 2001/0529/sys/src/9/port/auth.c:168,173 – 2001/0807/sys/src/9/port/auth.c:174,180 | ||
| 2001/0529 | m = devtab[c->type]->read(c, msg, 8192+IOHDRSZ, c->offset); | |
| 2001/0527 | if(m <= 0) error("EOF receiving fsession reply"); | |
| 2001/0807 | print("rsession rcvd\n"); | |
| 1993/0330 | ||
| 2001/0527 | lock(c); c->offset += m; | |
| 2001/0529/sys/src/9/port/auth.c:174,201 – 2001/0807/sys/src/9/port/auth.c:181,251 | ||
| 2001/0527 | unlock(c); | |
| 1993/0731 | ||
| 2001/0527 | n = convM2S(msg, m, &f); | |
| 2001/0807 | print("rsession conv returns %d\n", n); | |
| 2001/0527 | if(n != m) error("bad fsession conversion on reply"); if(f.type != Rsession) error("unexpected reply type in fsession"); | |
| 2001/0807 | c->session = allocsession(f.authlist); | |
| 1993/0731 | ||
| 2001/0527 | free(msg); poperror(); | |
| 2001/0807 | } long sysfsession(ulong *arg) { Chan *c; uint authlen, n; authlen = arg[2]; validaddr(arg[1], authlen, 1); c = fdtochan(arg[0], ORDWR, 0, 1); if(waserror()){ cclose(c); nexterror(); } if(c->session == nil){ if(c->flag&CMSG) error("session on mounted channel"); sendsession(c); } n = strlen(c->session->authlist)+1; if(n > authlen) error(Eshort); memmove((uchar*)arg[1], c->session->authlist, n); | |
| 2001/0527 | poperror(); cclose(c); | |
| 2001/0807 | return n; | |
| 1993/0330 | } long | |
| 2001/0527 |
| |
| 2001/0807 | sysfauth(ulong *arg) | |
| 1993/0330 | { | |
| 2001/0527 |
| |
| 2001/0807 | Chan *c; uint authlen, rauthlen; int n; authlen = arg[2]; validaddr(arg[1], authlen, 1); rauthlen = arg[4]; validaddr(arg[3], rauthlen, 1); c = fdtochan(arg[0], ORDWR, 0, 1); if(waserror()){ cclose(c); nexterror(); } n = mntauth(c, (uchar*)arg[1], authlen, (uchar*)arg[3], rauthlen); poperror(); cclose(c); return n; | |
| 1993/0731 | } /* | |