From 6c0209f6f0eb41151397e4784730d2b6bca8d7ea Mon Sep 17 00:00:00 2001 From: rsc Date: Fri, 11 Feb 2005 20:32:41 +0000 Subject: build changes --- src/cmd/factotum/attr.c | 2 ++ src/cmd/factotum/plan9.c | 65 +-------------------------------- src/cmd/tar.C | 2 +- src/cmd/vac/vac.c | 2 ++ src/lib9p/mkfile | 1 - src/libauthsrv/readnvram.c | 90 ++++++++-------------------------------------- src/libndb/ndbipinfo.c | 1 - src/mkmk.sh | 7 +++- 8 files changed, 27 insertions(+), 143 deletions(-) (limited to 'src') diff --git a/src/cmd/factotum/attr.c b/src/cmd/factotum/attr.c index 98ffb2c9..b92e96a0 100644 --- a/src/cmd/factotum/attr.c +++ b/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", diff --git a/src/cmd/factotum/plan9.c b/src/cmd/factotum/plan9.c index 36082c3b..0b6bb601 100644 --- a/src/cmd/factotum/plan9.c +++ b/src/cmd/factotum/plan9.c @@ -12,73 +12,10 @@ 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); -} - -/* 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; + return addattr(a, "cuid=%q suid=%q cap=''", t->cuid, t->suid); } int diff --git a/src/cmd/tar.C b/src/cmd/tar.C index ae6ac61a..2b283aec 100644 --- a/src/cmd/tar.C +++ b/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; diff --git a/src/cmd/vac/vac.c b/src/cmd/vac/vac.c index f2595fff..93add14d 100644 --- a/src/cmd/vac/vac.c +++ b/src/cmd/vac/vac.c @@ -400,6 +400,8 @@ vacfile(DirSink *dsink, char *lname, char *sname, VacFile *vf) if((dir = dirstat(sname)) == nil){ warn("could not stat file %s: %r", lname); + return; + } if(dir->mode&(DMSYMLINK|DMDEVICE|DMNAMEDPIPE|DMSOCKET)){ free(dir); return; diff --git a/src/lib9p/mkfile b/src/lib9p/mkfile index d131c4c7..4ff9d344 100644 --- a/src/lib9p/mkfile +++ b/src/lib9p/mkfile @@ -10,7 +10,6 @@ OFILES=\ mem.$O\ req.$O\ parse.$O\ - post.$O\ srv.$O\ tpost.$O\ uid.$O\ diff --git a/src/libauthsrv/readnvram.c b/src/libauthsrv/readnvram.c index e48a5761..524d2be5 100644 --- a/src/libauthsrv/readnvram.c +++ b/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; diff --git a/src/libndb/ndbipinfo.c b/src/libndb/ndbipinfo.c index 5cdc24b5..a860c8b7 100644 --- a/src/libndb/ndbipinfo.c +++ b/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); diff --git a/src/mkmk.sh b/src/mkmk.sh index 5ff530fb..812e64b3 100644 --- a/src/mkmk.sh +++ b/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 -- cgit v1.2.3