Plan 9 from Bell Labs’s /usr/web/sources/extra/changes/2007/0419

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


/sys/src/9/ip/ip.c
% cat >/sys/lib/dist/changes/1176957006.0.txt << EOF
Code cleanup.
• Whitespace / comments
• Add comments describing route flags
• Add function ipifcadd6, replacing ipifcaddpref6
• Condense ipifcsendra6 and ipifcrecvra6 and ipifcsetpar6 
into ipifcra6

EOF
 [geoff] --rw-rw-r-- M 43 glenda sys 15288 Apr 19 00:30 sys/src/9/ip/ip.c
	/n/sourcesdump/2007/0419/plan9/sys/src/9/ip/ip.c:145,151 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/9/ip/ip.c:145,150
	  void		ipfragfree4(IP*, Fragment4*);
	  Fragment4*	ipfragallo4(IP*);
	  
	- 
	  void
	  ip_init_6(Fs *f)
	  {
	/n/sourcesdump/2007/0419/plan9/sys/src/9/ip/ip.c:152,174 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/9/ip/ip.c:151,172
	  	v6params *v6p;
	  
	  	v6p = smalloc(sizeof(v6params));
	- 	
	- 	v6p->rp.mflag		= 0;		// default not managed
	+ 
	+ 	v6p->rp.mflag		= 0;		/* default not managed */
	  	v6p->rp.oflag		= 0;
	- 	v6p->rp.maxraint	= 600000;	// millisecs
	+ 	v6p->rp.maxraint	= 600000;	/* millisecs */
	  	v6p->rp.minraint	= 200000;
	- 	v6p->rp.linkmtu		= 0;		// no mtu sent
	+ 	v6p->rp.linkmtu		= 0;		/* no mtu sent */
	  	v6p->rp.reachtime	= 0;
	  	v6p->rp.rxmitra		= 0;
	  	v6p->rp.ttl		= MAXTTL;
	- 	v6p->rp.routerlt	= 3*(v6p->rp.maxraint);	
	+ 	v6p->rp.routerlt	= 3 * v6p->rp.maxraint;
	  
	- 	v6p->hp.rxmithost	= 1000;		// v6 RETRANS_TIMER
	+ 	v6p->hp.rxmithost	= 1000;		/* v6 RETRANS_TIMER */
	  
	  	v6p->cdrouter 		= -1;
	  
	  	f->v6p			= v6p;
	- 
	  }
	  
	  void
	/n/sourcesdump/2007/0419/plan9/sys/src/9/ip/ip.c:217,223 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/9/ip/ip.c:215,221
	  	if(f->ip->iprouting==0)
	  		f->ip->stats[Forwarding] = 2;
	  	else
	- 		f->ip->stats[Forwarding] = 1;	
	+ 		f->ip->stats[Forwarding] = 1;
	  }
	  
	  int
	/n/sourcesdump/2007/0419/plan9/sys/src/9/ip/ip.c:362,368 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/9/ip/ip.c:360,366
	  			seglen = dlen - fragoff;
	  			hnputs(feh->frag, fragoff>>3);
	  		}
	- 		else	
	+ 		else
	  			hnputs(feh->frag, (fragoff>>3)|IP_MF);
	  
	  		hnputs(feh->length, seglen + IP4HDR);
	/n/sourcesdump/2007/0419/plan9/sys/src/9/ip/ip.c:387,393 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/9/ip/ip.c:385,391
	  			chunk -= blklen;
	  			if(xp->rp == xp->wp)
	  				xp = xp->next;
	- 		} 
	+ 		}
	  
	  		feh->cksum[0] = 0;
	  		feh->cksum[1] = 0;
	/n/sourcesdump/2007/0419/plan9/sys/src/9/ip/ip.c:723,729 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/9/ip/ip.c:721,727
	  			hnputs(ih->length, len);
	  			qunlock(&ip->fraglock4);
	  			ip->stats[ReasmOKs]++;
	- 			return bl;		
	+ 			return bl;
	  		}
	  		pktposn += BKFG(bl)->flen;
	  	}
 [geoff] --rw-rw-r-- M 43 glenda sys 15982 Apr 19 00:32 sys/src/9/ip/ip.h
	/n/sourcesdump/2007/0419/plan9/sys/src/9/ip/ip.h:188,206 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/9/ip/ip.h:188,206
	  	int	ref;
	  };
	  
	- /* rfc 2461, pp.40--43. */
	+ /* rfc 2461, pp.40—43. */
	  
	  /* default values, one per stack */
	  struct Routerparams {
	- 	int	mflag;
	- 	int	oflag;
	- 	int 	maxraint;
	- 	int	minraint;
	- 	int	linkmtu;
	- 	int	reachtime;
	- 	int	rxmitra;
	- 	int	ttl;
	- 	int	routerlt;	
	+ 	int	mflag;		/* flag: managed address configuration */
	+ 	int	oflag;		/* flag: other stateful configuration */
	+ 	int 	maxraint;	/* max. router adv interval (ms) */
	+ 	int	minraint;	/* min. router adv interval (ms) */
	+ 	int	linkmtu;	/* mtu options */
	+ 	int	reachtime;	/* reachable time */
	+ 	int	rxmitra;	/* retransmit interval */
	+ 	int	ttl;		/* cur hop count limit */
	+ 	int	routerlt;	/* router lifetime */
	  };
	  
	  struct Hostparams {
	/n/sourcesdump/2007/0419/plan9/sys/src/9/ip/ip.h:210,216 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/9/ip/ip.h:210,216
	  struct Ipifc
	  {
	  	RWlock;
	- 	
	+ 
	  	Conv	*conv;		/* link to its conversation structure */
	  	char	dev[64];	/* device we're attached to */
	  	Medium	*m;		/* Media pointer */
	/n/sourcesdump/2007/0419/plan9/sys/src/9/ip/ip.h:234,242 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/9/ip/ip.h:234,242
	  	ulong	in, out;	/* message statistics */
	  	ulong	inerr, outerr;	/* ... */
	  
	- 	uchar	sendra6;	/* == 1 => send router advs on this ifc	*/
	- 	uchar	recvra6;	/* == 1 => recv router advs on this ifc */
	- 	Routerparams rp;	/* router parameters as in RFC 2461, pp.40--43. 
	+ 	uchar	sendra6;	/* flag: send router advs on this ifc */
	+ 	uchar	recvra6;	/* flag: recv router advs on this ifc */
	+ 	Routerparams rp;	/* router parameters as in RFC 2461, pp.40—43.
	  					used only if node is router */
	  };
	  
	/n/sourcesdump/2007/0419/plan9/sys/src/9/ip/ip.h:361,367 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/9/ip/ip.h:361,367
	  	Routerparams	rp;		/* v6 params, one copy per node now */
	  	Hostparams	hp;
	  	v6router	v6rlist[3];	/* max 3 default routers, currently */
	- 	int		cdrouter;	/* uses only v6rlist[cdrouter] if   */ 
	+ 	int		cdrouter;	/* uses only v6rlist[cdrouter] if   */
	  					/* cdrouter >= 0. */
	  };
	  
	/n/sourcesdump/2007/0419/plan9/sys/src/9/ip/ip.h:379,385 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/9/ip/ip.h:379,385
	  char*	Fsstdbind(Conv*, char**, int);
	  ulong	scalednconv(void);
	  void	closeconv(Conv*);
	- /* 
	+ /*
	   *  logging
	   */
	  enum
	/n/sourcesdump/2007/0419/plan9/sys/src/9/ip/ip.h:605,612 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/9/ip/ip.h:605,611
	  extern char*	ipifcrem(Ipifc *ifc, char **argv, int argc);
	  extern char*	ipifcadd(Ipifc *ifc, char **argv, int argc, int tentative, Iplifc *lifcp);
	  extern long	ipselftabread(Fs*, char *a, ulong offset, int n);
	- extern char*	ipifcaddpref6(Ipifc *ifc, char**argv, int argc);
	- extern void	ipsendra6(Fs *f, int on);
	+ extern char*	ipifcadd6(Ipifc *ifc, char**argv, int argc);
	  /*
	   *  ip.c
	   */
 [geoff] --rw-rw-r-- M 43 glenda sys 33517 Apr 19 00:32 sys/src/9/ip/ipifc.c
	/n/sourcesdump/2007/0419/plan9/sys/src/9/ip/ipifc.c:415,426 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/9/ip/ipifc.c:415,426
	  		if(ipcmp(lifc->local, ip) == 0) {
	  			if(lifc->tentative != tentative)
	  				lifc->tentative = tentative;
	- 			if(lifcp != nil) {
	- 				lifc->onlink = lifcp->onlink;
	+ 			if(lifcp) {
	+ 				lifc->onlink   = lifcp->onlink;
	  				lifc->autoflag = lifcp->autoflag;
	- 				lifc->validlt = lifcp->validlt;
	- 				lifc->preflt = lifcp->preflt;
	- 				lifc->origint = lifcp->origint;
	+ 				lifc->validlt  = lifcp->validlt;
	+ 				lifc->preflt   = lifcp->preflt;
	+ 				lifc->origint  = lifcp->origint;
	  			}
	  			goto out;
	  		}
	/n/sourcesdump/2007/0419/plan9/sys/src/9/ip/ipifc.c:432,449 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/9/ip/ipifc.c:432,447
	  	ipmove(lifc->remote, rem);
	  	ipmove(lifc->net, net);
	  	lifc->tentative = tentative;
	- 	if(lifcp != nil) {
	- 		lifc->onlink = lifcp->onlink;
	+ 	if(lifcp) {
	+ 		lifc->onlink   = lifcp->onlink;
	  		lifc->autoflag = lifcp->autoflag;
	- 		lifc->validlt = lifcp->validlt;
	- 		lifc->preflt = lifcp->preflt;
	- 		lifc->origint = lifcp->origint;
	+ 		lifc->validlt  = lifcp->validlt;
	+ 		lifc->preflt   = lifcp->preflt;
	+ 		lifc->origint  = lifcp->origint;
	  	} else {		/* default values */
	- 		lifc->onlink = 1;
	- 		lifc->autoflag = 1;
	- 		lifc->validlt = ~0L;
	- 		lifc->preflt = ~0L;
	- 		lifc->origint = NOW / 1000;
	+ 		lifc->onlink   = lifc->autoflag = 1;
	+ 		lifc->validlt  = lifc->preflt = ~0L;
	+ 		lifc->origint  = NOW / 1000;
	  	}
	  	lifc->next = nil;
	  
	/n/sourcesdump/2007/0419/plan9/sys/src/9/ip/ipifc.c:687,693 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/9/ip/ipifc.c:685,691
	  }
	  
	  char*
	- ipifcsetpar6(Ipifc *ifc, char **argv, int argc)
	+ ipifcra6(Ipifc *ifc, char **argv, int argc)
	  {
	  	int i, argsleft, vmax = ifc->rp.maxraint, vmin = ifc->rp.minraint;
	  
	/n/sourcesdump/2007/0419/plan9/sys/src/9/ip/ipifc.c:736,755 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/9/ip/ipifc.c:734,739
	  	return nil;
	  }
	  
	- char*
	- ipifcsendra6(Ipifc *ifc, char **argv, int argc)
	- {
	- 	ifc->sendra6 = ((argc > 1? atoi(argv[1]): 0) != 0);
	- 	return nil;
	- }
	- 
	- char*
	- ipifcrecvra6(Ipifc *ifc, char **argv, int argc)
	- {
	- 	ifc->recvra6 = ((argc > 1? atoi(argv[1]): 0) != 0);
	- 	return nil;
	- }
	- 
	  /*
	   *  non-standard control messages.
	   *  called with c->car locked.
	/n/sourcesdump/2007/0419/plan9/sys/src/9/ip/ipifc.c:780,794 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/9/ip/ipifc.c:764,775
	  	} else if(strcmp(argv[0], "iprouting") == 0){
	  		iprouting(c->p->f, (argc > 1? atoi(argv[1]): 1));
	  		return nil;
	- 	} else if(strcmp(argv[0], "addpref6") == 0)
	- 		return ipifcaddpref6(ifc, argv, argc);
	- 	else if(strcmp(argv[0], "setpar6") == 0)
	- 		return ipifcsetpar6(ifc, argv, argc);
	- 	else if(strcmp(argv[0], "sendra6") == 0)
	- 		return ipifcsendra6(ifc, argv, argc);
	- 	else if(strcmp(argv[0], "recvra6") == 0)
	- 		return ipifcrecvra6(ifc, argv, argc);
	- 	return "unsupported ctl";
	+ 	} else if(strcmp(argv[0], "add6") == 0)
	+ 		return ipifcadd6(ifc, argv, argc);
	+ 	else if(strcmp(argv[0], "ra6") == 0)
	+ 		return ipifcra6(ifc, argv, argc);
	+ 	else
	+ 		return "unsupported ctl";
	  }
	  
	  int
	/n/sourcesdump/2007/0419/plan9/sys/src/9/ip/ipifc.c:1583,1589 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/9/ip/ipifc.c:1564,1570
	  };
	  
	  char*
	- ipifcaddpref6(Ipifc *ifc, char**argv, int argc)
	+ ipifcadd6(Ipifc *ifc, char**argv, int argc)
	  {
	  	int plen = 64;
	  	long origint = NOW / 1000, preflt = ~0L, validlt = ~0L;
	/n/sourcesdump/2007/0419/plan9/sys/src/9/ip/ipifc.c:1620,1636 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/9/ip/ipifc.c:1601,1616
	  		return Ebadarg;
	  
	  	lifc = smalloc(sizeof(Iplifc));
	- 	lifc->onlink = (onlink!=0);
	- 	lifc->autoflag = (autoflag!=0);
	+ 	lifc->onlink = (onlink != 0);
	+ 	lifc->autoflag = (autoflag != 0);
	  	lifc->validlt = validlt;
	  	lifc->preflt = preflt;
	  	lifc->origint = origint;
	  
	- 	if(ifc->m->pref2addr)
	- 		ifc->m->pref2addr(prefix, ifc->mac);
	- 	else
	+ 	/* issue "add" ctl msg for v6 link-local addr and prefix len */
	+ 	if(!ifc->m->pref2addr)
	  		return Ebadarg;
	- 
	+ 	ifc->m->pref2addr(prefix, ifc->mac);	/* mac → v6 link-local addr */
	  	sprint(addr, "%I", prefix);
	  	sprint(preflen, "/%d", plen);
	  	params[0] = "add";

/sys/man/3/ip
% cat >/sys/lib/dist/changes/1176958805.0.txt << EOF
Document IPv6-related changes, as well as router flags.
EOF
 [geoff] --rw-rw-r-- M 43 glenda sys 24540 Apr 19 01:11 sys/man/3/ip
	/n/sourcesdump/2007/0419/plan9/sys/man/3/ip:94,100 - 
	/n/sourcesdump/2007/0420/plan9/sys/man/3/ip:94,101
	  The possible
	  .I ctl
	  messages are:
	- .TF "bind loopback"
	+ .\" .TF "bind loopback"
	+ .TF "bind netdev"
	  .PD
	  .TP
	  .BI "bind ether " path
	/n/sourcesdump/2007/0419/plan9/sys/man/3/ip:135,141 - 
	/n/sourcesdump/2007/0420/plan9/sys/man/3/ip:136,150
	  Disassociate the physical device from an IP interface.
	  .TP
	  .BI add\  "local mask remote mtu " proxy
	- Add a local IP address to the interface.  The
	+ .PD 0
	+ .TP
	+ .BI try\  "local mask remote mtu " proxy
	+ .PD
	+ Add a local IP address to the interface.
	+ .I try
	+ adds the local address as a tentative address
	+ if it's an IPv6 address.
	+ The
	  .IR mask ,
	  .IR remote ,
	  .IR mtu ,
	/n/sourcesdump/2007/0419/plan9/sys/man/3/ip:185,190 - 
	/n/sourcesdump/2007/0420/plan9/sys/man/3/ip:194,281
	  Remove the multicast address
	  .I addr
	  from this interface.
	+ .TP
	+ .BI "add6 " "v6addr pfx-len [onlink auto validlt preflt]"
	+ Add the local IPv6 address
	+ .I v6addr
	+ with prefix length
	+ .I pfx-len
	+ to this interface.
	+ See RFC 2461 §6.2.1 for more detail.
	+ The remaining arguments are optional:
	+ .RS
	+ .TF onlink
	+ .TP
	+ .I onlink
	+ flag: address is `on-link'
	+ .TP
	+ .I auto
	+ flag: autonomous
	+ .TP
	+ .I validlt
	+ valid life-time in seconds
	+ .TP
	+ .I preflt
	+ preferred life-time in seconds
	+ .RE
	+ .PD
	+ .TP
	+ .BI "ra6 " "keyword value ..."
	+ Set IPv6 router advertisement (RA) parameter
	+ .IR keyword 's
	+ .IR value .
	+ Known
	+ .IR keyword s
	+ and the meanings of their values follow.
	+ See RFC 2461 §6.2.1 for more detail.
	+ Flags are true iff non-zero.
	+ .RS
	+ .TF minraint
	+ .TP
	+ .B recvra
	+ flag: receive and process RAs.
	+ .TP
	+ .B sendra
	+ flag: generate and send RAs.
	+ .TP
	+ .B mflag
	+ flag: ``Managed address configuration'',
	+ goes into RAs.
	+ .TP
	+ .B oflag
	+ flag: ``Other stateful configuration'',
	+ goes into RAs.
	+ .TP
	+ .B maxraint
	+ ``maximum time allowed between sending unsolicited multicast''
	+ RAs from the interface, in ms.
	+ .TP
	+ .B minraint
	+ ``minimum time allowed between sending unsolicited multicast''
	+ RAs from the interface, in ms.
	+ .TP
	+ .B linkmtu
	+ ``value to be placed in MTU options sent by the router.''
	+ Zero indicates none.
	+ .TP
	+ .B reachtime
	+ sets the Reachable Time field in RAs sent by the router.
	+ ``Zero means unspecified (by this router).''
	+ .TP
	+ .B rxmitra
	+ sets the Retrans Timer field in RAs sent by the router.
	+ ``Zero means unspecified (by this router).''
	+ .TP
	+ .B ttl
	+ default value of the Cur Hop Limit field in RAs sent by the router.
	+ Should be set to the ``current diameter of the Internet.''
	+ ``Zero means unspecified (by this router).''
	+ .TP
	+ .B routerlt
	+ sets the Router Lifetime field of RAs sent from the interface, in ms.
	+ Zero means the router is not to be used as a default router.
	+ .PD
	+ .RE
	  .PP
	  Reading the interface's
	  .I status

% cat >/sys/lib/dist/changes/1177005616.0.txt << EOF
• Fix misplaced comment
• Create a clog procedure to get rid of a lot of redundant syslog stuff (we know
we're always going to be CRONLOG).
EOF
 [geoff] --rw-rw-r-- M 43 glenda sys 12306 Apr 19 13:49 sys/src/cmd/auth/cron.c
	/n/sourcesdump/2007/0419/plan9/sys/src/cmd/auth/cron.c:84,89 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/cmd/auth/cron.c:84,103
	  		return 0;
	  }
	  
	+ #pragma varargck	argpos clog 1
	+ 
	+ static void
	+ clog(char *fmt, ...)
	+ {
	+ 	char msg[256];
	+ 	va_list arg;
	+ 
	+ 	va_start(arg, fmt);
	+ 	vseprint(msg, msg + sizeof msg, fmt, arg);
	+ 	va_end(arg);
	+ 	syslog(0, CRONLOG, msg);
	+ }
	+ 
	  void
	  main(int argc, char *argv[])
	  {
	/n/sourcesdump/2007/0419/plan9/sys/src/cmd/auth/cron.c:138,147 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/cmd/auth/cron.c:152,161
	  		 * just execute one day's jobs.
	  		 */
	  		if (now < last) {
	- 			syslog(0, CRONLOG, "time went backward");
	+ 			clog("time went backward");
	  			last = now;
	  		} else if (now - last > Day) {
	- 			syslog(0, CRONLOG, "time advanced more than a day");
	+ 			clog("time advanced more than a day");
	  			last = now - Day;
	  		}
	  		now = minute(now);
	/n/sourcesdump/2007/0419/plan9/sys/src/cmd/auth/cron.c:261,268 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/cmd/auth/cron.c:275,281
	  		if(*savec == '#' || *savec == '\0')
	  			continue;
	  		if(strlen(savec) > 1024){
	- 			syslog(0, CRONLOG, "%s: line %d: line too long",
	- 				user->name, line);
	+ 			clog("%s: line %d: line too long", user->name, line);
	  			continue;
	  		}
	  		j = emalloc(sizeof *j);
	/n/sourcesdump/2007/0419/plan9/sys/src/cmd/auth/cron.c:277,284 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/cmd/auth/cron.c:290,296
	  			j->next = jobs;
	  			jobs = j;
	  		}else{
	- 			syslog(0, CRONLOG, "%s: line %d: syntax error",
	- 				user->name, line);
	+ 			clog("%s: line %d: syntax error", user->name, line);
	  			free(j);
	  		}
	  	}
	/n/sourcesdump/2007/0419/plan9/sys/src/cmd/auth/cron.c:356,362 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/cmd/auth/cron.c:368,374
	  	*p = '\0';
	  	*namep = strdup(buf);
	  	if(*namep == 0){
	- 		syslog(0, CRONLOG, "internal error: strdup failure");
	+ 		clog("internal error: strdup failure");
	  		_exits(0);
	  	}
	  	while(*savec == ' ' || *savec == '\t')
	/n/sourcesdump/2007/0419/plan9/sys/src/cmd/auth/cron.c:492,550 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/cmd/auth/cron.c:504,566
	  	case 0:
	  		break;
	  	case -1:
	- 		syslog(0, CRONLOG, "can't fork a job for %s: %r\n", user->name);
	+ 		clog("can't fork a job for %s: %r\n", user->name);
	  	default:
	  		return;
	  	}
	  
	  	if(!mkcmd(j->cmd, buf, sizeof buf)){
	- 		syslog(0, CRONLOG, "internal error: cmd buffer overflow");
	+ 		clog("internal error: cmd buffer overflow");
	  		_exits(0);
	  	}
	  
	  	/*
	- 	 * remote call, auth, cmd with no i/o
	- 	 * give it 2 min to complete
	+ 	 * local call, auth, cmd with no i/o
	  	 */
	  	if(strcmp(j->host, "local") == 0){
	  		if(becomeuser(user->name) < 0){
	- 			syslog(0, CRONLOG, "%s: can't change uid for %s on %s: %r", user->name, j->cmd, j->host);
	+ 			clog("%s: can't change uid for %s on %s: %r",
	+ 				user->name, j->cmd, j->host);
	  			_exits(0);
	  		}
	- syslog(0, CRONLOG, "%s: ran '%s' on %s", user->name, j->cmd, j->host);
	- 		execl("/bin/rc", "rc", "-c", buf, nil);
	- 		syslog(0, CRONLOG, "%s: exec failed for %s on %s: %r",
	+ 		putenv("service", "rx");
	+ 		clog("%s: ran '%s' on %s", user->name, j->cmd, j->host);
	+ 		execl("/bin/rc", "rc", "-lc", buf, nil);
	+ 		clog("%s: exec failed for %s on %s: %r",
	  			user->name, j->cmd, j->host);
	  		_exits(0);
	  	}
	  
	+ 	/*
	+ 	 * remote call, auth, cmd with no i/o
	+ 	 * give it 2 min to complete
	+ 	 */
	  	alarm(2*Minute*1000);
	  	fd = call(j->host);
	  	if(fd < 0){
	  		if(fd == -2)
	- 			syslog(0, CRONLOG, "%s: dangerous host %s",
	- 				user->name, j->host);
	- 		syslog(0, CRONLOG, "%s: can't call %s: %r", user->name, j->host);
	+ 			clog("%s: dangerous host %s", user->name, j->host);
	+ 		clog("%s: can't call %s: %r", user->name, j->host);
	  		_exits(0);
	  	}
	- syslog(0, CRONLOG, "%s: called %s on %s", user->name, j->cmd, j->host);
	+ 	clog("%s: called %s on %s", user->name, j->cmd, j->host);
	  	if(becomeuser(user->name) < 0){
	- 		syslog(0, CRONLOG, "%s: can't change uid for %s on %s: %r",
	+ 		clog("%s: can't change uid for %s on %s: %r",
	  			user->name, j->cmd, j->host);
	  		_exits(0);
	  	}
	  	ai = auth_proxy(fd, nil, "proto=p9any role=client");
	  	if(ai == nil){
	- 		syslog(0, CRONLOG, "%s: can't authenticate for %s on %s: %r",
	+ 		clog("%s: can't authenticate for %s on %s: %r",
	  			user->name, j->cmd, j->host);
	  		_exits(0);
	  	}
	- syslog(0, CRONLOG, "%s: authenticated %s on %s", user->name, j->cmd, j->host);
	+ 	clog("%s: authenticated %s on %s", user->name, j->cmd, j->host);
	  	write(fd, buf, strlen(buf)+1);
	  	write(fd, buf, 0);
	  	while((n = read(fd, buf, sizeof(buf)-1)) > 0){
	  		buf[n] = 0;
	- 		syslog(0, CRONLOG, "%s: %s\n", j->cmd, buf);
	+ 		clog("%s: %s\n", j->cmd, buf);
	  	}
	  	_exits(0);
	  }
	/n/sourcesdump/2007/0419/plan9/sys/src/cmd/auth/cron.c:660,665 - 
	/n/sourcesdump/2007/0420/plan9/sys/src/cmd/auth/cron.c:676,682
	  {
	  	char *cap;
	  	int rv;
	+ 
	  	cap = mkcap(getuser(), new);
	  	if(cap == nil)
	  		return -1;

NEED SOME FILES

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.