ether83815: import changes from fs kernel
[rsc] --rw-rw-r-- M 1292596 glenda sys 26125 Feb 18 09:09 sys/src/9/pc/ether83815.c
[diffs elided - too long]
[diff -c /n/sourcesdump/2006/0218/plan9/sys/src/9/pc/ether83815.c /n/sourcesdump/2006/0219/plan9/sys/src/9/pc/ether83815.c]
auth/*: add program name to error messages
[rsc] --rw-rw-r-- M 1292596 glenda sys 2370 Feb 18 09:29 sys/src/cmd/auth/convkeys.c
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/convkeys.c:74,80 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/convkeys.c:74,80
fd = open("/dev/random", OREAD);
if(fd < 0){
- fprint(2, "can't open /dev/random, using rand()\n");
+ fprint(2, "convkeys: can't open /dev/random, using rand()\n");
srand(time(0));
for(i = 0; i < len; i++)
p[i] = rand();
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/convkeys.c:118,124 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/convkeys.c:118,125
len -= KEYDBOFF;
if(len % KEYDBLEN){
- fprint(2, "file odd length; not converting %d bytes\n", len % KEYDBLEN);
+ fprint(2, "convkeys: file odd length; not converting %d bytes\n",
+ len % KEYDBLEN);
len -= len % KEYDBLEN;
}
len += KEYDBOFF;
[rsc] --rw-rw-r-- M 1292596 glenda sys 2427 Feb 18 09:29 sys/src/cmd/auth/convkeys2.c
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/convkeys2.c:88,94 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/convkeys2.c:88,95
int i, off, noff;
if(len % OKEYDBLEN)
- fprint(2, "file odd length; not converting %d bytes\n", len % KEYDBLEN);
+ fprint(2, "convkeys2: file odd length; not converting %d bytes\n",
+ len % KEYDBLEN);
len /= OKEYDBLEN;
for(i = 0; i < len; i ++){
off = i*OKEYDBLEN;
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/convkeys2.c:108,114 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/convkeys2.c:109,115
void
usage(void)
{
- fprint(2, "usage: convkeys keyfile\n");
+ fprint(2, "usage: convkeys2 keyfile\n");
exits("usage");
}
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/convkeys2.c:119,125 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/convkeys2.c:120,126
fd = open("/dev/random", OREAD);
if(fd < 0){
- fprint(2, "can't open /dev/random, using rand()\n");
+ fprint(2, "convkeys2: can't open /dev/random, using rand()\n");
srand(time(0));
for(i = 0; i < len; i++)
p[i] = rand();
[rsc] --rw-rw-r-- M 1292596 glenda sys 11435 Feb 18 09:29 sys/src/cmd/auth/cron.c
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/cron.c:140,149 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/cron.c:140,147
user = getuser();
sprint(file, "/cron/%s", user);
fd = create(file, OREAD, 0755|DMDIR);
- if(fd < 0){
- fprint(2, "couldn't create %s: %r\n", file);
- exits("create");
- }
+ if(fd < 0)
+ sysfatal("couldn't create %s: %r", file);
nulldir(&d);
d.gid = user;
dirfwstat(fd, &d);
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/cron.c:150,159 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/cron.c:148,155
close(fd);
sprint(file, "/cron/%s/cron", user);
fd = create(file, OREAD, 0644);
- if(fd < 0){
- fprint(2, "couldn't create %s: %r\n", file);
- exits("create");
- }
+ if(fd < 0)
+ sysfatal("couldn't create %s: %r", file);
nulldir(&d);
d.gid = user;
dirfwstat(fd, &d);
[rsc] --rw-rw-r-- M 1292596 rsc sys 7365 Feb 18 09:29 sys/src/cmd/auth/debug.c
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/debug.c:103,109 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/debug.c:103,109
b = Bopen("/mnt/factotum/ctl", OREAD);
if(b == nil){
- fprint(2, "cannot open /mnt/factotum/ctl");
+ fprint(2, "debug: cannot open /mnt/factotum/ctl\n");
return;
}
found = 0;
[rsc] --rw-rw-r-- M 1292596 glenda sys 10544 Feb 18 09:29 sys/src/cmd/auth/factotum/fs.c
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/factotum/fs.c:161,167 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/factotum/fs.c:161,167
rerrstr(err, sizeof err);
if(strcmp(err, "cancel") == 0)
break;
- fprint(2, "secstorefetch: %r\n");
+ fprint(2, "factotum: secstorefetch: %r\n");
fprint(2, "Enter an empty password to quit.\n");
free(secstorepw);
secstorepw = nil; /* just try nvram pw once */
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/factotum/fs.c:170,176 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/factotum/fs.c:170,176
/*
rerrstr(err, sizeof err);
if(*err)
- fprint(2, "havesecstore: %r\n");
+ fprint(2, "factotum: havesecstore: %r\n");
*/
}
}
[rsc] --rw-rw-r-- M 1292596 glenda sys 14955 Feb 18 09:29 sys/src/cmd/auth/factotum/secstore.c
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/factotum/secstore.c:363,369 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/factotum/secstore.c:363,369
*q++ = '\0';
n++;
if(ctlwrite(p, 0) < 0)
- fprint(2, "secstore(%s) line %d: %r\n", gf, n);
+ fprint(2, "factotum: secstore(%s) line %d: %r\n", gf, n);
p = q;
}
free(buf);
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/factotum/secstore.c:497,503 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/factotum/secstore.c:497,503
// recv g**y, S, check hash1(g**xy)
if(readstr(conn, mess) < 0){
- fprint(2, "error: %s\n", mess);
+ fprint(2, "factotum: error: %s\n", mess);
writerr(conn, "couldn't read g**y");
goto done;
}
[rsc] --rw-rw-r-- M 1292596 glenda sys 18056 Feb 18 09:29 sys/src/cmd/auth/factotum/util.c
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/factotum/util.c:948,954 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/factotum/util.c:948,955
fd = open("#c/hostowner", OWRITE);
if(fd >= 0){
if(fprint(fd, "%s", owner) < 0)
- fprint(2, "setting #c/hostowner to %q: %r\n", owner);
+ fprint(2, "factotum: setting #c/hostowner to %q: %r\n",
+ owner);
close(fd);
}
}
[rsc] --rw-rw-r-- M 1292596 glenda sys 17633 Feb 18 09:29 sys/src/cmd/auth/keyfs.c
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/keyfs.c:679,685 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/keyfs.c:679,685
fd = open("/dev/random", OREAD);
if(fd < 0){
- fprint(2, "can't open /dev/random, using rand()\n");
+ fprint(2, "keyfs: can't open /dev/random, using rand()\n");
srand(time(0));
for(i = 0; i < len; i++)
p[i] = rand();
[rsc] --rw-rw-r-- M 1292596 glenda sys 4002 Feb 18 09:29 sys/src/cmd/auth/login.c
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/login.c:15,21 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/login.c:15,21
if(raw){
ctl = open("/dev/consctl", OWRITE);
if(ctl < 0){
- fprint(2, "couldn't set raw mode");
+ fprint(2, "login: couldn't set raw mode");
exits("readln");
}
write(ctl, "rawon", 5);
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/login.c:29,35 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/login.c:29,35
close(ctl);
close(fdin);
close(fdout);
- fprint(2, "can't read cons");
+ fprint(2, "login: can't read cons");
exits("readln");
}
if(*p == 0x7f)
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/login.c:162,168 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/login.c:162,168
service = getenv("service");
if(strcmp(service, "cpu") == 0)
- fprint(2, "warning: running on a cpu server!\n");
+ fprint(2, "login: warning: running on a cpu server!\n");
if(argc != 1){
fprint(2, "usage: login username\n");
exits("usage");
[rsc] --rw-rw-r-- M 1292596 glenda sys 2769 Feb 18 09:29 sys/src/cmd/auth/passwd.c
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/passwd.c:130,136 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/passwd.c:130,136
error("AS protocol botch: %r");
if(asrdresp(fd, buf, 0) == 0)
break;
- fprint(2, "refused: %r\n");
+ fprint(2, "passwd: refused: %r\n");
}
close(fd);
[rsc] --rw-rw-r-- M 1292596 glenda sys 653 Feb 18 09:29 sys/src/cmd/auth/printnetkey.c
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/printnetkey.c:26,35 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/printnetkey.c:26,31
u = argv[0];
fmtinstall('K', keyfmt);
- if(argc != 1){
- fprint(2, "usage: printnetkey user\n");
- exits("usage");
- }
if(memchr(u, '\0', ANAMELEN) == 0)
error("bad user name");
key = findkey(NETKEYDB, u, keybuf);
[rsc] --rw-rw-r-- M 1292596 rsc sys 3407 Feb 18 09:29 sys/src/cmd/auth/rsa2any.c
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/rsa2any.c:70,80 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/rsa2any.c:70,80
return nil;
}
if((p = _strfindattr(a, "size")) == nil)
- fprint(2, "warning: missing size; will add\n");
+ fprint(2, "rsa2any: warning: missing size; will add\n");
else if((sz = strtol(p, &p, 10)) == 0 || *p != 0)
- fprint(2, "warning: bad size; will correct\n");
+ fprint(2, "rsa2any: warning: bad size; will correct\n");
else if(sz != mpsignif(key->pub.n))
- fprint(2, "warning: wrong size (got %d, expected %d); will correct\n",
+ fprint(2, "rsa2any: warning: wrong size (got %d, expected %d); will correct\n",
sz, mpsignif(key->pub.n));
if(!needprivate)
goto call;
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/rsa2any.c:103,134 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/rsa2any.c:103,134
return nil;
}
if((p = _strfindattr(a, "!kp")) == nil){
- fprint(2, "warning: no !kp\n");
+ fprint(2, "rsa2any: warning: no !kp\n");
regen = 1;
goto regen;
}
if((key->kp = strtomp(p, &p, 16, nil)) == nil || *p != 0){
- fprint(2, "warning: bad !kp\n");
+ fprint(2, "rsa2any: warning: bad !kp\n");
regen = 1;
goto regen;
}
if((p = _strfindattr(a, "!kq")) == nil){
- fprint(2, "warning: no !kq\n");
+ fprint(2, "rsa2any: warning: no !kq\n");
regen = 1;
goto regen;
}
if((key->kq = strtomp(p, &p, 16, nil)) == nil || *p != 0){
- fprint(2, "warning: bad !kq\n");
+ fprint(2, "rsa2any: warning: bad !kq\n");
regen = 1;
goto regen;
}
if((p = _strfindattr(a, "!c2")) == nil){
- fprint(2, "warning: no !c2\n");
+ fprint(2, "rsa2any: warning: no !c2\n");
regen = 1;
goto regen;
}
if((key->c2 = strtomp(p, &p, 16, nil)) == nil || *p != 0){
- fprint(2, "warning: bad !c2\n");
+ fprint(2, "rsa2any: warning: bad !c2\n");
regen = 1;
goto regen;
}
[rsc] --rw-rw-r-- M 1292596 glenda sys 4064 Feb 18 09:29 sys/src/cmd/auth/secstore/aescbc.c
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/secstore/aescbc.c:22,44 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/secstore/aescbc.c:22,36
void
safewrite(uchar *buf, int n)
{
- int i = Bwrite(&bout, buf, n);
-
- if(i == n)
- return;
- fprint(2, "write error\n");
- exits("write error");
+ if(Bwrite(&bout, buf, n) != n)
+ sysfatal("write error");
}
void
saferead(uchar *buf, int n)
{
- int i = Bread(&bin, buf, n);
-
- if(i == n)
- return;
- fprint(2, "read error\n");
- exits("read error");
+ if(Bread(&bin, buf, n) != n)
+ sysfatal("read error");
}
int
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/secstore/aescbc.c:93,102 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/secstore/aescbc.c:85,92
memset(pass, 0, n);
free(pass);
}
- if(n <= 0){
- fprint(2,"no key\n");
- exits("key");
- }
+ if(n <= 0)
+ sysfatal("no key");
dstate = sha1((uchar*)"aescbc file", 11, nil, nil);
sha1(buf, n, key2, dstate);
memcpy(key, key2, 16);
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/secstore/aescbc.c:112,121 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/secstore/aescbc.c:102,109
dstate = hmac_sha1(buf+AESbsize, AESbsize, key2, MD5dlen, 0, 0);
while(1){
n = Bread(&bin, buf, BUF);
- if(n < 0){
- fprint(2,"read error\n");
- exits("read error");
- }
+ if(n < 0)
+ sysfatal("read error");
aesCBCencrypt(buf, n, &aes);
safewrite(buf, n);
dstate = hmac_sha1(buf, n, key2, MD5dlen, 0, dstate);
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/secstore/aescbc.c:139,148 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/secstore/aescbc.c:127,134
memmove(buf, buf+n, SHA1dlen); /* these bytes are not yet decrypted */
}
hmac_sha1(0, 0, key2, MD5dlen, buf+SHA1dlen, dstate);
- if(memcmp(buf, buf+SHA1dlen, SHA1dlen) != 0){
- fprint(2,"decrypted file failed to authenticate\n");
- exits("decrypted file failed to authenticate");
- }
+ if(memcmp(buf, buf+SHA1dlen, SHA1dlen) != 0)
+ sysfatal("decrypted file failed to authenticate");
}else{ /* compatibility with past mistake */
// if file was encrypted with bad aescbc use this:
// memset(key, 0, AESmaxkey);
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/secstore/aescbc.c:155,164 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/secstore/aescbc.c:141,148
safewrite(buf, n);
memmove(buf, buf+n, CHK);
}
- if(memcmp(buf, "XXXXXXXXXXXXXXXX", CHK) != 0){
- fprint(2,"decrypted file failed to authenticate\n");
- exits("decrypted file failed to authenticate");
- }
+ if(memcmp(buf, "XXXXXXXXXXXXXXXX", CHK) != 0)
+ sysfatal("decrypted file failed to authenticate");
}
}
exits("");
[rsc] --rw-rw-r-- M 1292596 glenda sys 9314 Feb 18 09:29 sys/src/cmd/auth/secstore/pak.c
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/secstore/pak.c:124,130 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/secstore/pak.c:124,130
hexHi = PAK_Hi(C, pass, H, Hi);
if(verbose)
- fprint(2,"%s\n", feedback[H->p[0]&0x7]); // provide a clue to catch typos
+ fprint(2, "%s\n", feedback[H->p[0]&0x7]); // provide a clue to catch typos
// random 1<=x<=q-1; send C, m=g**x H
x = mprand(240, genrandom, nil);
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/secstore/pak.c:142,148 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/secstore/pak.c:142,148
// recv g**y, S, check hash1(g**xy)
if(readstr(conn, mess) < 0){
- fprint(2, "error: %s\n", mess);
+ fprint(2, "%s: error: %s\n", argv0, mess);
writerr(conn, "couldn't read g**y");
goto done;
}
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/secstore/pak.c:240,246 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/secstore/pak.c:240,246
// parse first message into C, m
eol = strchr(mess, '\n');
if(strncmp("C=", mess, 2) != 0 || !eol){
- fprint(2,"mess[1]=%s\n", mess);
+ fprint(2, "%s: mess[1]=%s\n", argv0, mess);
writerr(conn, "PAK version mismatch");
goto done;
}
[rsc] --rw-rw-r-- M 1292596 glenda sys 12679 Feb 18 09:29 sys/src/cmd/auth/secstore/secstore.c
[diffs elided - too long]
[diff -c /n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/secstore/secstore.c /n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/secstore/secstore.c]
[rsc] --rw-rw-r-- M 1292596 glenda sys 8087 Feb 18 09:29 sys/src/cmd/auth/secstore/secstored.c
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/secstore/secstored.c:208,214 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/secstore/secstored.c:208,214
return strdup("?!?");
n = read(fd, ap, sizeof ap);
if(n <= 0 || n == sizeof ap){
- fprint(2, "error %d reading %s: %r\n", n, rp);
+ fprint(2, "secstored: error %d reading %s: %r\n", n, rp);
return strdup("?!?");
}
close(fd);
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/secstore/secstored.c:234,240 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/secstore/secstored.c:234,240
if((conn = newSConn(fd)) == nil)
return -1;
if(readstr(conn, msg) < 0){
- fprint(2, "remote: %s: %r\n", msg);
+ fprint(2, "secstored: remote: %s: %r\n", msg);
writerr(conn, "can't read your first message");
goto Out;
}
[rsc] --rw-rw-r-- M 1292596 glenda sys 5137 Feb 18 09:29 sys/src/cmd/auth/secstore/secuser.c
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/secstore/secuser.c:20,26 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/secstore/secuser.c:20,26
fprint(2,"first time setup for secstore: create %s %lo\n", f, perm);
fd = create(f, OREAD, perm);
if(fd < 0){
- fprint(2, "unable to create %s\n", f);
+ fprint(2, "secuser: unable to create %s\n", f);
exits("secstored directories");
}
close(fd);
[rsc] --rw-rw-r-- M 1292596 glenda sys 1770 Feb 18 09:29 sys/src/cmd/auth/secstore/util.c
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/secstore/util.c:40,54 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/secstore/util.c:40,50
if(cons == 0){ // first time
cons = open("/dev/cons", ORDWR);
- if(cons < 0){
- fprint(2, "couldn't open cons\n");
- exits("no cons");
- }
+ if(cons < 0)
+ sysfatal("couldn't open cons");
consctl = open("/dev/consctl", OWRITE);
- if(consctl < 0){
- fprint(2, "couldn't set raw mode\n");
- exits("no consctl");
- }
+ if(consctl < 0)
+ sysfatal("couldn't set raw mode via consctl");
}
fprint(consctl, "rawon");
fprint(cons, "%s", prompt);
[rsc] --rw-rw-r-- M 1292596 glenda sys 1440 Feb 18 09:29 sys/src/cmd/auth/uniq.c
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/uniq.c:58,64 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/uniq.c:58,64
w = malloc(sizeof(Who));
if(w == 0){
- fprint(2, "out of memory\n");
+ fprint(2, "auth/uniq: out of memory\n");
exits(0);
}
memset(w, 0, sizeof(Who));
[rsc] --rw-rw-r-- M 1292596 glenda sys 5271 Feb 18 09:29 sys/src/cmd/auth/warning.c
/n/sourcesdump/2006/0218/plan9/sys/src/cmd/auth/warning.c:266,273 -
/n/sourcesdump/2006/0219/plan9/sys/src/cmd/auth/warning.c:266,272
execl("/bin/upas/send", "send", "-r", rcvr, nil);
/* just in case */
- fprint(2, "warning can't exec send: %r\n");
- exits("exec send");
+ sysfatal("can't exec send: %r");
return 0; /* for compiler */
}
|