From fa325e9b42b0bdfb48857d1958d9fb7ceac55151 Mon Sep 17 00:00:00 2001 From: Dan Cross Date: Fri, 10 Jan 2020 14:44:21 +0000 Subject: Trivial changes: whitespace and modes. Remote whitespace at the ends of lines. Remove blank lines from the ends of files. Change modes on source files so that they are not executable. Signed-off-by: Dan Cross --- src/cmd/auth/factotum/apop.c | 7 +++---- src/cmd/auth/factotum/attr.c | 4 ++-- src/cmd/auth/factotum/chap.c | 10 ++++------ src/cmd/auth/factotum/conv.c | 1 - src/cmd/auth/factotum/cpu.c | 8 ++++---- src/cmd/auth/factotum/dat.h | 2 +- src/cmd/auth/factotum/dsa.c | 23 +++++++++++----------- src/cmd/auth/factotum/fs.c | 9 ++++----- src/cmd/auth/factotum/httpdigest.c | 10 +++++----- src/cmd/auth/factotum/key.c | 4 ++-- src/cmd/auth/factotum/log.c | 1 - src/cmd/auth/factotum/main.c | 2 +- src/cmd/auth/factotum/p9any.c | 9 ++++----- src/cmd/auth/factotum/p9cr.c | 6 +++--- src/cmd/auth/factotum/p9sk1.c | 7 +++---- src/cmd/auth/factotum/pass.c | 4 ++-- src/cmd/auth/factotum/pkcs1.c | 15 +++++++------- src/cmd/auth/factotum/rpc.c | 5 ++--- src/cmd/auth/factotum/rsa.c | 40 +++++++++++++++++++------------------- src/cmd/auth/factotum/secstore.c | 1 - src/cmd/auth/factotum/std.h | 1 - src/cmd/auth/factotum/util.c | 2 -- src/cmd/auth/factotum/wep.c | 6 +++--- src/cmd/auth/factotum/xio.c | 3 +-- 24 files changed, 82 insertions(+), 98 deletions(-) (limited to 'src/cmd/auth/factotum') diff --git a/src/cmd/auth/factotum/apop.c b/src/cmd/auth/factotum/apop.c index 992cc0ad..d3d8c95a 100644 --- a/src/cmd/auth/factotum/apop.c +++ b/src/cmd/auth/factotum/apop.c @@ -10,7 +10,7 @@ * S -> C: ok * * Note that this is the protocol between factotum and the local - * program, not between the two factotums. The information + * program, not between the two factotums. The information * exchanged here is wrapped in the APOP protocol by the local * programs. * @@ -42,7 +42,7 @@ apopclient(Conv *c) Attr *attr; DigestState *ds; Key *k; - + chal = nil; k = nil; res = nil; @@ -328,7 +328,7 @@ apopresp(ServerState *s, char *user, char *resp) } static Role -apoproles[] = +apoproles[] = { "client", apopclient, "server", apopserver, @@ -350,4 +350,3 @@ Proto cram = { apopcheck, nil }; - diff --git a/src/cmd/auth/factotum/attr.c b/src/cmd/auth/factotum/attr.c index 1c037a53..25a46159 100644 --- a/src/cmd/auth/factotum/attr.c +++ b/src/cmd/auth/factotum/attr.c @@ -53,7 +53,7 @@ addattrs(Attr *a, Attr *b) break; } } - return a; + return a; } void @@ -201,7 +201,7 @@ matchattr(Attr *pat, Attr *a0, Attr *a1) break; } } - return 1; + return 1; } Attr* diff --git a/src/cmd/auth/factotum/chap.c b/src/cmd/auth/factotum/chap.c index fa44db96..d4fee3c4 100644 --- a/src/cmd/auth/factotum/chap.c +++ b/src/cmd/auth/factotum/chap.c @@ -1,6 +1,6 @@ /* * CHAP, MSCHAP - * + * * The client does not authenticate the server, hence no CAI * * Protocol: @@ -51,7 +51,7 @@ nthash(uchar hash[MShashlen], char *passwd) { uchar buf[512]; int i; - + for(i=0; *passwd && iattr, "p"))==nil + if((a=strfindattr(k->attr, "p"))==nil || (priv->pub.p=strtomp(a, nil, 16, nil))==nil) goto Error; strlwr(a); - if((a=strfindattr(k->attr, "q"))==nil + if((a=strfindattr(k->attr, "q"))==nil || (priv->pub.q=strtomp(a, nil, 16, nil))==nil) goto Error; strlwr(a); @@ -90,15 +90,15 @@ readdsapriv(Key *k) werrstr("dsa: p or q not prime"); goto Error; } - if((a=strfindattr(k->attr, "alpha"))==nil + if((a=strfindattr(k->attr, "alpha"))==nil || (priv->pub.alpha=strtomp(a, nil, 16, nil))==nil) goto Error; strlwr(a); - if((a=strfindattr(k->attr, "key"))==nil + if((a=strfindattr(k->attr, "key"))==nil || (priv->pub.key=strtomp(a, nil, 16, nil))==nil) goto Error; strlwr(a); - if((a=strfindattr(k->privattr, "!secret"))==nil + if((a=strfindattr(k->privattr, "!secret"))==nil || (priv->secret=strtomp(a, nil, 16, nil))==nil) goto Error; strlwr(a); @@ -113,7 +113,7 @@ static int dsacheck(Key *k) { static int first = 1; - + if(first){ fmtinstall('B', mpfmt); first = 0; @@ -134,7 +134,7 @@ dsaclose(Key *k) } static Role -dsaroles[] = +dsaroles[] = { "sign", xdsasign, 0 @@ -147,4 +147,3 @@ Proto dsa = { dsacheck, dsaclose }; - diff --git a/src/cmd/auth/factotum/fs.c b/src/cmd/auth/factotum/fs.c index fd89b2c2..811bd5b0 100644 --- a/src/cmd/auth/factotum/fs.c +++ b/src/cmd/auth/factotum/fs.c @@ -65,7 +65,7 @@ rootdirgen(int n, Dir *dir, void *v) if(n > 0) return -1; - + fillstat(dir, factname, QTDIR, Qfactotum, DMDIR|0555); return 0; } @@ -224,7 +224,7 @@ convlist(int i, char *a, uint nn) memmove(a, buf, n); return n; } - + static void fskickreply(Conv *c) { @@ -250,7 +250,7 @@ fskickreply(Conv *c) respond(r, nil); c->nreply = 0; } - + /* * Some of the file system work happens in the fs proc, but * fsopen, fsread, fswrite, fsdestroyfid, and fsflush happen in @@ -305,7 +305,7 @@ fsopen(Req *r) c->kickreply = fskickreply; r->fid->aux = c; } - + respond(r, nil); } @@ -538,4 +538,3 @@ fsinit0(void) fs.destroyfid = fssendclunk; fs.start = fsstart; } - diff --git a/src/cmd/auth/factotum/httpdigest.c b/src/cmd/auth/factotum/httpdigest.c index 3e299bf5..1e9d5793 100644 --- a/src/cmd/auth/factotum/httpdigest.c +++ b/src/cmd/auth/factotum/httpdigest.c @@ -2,7 +2,7 @@ * HTTPDIGEST - MD5 challenge/response authentication (RFC 2617) * * Client protocol: - * write challenge: nonce method uri + * write challenge: nonce method uri * read response: 2*MD5dlen hex digits * * Server protocol: @@ -22,10 +22,10 @@ hdclient(Conv *c) char *realm, *passwd, *user, *f[4], *s, resp[MD5dlen*2+1]; int ret; Key *k; - + ret = -1; s = nil; - + c->state = "keylookup"; k = keyfetch(c, "%A", c->attr); if(k == nil) @@ -45,7 +45,7 @@ hdclient(Conv *c) digest(user, realm, passwd, f[0], f[1], f[2], resp); convwrite(c, resp, strlen(resp)); ret = 0; - + out: free(s); keyclose(k); @@ -103,7 +103,7 @@ digest(char *user, char *realm, char *passwd, strtolower(dig); } -static Role hdroles[] = +static Role hdroles[] = { "client", hdclient, 0 diff --git a/src/cmd/auth/factotum/key.c b/src/cmd/auth/factotum/key.c index 9df50eb3..817df97b 100644 --- a/src/cmd/auth/factotum/key.c +++ b/src/cmd/auth/factotum/key.c @@ -161,7 +161,7 @@ keyreplace(Conv *c, Key *k, char *fmt, ...) sysfatal("out of memory"); va_end(arg); - /* replace prompted values with prompts */ + /* replace prompted values with prompts */ a = copyattr(k->attr); bp = parseattr(k->proto->keyprompt); for(b=bp; b; b=b->next){ @@ -204,7 +204,7 @@ keyevict(Conv *c, Key *k, char *fmt, ...) sysfatal("out of memory"); va_end(arg); - /* replace prompted values with prompts */ + /* replace prompted values with prompts */ a = copyattr(k->attr); bp = parseattr(k->proto->keyprompt); for(b=bp; b; b=b->next){ diff --git a/src/cmd/auth/factotum/log.c b/src/cmd/auth/factotum/log.c index 4d29536b..e644028a 100644 --- a/src/cmd/auth/factotum/log.c +++ b/src/cmd/auth/factotum/log.c @@ -118,4 +118,3 @@ flog(char *fmt, ...) lbvappend(&logbuf, fmt, arg); va_end(arg); } - diff --git a/src/cmd/auth/factotum/main.c b/src/cmd/auth/factotum/main.c index 1f603ac7..b3ace12c 100644 --- a/src/cmd/auth/factotum/main.c +++ b/src/cmd/auth/factotum/main.c @@ -142,7 +142,7 @@ sendkey(Attr *attr) int rv; char buf[8192]; CFid *fid; - + fid = nsopen("factotum", nil, "ctl", OWRITE); if(fid == nil) sysfatal("opening factotum/ctl: %r"); diff --git a/src/cmd/auth/factotum/p9any.c b/src/cmd/auth/factotum/p9any.c index 0267a616..079eed94 100644 --- a/src/cmd/auth/factotum/p9any.c +++ b/src/cmd/auth/factotum/p9any.c @@ -9,7 +9,7 @@ * C->S: proto dom NUL * [negotiated proto continues] */ - + extern Proto p9sk1, p9sk2, p9cr; static Proto* okproto[] = @@ -111,7 +111,7 @@ p9anyserver(Conv *c) } ret = 0; - + out: free(s); freeattr(attr); @@ -222,7 +222,7 @@ found: /* f[i] is the chosen protocol, q the chosen domain */ attr = addattr(attr, "proto=%q dom=%q", f[i], q); c->state = "write choice"; - + /* have a key: go for it */ choice = estrappend(nil, "%q %q", f[i], q); if(convwrite(c, choice, strlen(choice)+1) < 0){ @@ -258,7 +258,7 @@ out: } static Role -p9anyroles[] = +p9anyroles[] = { "client", p9anyclient, "server", p9anyserver, @@ -269,4 +269,3 @@ Proto p9any = { "p9any", p9anyroles }; - diff --git a/src/cmd/auth/factotum/p9cr.c b/src/cmd/auth/factotum/p9cr.c index 1c3f21e1..4f181e98 100644 --- a/src/cmd/auth/factotum/p9cr.c +++ b/src/cmd/auth/factotum/p9cr.c @@ -9,7 +9,7 @@ * S -> C: ok or bad * * Note that this is the protocol between factotum and the local - * program, not between the two factotums. The information + * program, not between the two factotums. The information * exchanged here is wrapped in other protocols by the local * programs. */ @@ -317,7 +317,7 @@ p9crresp(ServerState *s, uchar *resp, int resplen) static int p9response(char *pw, uchar *chal, uchar *resp) -{ +{ char key[DESKEYLEN]; uchar buf[8]; ulong x; @@ -338,7 +338,7 @@ static int vncresponse(char *pw, uchar *chal, uchar *resp) { DESstate des; - + memmove(resp, chal, MAXCHAL); setupDESstate(&des, 0, nil); // XXX put key in for 0 desECBencrypt(resp, MAXCHAL, &des); diff --git a/src/cmd/auth/factotum/p9sk1.c b/src/cmd/auth/factotum/p9sk1.c index 0a79a361..d2d7eb89 100644 --- a/src/cmd/auth/factotum/p9sk1.c +++ b/src/cmd/auth/factotum/p9sk1.c @@ -93,7 +93,7 @@ p9skclient(Conv *c) k = keyfetch(c, "%A", a); if(k == nil) goto out; - + /* relay ticket request to auth server, get tickets */ strcpy(tr.hostid, strfindattr(k->attr, "user")); if(speakfor) @@ -329,7 +329,7 @@ p9sk1close(Key *k) } static Role -p9sk1roles[] = +p9sk1roles[] = { "client", p9skclient, "server", p9skserver, @@ -337,7 +337,7 @@ p9sk1roles[] = }; static Role -p9sk2roles[] = +p9sk2roles[] = { "client", p9skclient, "server", p9skserver, @@ -356,4 +356,3 @@ Proto p9sk2 = { "p9sk2", p9sk2roles }; - diff --git a/src/cmd/auth/factotum/pass.c b/src/cmd/auth/factotum/pass.c index 453045ce..ddda9596 100644 --- a/src/cmd/auth/factotum/pass.c +++ b/src/cmd/auth/factotum/pass.c @@ -15,12 +15,12 @@ static int passproto(Conv *c) { Key *k; - + k = keyfetch(c, "%A", c->attr); if(k == nil) return -1; c->state = "write"; - convprint(c, "%q %q", + convprint(c, "%q %q", strfindattr(k->attr, "user"), strfindattr(k->privattr, "!password")); return 0; diff --git a/src/cmd/auth/factotum/pkcs1.c b/src/cmd/auth/factotum/pkcs1.c index f3278454..0e116f2d 100644 --- a/src/cmd/auth/factotum/pkcs1.c +++ b/src/cmd/auth/factotum/pkcs1.c @@ -12,7 +12,7 @@ * * We sign hashes of messages instead of the messages * themselves. - * + * * The hashes are encoded in ASN.1 DER to identify * the signature type, and then prefixed with 0x01 PAD 0x00 * where PAD is as many 0xFF bytes as desired. @@ -138,7 +138,7 @@ mptoberjust(mpint *b, uchar *buf, uint len) #define O3(x) \ (((x)>>14)&0x7F)|0x80, \ (((x)>>7)&0x7F)|0x80, \ - ((x)&0x7F) + ((x)&0x7F) uchar oidsha1[] = { O0(1, 3), 14, 3, 2, 26 }; uchar oidmd2[] = { O0(1, 2), O2(840), O3(113549), 2, 2 }; uchar oidmd5[] = { O0(1, 2), O2(840), O3(113549), 2, 5 }; @@ -174,11 +174,11 @@ mkasn1(uchar *asn1, DigestAlg *alg, uchar *d, uint dlen) sysfatal("bad alg in mkasn1"); return -1; } - + p = asn1; *p++ = 0x30; /* sequence */ p++; - + *p++ = 0x30; /* another sequence */ p++; @@ -186,12 +186,12 @@ mkasn1(uchar *asn1, DigestAlg *alg, uchar *d, uint dlen) *p++ = olen; memmove(p, obj, olen); p += olen; - + *p++ = 0x05; /* null */ *p++ = 0; - + asn1[3] = p - (asn1+4); /* end of inner sequence */ - + *p++ = 0x04; /* octet string */ *p++ = dlen; memmove(p, d, dlen); @@ -200,4 +200,3 @@ mkasn1(uchar *asn1, DigestAlg *alg, uchar *d, uint dlen) asn1[1] = p - (asn1+2); /* end of outer sequence */ return p-asn1; } - diff --git a/src/cmd/auth/factotum/rpc.c b/src/cmd/auth/factotum/rpc.c index ad894330..26d5fd4b 100644 --- a/src/cmd/auth/factotum/rpc.c +++ b/src/cmd/auth/factotum/rpc.c @@ -32,7 +32,7 @@ * done [haveai] - authentication is done [haveai: you can get an ai with authinfo] */ -char *rpcname[] = +char *rpcname[] = { "unknown", "authinfo", @@ -196,7 +196,7 @@ rpcexec(Conv *c) rpcrespond(c, "error conversation not successful"); else{ /* make up an auth info using the attr */ - p = convAI2M((uchar*)c->reply+3, sizeof c->reply-3, + p = convAI2M((uchar*)c->reply+3, sizeof c->reply-3, strfindattr(c->attr, "cuid"), strfindattr(c->attr, "suid"), strfindattr(c->attr, "cap"), @@ -341,4 +341,3 @@ convAI2M(uchar *p, int n, char *cuid, char *suid, char *cap, char *hex) werrstr("authinfo too big"); return p; } - diff --git a/src/cmd/auth/factotum/rsa.c b/src/cmd/auth/factotum/rsa.c index 95545f93..e59feaab 100644 --- a/src/cmd/auth/factotum/rsa.c +++ b/src/cmd/auth/factotum/rsa.c @@ -3,7 +3,7 @@ /* * RSA authentication. - * + * * Encrypt/Decrypt: * start n=xxx ek=xxx * write msg @@ -13,7 +13,7 @@ * start n=xxx ek=xxx * write hash(msg) * read signature(hash(msg)) - * + * * Verify: * start n=xxx ek=xxx * write hash(msg) @@ -44,14 +44,14 @@ xrsadecrypt(Conv *c) if(k == nil) goto out; key = k->priv; - + /* make sure have private half if needed */ role = strfindattr(c->attr, "role"); if(strcmp(role, "decrypt") == 0 && !key->c2){ werrstr("missing private half of key -- cannot decrypt"); goto out; } - + /* read text */ c->state = "read"; if((n=convreadm(c, &txt)) < 0) @@ -60,7 +60,7 @@ xrsadecrypt(Conv *c) convprint(c, "data too short"); goto out; } - + /* encrypt/decrypt */ m = betomp((uchar*)txt, n, nil); if(m == nil) @@ -72,7 +72,7 @@ xrsadecrypt(Conv *c) if(mm == nil) goto out; n = mptobe(mm, (uchar*)buf, sizeof buf, nil); - + /* send response */ c->state = "write"; convwrite(c, buf, n); @@ -98,7 +98,7 @@ xrsasign(Conv *c) char *sig2; ret = -1; - + /* fetch key */ c->state = "keylookup"; k = keylookup("%A", c->attr); @@ -112,7 +112,7 @@ xrsasign(Conv *c) werrstr("missing private half of key -- cannot sign"); goto out; } - + /* get hash type from key */ hash = strfindattr(k->attr, "hash"); if(hash == nil) @@ -144,7 +144,7 @@ xrsasign(Conv *c) /* read signature */ if((n = convreadm(c, &sig2)) < 0) goto out; - + /* verify */ if(rsaverify(&key->pub, hashfn, digest, dlen, (uchar*)sig2, n) == 0) convprint(c, "ok"); @@ -160,7 +160,7 @@ out: } /* - * convert to canonical form (lower case) + * convert to canonical form (lower case) * for use in attribute matches. */ static void @@ -180,22 +180,22 @@ readrsapriv(Key *k) priv = rsaprivalloc(); - if((a=strfindattr(k->attr, "ek"))==nil + if((a=strfindattr(k->attr, "ek"))==nil || (priv->pub.ek=strtomp(a, nil, 16, nil))==nil) goto Error; strlwr(a); - if((a=strfindattr(k->attr, "n"))==nil + if((a=strfindattr(k->attr, "n"))==nil || (priv->pub.n=strtomp(a, nil, 16, nil))==nil) goto Error; strlwr(a); if(k->privattr == nil) /* only public half */ return priv; - if((a=strfindattr(k->privattr, "!p"))==nil + if((a=strfindattr(k->privattr, "!p"))==nil || (priv->p=strtomp(a, nil, 16, nil))==nil) goto Error; strlwr(a); - if((a=strfindattr(k->privattr, "!q"))==nil + if((a=strfindattr(k->privattr, "!q"))==nil || (priv->q=strtomp(a, nil, 16, nil))==nil) goto Error; strlwr(a); @@ -203,19 +203,19 @@ readrsapriv(Key *k) werrstr("rsa: p or q not prime"); goto Error; } - if((a=strfindattr(k->privattr, "!kp"))==nil + if((a=strfindattr(k->privattr, "!kp"))==nil || (priv->kp=strtomp(a, nil, 16, nil))==nil) goto Error; strlwr(a); - if((a=strfindattr(k->privattr, "!kq"))==nil + if((a=strfindattr(k->privattr, "!kq"))==nil || (priv->kq=strtomp(a, nil, 16, nil))==nil) goto Error; strlwr(a); - if((a=strfindattr(k->privattr, "!c2"))==nil + if((a=strfindattr(k->privattr, "!c2"))==nil || (priv->c2=strtomp(a, nil, 16, nil))==nil) goto Error; strlwr(a); - if((a=strfindattr(k->privattr, "!dk"))==nil + if((a=strfindattr(k->privattr, "!dk"))==nil || (priv->dk=strtomp(a, nil, 16, nil))==nil) goto Error; strlwr(a); @@ -230,7 +230,7 @@ static int rsacheck(Key *k) { static int first = 1; - + if(first){ fmtinstall('B', mpfmt); first = 0; @@ -251,7 +251,7 @@ rsaclose(Key *k) } static Role -rsaroles[] = +rsaroles[] = { "sign", xrsasign, "verify", xrsasign, /* public operation */ diff --git a/src/cmd/auth/factotum/secstore.c b/src/cmd/auth/factotum/secstore.c index c17c3cf2..9928d361 100644 --- a/src/cmd/auth/factotum/secstore.c +++ b/src/cmd/auth/factotum/secstore.c @@ -659,4 +659,3 @@ Out: free(sta); return rv; } - diff --git a/src/cmd/auth/factotum/std.h b/src/cmd/auth/factotum/std.h index 814664e0..52c55b7c 100644 --- a/src/cmd/auth/factotum/std.h +++ b/src/cmd/auth/factotum/std.h @@ -7,4 +7,3 @@ #include #include #include <9p.h> - diff --git a/src/cmd/auth/factotum/util.c b/src/cmd/auth/factotum/util.c index accddddd..dce37dca 100644 --- a/src/cmd/auth/factotum/util.c +++ b/src/cmd/auth/factotum/util.c @@ -50,5 +50,3 @@ estrappend(char *s, char *fmt, ...) free(t); return s; } - - diff --git a/src/cmd/auth/factotum/wep.c b/src/cmd/auth/factotum/wep.c index 1d516db2..701018e7 100644 --- a/src/cmd/auth/factotum/wep.c +++ b/src/cmd/auth/factotum/wep.c @@ -11,11 +11,11 @@ wepclient(Conv *c) char *dev, buf[128], *p, *kp; Key *k; int ret, fd, cfd; - + fd = cfd = -1; ret = -1; dev = nil; - + if((k = keylookup("%A !key1?", c->attr)) == nil && (k = keylookup("%A !key2?", c->attr)) == nil && (k = keylookup("%A !key3?", c->attr)) == nil){ @@ -73,7 +73,7 @@ static Role weproles[] = { 0 }; -Proto wep = +Proto wep = { "wep", weproles, diff --git a/src/cmd/auth/factotum/xio.c b/src/cmd/auth/factotum/xio.c index 2e6b141b..116fccaf 100644 --- a/src/cmd/auth/factotum/xio.c +++ b/src/cmd/auth/factotum/xio.c @@ -9,7 +9,7 @@ xioproc(void) { Ioproc *c; int i; - + for(i=0; i