commit 6c0209f6f0eb41151397e4784730d2b6bca8d7ea from: rsc date: Fri Feb 11 20:32:41 2005 UTC build changes commit - 7d59ed711467b2b2c8ac25f86724225c8be7524c commit + 6c0209f6f0eb41151397e4784730d2b6bca8d7ea blob - 7b14c1aed63bac7b754bf4b2d08e98b39f616d37 blob + ed50d680643e2240537604eb6812f9fcdde26b15 --- include/venti.h +++ include/venti.h @@ -4,6 +4,11 @@ extern "C" { #endif +#ifndef PLAN9PORT +#pragma lib "libventi.a" +#pragma src "/sys/src/libventi" +#endif + AUTOLIB(venti) /* XXX should be own library? */ @@ -38,13 +43,39 @@ int packetcmp(Packet*, Packet*); void packetstats(void); void packetsha1(Packet*, uchar sha1[20]); -/* XXX begin actual venti.h */ +/* XXX should be own library? */ +/* + * Logging + */ +typedef struct VtLog VtLog; +typedef struct VtLogChunk VtLogChunk; -#ifndef PLAN9PORT -#pragma lib "libventi.a" -#pragma src "/sys/src/libventi" -#endif +struct VtLog +{ + VtLog *next; /* in hash table */ + VtLogChunk *chunk; + uint nchunk; + VtLogChunk *w; + QLock lk; + int ref; +}; + +struct VtLogchunk +{ + char *buf; + uint nbuf; + char *w; +}; +VtLog *vtlogopen(char *name, uint size); +void vtlogprint(VtLog *log, char *fmt, ...); +void vtlog(char *name, char *fmt, ...); +void vtlogclose(char *name); +void vtlogremove(char *name); +int vtlogdump(int fd, VtLog*); + +/* XXX begin actual venti.h */ + typedef struct VtFcall VtFcall; typedef struct VtConn VtConn; typedef struct VtEntry VtEntry; blob - 98ffb2c90a8e585c68763baeb3fe70c07033d009 blob + b92e96a02a284f92a80b874fd22f6baadb087fc6 --- src/cmd/factotum/attr.c +++ src/cmd/factotum/attr.c @@ -130,6 +130,7 @@ attrnamefmt(Fmt *fmt) return fmtstrcpy(fmt, buf+1); } +/* static int hasqueries(Attr *a) { @@ -138,6 +139,7 @@ hasqueries(Attr *a) return 1; return 0; } +*/ char *ignored[] = { "role", blob - 36082c3b27436f169ff269132969eacff5572e28 blob + 0b6bb601731289951ac250f8f4c7ff466c78f065 --- src/cmd/factotum/plan9.c +++ src/cmd/factotum/plan9.c @@ -12,75 +12,12 @@ memrandom(void *p, int n) return 0; } -/* - * create a change uid capability - */ -static int caphashfd = -1; - -static char* -mkcap(char *from, char *to) -{ - uchar rand[20]; - char *cap; - char *key; - int nfrom, nto; - uchar hash[SHA1dlen]; - - if(caphashfd < 0) - return nil; - - /* create the capability */ - nto = strlen(to); - nfrom = strlen(from); - cap = emalloc(nfrom+1+nto+1+sizeof(rand)*3+1); - sprint(cap, "%s@%s", from, to); - memrandom(rand, sizeof(rand)); - key = cap+nfrom+1+nto+1; - enc64(key, sizeof(rand)*3, rand, sizeof(rand)); - - /* hash the capability */ - hmac_sha1((uchar*)cap, strlen(cap), (uchar*)key, strlen(key), hash, nil); - - /* give the kernel the hash */ - key[-1] = '@'; - if(write(caphashfd, hash, SHA1dlen) < 0){ - free(cap); - return nil; - } - - return cap; -} - Attr* addcap(Attr *a, char *from, Ticket *t) { - char *cap; - - cap = mkcap(from, t->suid); - return addattr(a, "cuid=%q suid=%q cap=%q", t->cuid, t->suid, cap); + return addattr(a, "cuid=%q suid=%q cap=''", t->cuid, t->suid); } -/* bind in the default network and cs */ -static int -bindnetcs(void) -{ - int srvfd; - - if(access("/net/tcp", AEXIST) < 0) - bind("#I", "/net", MBEFORE); - - if(access("/net/cs", AEXIST) < 0){ - if((srvfd = open("#s/cs", ORDWR)) >= 0){ - /* mount closes srvfd on success */ - if(mount(srvfd, -1, "/net", MBEFORE, "") >= 0) - return 0; - close(srvfd); - } - return -1; - } - return 0; -} - int _authdial(char *net, char *authdom) { blob - ae6ac61a96377576accb44e870a59b27e1db7c34 blob + 2b283aec4e562cf3679b142192862eb657c763e8 --- src/cmd/tar.C +++ src/cmd/tar.C @@ -90,7 +90,7 @@ typedef union { }; } Hdr; -static int debug; +int debug; static int verb; static int posix = 1; static int creat; blob - f2595ffff50dbf7d5e39ebc24fd649a15f35e453 blob + 93add14d6c9d5c5570925e84843cc39fa151cc91 --- src/cmd/vac/vac.c +++ src/cmd/vac/vac.c @@ -400,6 +400,8 @@ vacfile(DirSink *dsink, char *lname, char *sname, VacF if((dir = dirstat(sname)) == nil){ warn("could not stat file %s: %r", lname); + return; + } if(dir->mode&(DMSYMLINK|DMDEVICE|DMNAMEDPIPE|DMSOCKET)){ free(dir); return; blob - d131c4c71069707393951b3c9db9a80dede7f221 blob + 4ff9d344551276791afd433fefc37b2e65a7d591 --- src/lib9p/mkfile +++ src/lib9p/mkfile @@ -10,7 +10,6 @@ OFILES=\ mem.$O\ req.$O\ parse.$O\ - post.$O\ srv.$O\ tpost.$O\ uid.$O\ blob - e48a576156a71333952c0802a64b795453ce1504 blob + 524d2be5e40f9bfd60227daa5e23b039a8e4f109 --- src/libauthsrv/readnvram.c +++ src/libauthsrv/readnvram.c @@ -41,80 +41,20 @@ static struct { "debug", "/tmp/nvram", 0, sizeof(Nvrsafe), }; -static char* -readcons(char *prompt, char *def, int raw, char *buf, int nbuf) +char* +xreadcons(char *prompt, char *def, int secret, char *buf, int nbuf) { - int fdin, fdout, ctl, n, m; - char line[10]; - - fdin = open("/dev/cons", OREAD); - if(fdin < 0) - fdin = 0; - fdout = open("/dev/cons", OWRITE); - if(fdout < 0) - fdout = 1; - if(def != nil) - fprint(fdout, "%s[%s]: ", prompt, def); - else - fprint(fdout, "%s: ", prompt); - if(raw){ - ctl = open("/dev/consctl", OWRITE); - if(ctl >= 0) - write(ctl, "rawon", 5); - } else - ctl = -1; - - m = 0; - for(;;){ - n = read(fdin, line, 1); - if(n == 0){ - close(ctl); - werrstr("readcons: EOF"); - return nil; - } - if(n < 0){ - close(ctl); - werrstr("can't read cons"); - return nil; - } - if(line[0] == 0x7f) - exits(0); - if(n == 0 || line[0] == '\n' || line[0] == '\r'){ - if(raw){ - write(ctl, "rawoff", 6); - write(fdout, "\n", 1); - close(ctl); - } - buf[m] = '\0'; - if(buf[0]=='\0' && def) - strcpy(buf, def); - return buf; - } - if(line[0] == '\b'){ - if(m > 0) - m--; - }else if(line[0] == 0x15){ /* ^U: line kill */ - m = 0; - if(def != nil) - fprint(fdout, "%s[%s]: ", prompt, def); - else - fprint(fdout, "%s: ", prompt); - }else{ - if(m >= nbuf-1){ - fprint(fdout, "line too long\n"); - m = 0; - if(def != nil) - fprint(fdout, "%s[%s]: ", prompt, def); - else - fprint(fdout, "%s: ", prompt); - }else - buf[m++] = line[0]; - } - } - return buf; /* how does this happen */ + char *p; + + p = readcons(prompt, def, secret); + if(p == nil) + return nil; + strecpy(buf, buf+nbuf, p); + memset(p, 0, strlen(p)); + free(p); + return buf; } - /* * get key info out of nvram. since there isn't room in the PC's nvram use * a disk partition there. @@ -210,11 +150,11 @@ readnvram(Nvrsafe *safep, int flag) } if((flag&NVwrite) || (err && (flag&NVwriteonerr))){ - readcons("authid", nil, 0, safe->authid, sizeof(safe->authid)); - readcons("authdom", nil, 0, safe->authdom, sizeof(safe->authdom)); - readcons("secstore key", nil, 1, safe->config, sizeof(safe->config)); + xreadcons("authid", nil, 0, safe->authid, sizeof(safe->authid)); + xreadcons("authdom", nil, 0, safe->authdom, sizeof(safe->authdom)); + xreadcons("secstore key", nil, 1, safe->config, sizeof(safe->config)); for(;;){ - if(readcons("password", nil, 1, in, sizeof in) == nil) + if(xreadcons("password", nil, 1, in, sizeof in) == nil) goto Out; if(passtokey(safe->machkey, in)) break; blob - 5cdc24b5f580b00785c6a4f210bab5bd8700fcda blob + a860c8b72943987de2927fad67a0ef4db83c79b9 --- src/libndb/ndbipinfo.c +++ src/libndb/ndbipinfo.c @@ -14,7 +14,6 @@ enum static Ndbtuple* filter(Ndb *db, Ndbtuple *t, Ndbtuple *f); static Ndbtuple* mkfilter(int argc, char **argv); static int filtercomplete(Ndbtuple *f); -static Ndbtuple* toipaddr(Ndb *db, Ndbtuple *t); static int prefixlen(uchar *ip); static Ndbtuple* subnet(Ndb *db, uchar *net, Ndbtuple *f, int prefix); blob - 5ff530fb2feda436262d9ffab4e7d14bd34a6462 blob + 812e64b3debba16ebe2ae59523b0e37291e075c8 --- src/mkmk.sh +++ src/mkmk.sh @@ -19,6 +19,7 @@ cd lib9 9c convM2S.c 9c convS2M.c 9c create.c +9c crypt.c 9c ctime.c 9c date.c 9c dial.c @@ -51,6 +52,7 @@ cd lib9 9c nan.c 9c needsrcquote.c 9c needstack.c +9c netcrypt.c 9c netmkaddr.c 9c notify.c 9c nrand.c @@ -64,14 +66,17 @@ cd lib9 9c quote.c 9c rand.c 9c read9pmsg.c +9c readcons.c 9c readn.c 9c rfork.c +9c searchpath.c 9c seek.c 9c sendfd.c 9c sleep.c 9c strdup.c 9c strecpy.c 9c sysfatal.c +9c syslog.c 9c sysname.c 9c time.c 9c tokenize.c @@ -135,7 +140,7 @@ cd lib9 9c utf/utfrrune.c 9c utf/utfrune.c 9c utf/utfutf.c -9ar rvc $PLAN9/lib/lib9.a _exits.o _p9dialparse.o _p9dir.o announce.o argv0.o atexit.o atoi.o atol.o atoll.o atnotify.o await.o cistrcmp.o cistrncmp.o cistrstr.o cleanname.o convD2M.o convM2D.o convM2S.o convS2M.o create.o ctime.o date.o dial.o dirfstat.o dirfwstat.o dirmodefmt.o dirread.o dirstat.o dirwstat.o dup.o encodefmt.o errstr.o exec.o execl.o fcallfmt.o get9root.o getcallerpc-$OBJTYPE.o getenv.o getfields.o getns.o getuser.o getwd.o jmp.o lrand.o lnrand.o main.o malloc.o malloctag.o mallocz.o nan.o needsrcquote.o needstack.o netmkaddr.o notify.o nrand.o nulldir.o open.o opentemp.o pipe.o post9p.o postnote.o qlock.o quote.o rand.o read9pmsg.o readn.o rfork.o seek.o sendfd.o sleep.o strdup.o strecpy.o sysfatal.o sysname.o time.o tokenize.o truerand.o u16.o u32.o u64.o unsharp.o wait.o waitpid.o dofmt.o fltfmt.o fmt.o fmtfd.o fmtfdflush.o fmtlock2.o fmtprint.o fmtquote.o fmtrune.o fmtstr.o fmtvprint.o fprint.o nan64.o print.o runefmtstr.o runeseprint.o runesmprint.o runesnprint.o runesprint.o runevseprint.o runevsmprint.o runevsnprint.o seprint.o smprint.o snprint.o sprint.o strtod.o vfprint.o vseprint.o vsmprint.o vsnprint.o charstod.o pow10.o rune.o runestrcat.o runestrchr.o runestrcmp.o runestrcpy.o runestrdup.o runestrlen.o runestrecpy.o runestrncat.o runestrncmp.o runestrncpy.o runestrrchr.o runestrstr.o runetype.o utfecpy.o utflen.o utfnlen.o utfrrune.o utfrune.o utfutf.o +9ar rvc $PLAN9/lib/lib9.a _exits.o _p9dialparse.o _p9dir.o announce.o argv0.o atexit.o atoi.o atol.o atoll.o atnotify.o await.o cistrcmp.o cistrncmp.o cistrstr.o cleanname.o convD2M.o convM2D.o convM2S.o convS2M.o create.o crypt.o ctime.o date.o dial.o dirfstat.o dirfwstat.o dirmodefmt.o dirread.o dirstat.o dirwstat.o dup.o encodefmt.o errstr.o exec.o execl.o fcallfmt.o get9root.o getcallerpc-$OBJTYPE.o getenv.o getfields.o getns.o getuser.o getwd.o jmp.o lrand.o lnrand.o main.o malloc.o malloctag.o mallocz.o nan.o needsrcquote.o needstack.o netcrypt.o netmkaddr.o notify.o nrand.o nulldir.o open.o opentemp.o pipe.o post9p.o postnote.o qlock.o quote.o rand.o read9pmsg.o readcons.o readn.o rfork.o searchpath.o seek.o sendfd.o sleep.o strdup.o strecpy.o sysfatal.o syslog.o sysname.o time.o tokenize.o truerand.o u16.o u32.o u64.o unsharp.o wait.o waitpid.o dofmt.o fltfmt.o fmt.o fmtfd.o fmtfdflush.o fmtlock2.o fmtprint.o fmtquote.o fmtrune.o fmtstr.o fmtvprint.o fprint.o nan64.o print.o runefmtstr.o runeseprint.o runesmprint.o runesnprint.o runesprint.o runevseprint.o runevsmprint.o runevsnprint.o seprint.o smprint.o snprint.o sprint.o strtod.o vfprint.o vseprint.o vsmprint.o vsnprint.o charstod.o pow10.o rune.o runestrcat.o runestrchr.o runestrcmp.o runestrcpy.o runestrdup.o runestrlen.o runestrecpy.o runestrncat.o runestrncmp.o runestrncpy.o runestrrchr.o runestrstr.o runetype.o utfecpy.o utflen.o utfnlen.o utfrrune.o utfrune.o utfutf.o cd .. cd libbio 9c bbuffered.c