cmd: remove a bit of unused stuff
This commit is contained in:
parent
c0d0f86b14
commit
0930f44feb
38 changed files with 8 additions and 732 deletions
|
@ -28,7 +28,6 @@ void rwrite(void);
|
||||||
void rwstat(void);
|
void rwstat(void);
|
||||||
|
|
||||||
static int openflags(int);
|
static int openflags(int);
|
||||||
static void rmservice(void);
|
|
||||||
static void usage(void);
|
static void usage(void);
|
||||||
|
|
||||||
#define Reqsize (sizeof(Fcall)+Maxfdata)
|
#define Reqsize (sizeof(Fcall)+Maxfdata)
|
||||||
|
|
|
@ -46,27 +46,6 @@ gcarray(uchar *p, uchar *ep, uchar **s, int *np)
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uchar*
|
|
||||||
convM2AI(uchar *p, int n, AuthInfo **aip)
|
|
||||||
{
|
|
||||||
uchar *e = p+n;
|
|
||||||
AuthInfo *ai;
|
|
||||||
|
|
||||||
ai = mallocz(sizeof(*ai), 1);
|
|
||||||
if(ai == nil)
|
|
||||||
return nil;
|
|
||||||
|
|
||||||
p = gstring(p, e, &ai->cuid);
|
|
||||||
p = gstring(p, e, &ai->suid);
|
|
||||||
p = gstring(p, e, &ai->cap);
|
|
||||||
p = gcarray(p, e, &ai->secret, &ai->nsecret);
|
|
||||||
if(p == nil)
|
|
||||||
auth_freeAI(ai);
|
|
||||||
else
|
|
||||||
*aip = ai;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
dorpc(AuthRpc *rpc, char *verb, char *val, int len, AuthGetkey *getkey)
|
dorpc(AuthRpc *rpc, char *verb, char *val, int len, AuthGetkey *getkey)
|
||||||
{
|
{
|
||||||
|
|
|
@ -182,18 +182,6 @@ mntnull(int n, Rpccall *cmd, Rpccall *reply)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char*
|
|
||||||
Str2str(String s, char *buf, int nbuf)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
i = s.n;
|
|
||||||
if(i >= nbuf)
|
|
||||||
i = nbuf-1;
|
|
||||||
memmove(buf, s.s, i);
|
|
||||||
buf[i] = 0;
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mntmnt(int n, Rpccall *cmd, Rpccall *reply)
|
mntmnt(int n, Rpccall *cmd, Rpccall *reply)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
static int alarmflag;
|
static int alarmflag;
|
||||||
|
|
||||||
static int Iconv(Fmt*);
|
static int Iconv(Fmt*);
|
||||||
static void openudp(int);
|
|
||||||
static void cachereply(Rpccall*, void*, int);
|
static void cachereply(Rpccall*, void*, int);
|
||||||
static int replycache(int, Rpccall*, long (*)(int, void*, long));
|
static int replycache(int, Rpccall*, long (*)(int, void*, long));
|
||||||
static void udpserver(int, Progmap*);
|
static void udpserver(int, Progmap*);
|
||||||
|
@ -443,12 +442,6 @@ domlookupl(void *name, int len)
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Namecache*
|
|
||||||
domlookup(void *name)
|
|
||||||
{
|
|
||||||
return domlookupl(name, strlen(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
static Namecache*
|
static Namecache*
|
||||||
iplookup(ulong ip)
|
iplookup(ulong ip)
|
||||||
{
|
{
|
||||||
|
|
|
@ -548,19 +548,6 @@ static Rune left1[] = { L'{', L'[', L'(', L'<', L'«', 0 };
|
||||||
static Rune right1[] = { L'}', L']', L')', L'>', L'»', 0 };
|
static Rune right1[] = { L'}', L']', L')', L'>', L'»', 0 };
|
||||||
static Rune left2[] = { L'\'', L'"', L'`', 0 };
|
static Rune left2[] = { L'\'', L'"', L'`', 0 };
|
||||||
|
|
||||||
static
|
|
||||||
Rune *left[] = {
|
|
||||||
left1,
|
|
||||||
left2,
|
|
||||||
nil
|
|
||||||
};
|
|
||||||
static
|
|
||||||
Rune *right[] = {
|
|
||||||
right1,
|
|
||||||
left2,
|
|
||||||
nil
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
void
|
||||||
pagedoubleclick(Page *p)
|
pagedoubleclick(Page *p)
|
||||||
{
|
{
|
||||||
|
|
|
@ -199,14 +199,12 @@ pagescroll(Page *p, int but, int horizontal)
|
||||||
{
|
{
|
||||||
uint oldp0, p0;
|
uint oldp0, p0;
|
||||||
Rectangle s;
|
Rectangle s;
|
||||||
Point mxy;
|
int m, om, first, d, size;
|
||||||
int i, m, om, first, d, size;
|
|
||||||
int smin, smax, ss, *pos;
|
int smin, smax, ss, *pos;
|
||||||
|
|
||||||
if(horizontal){
|
if(horizontal){
|
||||||
s = insetrect(p->hscrollr, 1);
|
s = insetrect(p->hscrollr, 1);
|
||||||
ss = s.max.x - s.min.x;
|
ss = s.max.x - s.min.x;
|
||||||
i = (s.min.y+s.max.y)/2;
|
|
||||||
d = Dx(p->r);
|
d = Dx(p->r);
|
||||||
size = Dx(p->lay->r);
|
size = Dx(p->lay->r);
|
||||||
p0 = p->pos.x;
|
p0 = p->pos.x;
|
||||||
|
@ -217,7 +215,6 @@ pagescroll(Page *p, int but, int horizontal)
|
||||||
}else{
|
}else{
|
||||||
s = insetrect(p->vscrollr, 1);
|
s = insetrect(p->vscrollr, 1);
|
||||||
ss = s.max.y-s.min.y;
|
ss = s.max.y-s.min.y;
|
||||||
i = (s.min.x+s.max.x)/2;
|
|
||||||
d = Dy(p->r);
|
d = Dy(p->r);
|
||||||
size = Dy(p->lay->r);
|
size = Dy(p->lay->r);
|
||||||
p0 = p->pos.y;
|
p0 = p->pos.y;
|
||||||
|
@ -248,10 +245,6 @@ pagescroll(Page *p, int but, int horizontal)
|
||||||
m = smax;
|
m = smax;
|
||||||
|
|
||||||
om = m;
|
om = m;
|
||||||
if(horizontal)
|
|
||||||
mxy = Pt(m, i);
|
|
||||||
else
|
|
||||||
mxy = Pt(i, m);
|
|
||||||
if(but == 2){
|
if(but == 2){
|
||||||
p0 = muldiv(m-smin, size, ss);
|
p0 = muldiv(m-smin, size, ss);
|
||||||
p0 = max(p0, 0);
|
p0 = max(p0, 0);
|
||||||
|
|
|
@ -58,7 +58,6 @@ threadmain(int argc, char *argv[])
|
||||||
Column *c;
|
Column *c;
|
||||||
int ncol;
|
int ncol;
|
||||||
Display *d;
|
Display *d;
|
||||||
static void *arg[1];
|
|
||||||
|
|
||||||
rfork(RFENVG|RFNAMEG);
|
rfork(RFENVG|RFNAMEG);
|
||||||
|
|
||||||
|
|
|
@ -1196,7 +1196,6 @@ runproc(void *argvp)
|
||||||
int ac, w, inarg, i, n, fd, nincl, winid;
|
int ac, w, inarg, i, n, fd, nincl, winid;
|
||||||
int pipechar;
|
int pipechar;
|
||||||
char buf[512];
|
char buf[512];
|
||||||
static void *parg[2];
|
|
||||||
void **argv;
|
void **argv;
|
||||||
|
|
||||||
argv = argvp;
|
argv = argvp;
|
||||||
|
|
|
@ -1511,25 +1511,6 @@ special(char *s, Dev *d, Req *r)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *regtab[] = {
|
|
||||||
"Ftype",
|
|
||||||
"Fflags",
|
|
||||||
"Fcmd",
|
|
||||||
"Ffeat",
|
|
||||||
"Flba0",
|
|
||||||
"Flba8",
|
|
||||||
"Flba16",
|
|
||||||
"Fdev",
|
|
||||||
"Flba24",
|
|
||||||
"Flba32",
|
|
||||||
"Flba40",
|
|
||||||
"Ffeat8",
|
|
||||||
"Fsc",
|
|
||||||
"Fsc8",
|
|
||||||
"Fr",
|
|
||||||
"Fcontrol",
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
void
|
||||||
setreg(Req *r, uint reg, uvlong v)
|
setreg(Req *r, uint reg, uvlong v)
|
||||||
{
|
{
|
||||||
|
@ -1540,7 +1521,6 @@ setreg(Req *r, uint reg, uvlong v)
|
||||||
case 0:
|
case 0:
|
||||||
r->fisbits |= 1 << reg;
|
r->fisbits |= 1 << reg;
|
||||||
r->cmd.fis[reg] = v;
|
r->cmd.fis[reg] = v;
|
||||||
// print("%s: %.2ux\n", regtab[reg], (uchar)v);
|
|
||||||
break;
|
break;
|
||||||
case Sbase:
|
case Sbase:
|
||||||
case Sbase | Pbase:
|
case Sbase | Pbase:
|
||||||
|
|
|
@ -662,19 +662,6 @@ vlong2be(uchar *t, vlong from)
|
||||||
|
|
||||||
static long order = 0x00010203;
|
static long order = 0x00010203;
|
||||||
|
|
||||||
static uchar*
|
|
||||||
be2long(long *to, uchar *f)
|
|
||||||
{
|
|
||||||
uchar *t, *o;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
t = (uchar*)to;
|
|
||||||
o = (uchar*)ℴ
|
|
||||||
for(i = 0; i < sizeof(long); i++)
|
|
||||||
t[o[i]] = f[i];
|
|
||||||
return f+sizeof(long);
|
|
||||||
}
|
|
||||||
|
|
||||||
static uchar*
|
static uchar*
|
||||||
long2be(uchar *t, long from)
|
long2be(uchar *t, long from)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,6 @@ static void checktoc(Drive*);
|
||||||
int vflag;
|
int vflag;
|
||||||
|
|
||||||
static Drive *drive;
|
static Drive *drive;
|
||||||
static int nchange;
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
Qdir = 0,
|
Qdir = 0,
|
||||||
|
|
|
@ -73,15 +73,6 @@ bige(void *p)
|
||||||
return (a[0]<<24)|(a[1]<<16)|(a[2]<<8)|(a[3]<<0);
|
return (a[0]<<24)|(a[1]<<16)|(a[2]<<8)|(a[3]<<0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ushort
|
|
||||||
biges(void *p)
|
|
||||||
{
|
|
||||||
uchar *a;
|
|
||||||
|
|
||||||
a = p;
|
|
||||||
return (a[0]<<8) | a[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
ulong
|
ulong
|
||||||
getnwa(Drive *drive)
|
getnwa(Drive *drive)
|
||||||
{
|
{
|
||||||
|
@ -91,22 +82,6 @@ getnwa(Drive *drive)
|
||||||
return aux->mmcnwa;
|
return aux->mmcnwa;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
hexdump(void *v, int n)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
uchar *p;
|
|
||||||
|
|
||||||
p = v;
|
|
||||||
for(i=0; i<n; i++){
|
|
||||||
print("%.2ux ", p[i]);
|
|
||||||
if((i%8) == 7)
|
|
||||||
print("\n");
|
|
||||||
}
|
|
||||||
if(i%8)
|
|
||||||
print("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
initcdb(uchar *cdb, int len, int cmd)
|
initcdb(uchar *cdb, int len, int cmd)
|
||||||
{
|
{
|
||||||
|
@ -220,18 +195,8 @@ mmcsetpage10(Drive *drive, int page, void *v)
|
||||||
cmd[1] = 0x10; /* format not vendor-specific */
|
cmd[1] = 0x10; /* format not vendor-specific */
|
||||||
cmd[8] = len;
|
cmd[8] = len;
|
||||||
|
|
||||||
// print("set: sending cmd\n");
|
|
||||||
// hexdump(cmd, 10);
|
|
||||||
// print("parameter list header\n");
|
|
||||||
// hexdump(p, Mode10parmhdrlen);
|
|
||||||
// print("page\n");
|
|
||||||
// hexdump(p + Mode10parmhdrlen, len - Mode10parmhdrlen);
|
|
||||||
|
|
||||||
n = scsi(drive, cmd, sizeof(cmd), p, len, Swrite);
|
n = scsi(drive, cmd, sizeof(cmd), p, len, Swrite);
|
||||||
|
|
||||||
// print("set: got cmd\n");
|
|
||||||
// hexdump(cmd, 10);
|
|
||||||
|
|
||||||
free(p);
|
free(p);
|
||||||
if(n < len)
|
if(n < len)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -414,9 +379,6 @@ mmcprobe(Scsi *scsi)
|
||||||
if(buf[Capmisc] & Capcdda) /* CD-DA commands supported? */
|
if(buf[Capmisc] & Capcdda) /* CD-DA commands supported? */
|
||||||
cap |= Ccdda; /* not used anywhere else */
|
cap |= Ccdda; /* not used anywhere else */
|
||||||
|
|
||||||
// print("read %d max %d\n", biges(buf+14), biges(buf+8));
|
|
||||||
// print("write %d max %d\n", biges(buf+20), biges(buf+18));
|
|
||||||
|
|
||||||
/* cache optional page 05 (write parameter page) */
|
/* cache optional page 05 (write parameter page) */
|
||||||
if(/* (cap & Cwrite) && */
|
if(/* (cap & Cwrite) && */
|
||||||
mmcgetpage(drive, Pagwrparams, aux->page05) >= 0) {
|
mmcgetpage(drive, Pagwrparams, aux->page05) >= 0) {
|
||||||
|
@ -1256,9 +1218,6 @@ format(Drive *drive)
|
||||||
PUTBELONG(fmtdesc, nblks);
|
PUTBELONG(fmtdesc, nblks);
|
||||||
PUTBE24(fmtdesc + 5, blksize);
|
PUTBE24(fmtdesc + 5, blksize);
|
||||||
|
|
||||||
// print("format parameters:\n");
|
|
||||||
// hexdump(parms, sizeof parms);
|
|
||||||
|
|
||||||
if(vflag)
|
if(vflag)
|
||||||
print("%lld ns: format\n", nsec());
|
print("%lld ns: format\n", nsec());
|
||||||
return scsi(drive, cmd, sizeof(cmd), parms, sizeof parms, Swrite);
|
return scsi(drive, cmd, sizeof(cmd), parms, sizeof parms, Swrite);
|
||||||
|
|
|
@ -1,455 +0,0 @@
|
||||||
/*
|
|
||||||
* Beware the LM hash is easy to crack (google for l0phtCrack)
|
|
||||||
* and though NTLM is more secure it is still breakable.
|
|
||||||
* Ntlmv2 is better and seen as good enough by the Windows community.
|
|
||||||
* For real security use Kerberos.
|
|
||||||
*/
|
|
||||||
#include <u.h>
|
|
||||||
#include <libc.h>
|
|
||||||
#include <mp.h>
|
|
||||||
#include <auth.h>
|
|
||||||
#include <libsec.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <fcall.h>
|
|
||||||
#include <thread.h>
|
|
||||||
#include <9p.h>
|
|
||||||
#include "cifs.h"
|
|
||||||
|
|
||||||
#define NTLMV2_TEST 1
|
|
||||||
#define DEF_AUTH "ntlmv2"
|
|
||||||
|
|
||||||
static enum {
|
|
||||||
MACkeylen = 40, /* MAC key len */
|
|
||||||
MAClen = 8, /* signature length */
|
|
||||||
MACoff = 14, /* sign. offset from start of SMB (not netbios) pkt */
|
|
||||||
Bliplen = 8, /* size of LMv2 client nonce */
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
dmp(char *s, int seq, void *buf, int n)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
char *p = buf;
|
|
||||||
|
|
||||||
print("%s %3d ", s, seq);
|
|
||||||
while(n > 0){
|
|
||||||
for(i = 0; i < 16 && n > 0; i++, n--)
|
|
||||||
print("%02x ", *p++ & 0xff);
|
|
||||||
if(n > 0)
|
|
||||||
print("\n");
|
|
||||||
}
|
|
||||||
print("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static Auth *
|
|
||||||
auth_plain(char *windom, char *keyp, uchar *chal, int len)
|
|
||||||
{
|
|
||||||
UserPasswd *up;
|
|
||||||
static Auth *ap;
|
|
||||||
|
|
||||||
USED(chal, len);
|
|
||||||
|
|
||||||
up = auth_getuserpasswd(auth_getkey, "windom=%s proto=pass service=cifs %s",
|
|
||||||
windom, keyp);
|
|
||||||
if(! up)
|
|
||||||
sysfatal("cannot get key - %r");
|
|
||||||
|
|
||||||
ap = emalloc9p(sizeof(Auth));
|
|
||||||
memset(ap, 0, sizeof(ap));
|
|
||||||
ap->user = estrdup9p(up->user);
|
|
||||||
ap->windom = estrdup9p(windom);
|
|
||||||
|
|
||||||
ap->resp[0] = estrdup9p(up->passwd);
|
|
||||||
ap->len[0] = strlen(up->passwd);
|
|
||||||
memset(up->passwd, 0, strlen(up->passwd));
|
|
||||||
free(up);
|
|
||||||
|
|
||||||
return ap;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Auth *
|
|
||||||
auth_lm_and_ntlm(char *windom, char *keyp, uchar *chal, int len)
|
|
||||||
{
|
|
||||||
int err;
|
|
||||||
Auth *ap;
|
|
||||||
char user[64];
|
|
||||||
MSchapreply mcr;
|
|
||||||
|
|
||||||
err = auth_respond(chal, len, user, sizeof user, &mcr, sizeof mcr,
|
|
||||||
auth_getkey, "windom=%s proto=mschap role=client service=cifs %s",
|
|
||||||
windom, keyp);
|
|
||||||
if(err == -1)
|
|
||||||
sysfatal("cannot get key - %r");
|
|
||||||
|
|
||||||
ap = emalloc9p(sizeof(Auth));
|
|
||||||
memset(ap, 0, sizeof(ap));
|
|
||||||
ap->user = estrdup9p(user);
|
|
||||||
ap->windom = estrdup9p(windom);
|
|
||||||
|
|
||||||
/* LM response */
|
|
||||||
ap->len[0] = sizeof(mcr.LMresp);
|
|
||||||
ap->resp[0] = emalloc9p(ap->len[0]);
|
|
||||||
memcpy(ap->resp[0], mcr.LMresp, ap->len[0]);
|
|
||||||
|
|
||||||
/* NTLM response */
|
|
||||||
ap->len[1] = sizeof(mcr.NTresp);
|
|
||||||
ap->resp[1] = emalloc9p(ap->len[1]);
|
|
||||||
memcpy(ap->resp[1], mcr.NTresp, ap->len[1]);
|
|
||||||
|
|
||||||
return ap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NTLM response only, the LM response is a just
|
|
||||||
* copy of the NTLM one. We do this because the lm
|
|
||||||
* response is easily reversed - Google for l0pht for more info.
|
|
||||||
*/
|
|
||||||
static Auth *
|
|
||||||
auth_ntlm(char *windom, char *keyp, uchar *chal, int len)
|
|
||||||
{
|
|
||||||
Auth *ap;
|
|
||||||
|
|
||||||
if((ap = auth_lm_and_ntlm(windom, keyp, chal, len)) == nil)
|
|
||||||
return nil;
|
|
||||||
|
|
||||||
free(ap->resp[0]);
|
|
||||||
ap->len[0] = ap->len[1];
|
|
||||||
ap->resp[0] = emalloc9p(ap->len[0]);
|
|
||||||
memcpy(ap->resp[0], ap->resp[1], ap->len[0]);
|
|
||||||
return ap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This is not really nescessary as all fields hmac_md5'ed
|
|
||||||
* in the ntlmv2 protocol are less than 64 bytes long, however
|
|
||||||
* I still do this for completeness.
|
|
||||||
*/
|
|
||||||
static DigestState *
|
|
||||||
hmac_t64(uchar *data, ulong dlen, uchar *key, ulong klen, uchar *digest,
|
|
||||||
DigestState *state)
|
|
||||||
{
|
|
||||||
if(klen > 64)
|
|
||||||
klen = 64;
|
|
||||||
return hmac_md5(data, dlen, key, klen, digest, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
|
||||||
ntv2_blob(uchar *blob, int len, char *windom)
|
|
||||||
{
|
|
||||||
uvlong t;
|
|
||||||
uchar *p;
|
|
||||||
enum { /* name types */
|
|
||||||
Beof, /* end of name list */
|
|
||||||
Bhost, /* Netbios host name */
|
|
||||||
Bdomain, /* Windows Domain name (NT) */
|
|
||||||
Bdnshost, /* DNS host name */
|
|
||||||
Bdnsdomain, /* DNS domain name */
|
|
||||||
};
|
|
||||||
|
|
||||||
p = blob;
|
|
||||||
*p++ = 1; /* 8bit: response type */
|
|
||||||
*p++ = 1; /* 8bit: max response type understood by client */
|
|
||||||
|
|
||||||
*p++ = 0; /* 16bit: reserved */
|
|
||||||
*p++ = 0;
|
|
||||||
|
|
||||||
*p++ = 0; /* 32bit: unknown */
|
|
||||||
*p++ = 0;
|
|
||||||
*p++ = 0;
|
|
||||||
*p++ = 0;
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef NTLMV2_TEST
|
|
||||||
*p++ = 0xf0;
|
|
||||||
*p++ = 0x20;
|
|
||||||
*p++ = 0xd0;
|
|
||||||
*p++ = 0xb6;
|
|
||||||
*p++ = 0xc2;
|
|
||||||
*p++ = 0x92;
|
|
||||||
*p++ = 0xbe;
|
|
||||||
*p++ = 0x01;
|
|
||||||
#else
|
|
||||||
t = time(nil); /* 64bit: time in NT format */
|
|
||||||
t += 11644473600LL;
|
|
||||||
t *= 10000000LL;
|
|
||||||
*p++ = t;
|
|
||||||
*p++ = t >> 8;
|
|
||||||
*p++ = t >> 16;
|
|
||||||
*p++ = t >> 24;
|
|
||||||
*p++ = t >> 32;
|
|
||||||
*p++ = t >> 40;
|
|
||||||
*p++ = t >> 48;
|
|
||||||
*p++ = t >> 56;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef NTLMV2_TEST
|
|
||||||
*p++ = 0x05;
|
|
||||||
*p++ = 0x83;
|
|
||||||
*p++ = 0x32;
|
|
||||||
*p++ = 0xec;
|
|
||||||
*p++ = 0xfa;
|
|
||||||
*p++ = 0xe4;
|
|
||||||
*p++ = 0xf3;
|
|
||||||
*p++ = 0x6d;
|
|
||||||
#else
|
|
||||||
genrandom(p, 8);
|
|
||||||
p += 8; /* 64bit: client nonce */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
*p++ = 0; /* 32bit: unknown data */
|
|
||||||
*p++ = 0;
|
|
||||||
*p++ = 0;
|
|
||||||
*p++ = 0;
|
|
||||||
|
|
||||||
p += putname(p, len - (p-blob), windom, Bdomain);
|
|
||||||
p += putname(p, len - (p-blob), "", Beof);
|
|
||||||
|
|
||||||
return p - blob;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Auth *
|
|
||||||
auth_ntlmv2(char *windom, char *keyp, uchar *chal, int len)
|
|
||||||
{
|
|
||||||
int i, n;
|
|
||||||
Rune r;
|
|
||||||
char *p, *u;
|
|
||||||
uchar c, lm_hmac[MD5dlen], nt_hmac[MD5dlen], nt_sesskey[MD5dlen];
|
|
||||||
uchar lm_sesskey[MD5dlen];
|
|
||||||
uchar v1hash[MD5dlen], blip[Bliplen], blob[1024], v2hash[MD5dlen];
|
|
||||||
DigestState *ds;
|
|
||||||
UserPasswd *up;
|
|
||||||
static Auth *ap;
|
|
||||||
|
|
||||||
up = auth_getuserpasswd(auth_getkey, "windom=%s proto=pass service=cifs-ntlmv2 %s",
|
|
||||||
windom, keyp);
|
|
||||||
if(! up)
|
|
||||||
sysfatal("cannot get key - %r");
|
|
||||||
|
|
||||||
#ifdef NTLMV2_TEST
|
|
||||||
{
|
|
||||||
static uchar srvchal[] = { 0x52, 0xaa, 0xc8, 0xe8, 0x2c, 0x06, 0x7f, 0xa1 };
|
|
||||||
up->user = "ADMINISTRATOR";
|
|
||||||
windom = "rocknroll";
|
|
||||||
chal = srvchal;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ap = emalloc9p(sizeof(Auth));
|
|
||||||
memset(ap, 0, sizeof(ap));
|
|
||||||
|
|
||||||
/* Standard says unlimited length, experience says 128 max */
|
|
||||||
if((n = strlen(up->passwd)) > 128)
|
|
||||||
n = 128;
|
|
||||||
|
|
||||||
ds = md4(nil, 0, nil, nil);
|
|
||||||
for(i = 0, p = up->passwd; i < n; i++) {
|
|
||||||
p += chartorune(&r, p);
|
|
||||||
c = r;
|
|
||||||
md4(&c, 1, nil, ds);
|
|
||||||
c = r >> 8;
|
|
||||||
md4(&c, 1, nil, ds);
|
|
||||||
}
|
|
||||||
md4(nil, 0, v1hash, ds);
|
|
||||||
|
|
||||||
#ifdef NTLMV2_TEST
|
|
||||||
{
|
|
||||||
uchar v1[] = {
|
|
||||||
0x0c, 0xb6, 0x94, 0x88, 0x05, 0xf7, 0x97, 0xbf,
|
|
||||||
0x2a, 0x82, 0x80, 0x79, 0x73, 0xb8, 0x95, 0x37
|
|
||||||
;
|
|
||||||
memcpy(v1hash, v1, sizeof(v1));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
* Some documentation insists that the username must be forced to
|
|
||||||
* uppercase, but the domain name should not be. Other shows both
|
|
||||||
* being forced to uppercase. I am pretty sure this is irrevevant as
|
|
||||||
* the domain name passed from the remote server always seems to be in
|
|
||||||
* uppercase already.
|
|
||||||
*/
|
|
||||||
ds = hmac_t64(nil, 0, v1hash, MD5dlen, nil, nil);
|
|
||||||
u = up->user;
|
|
||||||
while(*u){
|
|
||||||
u += chartorune(&r, u);
|
|
||||||
r = toupperrune(r);
|
|
||||||
c = r & 0xff;
|
|
||||||
hmac_t64(&c, 1, v1hash, MD5dlen, nil, ds);
|
|
||||||
c = r >> 8;
|
|
||||||
hmac_t64(&c, 1, v1hash, MD5dlen, nil, ds);
|
|
||||||
}
|
|
||||||
u = windom;
|
|
||||||
|
|
||||||
while(*u){
|
|
||||||
u += chartorune(&r, u);
|
|
||||||
c = r;
|
|
||||||
hmac_t64(&c, 1, v1hash, MD5dlen, nil, ds);
|
|
||||||
c = r >> 8;
|
|
||||||
hmac_t64(&c, 1, v1hash, MD5dlen, nil, ds);
|
|
||||||
}
|
|
||||||
hmac_t64(nil, 0, v1hash, MD5dlen, v2hash, ds);
|
|
||||||
#ifdef NTLMV2_TEST
|
|
||||||
print("want: 40 e1 b3 24...\n");
|
|
||||||
dmp("v2hash==kr", 0, v2hash, MD5dlen);
|
|
||||||
#endif
|
|
||||||
ap->user = estrdup9p(up->user);
|
|
||||||
ap->windom = estrdup9p(windom);
|
|
||||||
|
|
||||||
/* LM v2 */
|
|
||||||
|
|
||||||
genrandom(blip, Bliplen);
|
|
||||||
#ifdef NTLMV2_TEST
|
|
||||||
{
|
|
||||||
uchar t[] = { 0x05, 0x83, 0x32, 0xec, 0xfa, 0xe4, 0xf3, 0x6d };
|
|
||||||
memcpy(blip, t, 8);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ds = hmac_t64(chal, len, v2hash, MD5dlen, nil, nil);
|
|
||||||
hmac_t64(blip, Bliplen, v2hash, MD5dlen, lm_hmac, ds);
|
|
||||||
ap->len[0] = MD5dlen+Bliplen;
|
|
||||||
ap->resp[0] = emalloc9p(ap->len[0]);
|
|
||||||
memcpy(ap->resp[0], lm_hmac, MD5dlen);
|
|
||||||
memcpy(ap->resp[0]+MD5dlen, blip, Bliplen);
|
|
||||||
#ifdef NTLMV2_TEST
|
|
||||||
print("want: 38 6b ae...\n");
|
|
||||||
dmp("lmv2 resp ", 0, lm_hmac, MD5dlen);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* LM v2 session key */
|
|
||||||
hmac_t64(lm_hmac, MD5dlen, v2hash, MD5dlen, lm_sesskey, nil);
|
|
||||||
|
|
||||||
/* LM v2 MAC key */
|
|
||||||
ap->mackey[0] = emalloc9p(MACkeylen);
|
|
||||||
memcpy(ap->mackey[0], lm_sesskey, MD5dlen);
|
|
||||||
memcpy(ap->mackey[0]+MD5dlen, ap->resp[0], MACkeylen-MD5dlen);
|
|
||||||
|
|
||||||
/* NTLM v2 */
|
|
||||||
n = ntv2_blob(blob, sizeof(blob), windom);
|
|
||||||
ds = hmac_t64(chal, len, v2hash, MD5dlen, nil, nil);
|
|
||||||
hmac_t64(blob, n, v2hash, MD5dlen, nt_hmac, ds);
|
|
||||||
ap->len[1] = MD5dlen+n;
|
|
||||||
ap->resp[1] = emalloc9p(ap->len[1]);
|
|
||||||
memcpy(ap->resp[1], nt_hmac, MD5dlen);
|
|
||||||
memcpy(ap->resp[1]+MD5dlen, blob, n);
|
|
||||||
#ifdef NTLMV2_TEST
|
|
||||||
print("want: 1a ad 55...\n");
|
|
||||||
dmp("ntv2 resp ", 0, nt_hmac, MD5dlen);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* NTLM v2 session key */
|
|
||||||
hmac_t64(nt_hmac, MD5dlen, v2hash, MD5dlen, nt_sesskey, nil);
|
|
||||||
|
|
||||||
/* NTLM v2 MAC key */
|
|
||||||
ap->mackey[1] = emalloc9p(MACkeylen);
|
|
||||||
memcpy(ap->mackey[1], nt_sesskey, MD5dlen);
|
|
||||||
memcpy(ap->mackey[1]+MD5dlen, ap->resp[1], MACkeylen-MD5dlen);
|
|
||||||
free(up);
|
|
||||||
|
|
||||||
return ap;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct {
|
|
||||||
char *name;
|
|
||||||
Auth *(*func)(char *, char *, uchar *, int);
|
|
||||||
} methods[] = {
|
|
||||||
{ "plain", auth_plain },
|
|
||||||
{ "lm+ntlm", auth_lm_and_ntlm },
|
|
||||||
{ "ntlm", auth_ntlm },
|
|
||||||
{ "ntlmv2", auth_ntlmv2 },
|
|
||||||
// { "kerberos", auth_kerberos },
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
|
||||||
autherr(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
fprint(2, "supported auth methods:\t");
|
|
||||||
for(i = 0; i < nelem(methods); i++)
|
|
||||||
fprint(2, "%s ", methods[i].name);
|
|
||||||
fprint(2, "\n");
|
|
||||||
exits("usage");
|
|
||||||
}
|
|
||||||
|
|
||||||
Auth *
|
|
||||||
getauth(char *name, char *windom, char *keyp, int secmode, uchar *chal, int len)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
Auth *ap;
|
|
||||||
|
|
||||||
if(name == nil){
|
|
||||||
name = DEF_AUTH;
|
|
||||||
if((secmode & SECMODE_PW_ENCRYPT) == 0)
|
|
||||||
sysfatal("plaintext authentication required, use '-a plain'");
|
|
||||||
}
|
|
||||||
|
|
||||||
ap = nil;
|
|
||||||
for(i = 0; i < nelem(methods); i++)
|
|
||||||
if(strcmp(methods[i].name, name) == 0){
|
|
||||||
ap = methods[i].func(windom, keyp, chal, len);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(! ap){
|
|
||||||
fprint(2, "%s: %s - unknown auth method\n", argv0, name);
|
|
||||||
autherr(); /* never returns */
|
|
||||||
}
|
|
||||||
return ap;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
genmac(uchar *buf, int len, int seq, uchar key[MACkeylen], uchar mine[MAClen])
|
|
||||||
{
|
|
||||||
DigestState *ds;
|
|
||||||
uchar *sig, digest[MD5dlen], their[MAClen];
|
|
||||||
|
|
||||||
sig = buf+MACoff;
|
|
||||||
memcpy(their, sig, MAClen);
|
|
||||||
memset(sig, 0, MAClen);
|
|
||||||
sig[0] = seq;
|
|
||||||
sig[1] = seq >> 8;
|
|
||||||
sig[2] = seq >> 16;
|
|
||||||
sig[3] = seq >> 24;
|
|
||||||
|
|
||||||
ds = md5(key, MACkeylen, nil, nil);
|
|
||||||
md5(buf, len, nil, ds);
|
|
||||||
md5(nil, 0, digest, ds);
|
|
||||||
memcpy(mine, digest, MAClen);
|
|
||||||
|
|
||||||
return memcmp(their, mine, MAClen);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
macsign(Pkt *p)
|
|
||||||
{
|
|
||||||
int i, len;
|
|
||||||
uchar *sig, *buf, mac[MAClen], zeros[MACkeylen];
|
|
||||||
|
|
||||||
sig = p->buf + NBHDRLEN + MACoff;
|
|
||||||
buf = p->buf + NBHDRLEN;
|
|
||||||
len = (p->pos - p->buf) - NBHDRLEN;
|
|
||||||
|
|
||||||
for(i = -3; i < 4; i++){
|
|
||||||
memset(zeros, 0, sizeof(zeros));
|
|
||||||
if(genmac(buf, len, p->seq+i, zeros, mac) == 0){
|
|
||||||
dmp("got", 0, buf, len);
|
|
||||||
dmp("Zero OK", p->seq, mac, MAClen);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(genmac(buf, len, p->seq+i, p->s->auth->mackey[0], mac) == 0){
|
|
||||||
dmp("got", 0, buf, len);
|
|
||||||
dmp("LM-hash OK", p->seq, mac, MAClen);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(genmac(buf, len, p->seq+i, p->s->auth->mackey[1], mac) == 0){
|
|
||||||
dmp("got", 0, buf, len);
|
|
||||||
dmp("NT-hash OK", p->seq, mac, MAClen);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
genmac(buf, len, p->seq, p->s->auth->mackey[0], mac);
|
|
||||||
|
|
||||||
memcpy(sig, mac, MAClen);
|
|
||||||
return -1;
|
|
||||||
}
|
|
|
@ -23,6 +23,7 @@ static enum {
|
||||||
MACoff = 14, /* sign. offset from start of SMB (not netbios) pkt */
|
MACoff = 14, /* sign. offset from start of SMB (not netbios) pkt */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef DEBUG_MAC
|
||||||
static void
|
static void
|
||||||
dmp(char *s, int seq, void *buf, int n)
|
dmp(char *s, int seq, void *buf, int n)
|
||||||
{
|
{
|
||||||
|
@ -38,6 +39,7 @@ dmp(char *s, int seq, void *buf, int n)
|
||||||
}
|
}
|
||||||
print("\n");
|
print("\n");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static Auth *
|
static Auth *
|
||||||
auth_plain(char *windom, char *keyp, uchar *chal, int len)
|
auth_plain(char *windom, char *keyp, uchar *chal, int len)
|
||||||
|
|
|
@ -125,20 +125,6 @@ pbytes(Pkt *p)
|
||||||
p->bytebase = pl16(p, 0); /* filled in by cifsrpc() */
|
p->bytebase = pl16(p, 0); /* filled in by cifsrpc() */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
dmp(int seq, uchar *buf)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if(seq == 99)
|
|
||||||
print("\n ");
|
|
||||||
else
|
|
||||||
print("%+2d ", seq);
|
|
||||||
for(i = 0; i < 8; i++)
|
|
||||||
print("%02x ", buf[i] & 0xff);
|
|
||||||
print("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
cifsrpc(Pkt *p)
|
cifsrpc(Pkt *p)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1145,7 +1145,6 @@ main(int argc, char **argv)
|
||||||
long svrtime;
|
long svrtime;
|
||||||
char windom[64], cname[64];
|
char windom[64], cname[64];
|
||||||
char *method, *sysname, *keyp, *mtpt, *svs;
|
char *method, *sysname, *keyp, *mtpt, *svs;
|
||||||
static char *sh[1024];
|
|
||||||
|
|
||||||
*cname = 0;
|
*cname = 0;
|
||||||
keyp = "";
|
keyp = "";
|
||||||
|
|
|
@ -68,19 +68,6 @@ Gmem(uchar **p, void *v, int n)
|
||||||
*str++ = *(*p)++;
|
*str++ = *(*p)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ulong
|
|
||||||
GB32(uchar **p)
|
|
||||||
{
|
|
||||||
ulong n;
|
|
||||||
|
|
||||||
n = *(*p)++ << 24;
|
|
||||||
n |= *(*p)++ << 16;
|
|
||||||
n |= *(*p)++ << 8;
|
|
||||||
n |= *(*p)++;
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ushort
|
static ushort
|
||||||
GB16(uchar **p)
|
GB16(uchar **p)
|
||||||
{
|
{
|
||||||
|
|
|
@ -103,13 +103,6 @@ gtparam(Pkt *p)
|
||||||
p->pos = p->tparam;
|
p->pos = p->tparam;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gtdata(Pkt *p)
|
|
||||||
{
|
|
||||||
p->pos = p->tdata;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
RAPshareenum(Session *s, Share *sp, Share **ent)
|
RAPshareenum(Session *s, Share *sp, Share **ent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -95,12 +95,6 @@ tntrpc(Pkt *p)
|
||||||
return got;
|
return got;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gtntparam(Pkt *p)
|
|
||||||
{
|
|
||||||
p->pos = p->tparam;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtntdata(Pkt *p)
|
gtntdata(Pkt *p)
|
||||||
{
|
{
|
||||||
|
|
|
@ -309,7 +309,6 @@ gettokens(Tokenrow *trp, int reset)
|
||||||
int runelen;
|
int runelen;
|
||||||
Source *s = cursource;
|
Source *s = cursource;
|
||||||
int nmac = 0;
|
int nmac = 0;
|
||||||
extern char outbuf[];
|
|
||||||
|
|
||||||
tp = trp->lp;
|
tp = trp->lp;
|
||||||
ip = s->inp;
|
ip = s->inp;
|
||||||
|
|
|
@ -10,15 +10,6 @@ static Xfs *xhead;
|
||||||
static Xfile *xfiles[FIDMOD], *freelist;
|
static Xfile *xfiles[FIDMOD], *freelist;
|
||||||
static MLock xlock, xlocks[FIDMOD], freelock;
|
static MLock xlock, xlocks[FIDMOD], freelock;
|
||||||
|
|
||||||
static int
|
|
||||||
okmode(int omode, int fmode)
|
|
||||||
{
|
|
||||||
if(omode == OREAD)
|
|
||||||
return fmode & 4;
|
|
||||||
/* else ORDWR */
|
|
||||||
return (fmode & 6) == 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
Xfs *
|
Xfs *
|
||||||
getxfs(char *user, char *name)
|
getxfs(char *user, char *name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,6 @@ void eqnbox(int p1, int p2, int lu)
|
||||||
{
|
{
|
||||||
double b, h;
|
double b, h;
|
||||||
char *sh;
|
char *sh;
|
||||||
extern char *IRspace;
|
|
||||||
|
|
||||||
yyval = p1;
|
yyval = p1;
|
||||||
b = max(ebase[p1], ebase[p2]);
|
b = max(ebase[p1], ebase[p2]);
|
||||||
|
|
|
@ -14,7 +14,6 @@ closest(int Y, int Cb, int Cr)
|
||||||
double r, g, b;
|
double r, g, b;
|
||||||
double diff, min;
|
double diff, min;
|
||||||
int rgb, R, G, B, v, i;
|
int rgb, R, G, B, v, i;
|
||||||
int y1, cb1, cr1;
|
|
||||||
|
|
||||||
Cb -= 128;
|
Cb -= 128;
|
||||||
Cr -= 128;
|
Cr -= 128;
|
||||||
|
|
|
@ -90,7 +90,7 @@ int get2 (void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void eatmarker (int kind) {
|
void eatmarker (int kind) {
|
||||||
int l, c;
|
int l;
|
||||||
l = get2();
|
l = get2();
|
||||||
printf ("%02x len=%d\n", kind, l);
|
printf ("%02x len=%d\n", kind, l);
|
||||||
for (l -= 2; l > 0; l--)
|
for (l -= 2; l > 0; l--)
|
||||||
|
@ -211,7 +211,7 @@ void get_dqt (int kind) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int get1dht (void) {
|
int get1dht (void) {
|
||||||
int l, tcth, p, i, j, v[16], vv[16][256];
|
int l, tcth, i, j, v[16], vv[16][256];
|
||||||
tcth = get1();
|
tcth = get1();
|
||||||
printf ("DHT:\tclass = %d, table = %d\n", tcth >> 4, tcth & 0xf);
|
printf ("DHT:\tclass = %d, table = %d\n", tcth >> 4, tcth & 0xf);
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
|
|
|
@ -41,7 +41,6 @@ static int colormapsize[] = { 2, 4, 16, 256, 256 }; /* 2 for zero is an odd pro
|
||||||
static void writeheader(Biobuf*, Rectangle, int, ulong, int);
|
static void writeheader(Biobuf*, Rectangle, int, ulong, int);
|
||||||
static void writedescriptor(Biobuf*, Rectangle);
|
static void writedescriptor(Biobuf*, Rectangle);
|
||||||
static char* writedata(Biobuf*, Image*, Memimage*);
|
static char* writedata(Biobuf*, Image*, Memimage*);
|
||||||
static void writetrailer(Biobuf *fd);
|
|
||||||
static void writecomment(Biobuf *fd, char*);
|
static void writecomment(Biobuf *fd, char*);
|
||||||
static void writegraphiccontrol(Biobuf *fd, int, int);
|
static void writegraphiccontrol(Biobuf *fd, int, int);
|
||||||
static void* gifmalloc(ulong);
|
static void* gifmalloc(ulong);
|
||||||
|
|
|
@ -162,17 +162,6 @@ static Fld flds[] = {
|
||||||
[Tcolor] {0x0140, Tshort}
|
[Tcolor] {0x0140, Tshort}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* imported from libdraw/arith.c to permit
|
|
||||||
* extern log2 function
|
|
||||||
*/
|
|
||||||
static int log2[] = {
|
|
||||||
-1, 0, 1, -1, 2, -1, -1, -1, 3,
|
|
||||||
-1, -1, -1, -1, -1, -1, -1, 4,
|
|
||||||
-1, -1, -1, -1, -1, -1, -1, 4 /* BUG */,
|
|
||||||
-1, -1, -1, -1, -1, -1, -1, 5
|
|
||||||
};
|
|
||||||
|
|
||||||
static Tab faxwhite[Nfaxtab] = {
|
static Tab faxwhite[Nfaxtab] = {
|
||||||
{8, 0x35, 0}, /* 0011 0101 */
|
{8, 0x35, 0}, /* 0011 0101 */
|
||||||
{6, 0x7, 1}, /* 0001 11 */
|
{6, 0x7, 1}, /* 0001 11 */
|
||||||
|
|
|
@ -985,19 +985,6 @@ isvalidip(uchar *ip)
|
||||||
return ipcmp(ip, IPnoaddr) != 0 && ipcmp(ip, v4prefix) != 0;
|
return ipcmp(ip, IPnoaddr) != 0 && ipcmp(ip, v4prefix) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uchar loopbacknet[IPaddrlen] = {
|
|
||||||
0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0,
|
|
||||||
0, 0, 0xff, 0xff,
|
|
||||||
127, 0, 0, 0
|
|
||||||
};
|
|
||||||
static uchar loopbackmask[IPaddrlen] = {
|
|
||||||
0xff, 0xff, 0xff, 0xff,
|
|
||||||
0xff, 0xff, 0xff, 0xff,
|
|
||||||
0xff, 0xff, 0xff, 0xff,
|
|
||||||
0xff, 0, 0, 0
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
void
|
||||||
readipinterfaces(void)
|
readipinterfaces(void)
|
||||||
{
|
{
|
||||||
|
@ -1114,7 +1101,6 @@ netinit(int background)
|
||||||
{
|
{
|
||||||
char clone[Maxpath];
|
char clone[Maxpath];
|
||||||
Network *np;
|
Network *np;
|
||||||
static int working;
|
|
||||||
|
|
||||||
if(background){
|
if(background){
|
||||||
switch(rfork(RFPROC|RFNOTEG|RFMEM|RFNOWAIT)){
|
switch(rfork(RFPROC|RFNOTEG|RFMEM|RFNOWAIT)){
|
||||||
|
@ -1310,7 +1296,6 @@ ipserv(Network *np, char *name, char *buf, int blen)
|
||||||
char *p;
|
char *p;
|
||||||
int alpha = 0;
|
int alpha = 0;
|
||||||
int restr = 0;
|
int restr = 0;
|
||||||
char port[10];
|
|
||||||
Ndbtuple *t, *nt;
|
Ndbtuple *t, *nt;
|
||||||
Ndbs s;
|
Ndbs s;
|
||||||
|
|
||||||
|
@ -1321,7 +1306,6 @@ ipserv(Network *np, char *name, char *buf, int blen)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* see if it's numeric or symbolic */
|
/* see if it's numeric or symbolic */
|
||||||
port[0] = 0;
|
|
||||||
for(p = name; *p; p++){
|
for(p = name; *p; p++){
|
||||||
if(isdigit(*p))
|
if(isdigit(*p))
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -561,16 +561,6 @@ look(Ndbtuple *entry, Ndbtuple *line, char *attr)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static RR**
|
|
||||||
linkrr(RR *rp, DN *dp, RR **l)
|
|
||||||
{
|
|
||||||
rp->owner = dp;
|
|
||||||
rp->auth = 1;
|
|
||||||
rp->db = 1;
|
|
||||||
*l = rp;
|
|
||||||
return &rp->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* these are answered specially by the tcp version */
|
/* these are answered specially by the tcp version */
|
||||||
static RR*
|
static RR*
|
||||||
doaxfr(Ndb *db, char *name)
|
doaxfr(Ndb *db, char *name)
|
||||||
|
|
|
@ -672,8 +672,6 @@ getactivity(Request *req, int recursive)
|
||||||
void
|
void
|
||||||
putactivity(int recursive)
|
putactivity(int recursive)
|
||||||
{
|
{
|
||||||
static ulong lastclean;
|
|
||||||
|
|
||||||
if(traceactivity)
|
if(traceactivity)
|
||||||
dnslog("put: %d active by pid %d",
|
dnslog("put: %d active by pid %d",
|
||||||
dnvars.active, getpid());
|
dnvars.active, getpid());
|
||||||
|
@ -706,7 +704,6 @@ putactivity(int recursive)
|
||||||
dnageall(0);
|
dnageall(0);
|
||||||
|
|
||||||
/* let others back in */
|
/* let others back in */
|
||||||
lastclean = now;
|
|
||||||
needrefresh = 0;
|
needrefresh = 0;
|
||||||
dnvars.mutex = 0;
|
dnvars.mutex = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ enum {
|
||||||
Cfg cfg;
|
Cfg cfg;
|
||||||
|
|
||||||
static char *servername;
|
static char *servername;
|
||||||
static RR *serverrr;
|
|
||||||
static RR *serveraddrs;
|
static RR *serveraddrs;
|
||||||
|
|
||||||
char *dbfile;
|
char *dbfile;
|
||||||
|
|
|
@ -6,14 +6,6 @@
|
||||||
#include <plumb.h>
|
#include <plumb.h>
|
||||||
#include "plumber.h"
|
#include "plumber.h"
|
||||||
|
|
||||||
static char*
|
|
||||||
nonnil(char *s)
|
|
||||||
{
|
|
||||||
if(s == nil)
|
|
||||||
return "";
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
verbis(int obj, Plumbmsg *m, Rule *r)
|
verbis(int obj, Plumbmsg *m, Rule *r)
|
||||||
{
|
{
|
||||||
|
|
|
@ -144,7 +144,7 @@ char*
|
||||||
getline(void)
|
getline(void)
|
||||||
{
|
{
|
||||||
static int n = 0;
|
static int n = 0;
|
||||||
static char *s, *incl;
|
static char *s;
|
||||||
int c, i;
|
int c, i;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
|
@ -10,7 +10,6 @@ char lastload[NFONT][20]; /* last file name prefix loaded for this font */
|
||||||
Font *fonttab[NFONT][NSIZE]; /* pointers to fonts */
|
Font *fonttab[NFONT][NSIZE]; /* pointers to fonts */
|
||||||
int fmap[NFONT]; /* what map to use with this font */
|
int fmap[NFONT]; /* what map to use with this font */
|
||||||
|
|
||||||
static void bufchar(Point, Subfont *, uchar *);
|
|
||||||
static void loadfont(int, int);
|
static void loadfont(int, int);
|
||||||
static void fontlookup(int, char *);
|
static void fontlookup(int, char *);
|
||||||
static void buildxheight(Biobuf*);
|
static void buildxheight(Biobuf*);
|
||||||
|
|
|
@ -44,7 +44,6 @@ static void eatline(void);
|
||||||
static int getn(void);
|
static int getn(void);
|
||||||
static int botpage(int);
|
static int botpage(int);
|
||||||
static void getstr(char *);
|
static void getstr(char *);
|
||||||
static void getutf(char *);
|
|
||||||
|
|
||||||
#define Do screen->r.min
|
#define Do screen->r.min
|
||||||
#define Dc screen->r.max
|
#define Dc screen->r.max
|
||||||
|
@ -452,24 +451,6 @@ getstr(char *is)
|
||||||
*s = 0;
|
*s = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
getutf(char *s) /* get next utf char, as bytes */
|
|
||||||
{
|
|
||||||
int c, i;
|
|
||||||
|
|
||||||
for (i=0;;) {
|
|
||||||
c = getc();
|
|
||||||
if (c < 0)
|
|
||||||
return;
|
|
||||||
s[i++] = c;
|
|
||||||
|
|
||||||
if (fullrune(s, i)) {
|
|
||||||
s[i] = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eatline(void)
|
eatline(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -123,14 +123,6 @@ getkbdstr(int c0)
|
||||||
|
|
||||||
#define butcvt(b) (1 << ((b) - 1))
|
#define butcvt(b) (1 << ((b) - 1))
|
||||||
|
|
||||||
static int buttondown(void) /* report state of buttons, if any */
|
|
||||||
{
|
|
||||||
if (!ecanmouse()) /* no event pending */
|
|
||||||
return 0;
|
|
||||||
mouse = emouse(); /* something, but it could be motion */
|
|
||||||
return mouse.buttons & 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
int waitdown(void) /* wait until some button is down */
|
int waitdown(void) /* wait until some button is down */
|
||||||
{
|
{
|
||||||
while (!(mouse.buttons & 7))
|
while (!(mouse.buttons & 7))
|
||||||
|
|
|
@ -11,10 +11,10 @@ enum {
|
||||||
RNONE,
|
RNONE,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void rflush(Fcall*), rnop(Fcall*),
|
static void rflush(Fcall*),
|
||||||
rauth(Fcall*), rattach(Fcall*),
|
rauth(Fcall*), rattach(Fcall*),
|
||||||
rclone(Fcall*), rwalk(Fcall*),
|
rclone(Fcall*), rwalk(Fcall*),
|
||||||
rclwalk(Fcall*), ropen(Fcall*),
|
ropen(Fcall*),
|
||||||
rcreate(Fcall*), rread(Fcall*),
|
rcreate(Fcall*), rread(Fcall*),
|
||||||
rwrite(Fcall*), rclunk(Fcall*),
|
rwrite(Fcall*), rclunk(Fcall*),
|
||||||
rremove(Fcall*), rstat(Fcall*),
|
rremove(Fcall*), rstat(Fcall*),
|
||||||
|
|
|
@ -54,7 +54,6 @@ char srvwctl[64];
|
||||||
static Xfid* filsysflush(Filsys*, Xfid*, Fid*);
|
static Xfid* filsysflush(Filsys*, Xfid*, Fid*);
|
||||||
static Xfid* filsysversion(Filsys*, Xfid*, Fid*);
|
static Xfid* filsysversion(Filsys*, Xfid*, Fid*);
|
||||||
static Xfid* filsysauth(Filsys*, Xfid*, Fid*);
|
static Xfid* filsysauth(Filsys*, Xfid*, Fid*);
|
||||||
static Xfid* filsysnop(Filsys*, Xfid*, Fid*);
|
|
||||||
static Xfid* filsysattach(Filsys*, Xfid*, Fid*);
|
static Xfid* filsysattach(Filsys*, Xfid*, Fid*);
|
||||||
static Xfid* filsyswalk(Filsys*, Xfid*, Fid*);
|
static Xfid* filsyswalk(Filsys*, Xfid*, Fid*);
|
||||||
static Xfid* filsysopen(Filsys*, Xfid*, Fid*);
|
static Xfid* filsysopen(Filsys*, Xfid*, Fid*);
|
||||||
|
|
|
@ -121,7 +121,6 @@ void
|
||||||
threadmain(int argc, char *argv[])
|
threadmain(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char *initstr, *kbdin, *s;
|
char *initstr, *kbdin, *s;
|
||||||
static void *arg[1];
|
|
||||||
char buf[256];
|
char buf[256];
|
||||||
Image *i;
|
Image *i;
|
||||||
Rectangle r;
|
Rectangle r;
|
||||||
|
|
Loading…
Reference in a new issue