diff --git a/sys/src/cmd/cwfs/9p1.c b/sys/src/cmd/cwfs/9p1.c index 1f672fbe6..ec7c6013a 100644 --- a/sys/src/cmd/cwfs/9p1.c +++ b/sys/src/cmd/cwfs/9p1.c @@ -264,14 +264,8 @@ f_attach(Chan *cp, Fcall *in, Fcall *ou) strncpy(cp->whoname, in->uname, sizeof(cp->whoname)); cp->whotime = time(nil); - if(cons.flags & attachflag) - print("9p1: attach %s %T to \"%s\" C%d\n", - cp->whoname, cp->whotime, fs->name, cp->chan); out: - if((cons.flags & attachflag) && ou->err) - print("9p1: attach %s %T SUCK EGGS --- %s\n", - in->uname, time(nil), errstr9p[ou->err]); if(p) putbuf(p); if(f) { diff --git a/sys/src/cmd/cwfs/9p2.c b/sys/src/cmd/cwfs/9p2.c index ec89a5263..584b1904f 100644 --- a/sys/src/cmd/cwfs/9p2.c +++ b/sys/src/cmd/cwfs/9p2.c @@ -165,7 +165,7 @@ auth(Chan* chan, Fcall* f, Fcall* r) Filsys *fs; int error; - if(cons.flags & authdisableflag) + if(noauth || wstatallow) return Eauthdisabled; error = 0; @@ -202,9 +202,6 @@ auth(Chan* chan, Fcall* f, Fcall* r) } r->aqid = file->qid; out: - if((cons.flags & attachflag) && error) - print("9p2: auth %s %T SUCK EGGS --- %s\n", - f->uname, time(nil), errstr9p[error]); if(file != nil){ qunlock(file); if(error) @@ -229,10 +226,10 @@ authorize(Chan* chan, Fcall* f) return uid; } - if(cons.flags & authdisableflag){ + if(noauth || wstatallow){ uid = strtouid(f->uname); if(db) - print("permission granted by authdisable uid %s = %d\n", + print("permission granted by noauth uid %s = %d\n", f->uname, uid); return uid; } @@ -326,14 +323,7 @@ attach(Chan* chan, Fcall* f, Fcall* r) strncpy(chan->whoname, f->uname, sizeof(chan->whoname)); chan->whotime = time(nil); - if(cons.flags & attachflag) - print("9p2: attach %s %T to \"%s\" C%d\n", - chan->whoname, chan->whotime, fs->name, chan->chan); - out: - if((cons.flags & attachflag) && error) - print("9p2: attach %s %T SUCK EGGS --- %s\n", - f->uname, time(nil), errstr9p[error]); if(p != nil) putbuf(p); if(file != nil){ diff --git a/sys/src/cmd/cwfs/all.h b/sys/src/cmd/cwfs/all.h index cb0e6ca49..3c29ecc5b 100644 --- a/sys/src/cmd/cwfs/all.h +++ b/sys/src/cmd/cwfs/all.h @@ -81,16 +81,14 @@ struct Fspar { ulong roflag; ulong errorflag; ulong chatflag; -ulong attachflag; ulong authdebugflag; -ulong authdisableflag; -int noattach; +int noattach; /* attach is disabled */ +int noauth; /* auth is disable */ int wstatallow; /* set to circumvent wstat permissions */ int writeallow; /* set to circumvent write permissions */ int duallow; /* single user to allow du */ int readonly; /* disable writes if true */ -int noauth; /* Debug */ int rawreadok; /* allow reading raw data */ diff --git a/sys/src/cmd/cwfs/con.c b/sys/src/cmd/cwfs/con.c index c1aa59623..0a7aa2134 100644 --- a/sys/src/cmd/cwfs/con.c +++ b/sys/src/cmd/cwfs/con.c @@ -695,6 +695,14 @@ cmd_time(int argc, char *argv[]) print("time = %ld ms\n", TK2MS(t2-t1)); } +void +cmd_noauth(int, char *[]) +{ + noauth = !noauth; + if(noauth) + print("authentication is DISABLED\n"); +} + void cmd_noattach(int, char *[]) { @@ -759,15 +767,14 @@ installcmds(void) cmd_install("who", "[user ...] -- print attaches", cmd_who); cmd_install("hangup", "chan -- clunk files", cmd_hangup); cmd_install("printconf", "-- print configuration", cmd_printconf); + cmd_install("noauth", "toggle noauth flag", cmd_noauth); cmd_install("noattach", "toggle noattach flag", cmd_noattach); cmd_install("files", "report on files structure", cmd_files); - attachflag = flag_install("attach", "-- attach calls"); chatflag = flag_install("chat", "-- verbose"); errorflag = flag_install("error", "-- on errors"); whoflag = flag_install("allchans", "-- on who"); authdebugflag = flag_install("authdebug", "-- report authentications"); - authdisableflag = flag_install("authdisable", "-- disable authentication"); } int diff --git a/sys/src/cmd/cwfs/config.c b/sys/src/cmd/cwfs/config.c index b11c53e77..49d0ff380 100644 --- a/sys/src/cmd/cwfs/config.c +++ b/sys/src/cmd/cwfs/config.c @@ -440,6 +440,10 @@ mergeconf(Iobuf *p) cp = getwrd(word, cp); if(service[0] == 0) strncpy(service, word, sizeof service); + } else if(strcmp(word, "noauth") == 0){ + noauth = 1; + } else if(strcmp(word, "readonly") == 0){ + readonly = 1; } else if(strcmp(word, "ipauth") == 0) /* obsolete */ cp = getwrd(word, cp); else if(astrcmp(word, "ip") == 0) /* obsolete */ @@ -579,7 +583,10 @@ start: if(fs->conf && fs->conf[0] != '\0') cp = seprint(cp, ep, "filsys %s %s\n", fs->name, fs->conf); - + if(noauth) + cp = seprint(cp, ep, "noauth\n"); + if(readonly) + cp = seprint(cp, ep, "readonly\n"); for (fsp = fspar; fsp->name != nil; fsp++) cp = seprint(cp, ep, "%s %ld\n", fsp->name, fsp->declared); @@ -591,7 +598,7 @@ start: } putbuf(p); - print("service %s\n", service); + print("service %s\n", service); loop: /* @@ -954,12 +961,6 @@ arginit(void) querychanger(iconfig(word)); continue; } - - if(strcmp(word, "allow") == 0) { - wstatallow = 1; - writeallow = 1; - continue; - } if(strcmp(word, "copyworm") == 0) { copyworm = 1; continue; @@ -976,16 +977,18 @@ arginit(void) copydev = 1; continue; } - if(strcmp(word, "noauth") == 0) { - noauth = !noauth; - continue; - } if(strcmp(word, "noattach") == 0) { noattach = !noattach; continue; } + if(strcmp(word, "noauth") == 0) { + noauth = !noauth; + f.modconf = 1; + continue; + } if(strcmp(word, "readonly") == 0) { - readonly = 1; + readonly = !readonly; + f.modconf = 1; continue; } diff --git a/sys/src/cmd/cwfs/console.c b/sys/src/cmd/cwfs/console.c index 98f617218..fdfd77e68 100644 --- a/sys/src/cmd/cwfs/console.c +++ b/sys/src/cmd/cwfs/console.c @@ -1,5 +1,4 @@ #include "all.h" - #include "9p1.h" void diff --git a/sys/src/cmd/cwfs/net.c b/sys/src/cmd/cwfs/net.c index 927433db1..ed6abe280 100644 --- a/sys/src/cmd/cwfs/net.c +++ b/sys/src/cmd/cwfs/net.c @@ -44,9 +44,7 @@ struct Network { static Network netif[Maxnets]; -char *annstrs[Maxnets] = { - "tcp!*!9fs", -}; +char *annstrs[Maxnets]; static void neti(void *v)