Apply the following mechanical transformations in preparation for
ansification and constification: s{\s+__P\((\(.*?\))\)}{$1}g; s{\(\s+}{\(}g; s{\s+\)}{\)}g; s{\s+,}{,}g; s{(\s+)(for|if|switch|while)\(}{$1$2 \(}g; s{return ([^\(].*?);}{return ($1);}g; s{([\w\)])([!=+/\*-]?=)([\w\(+-])}{$1 $2 $3}g; s{\s+$}{\n};g Also add $FreeBSD$ where needed. MFC after: 1 week
This commit is contained in:
parent
0e1bb965cc
commit
0f2cb9b020
@ -310,20 +310,20 @@ struct yppushresp_xfr {
|
||||
|
||||
struct inaddr;
|
||||
__BEGIN_DECLS
|
||||
bool_t xdr_datum __P((XDR *, datum *));
|
||||
bool_t xdr_ypreq_key __P((XDR *, struct ypreq_key *));
|
||||
bool_t xdr_ypreq_nokey __P((XDR *, struct ypreq_nokey *));
|
||||
bool_t xdr_ypreq_xfr __P((XDR *, struct ypreq_xfr *));
|
||||
bool_t xdr_ypresp_val __P((XDR *, struct ypresp_val *));
|
||||
bool_t xdr_ypresp_key_val __P((XDR *, struct ypresp_key_val *));
|
||||
bool_t xdr_ypbind_resp __P((XDR *, struct ypbind_resp *));
|
||||
bool_t xdr_ypbind_setdom __P((XDR *, struct ypbind_setdom *));
|
||||
bool_t xdr_yp_inaddr __P((XDR *, struct inaddr *));
|
||||
bool_t xdr_ypmap_parms __P((XDR *, struct ypmap_parms *));
|
||||
bool_t xdr_yppushresp_xfr __P((XDR *, struct yppushresp_xfr *));
|
||||
bool_t xdr_ypresp_order __P((XDR *, struct ypresp_order *));
|
||||
bool_t xdr_ypresp_master __P((XDR *, struct ypresp_master *));
|
||||
bool_t xdr_ypresp_maplist __P((XDR *, struct ypresp_maplist *));
|
||||
bool_t xdr_datum(XDR *, datum *);
|
||||
bool_t xdr_ypreq_key(XDR *, struct ypreq_key *);
|
||||
bool_t xdr_ypreq_nokey(XDR *, struct ypreq_nokey *);
|
||||
bool_t xdr_ypreq_xfr(XDR *, struct ypreq_xfr *);
|
||||
bool_t xdr_ypresp_val(XDR *, struct ypresp_val *);
|
||||
bool_t xdr_ypresp_key_val(XDR *, struct ypresp_key_val *);
|
||||
bool_t xdr_ypbind_resp(XDR *, struct ypbind_resp *);
|
||||
bool_t xdr_ypbind_setdom(XDR *, struct ypbind_setdom *);
|
||||
bool_t xdr_yp_inaddr(XDR *, struct inaddr *);
|
||||
bool_t xdr_ypmap_parms(XDR *, struct ypmap_parms *);
|
||||
bool_t xdr_yppushresp_xfr(XDR *, struct yppushresp_xfr *);
|
||||
bool_t xdr_ypresp_order(XDR *, struct ypresp_order *);
|
||||
bool_t xdr_ypresp_master(XDR *, struct ypresp_master *);
|
||||
bool_t xdr_ypresp_maplist(XDR *, struct ypresp_maplist *);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _RPCSVC_YP_PROT_H_ */
|
||||
|
@ -61,17 +61,17 @@
|
||||
|
||||
struct ypall_callback {
|
||||
/* return non-0 to stop getting called */
|
||||
int (*foreach) __P((unsigned long, char *, int, char *, int, void *));
|
||||
int (*foreach)(unsigned long, char *, int, char *, int, void *);
|
||||
char *data; /* opaque pointer for use of callback fn */
|
||||
};
|
||||
|
||||
struct dom_binding;
|
||||
|
||||
__BEGIN_DECLS
|
||||
int yp_bind __P((char *dom));
|
||||
int _yp_dobind __P((char *dom, struct dom_binding **ypdb));
|
||||
void yp_unbind __P((char *dom));
|
||||
int yp_get_default_domain __P((char **domp));
|
||||
int yp_bind(char *dom);
|
||||
int _yp_dobind(char *dom, struct dom_binding **ypdb);
|
||||
void yp_unbind(char *dom);
|
||||
int yp_get_default_domain(char **domp);
|
||||
int yp_match __P((char *indomain, char *inmap,
|
||||
const char *inkey, int inkeylen, char **outval,
|
||||
int *outvallen));
|
||||
@ -81,13 +81,13 @@ int yp_first __P((char *indomain, char *inmap,
|
||||
int yp_next __P((char *indomain, char *inmap,
|
||||
char *inkey, int inkeylen, char **outkey,
|
||||
int *outkeylen, char **outval, int *outvallen));
|
||||
int yp_master __P((char *indomain, char *inmap, char **outname));
|
||||
int yp_order __P((char *indomain, char *inmap, int *outorder));
|
||||
int yp_master(char *indomain, char *inmap, char **outname);
|
||||
int yp_order(char *indomain, char *inmap, int *outorder);
|
||||
int yp_all __P((char *indomain, char *inmap,
|
||||
struct ypall_callback *incallback));
|
||||
char * yperr_string __P((int incode));
|
||||
char * ypbinderr_string __P((int incode));
|
||||
int ypprot_err __P((unsigned int incode));
|
||||
char * yperr_string(int incode);
|
||||
char * ypbinderr_string(int incode);
|
||||
int ypprot_err(unsigned int incode);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _RPCSVC_YPCLNT_H_ */
|
||||
|
@ -72,19 +72,19 @@ u_long *objp;
|
||||
int r;
|
||||
|
||||
bzero(&out, sizeof out);
|
||||
while(1) {
|
||||
if( !xdr_ypresp_all(xdrs, &out)) {
|
||||
while (1) {
|
||||
if (!xdr_ypresp_all(xdrs, &out)) {
|
||||
xdr_free(xdr_ypresp_all, (char *)&out);
|
||||
*objp = YP_YPERR;
|
||||
return FALSE;
|
||||
return (FALSE);
|
||||
}
|
||||
if(out.more == 0) {
|
||||
if (out.more == 0) {
|
||||
xdr_free(xdr_ypresp_all, (char *)&out);
|
||||
*objp = YP_NOMORE;
|
||||
return TRUE;
|
||||
return (TRUE);
|
||||
}
|
||||
status = out.ypresp_all_u.val.stat;
|
||||
switch(status) {
|
||||
switch (status) {
|
||||
case YP_TRUE:
|
||||
key = (char *)malloc(out.ypresp_all_u.val.key.keydat_len + 1);
|
||||
bcopy(out.ypresp_all_u.val.key.keydat_val, key,
|
||||
@ -103,17 +103,17 @@ u_long *objp;
|
||||
*objp = status;
|
||||
free(key);
|
||||
free(val);
|
||||
if(r)
|
||||
return TRUE;
|
||||
if (r)
|
||||
return (TRUE);
|
||||
break;
|
||||
case YP_NOMORE:
|
||||
xdr_free(xdr_ypresp_all, (char *)&out);
|
||||
*objp = YP_NOMORE;
|
||||
return TRUE;
|
||||
return (TRUE);
|
||||
default:
|
||||
xdr_free(xdr_ypresp_all, (char *)&out);
|
||||
*objp = status;
|
||||
return TRUE;
|
||||
return (TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ extern bool_t xdr_ypresp_master();
|
||||
int (*ypresp_allfn)();
|
||||
void *ypresp_data;
|
||||
|
||||
static void _yp_unbind __P(( struct dom_binding * ));
|
||||
static void _yp_unbind(struct dom_binding *);
|
||||
struct dom_binding *_ypbindlist;
|
||||
static char _yp_domain[MAXHOSTNAMELEN];
|
||||
int _yplib_timeout = 10;
|
||||
@ -184,7 +184,7 @@ static void ypmatch_cache_insert(ypdb, map, key, val)
|
||||
|
||||
oldest = ~oldest;
|
||||
|
||||
while(c != NULL) {
|
||||
while (c != NULL) {
|
||||
if (c->ypc_expire_t < oldest) {
|
||||
oldest = c->ypc_expire_t;
|
||||
o = c;
|
||||
@ -270,18 +270,18 @@ ypbinderr_string(incode)
|
||||
int incode;
|
||||
{
|
||||
static char err[80];
|
||||
switch(incode) {
|
||||
switch (incode) {
|
||||
case 0:
|
||||
return "Success";
|
||||
return ("Success");
|
||||
case YPBIND_ERR_ERR:
|
||||
return "Internal ypbind error";
|
||||
return ("Internal ypbind error");
|
||||
case YPBIND_ERR_NOSERV:
|
||||
return "Domain not bound";
|
||||
return ("Domain not bound");
|
||||
case YPBIND_ERR_RESC:
|
||||
return "System resource allocation failure";
|
||||
return ("System resource allocation failure");
|
||||
}
|
||||
sprintf(err, "Unknown ypbind error: #%d\n", incode);
|
||||
return err;
|
||||
return (err);
|
||||
}
|
||||
|
||||
int
|
||||
@ -308,10 +308,10 @@ _yp_dobind(dom, ypdb)
|
||||
return(YPERR_BADARGS);
|
||||
|
||||
gpid = getpid();
|
||||
if( !(pid==-1 || pid==gpid) ) {
|
||||
if (!(pid == -1 || pid == gpid)) {
|
||||
ysd = _ypbindlist;
|
||||
while(ysd) {
|
||||
if(ysd->dom_client != NULL)
|
||||
while (ysd) {
|
||||
if (ysd->dom_client != NULL)
|
||||
_yp_unbind(ysd);
|
||||
ysd2 = ysd->dom_pnext;
|
||||
free(ysd);
|
||||
@ -321,18 +321,18 @@ _yp_dobind(dom, ypdb)
|
||||
}
|
||||
pid = gpid;
|
||||
|
||||
if(ypdb!=NULL)
|
||||
if (ypdb != NULL)
|
||||
*ypdb = NULL;
|
||||
|
||||
if(dom==NULL || strlen(dom)==0)
|
||||
return YPERR_BADARGS;
|
||||
if (dom == NULL || strlen(dom) == 0)
|
||||
return (YPERR_BADARGS);
|
||||
|
||||
for(ysd = _ypbindlist; ysd; ysd = ysd->dom_pnext)
|
||||
if( strcmp(dom, ysd->dom_domain) == 0)
|
||||
for (ysd = _ypbindlist; ysd; ysd = ysd->dom_pnext)
|
||||
if (strcmp(dom, ysd->dom_domain) == 0)
|
||||
break;
|
||||
|
||||
|
||||
if(ysd==NULL) {
|
||||
if (ysd == NULL) {
|
||||
ysd = (struct dom_binding *)malloc(sizeof *ysd);
|
||||
bzero((char *)ysd, sizeof *ysd);
|
||||
ysd->dom_socket = -1;
|
||||
@ -365,24 +365,24 @@ _yp_dobind(dom, ypdb)
|
||||
return(YPERR_YPBIND);
|
||||
}
|
||||
#ifdef BINDINGDIR
|
||||
if(ysd->dom_vers==0) {
|
||||
if (ysd->dom_vers == 0) {
|
||||
/*
|
||||
* We're trying to make a new binding: zorch the
|
||||
* existing handle now (if any).
|
||||
*/
|
||||
if(ysd->dom_client != NULL) {
|
||||
if (ysd->dom_client != NULL) {
|
||||
clnt_destroy(ysd->dom_client);
|
||||
ysd->dom_client = NULL;
|
||||
ysd->dom_socket = -1;
|
||||
}
|
||||
snprintf(path, sizeof(path), "%s/%s.%d", BINDINGDIR, dom, 2);
|
||||
if((fd = _open(path, O_RDONLY)) == -1) {
|
||||
if ((fd = _open(path, O_RDONLY)) == -1) {
|
||||
/* no binding file, YP is dead. */
|
||||
/* Try to bring it back to life. */
|
||||
_close(fd);
|
||||
goto skipit;
|
||||
}
|
||||
if(_flock(fd, LOCK_EX|LOCK_NB) == -1 && errno==EWOULDBLOCK) {
|
||||
if (_flock(fd, LOCK_EX|LOCK_NB) == -1 && errno == EWOULDBLOCK) {
|
||||
struct iovec iov[2];
|
||||
struct ypbind_resp ybr;
|
||||
u_short ypb_port;
|
||||
@ -393,7 +393,7 @@ _yp_dobind(dom, ypdb)
|
||||
iov[1].iov_len = sizeof ybr;
|
||||
|
||||
r = _readv(fd, iov, 2);
|
||||
if(r != iov[0].iov_len + iov[1].iov_len) {
|
||||
if (r != iov[0].iov_len + iov[1].iov_len) {
|
||||
_close(fd);
|
||||
ysd->dom_vers = -1;
|
||||
goto again;
|
||||
@ -421,12 +421,12 @@ _yp_dobind(dom, ypdb)
|
||||
}
|
||||
skipit:
|
||||
#endif
|
||||
if(ysd->dom_vers==-1 || ysd->dom_vers==0) {
|
||||
if (ysd->dom_vers == -1 || ysd->dom_vers == 0) {
|
||||
/*
|
||||
* We're trying to make a new binding: zorch the
|
||||
* existing handle now (if any).
|
||||
*/
|
||||
if(ysd->dom_client != NULL) {
|
||||
if (ysd->dom_client != NULL) {
|
||||
clnt_destroy(ysd->dom_client);
|
||||
ysd->dom_client = NULL;
|
||||
ysd->dom_socket = -1;
|
||||
@ -438,7 +438,7 @@ _yp_dobind(dom, ypdb)
|
||||
clnt_sock = RPC_ANYSOCK;
|
||||
client = clnttcp_create(&clnt_sin, YPBINDPROG, YPBINDVERS, &clnt_sock,
|
||||
0, 0);
|
||||
if(client==NULL) {
|
||||
if (client == NULL) {
|
||||
/*
|
||||
* These conditions indicate ypbind just isn't
|
||||
* alive -- we probably don't want to shoot our
|
||||
@ -449,7 +449,7 @@ _yp_dobind(dom, ypdb)
|
||||
(rpc_createerr.cf_stat != RPC_SYSTEMERROR &&
|
||||
rpc_createerr.cf_error.re_errno == ECONNREFUSED))
|
||||
clnt_pcreateerror("clnttcp_create");
|
||||
if(new)
|
||||
if (new)
|
||||
free(ysd);
|
||||
return (YPERR_YPBIND);
|
||||
}
|
||||
@ -470,7 +470,7 @@ _yp_dobind(dom, ypdb)
|
||||
tv.tv_usec = 0;
|
||||
r = clnt_call(client, YPBINDPROC_DOMAIN,
|
||||
xdr_domainname, (char *)&dom, xdr_ypbind_resp, &ypbr, tv);
|
||||
if(r != RPC_SUCCESS) {
|
||||
if (r != RPC_SUCCESS) {
|
||||
clnt_destroy(client);
|
||||
ysd->dom_vers = -1;
|
||||
if (r == RPC_PROGUNAVAIL || r == RPC_PROCUNAVAIL) {
|
||||
@ -526,12 +526,12 @@ _yp_dobind(dom, ypdb)
|
||||
ysd->dom_socket = RPC_ANYSOCK;
|
||||
ysd->dom_client = clntudp_bufcreate(&ysd->dom_server_addr,
|
||||
YPPROG, YPVERS, tv, &ysd->dom_socket, 1280, 2304);
|
||||
if(ysd->dom_client==NULL) {
|
||||
if (ysd->dom_client == NULL) {
|
||||
clnt_pcreateerror("clntudp_create");
|
||||
ysd->dom_vers = -1;
|
||||
goto again;
|
||||
}
|
||||
if(_fcntl(ysd->dom_socket, F_SETFD, 1) == -1)
|
||||
if (_fcntl(ysd->dom_socket, F_SETFD, 1) == -1)
|
||||
perror("fcntl: F_SETFD");
|
||||
/*
|
||||
* We want a port number associated with this socket
|
||||
@ -552,14 +552,14 @@ _yp_dobind(dom, ypdb)
|
||||
}
|
||||
}
|
||||
|
||||
if(new) {
|
||||
if (new) {
|
||||
ysd->dom_pnext = _ypbindlist;
|
||||
_ypbindlist = ysd;
|
||||
}
|
||||
|
||||
if(ypdb!=NULL)
|
||||
if (ypdb != NULL)
|
||||
*ypdb = ysd;
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -597,7 +597,7 @@ int
|
||||
yp_bind(dom)
|
||||
char *dom;
|
||||
{
|
||||
return _yp_dobind(dom, NULL);
|
||||
return (_yp_dobind(dom, NULL));
|
||||
}
|
||||
|
||||
void
|
||||
@ -607,10 +607,10 @@ yp_unbind(dom)
|
||||
struct dom_binding *ypb, *ypbp;
|
||||
|
||||
ypbp = NULL;
|
||||
for(ypb=_ypbindlist; ypb; ypb=ypb->dom_pnext) {
|
||||
if( strcmp(dom, ypb->dom_domain) == 0) {
|
||||
for (ypb = _ypbindlist; ypb; ypb = ypb->dom_pnext) {
|
||||
if (strcmp(dom, ypb->dom_domain) == 0) {
|
||||
_yp_unbind(ypb);
|
||||
if(ypbp)
|
||||
if (ypbp)
|
||||
ypbp->dom_pnext = ypb->dom_pnext;
|
||||
else
|
||||
_ypbindlist = ypb->dom_pnext;
|
||||
@ -645,7 +645,7 @@ yp_match(indomain, inmap, inkey, inkeylen, outval, outvallen)
|
||||
if (inkey == NULL || !strlen(inkey) || inkeylen <= 0 ||
|
||||
inmap == NULL || !strlen(inmap) ||
|
||||
indomain == NULL || !strlen(indomain))
|
||||
return YPERR_BADARGS;
|
||||
return (YPERR_BADARGS);
|
||||
|
||||
if (_yp_dobind(indomain, &ysd) != 0)
|
||||
return(YPERR_DOMAIN);
|
||||
@ -658,20 +658,20 @@ yp_match(indomain, inmap, inkey, inkeylen, outval, outvallen)
|
||||
#ifdef YPMATCHCACHE
|
||||
if (ypmatch_cache_lookup(ysd, yprk.map, &yprk.key, &yprv.val) == TRUE) {
|
||||
/*
|
||||
if( !strcmp(_yp_domain, indomain) && ypmatch_find(inmap, inkey,
|
||||
if (!strcmp(_yp_domain, indomain) && ypmatch_find(inmap, inkey,
|
||||
inkeylen, &yprv.val.valdat_val, &yprv.val.valdat_len)) {
|
||||
*/
|
||||
*outvallen = yprv.val.valdat_len;
|
||||
*outval = (char *)malloc(*outvallen+1);
|
||||
bcopy(yprv.val.valdat_val, *outval, *outvallen);
|
||||
(*outval)[*outvallen] = '\0';
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
again:
|
||||
if( _yp_dobind(indomain, &ysd) != 0)
|
||||
return YPERR_DOMAIN;
|
||||
if (_yp_dobind(indomain, &ysd) != 0)
|
||||
return (YPERR_DOMAIN);
|
||||
|
||||
tv.tv_sec = _yplib_timeout;
|
||||
tv.tv_usec = 0;
|
||||
@ -680,13 +680,13 @@ yp_match(indomain, inmap, inkey, inkeylen, outval, outvallen)
|
||||
|
||||
r = clnt_call(ysd->dom_client, YPPROC_MATCH,
|
||||
xdr_ypreq_key, &yprk, xdr_ypresp_val, &yprv, tv);
|
||||
if(r != RPC_SUCCESS) {
|
||||
if (r != RPC_SUCCESS) {
|
||||
clnt_perror(ysd->dom_client, "yp_match: clnt_call");
|
||||
_yp_unbind(ysd);
|
||||
goto again;
|
||||
}
|
||||
|
||||
if( !(r=ypprot_err(yprv.stat)) ) {
|
||||
if (!(r = ypprot_err(yprv.stat))) {
|
||||
*outvallen = yprv.val.valdat_len;
|
||||
*outval = (char *)malloc(*outvallen+1);
|
||||
bcopy(yprv.val.valdat_val, *outval, *outvallen);
|
||||
@ -697,7 +697,7 @@ yp_match(indomain, inmap, inkey, inkeylen, outval, outvallen)
|
||||
}
|
||||
|
||||
xdr_free(xdr_ypresp_val, (char *)&yprv);
|
||||
return r;
|
||||
return (r);
|
||||
}
|
||||
|
||||
int
|
||||
@ -705,11 +705,11 @@ yp_get_default_domain(domp)
|
||||
char **domp;
|
||||
{
|
||||
*domp = NULL;
|
||||
if(_yp_domain[0] == '\0')
|
||||
if( getdomainname(_yp_domain, sizeof _yp_domain))
|
||||
return YPERR_NODOM;
|
||||
if (_yp_domain[0] == '\0')
|
||||
if (getdomainname(_yp_domain, sizeof _yp_domain))
|
||||
return (YPERR_NODOM);
|
||||
*domp = _yp_domain;
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
@ -731,14 +731,14 @@ yp_first(indomain, inmap, outkey, outkeylen, outval, outvallen)
|
||||
|
||||
if (indomain == NULL || !strlen(indomain) ||
|
||||
inmap == NULL || !strlen(inmap))
|
||||
return YPERR_BADARGS;
|
||||
return (YPERR_BADARGS);
|
||||
|
||||
*outkey = *outval = NULL;
|
||||
*outkeylen = *outvallen = 0;
|
||||
|
||||
again:
|
||||
if( _yp_dobind(indomain, &ysd) != 0)
|
||||
return YPERR_DOMAIN;
|
||||
if (_yp_dobind(indomain, &ysd) != 0)
|
||||
return (YPERR_DOMAIN);
|
||||
|
||||
tv.tv_sec = _yplib_timeout;
|
||||
tv.tv_usec = 0;
|
||||
@ -749,12 +749,12 @@ yp_first(indomain, inmap, outkey, outkeylen, outval, outvallen)
|
||||
|
||||
r = clnt_call(ysd->dom_client, YPPROC_FIRST,
|
||||
xdr_ypreq_nokey, &yprnk, xdr_ypresp_key_val, &yprkv, tv);
|
||||
if(r != RPC_SUCCESS) {
|
||||
if (r != RPC_SUCCESS) {
|
||||
clnt_perror(ysd->dom_client, "yp_first: clnt_call");
|
||||
_yp_unbind(ysd);
|
||||
goto again;
|
||||
}
|
||||
if( !(r=ypprot_err(yprkv.stat)) ) {
|
||||
if (!(r = ypprot_err(yprkv.stat))) {
|
||||
*outkeylen = yprkv.key.keydat_len;
|
||||
*outkey = (char *)malloc(*outkeylen+1);
|
||||
bcopy(yprkv.key.keydat_val, *outkey, *outkeylen);
|
||||
@ -766,7 +766,7 @@ yp_first(indomain, inmap, outkey, outkeylen, outval, outvallen)
|
||||
}
|
||||
|
||||
xdr_free(xdr_ypresp_key_val, (char *)&yprkv);
|
||||
return r;
|
||||
return (r);
|
||||
}
|
||||
|
||||
int
|
||||
@ -791,14 +791,14 @@ yp_next(indomain, inmap, inkey, inkeylen, outkey, outkeylen, outval, outvallen)
|
||||
if (inkey == NULL || !strlen(inkey) || inkeylen <= 0 ||
|
||||
inmap == NULL || !strlen(inmap) ||
|
||||
indomain == NULL || !strlen(indomain))
|
||||
return YPERR_BADARGS;
|
||||
return (YPERR_BADARGS);
|
||||
|
||||
*outkey = *outval = NULL;
|
||||
*outkeylen = *outvallen = 0;
|
||||
|
||||
again:
|
||||
if( _yp_dobind(indomain, &ysd) != 0)
|
||||
return YPERR_DOMAIN;
|
||||
if (_yp_dobind(indomain, &ysd) != 0)
|
||||
return (YPERR_DOMAIN);
|
||||
|
||||
tv.tv_sec = _yplib_timeout;
|
||||
tv.tv_usec = 0;
|
||||
@ -811,12 +811,12 @@ yp_next(indomain, inmap, inkey, inkeylen, outkey, outkeylen, outval, outvallen)
|
||||
|
||||
r = clnt_call(ysd->dom_client, YPPROC_NEXT,
|
||||
xdr_ypreq_key, &yprk, xdr_ypresp_key_val, &yprkv, tv);
|
||||
if(r != RPC_SUCCESS) {
|
||||
if (r != RPC_SUCCESS) {
|
||||
clnt_perror(ysd->dom_client, "yp_next: clnt_call");
|
||||
_yp_unbind(ysd);
|
||||
goto again;
|
||||
}
|
||||
if( !(r=ypprot_err(yprkv.stat)) ) {
|
||||
if (!(r = ypprot_err(yprkv.stat))) {
|
||||
*outkeylen = yprkv.key.keydat_len;
|
||||
*outkey = (char *)malloc(*outkeylen+1);
|
||||
bcopy(yprkv.key.keydat_val, *outkey, *outkeylen);
|
||||
@ -828,7 +828,7 @@ yp_next(indomain, inmap, inkey, inkeylen, outkey, outkeylen, outval, outvallen)
|
||||
}
|
||||
|
||||
xdr_free(xdr_ypresp_key_val, (char *)&yprkv);
|
||||
return r;
|
||||
return (r);
|
||||
}
|
||||
|
||||
int
|
||||
@ -849,12 +849,12 @@ yp_all(indomain, inmap, incallback)
|
||||
|
||||
if (indomain == NULL || !strlen(indomain) ||
|
||||
inmap == NULL || !strlen(inmap))
|
||||
return YPERR_BADARGS;
|
||||
return (YPERR_BADARGS);
|
||||
|
||||
again:
|
||||
|
||||
if( _yp_dobind(indomain, &ysd) != 0)
|
||||
return YPERR_DOMAIN;
|
||||
if (_yp_dobind(indomain, &ysd) != 0)
|
||||
return (YPERR_DOMAIN);
|
||||
|
||||
tv.tv_sec = _yplib_timeout;
|
||||
tv.tv_usec = 0;
|
||||
@ -865,9 +865,9 @@ yp_all(indomain, inmap, incallback)
|
||||
clnt_sin = ysd->dom_server_addr;
|
||||
clnt_sin.sin_port = 0;
|
||||
clnt = clnttcp_create(&clnt_sin, YPPROG, YPVERS, &clnt_sock, 0, 0);
|
||||
if(clnt==NULL) {
|
||||
if (clnt == NULL) {
|
||||
printf("clnttcp_create failed\n");
|
||||
return YPERR_PMAP;
|
||||
return (YPERR_PMAP);
|
||||
}
|
||||
|
||||
yprnk.domain = indomain;
|
||||
@ -887,9 +887,9 @@ yp_all(indomain, inmap, incallback)
|
||||
clnt_destroy(clnt);
|
||||
savstat = status;
|
||||
xdr_free(xdr_ypresp_all_seq, (char *)&status); /* not really needed... */
|
||||
if(savstat != YP_NOMORE)
|
||||
return ypprot_err(savstat);
|
||||
return 0;
|
||||
if (savstat != YP_NOMORE)
|
||||
return (ypprot_err(savstat));
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
@ -908,11 +908,11 @@ yp_order(indomain, inmap, outorder)
|
||||
|
||||
if (indomain == NULL || !strlen(indomain) ||
|
||||
inmap == NULL || !strlen(inmap))
|
||||
return YPERR_BADARGS;
|
||||
return (YPERR_BADARGS);
|
||||
|
||||
again:
|
||||
if( _yp_dobind(indomain, &ysd) != 0)
|
||||
return YPERR_DOMAIN;
|
||||
if (_yp_dobind(indomain, &ysd) != 0)
|
||||
return (YPERR_DOMAIN);
|
||||
|
||||
tv.tv_sec = _yplib_timeout;
|
||||
tv.tv_usec = 0;
|
||||
@ -933,13 +933,13 @@ yp_order(indomain, inmap, outorder)
|
||||
return(YPERR_YPERR);
|
||||
}
|
||||
|
||||
if(r != RPC_SUCCESS) {
|
||||
if (r != RPC_SUCCESS) {
|
||||
clnt_perror(ysd->dom_client, "yp_order: clnt_call");
|
||||
_yp_unbind(ysd);
|
||||
goto again;
|
||||
}
|
||||
|
||||
if( !(r=ypprot_err(ypro.stat)) ) {
|
||||
if (!(r = ypprot_err(ypro.stat))) {
|
||||
*outorder = ypro.ordernum;
|
||||
}
|
||||
|
||||
@ -963,10 +963,10 @@ yp_master(indomain, inmap, outname)
|
||||
|
||||
if (indomain == NULL || !strlen(indomain) ||
|
||||
inmap == NULL || !strlen(inmap))
|
||||
return YPERR_BADARGS;
|
||||
return (YPERR_BADARGS);
|
||||
again:
|
||||
if( _yp_dobind(indomain, &ysd) != 0)
|
||||
return YPERR_DOMAIN;
|
||||
if (_yp_dobind(indomain, &ysd) != 0)
|
||||
return (YPERR_DOMAIN);
|
||||
|
||||
tv.tv_sec = _yplib_timeout;
|
||||
tv.tv_usec = 0;
|
||||
@ -978,13 +978,13 @@ yp_master(indomain, inmap, outname)
|
||||
|
||||
r = clnt_call(ysd->dom_client, YPPROC_MASTER,
|
||||
xdr_ypreq_nokey, &yprnk, xdr_ypresp_master, &yprm, tv);
|
||||
if(r != RPC_SUCCESS) {
|
||||
if (r != RPC_SUCCESS) {
|
||||
clnt_perror(ysd->dom_client, "yp_master: clnt_call");
|
||||
_yp_unbind(ysd);
|
||||
goto again;
|
||||
}
|
||||
|
||||
if( !(r=ypprot_err(yprm.stat)) ) {
|
||||
if (!(r = ypprot_err(yprm.stat))) {
|
||||
*outname = (char *)strdup(yprm.peer);
|
||||
}
|
||||
|
||||
@ -1004,11 +1004,11 @@ yp_maplist(indomain, outmaplist)
|
||||
/* Sanity check */
|
||||
|
||||
if (indomain == NULL || !strlen(indomain))
|
||||
return YPERR_BADARGS;
|
||||
return (YPERR_BADARGS);
|
||||
|
||||
again:
|
||||
if( _yp_dobind(indomain, &ysd) != 0)
|
||||
return YPERR_DOMAIN;
|
||||
if (_yp_dobind(indomain, &ysd) != 0)
|
||||
return (YPERR_DOMAIN);
|
||||
|
||||
tv.tv_sec = _yplib_timeout;
|
||||
tv.tv_usec = 0;
|
||||
@ -1022,7 +1022,7 @@ yp_maplist(indomain, outmaplist)
|
||||
_yp_unbind(ysd);
|
||||
goto again;
|
||||
}
|
||||
if( !(r=ypprot_err(ypml.stat)) ) {
|
||||
if (!(r = ypprot_err(ypml.stat))) {
|
||||
*outmaplist = ypml.maps;
|
||||
}
|
||||
|
||||
@ -1036,75 +1036,75 @@ yperr_string(incode)
|
||||
{
|
||||
static char err[80];
|
||||
|
||||
switch(incode) {
|
||||
switch (incode) {
|
||||
case 0:
|
||||
return "Success";
|
||||
return ("Success");
|
||||
case YPERR_BADARGS:
|
||||
return "Request arguments bad";
|
||||
return ("Request arguments bad");
|
||||
case YPERR_RPC:
|
||||
return "RPC failure";
|
||||
return ("RPC failure");
|
||||
case YPERR_DOMAIN:
|
||||
return "Can't bind to server which serves this domain";
|
||||
return ("Can't bind to server which serves this domain");
|
||||
case YPERR_MAP:
|
||||
return "No such map in server's domain";
|
||||
return ("No such map in server's domain");
|
||||
case YPERR_KEY:
|
||||
return "No such key in map";
|
||||
return ("No such key in map");
|
||||
case YPERR_YPERR:
|
||||
return "YP server error";
|
||||
return ("YP server error");
|
||||
case YPERR_RESRC:
|
||||
return "Local resource allocation failure";
|
||||
return ("Local resource allocation failure");
|
||||
case YPERR_NOMORE:
|
||||
return "No more records in map database";
|
||||
return ("No more records in map database");
|
||||
case YPERR_PMAP:
|
||||
return "Can't communicate with portmapper";
|
||||
return ("Can't communicate with portmapper");
|
||||
case YPERR_YPBIND:
|
||||
return "Can't communicate with ypbind";
|
||||
return ("Can't communicate with ypbind");
|
||||
case YPERR_YPSERV:
|
||||
return "Can't communicate with ypserv";
|
||||
return ("Can't communicate with ypserv");
|
||||
case YPERR_NODOM:
|
||||
return "Local domain name not set";
|
||||
return ("Local domain name not set");
|
||||
case YPERR_BADDB:
|
||||
return "Server data base is bad";
|
||||
return ("Server data base is bad");
|
||||
case YPERR_VERS:
|
||||
return "YP server version mismatch - server can't supply service.";
|
||||
return ("YP server version mismatch - server can't supply service.");
|
||||
case YPERR_ACCESS:
|
||||
return "Access violation";
|
||||
return ("Access violation");
|
||||
case YPERR_BUSY:
|
||||
return "Database is busy";
|
||||
return ("Database is busy");
|
||||
}
|
||||
sprintf(err, "YP unknown error %d\n", incode);
|
||||
return err;
|
||||
return (err);
|
||||
}
|
||||
|
||||
int
|
||||
ypprot_err(incode)
|
||||
unsigned int incode;
|
||||
{
|
||||
switch(incode) {
|
||||
switch (incode) {
|
||||
case YP_TRUE:
|
||||
return 0;
|
||||
return (0);
|
||||
case YP_FALSE:
|
||||
return YPERR_YPBIND;
|
||||
return (YPERR_YPBIND);
|
||||
case YP_NOMORE:
|
||||
return YPERR_NOMORE;
|
||||
return (YPERR_NOMORE);
|
||||
case YP_NOMAP:
|
||||
return YPERR_MAP;
|
||||
return (YPERR_MAP);
|
||||
case YP_NODOM:
|
||||
return YPERR_DOMAIN;
|
||||
return (YPERR_DOMAIN);
|
||||
case YP_NOKEY:
|
||||
return YPERR_KEY;
|
||||
return (YPERR_KEY);
|
||||
case YP_BADOP:
|
||||
return YPERR_YPERR;
|
||||
return (YPERR_YPERR);
|
||||
case YP_BADDB:
|
||||
return YPERR_BADDB;
|
||||
return (YPERR_BADDB);
|
||||
case YP_YPERR:
|
||||
return YPERR_YPERR;
|
||||
return (YPERR_YPERR);
|
||||
case YP_BADARGS:
|
||||
return YPERR_BADARGS;
|
||||
return (YPERR_BADARGS);
|
||||
case YP_VERS:
|
||||
return YPERR_VERS;
|
||||
return (YPERR_VERS);
|
||||
}
|
||||
return YPERR_YPERR;
|
||||
return (YPERR_YPERR);
|
||||
}
|
||||
|
||||
int
|
||||
@ -1113,16 +1113,16 @@ _yp_check(dom)
|
||||
{
|
||||
char *unused;
|
||||
|
||||
if( _yp_domain[0]=='\0' )
|
||||
if( yp_get_default_domain(&unused) )
|
||||
return 0;
|
||||
if (_yp_domain[0]=='\0')
|
||||
if (yp_get_default_domain(&unused))
|
||||
return (0);
|
||||
|
||||
if(dom)
|
||||
if (dom)
|
||||
*dom = _yp_domain;
|
||||
|
||||
if( yp_bind(_yp_domain)==0 ) {
|
||||
if (yp_bind(_yp_domain) == 0) {
|
||||
yp_unbind(_yp_domain);
|
||||
return 1;
|
||||
return (1);
|
||||
}
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ yp_update(domain, map, ypop, key, keylen, data, datalen)
|
||||
* us right away, and we only have to exert a small amount of
|
||||
* extra effort.
|
||||
*/
|
||||
switch(ypop) {
|
||||
switch (ypop) {
|
||||
case YPOP_CHANGE:
|
||||
upargs.mapname = map;
|
||||
upargs.key.yp_buf_len = keylen;
|
||||
|
@ -75,7 +75,7 @@ DB *yp_open_db_rw(domain, map, flags)
|
||||
dbp = dbopen(buf,flags ? flags : FLAGS,PERM_SECURE,DB_HASH,&openinfo);
|
||||
|
||||
if (dbp == NULL) {
|
||||
switch(errno) {
|
||||
switch (errno) {
|
||||
case ENOENT:
|
||||
yp_errno = YP_NOMAP;
|
||||
break;
|
||||
@ -101,7 +101,7 @@ int yp_put_record(dbp,key,data,allow_overwrite)
|
||||
|
||||
if ((rval = (dbp->put)(dbp,key,data, allow_overwrite ? 0 :
|
||||
R_NOOVERWRITE))) {
|
||||
switch(rval) {
|
||||
switch (rval) {
|
||||
case 1:
|
||||
return(YP_FALSE);
|
||||
break;
|
||||
|
@ -47,16 +47,16 @@ extern BTREEINFO openinfo_b;
|
||||
extern char *yp_dir;
|
||||
extern int debug;
|
||||
extern enum ypstat yp_errno;
|
||||
extern void yp_error __P(( const char *, ... ));
|
||||
extern int _yp_check __P(( char ** ));
|
||||
extern char *ypxfrerr_string __P(( ypxfrstat ));
|
||||
extern DB *yp_open_db_rw __P(( const char *, const char *, const int));
|
||||
extern void yp_init_dbs __P(( void ));
|
||||
extern int yp_put_record __P(( DB *, DBT *, DBT * , int ));
|
||||
extern int yp_get_record __P(( const char *, const char *, const DBT *, DBT *, int ));
|
||||
extern int ypxfr_get_map __P(( char *, char *, char *, int (*)() ));
|
||||
extern char *ypxfr_get_master __P(( char *, char *, char *, const int ));
|
||||
extern unsigned long ypxfr_get_order __P(( char *, char *, char *, const int ));
|
||||
extern int ypxfr_match __P(( char *, char *, char *, char *, unsigned long ));
|
||||
extern char *ypxfxerr_string __P(( ypxfrstat ));
|
||||
extern int ypxfrd_get_map __P(( char *, char *, char *, char *));
|
||||
extern void yp_error(const char *, ...);
|
||||
extern int _yp_check(char **);
|
||||
extern char *ypxfrerr_string(ypxfrstat);
|
||||
extern DB *yp_open_db_rw(const char *, const char *, const int);
|
||||
extern void yp_init_dbs(void);
|
||||
extern int yp_put_record(DB *, DBT *, DBT *, int);
|
||||
extern int yp_get_record(const char *, const char *, const DBT *, DBT *, int);
|
||||
extern int ypxfr_get_map(char *, char *, char *, int (*)());
|
||||
extern char *ypxfr_get_master(char *, char *, char *, const int);
|
||||
extern unsigned long ypxfr_get_order(char *, char *, char *, const int);
|
||||
extern int ypxfr_match(char *, char *, char *, char *, unsigned long);
|
||||
extern char *ypxfxerr_string(ypxfrstat);
|
||||
extern int ypxfrd_get_map(char *, char *, char *, char *);
|
||||
|
@ -43,7 +43,7 @@ static const char rcsid[] =
|
||||
#include <rpcsvc/yp.h>
|
||||
#include "ypxfr_extern.h"
|
||||
|
||||
extern bool_t xdr_ypresp_all_seq __P(( XDR *, unsigned long * ));
|
||||
extern bool_t xdr_ypresp_all_seq(XDR *, unsigned long *);
|
||||
|
||||
int (*ypresp_allfn)();
|
||||
void *ypresp_data;
|
||||
|
@ -195,7 +195,7 @@ main(argc,argv)
|
||||
|
||||
while ((ch = getopt(argc, argv, "fcd:h:s:p:C:")) != -1) {
|
||||
int my_optind;
|
||||
switch(ch) {
|
||||
switch (ch) {
|
||||
case 'f':
|
||||
ypxfr_force++;
|
||||
ypxfr_args++;
|
||||
@ -387,7 +387,7 @@ the local domain name isn't set");
|
||||
if (!ypxfr_force) {
|
||||
int ignore = 0;
|
||||
if (yp_get_record(ypxfr_dest_domain,ypxfr_mapname,&key,&data,1) != YP_TRUE) {
|
||||
switch(yp_errno) {
|
||||
switch (yp_errno) {
|
||||
case YP_NOKEY:
|
||||
ypxfr_exit(YPXFR_FORCE,NULL);
|
||||
break;
|
||||
|
@ -49,7 +49,7 @@ struct dom_binding {};
|
||||
char *ypxfrerr_string(code)
|
||||
ypxfrstat code;
|
||||
{
|
||||
switch(code) {
|
||||
switch (code) {
|
||||
case YPXFR_SUCC:
|
||||
return ("Map successfully transferred");
|
||||
break;
|
||||
|
@ -53,7 +53,7 @@ int fp = 0;
|
||||
|
||||
static bool_t xdr_my_xfr(register XDR *xdrs, xfr *objp)
|
||||
{
|
||||
while(1) {
|
||||
while (1) {
|
||||
if (!xdr_xfr(xdrs, objp))
|
||||
return(FALSE);
|
||||
if (objp->ok == TRUE) {
|
||||
@ -65,7 +65,7 @@ static bool_t xdr_my_xfr(register XDR *xdrs, xfr *objp)
|
||||
}
|
||||
xdr_free(xdr_xfr, (char *)objp);
|
||||
if (objp->ok == FALSE) {
|
||||
switch(objp->xfr_u.xfrstat) {
|
||||
switch (objp->xfr_u.xfrstat) {
|
||||
case(XFR_DONE):
|
||||
return(TRUE);
|
||||
break;
|
||||
|
@ -54,12 +54,12 @@ extern int _use_yp;
|
||||
extern int suser_override;
|
||||
extern struct passwd local_password;
|
||||
extern struct passwd yp_password;
|
||||
extern void copy_yp_pass __P(( char *, int, int ));
|
||||
extern void copy_yp_pass(char *, int, int);
|
||||
extern char *yp_domain;
|
||||
extern char *yp_server;
|
||||
extern void yp_submit __P(( struct passwd * ));
|
||||
extern int use_yp __P(( char * , uid_t , int ));
|
||||
extern char *get_yp_master __P(( int ));
|
||||
extern void yp_submit(struct passwd *);
|
||||
extern int use_yp(char *, uid_t, int);
|
||||
extern char *get_yp_master(int);
|
||||
extern int yp_in_pw_file;
|
||||
|
||||
/*
|
||||
|
@ -50,7 +50,7 @@
|
||||
#include <err.h>
|
||||
#include "yppasswd_private.h"
|
||||
|
||||
extern char *getnewpasswd __P(( struct passwd * , int ));
|
||||
extern char *getnewpasswd(struct passwd *, int);
|
||||
|
||||
int
|
||||
yp_passwd(char *user)
|
||||
@ -130,7 +130,7 @@ for other users");
|
||||
|
||||
/* Get old password */
|
||||
|
||||
if(pw->pw_passwd[0] && !suser_override) {
|
||||
if (pw->pw_passwd[0] && !suser_override) {
|
||||
yppasswd.oldpass = strdup(getpass("Old Password: "));
|
||||
if (strcmp(crypt(yppasswd.oldpass, pw->pw_passwd),
|
||||
pw->pw_passwd)) {
|
||||
|
@ -75,12 +75,12 @@ usage(void)
|
||||
static int
|
||||
printit(unsigned long instatus, char *inkey, int inkeylen, char *inval, int invallen, void *dummy __unused)
|
||||
{
|
||||
if(instatus != YP_TRUE)
|
||||
return instatus;
|
||||
if(key)
|
||||
if (instatus != YP_TRUE)
|
||||
return (instatus);
|
||||
if (key)
|
||||
printf("%*.*s ", inkeylen, inkeylen, inkey);
|
||||
printf("%*.*s\n", invallen, invallen, inval);
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
@ -95,10 +95,10 @@ main(int argc, char *argv[])
|
||||
|
||||
notrans = key = 0;
|
||||
|
||||
while( (c=getopt(argc, argv, "xd:kt")) != -1)
|
||||
switch(c) {
|
||||
while ((c = getopt(argc, argv, "xd:kt")) != -1)
|
||||
switch (c) {
|
||||
case 'x':
|
||||
for(i=0; i<sizeof ypaliases/sizeof ypaliases[0]; i++)
|
||||
for (i = 0; i<sizeof ypaliases/sizeof ypaliases[0]; i++)
|
||||
printf("Use \"%s\" for \"%s\"\n",
|
||||
ypaliases[i].alias,
|
||||
ypaliases[i].name);
|
||||
@ -116,21 +116,21 @@ main(int argc, char *argv[])
|
||||
usage();
|
||||
}
|
||||
|
||||
if(optind + 1 != argc )
|
||||
if (optind + 1 != argc)
|
||||
usage();
|
||||
|
||||
if (!domainname)
|
||||
yp_get_default_domain(&domainname);
|
||||
|
||||
inmap = argv[optind];
|
||||
for(i=0; (!notrans) && i<sizeof ypaliases/sizeof ypaliases[0]; i++)
|
||||
if( strcmp(inmap, ypaliases[i].alias) == 0)
|
||||
for (i = 0; (!notrans) && i<sizeof ypaliases/sizeof ypaliases[0]; i++)
|
||||
if (strcmp(inmap, ypaliases[i].alias) == 0)
|
||||
inmap = ypaliases[i].name;
|
||||
ypcb.foreach = printit;
|
||||
ypcb.data = NULL;
|
||||
|
||||
r = yp_all(domainname, inmap, &ypcb);
|
||||
switch(r) {
|
||||
switch (r) {
|
||||
case 0:
|
||||
break;
|
||||
case YPERR_YPBIND:
|
||||
|
@ -81,10 +81,10 @@ main(int argc, char *argv[])
|
||||
|
||||
notrans = key = 0;
|
||||
|
||||
while( (c=getopt(argc, argv, "xd:kt")) != -1)
|
||||
switch(c) {
|
||||
while ((c = getopt(argc, argv, "xd:kt")) != -1)
|
||||
switch (c) {
|
||||
case 'x':
|
||||
for(i=0; i<sizeof ypaliases/sizeof ypaliases[0]; i++)
|
||||
for (i = 0; i<sizeof ypaliases/sizeof ypaliases[0]; i++)
|
||||
printf("Use \"%s\" for \"%s\"\n",
|
||||
ypaliases[i].alias,
|
||||
ypaliases[i].name);
|
||||
@ -102,24 +102,24 @@ main(int argc, char *argv[])
|
||||
usage();
|
||||
}
|
||||
|
||||
if( (argc-optind) < 2 )
|
||||
if ((argc-optind) < 2)
|
||||
usage();
|
||||
|
||||
if (!domainname)
|
||||
yp_get_default_domain(&domainname);
|
||||
|
||||
inmap = argv[argc-1];
|
||||
for(i=0; (!notrans) && i<sizeof ypaliases/sizeof ypaliases[0]; i++)
|
||||
if( strcmp(inmap, ypaliases[i].alias) == 0)
|
||||
for (i = 0; (!notrans) && i<sizeof ypaliases/sizeof ypaliases[0]; i++)
|
||||
if (strcmp(inmap, ypaliases[i].alias) == 0)
|
||||
inmap = ypaliases[i].name;
|
||||
for(; optind < argc-1; optind++) {
|
||||
for (; optind < argc-1; optind++) {
|
||||
inkey = argv[optind];
|
||||
|
||||
r = yp_match(domainname, inmap, inkey,
|
||||
strlen(inkey), &outbuf, &outbuflen);
|
||||
switch(r) {
|
||||
switch (r) {
|
||||
case 0:
|
||||
if(key)
|
||||
if (key)
|
||||
printf("%s ", inkey);
|
||||
printf("%*.*s\n", outbuflen, outbuflen, outbuf);
|
||||
break;
|
||||
|
@ -102,25 +102,25 @@ bind_host(char *dom, struct sockaddr_in *lsin)
|
||||
tv.tv_sec = 15;
|
||||
tv.tv_usec = 0;
|
||||
client = clntudp_create(lsin, YPBINDPROG, YPBINDVERS, tv, &sock);
|
||||
if(client==NULL) {
|
||||
if (client == NULL) {
|
||||
warnx("can't clntudp_create: %s", yperr_string(YPERR_YPBIND));
|
||||
return YPERR_YPBIND;
|
||||
return (YPERR_YPBIND);
|
||||
}
|
||||
|
||||
tv.tv_sec = 5;
|
||||
tv.tv_usec = 0;
|
||||
r = clnt_call(client, YPBINDPROC_DOMAIN,
|
||||
xdr_domainname, &dom, xdr_ypbind_resp, &ypbr, tv);
|
||||
if( r != RPC_SUCCESS) {
|
||||
if (r != RPC_SUCCESS) {
|
||||
warnx("can't clnt_call: %s", yperr_string(YPERR_YPBIND));
|
||||
clnt_destroy(client);
|
||||
return YPERR_YPBIND;
|
||||
return (YPERR_YPBIND);
|
||||
} else {
|
||||
if (ypbr.ypbind_status != YPBIND_SUCC_VAL) {
|
||||
warnx("can't yp_bind: reason: %s",
|
||||
ypbinderr_string(ypbr.ypbind_resp_u.ypbind_error));
|
||||
clnt_destroy(client);
|
||||
return r;
|
||||
return (r);
|
||||
}
|
||||
}
|
||||
clnt_destroy(client);
|
||||
@ -132,7 +132,7 @@ bind_host(char *dom, struct sockaddr_in *lsin)
|
||||
printf("%s\n", hent->h_name);
|
||||
else
|
||||
printf("%s\n", inet_ntoa(ss_addr));
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
@ -148,10 +148,10 @@ main(int argc, char *argv[])
|
||||
u_int i;
|
||||
|
||||
getmap = notrans = mode = 0;
|
||||
while( (c=getopt(argc, argv, "xd:mt")) != -1)
|
||||
switch(c) {
|
||||
while ((c = getopt(argc, argv, "xd:mt")) != -1)
|
||||
switch (c) {
|
||||
case 'x':
|
||||
for(i=0; i<sizeof ypaliases/sizeof ypaliases[0]; i++)
|
||||
for (i = 0; i<sizeof ypaliases/sizeof ypaliases[0]; i++)
|
||||
printf("\"%s\" is an alias for \"%s\"\n",
|
||||
ypaliases[i].alias,
|
||||
ypaliases[i].name);
|
||||
@ -169,30 +169,30 @@ main(int argc, char *argv[])
|
||||
usage();
|
||||
}
|
||||
|
||||
if(!domnam)
|
||||
if (!domnam)
|
||||
yp_get_default_domain(&domnam);
|
||||
|
||||
if(mode==0) {
|
||||
switch(argc-optind) {
|
||||
if (mode == 0) {
|
||||
switch (argc-optind) {
|
||||
case 0:
|
||||
bzero(&lsin, sizeof lsin);
|
||||
lsin.sin_family = AF_INET;
|
||||
lsin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
||||
|
||||
if(bind_host(domnam, &lsin))
|
||||
if (bind_host(domnam, &lsin))
|
||||
exit(ERR_NOBINDING);
|
||||
break;
|
||||
case 1:
|
||||
bzero(&lsin, sizeof lsin);
|
||||
lsin.sin_family = AF_INET;
|
||||
if( (lsin.sin_addr.s_addr=inet_addr(argv[optind]))==-1) {
|
||||
if ((lsin.sin_addr.s_addr = inet_addr(argv[optind])) == -1) {
|
||||
hent = gethostbyname(argv[optind]);
|
||||
if(!hent)
|
||||
if (!hent)
|
||||
errx(ERR_NOSUCHHOST, "host %s unknown", argv[optind]);
|
||||
bcopy((char *)hent->h_addr_list[0],
|
||||
(char *)&lsin.sin_addr, sizeof lsin.sin_addr);
|
||||
}
|
||||
if(bind_host(domnam, &lsin))
|
||||
if (bind_host(domnam, &lsin))
|
||||
exit(ERR_NOBINDING);
|
||||
break;
|
||||
default:
|
||||
@ -201,16 +201,16 @@ main(int argc, char *argv[])
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if( argc-optind > 1)
|
||||
if (argc-optind > 1)
|
||||
usage();
|
||||
|
||||
if(argv[optind]) {
|
||||
if (argv[optind]) {
|
||||
map = argv[optind];
|
||||
for(i=0; (!notrans) && i<sizeof ypaliases/sizeof ypaliases[0]; i++)
|
||||
if( strcmp(map, ypaliases[i].alias) == 0)
|
||||
for (i = 0; (!notrans) && i<sizeof ypaliases/sizeof ypaliases[0]; i++)
|
||||
if (strcmp(map, ypaliases[i].alias) == 0)
|
||||
map = ypaliases[i].name;
|
||||
r = yp_master(domnam, map, &master);
|
||||
switch(r) {
|
||||
switch (r) {
|
||||
case 0:
|
||||
printf("%s\n", master);
|
||||
free(master);
|
||||
@ -226,12 +226,12 @@ main(int argc, char *argv[])
|
||||
|
||||
ypml = NULL;
|
||||
r = yp_maplist(domnam, &ypml);
|
||||
switch(r) {
|
||||
switch (r) {
|
||||
case 0:
|
||||
for(y=ypml; y; ) {
|
||||
for (y = ypml; y;) {
|
||||
ypml = y;
|
||||
r = yp_master(domnam, ypml->map, &master);
|
||||
switch(r) {
|
||||
switch (r) {
|
||||
case 0:
|
||||
printf("%s %s\n", ypml->map, master);
|
||||
free(master);
|
||||
|
@ -150,7 +150,7 @@ pw_mkdb(username)
|
||||
/* Temporarily turn off SIGCHLD catching */
|
||||
install_reaper(0);
|
||||
if (!(pid = vfork())) {
|
||||
if(!username) {
|
||||
if (!username) {
|
||||
execl(_PATH_PWD_MKDB, "pwd_mkdb", "-p", tempname,
|
||||
(char *)NULL);
|
||||
} else {
|
||||
|
@ -57,14 +57,14 @@
|
||||
|
||||
extern char *yp_dir;
|
||||
extern char *progname;
|
||||
extern void do_master __P(( void ));
|
||||
extern void yppasswdprog_1 __P(( struct svc_req *, register SVCXPRT * ));
|
||||
extern void master_yppasswdprog_1 __P(( struct svc_req *,
|
||||
register SVCXPRT * ));
|
||||
extern void reaper __P(( int ));
|
||||
extern void install_reaper __P(( int ));
|
||||
extern int pw_copy __P(( int, int, struct passwd * ));
|
||||
extern char *ok_shell __P (( char * ));
|
||||
extern void do_master(void);
|
||||
extern void yppasswdprog_1(struct svc_req *, register SVCXPRT *);
|
||||
extern void master_yppasswdprog_1 __P((struct svc_req *,
|
||||
register SVCXPRT *));
|
||||
extern void reaper(int);
|
||||
extern void install_reaper(int);
|
||||
extern int pw_copy(int, int, struct passwd *);
|
||||
extern char *ok_shell __P ((char *));
|
||||
extern char *passfile;
|
||||
extern char *passfile_default;
|
||||
extern char *tempname;
|
||||
@ -76,4 +76,4 @@ extern int multidomain;
|
||||
extern int resvport;
|
||||
extern int inplace;
|
||||
extern int verbose;
|
||||
extern int _rpc_dtablesize __P((void));
|
||||
extern int _rpc_dtablesize(void);
|
||||
|
@ -169,7 +169,7 @@ main(argc, argv)
|
||||
debug = 1;
|
||||
|
||||
while ((ch = getopt(argc, argv, "t:d:p:sfamuivh")) != -1) {
|
||||
switch(ch) {
|
||||
switch (ch) {
|
||||
case 't':
|
||||
passfile_default = optarg;
|
||||
break;
|
||||
|
@ -76,7 +76,7 @@ void reaper(sig)
|
||||
|
||||
if (sig > 0) {
|
||||
if (sig == SIGCHLD)
|
||||
while(wait3(&st, WNOHANG, NULL) > 0) ;
|
||||
while (wait3(&st, WNOHANG, NULL) > 0) ;
|
||||
} else {
|
||||
pid = waitpid(pid, &pstat, 0);
|
||||
}
|
||||
@ -538,7 +538,7 @@ yppasswdproc_update_1_svc(yppasswd *argp, struct svc_req *rqstp)
|
||||
key.data = argp->newpw.pw_name;
|
||||
key.size = strlen(argp->newpw.pw_name);
|
||||
|
||||
if ((rval=yp_get_record(domain,"master.passwd.byname",
|
||||
if ((rval = yp_get_record(domain,"master.passwd.byname",
|
||||
&key, &data, 0)) != YP_TRUE) {
|
||||
if (rval == YP_NOKEY) {
|
||||
yp_error("user %s not found in passwd database",
|
||||
@ -642,7 +642,7 @@ cleaning up and bailing out");
|
||||
}
|
||||
}
|
||||
|
||||
switch((pid = fork())) {
|
||||
switch ((pid = fork())) {
|
||||
case 0:
|
||||
if (inplace && !rval) {
|
||||
execlp(MAP_UPDATE_PATH, MAP_UPDATE, passfile,
|
||||
@ -828,7 +828,7 @@ cleaning up and bailing out");
|
||||
}
|
||||
}
|
||||
|
||||
switch((pid = fork())) {
|
||||
switch ((pid = fork())) {
|
||||
case 0:
|
||||
if (inplace && !rval) {
|
||||
execlp(MAP_UPDATE_PATH, MAP_UPDATE, passfile,
|
||||
|
@ -78,7 +78,7 @@ static char PKFILE[] = "/etc/publickey";
|
||||
#endif /* YP */
|
||||
|
||||
#ifdef YP
|
||||
static int _openchild __P(( char *, FILE **, FILE ** ));
|
||||
static int _openchild(char *, FILE **, FILE **);
|
||||
|
||||
/*
|
||||
* Determine if requester is allowed to update the given map,
|
||||
@ -247,7 +247,7 @@ basename(path)
|
||||
extern char *malloc();
|
||||
#endif
|
||||
|
||||
static int match __P(( char * , char * ));
|
||||
static int match(char *, char *);
|
||||
|
||||
/*
|
||||
* Determine if requester is allowed to update the given map,
|
||||
|
@ -55,7 +55,7 @@ int yp_del_record(dbp,key)
|
||||
int rval;
|
||||
|
||||
if ((rval = (dbp->del)(dbp,key,0))) {
|
||||
switch(rval) {
|
||||
switch (rval) {
|
||||
case 1:
|
||||
return(YP_FALSE);
|
||||
break;
|
||||
|
@ -55,7 +55,7 @@ static int yp_domake(map, domain)
|
||||
{
|
||||
int pid;
|
||||
|
||||
switch((pid = fork())) {
|
||||
switch ((pid = fork())) {
|
||||
case 0:
|
||||
execlp(MAP_UPDATE_PATH, MAP_UPDATE, map, domain, (char *)NULL);
|
||||
yp_error("couldn't exec map update process: %s",
|
||||
@ -104,7 +104,7 @@ int ypmap_update(netname, map, op, keylen, keyval, datlen, datval)
|
||||
data.data = datval;
|
||||
data.size = datlen;
|
||||
|
||||
switch(op) {
|
||||
switch (op) {
|
||||
case YPOP_DELETE: /* delete this entry */
|
||||
rval = yp_del_record(dbp, &key);
|
||||
if (rval == YP_TRUE)
|
||||
|
@ -24,7 +24,7 @@
|
||||
#define MAP_UPDATE_PATH YPLIBDIR MAP_UPDATE
|
||||
|
||||
extern int children;
|
||||
extern void ypu_prog_1 __P(( struct svc_req *, register SVCXPRT * ));
|
||||
extern int localupdate __P(( char *, char *, u_int, u_int, char *, u_int, char * ));
|
||||
extern int ypmap_update __P(( char *, char *, u_int, u_int, char *, u_int, char * ));
|
||||
extern int yp_del_record __P(( DB *, DBT * ));
|
||||
extern void ypu_prog_1(struct svc_req *, register SVCXPRT *);
|
||||
extern int localupdate(char *, char *, u_int, u_int, char *, u_int, char *);
|
||||
extern int ypmap_update(char *, char *, u_int, u_int, char *, u_int, char *);
|
||||
extern int yp_del_record(DB *, DBT *);
|
||||
|
@ -197,7 +197,7 @@ main(argc, argv)
|
||||
int ch;
|
||||
|
||||
while ((ch = getopt(argc, argv, "p:h")) != -1) {
|
||||
switch(ch) {
|
||||
switch (ch) {
|
||||
case 'p':
|
||||
yp_dir = optarg;
|
||||
break;
|
||||
|
@ -42,9 +42,9 @@
|
||||
|
||||
extern int forked;
|
||||
extern int children;
|
||||
extern void load_securenets __P(( void ));
|
||||
extern void yp_error __P((const char *, ...));
|
||||
extern int yp_access __P((const char *, const struct svc_req * ));
|
||||
extern int yp_validdomain __P((const char * ));
|
||||
extern void load_securenets(void);
|
||||
extern void yp_error(const char *, ...);
|
||||
extern int yp_access(const char *, const struct svc_req *);
|
||||
extern int yp_validdomain(const char *);
|
||||
extern char *yp_dir;
|
||||
extern void ypxfrd_freebsd_prog_1 __P(( struct svc_req *, register SVCXPRT * ));
|
||||
extern void ypxfrd_freebsd_prog_1(struct svc_req *, register SVCXPRT *);
|
||||
|
@ -204,7 +204,7 @@ main(argc, argv)
|
||||
int ch;
|
||||
|
||||
while ((ch = getopt(argc, argv, "p:h")) != -1) {
|
||||
switch(ch) {
|
||||
switch (ch) {
|
||||
case 'p':
|
||||
yp_dir = optarg;
|
||||
break;
|
||||
|
@ -58,7 +58,7 @@ xdr_my_xfr(register XDR *xdrs, xfr *objp)
|
||||
{
|
||||
unsigned char buf[XFRBLOCKSIZE];
|
||||
|
||||
while(1) {
|
||||
while (1) {
|
||||
if ((objp->xfr_u.xfrblock_buf.xfrblock_buf_len =
|
||||
read(fp, &buf, XFRBLOCKSIZE)) != -1) {
|
||||
objp->ok = TRUE;
|
||||
|
@ -88,7 +88,7 @@ static void unwind(map)
|
||||
err(1, "open_db(%s) failed", map);
|
||||
|
||||
key.data = NULL;
|
||||
while(yp_next_record(dbp, &key, &data, 1, 1) == YP_TRUE)
|
||||
while (yp_next_record(dbp, &key, &data, 1, 1) == YP_TRUE)
|
||||
printf("%.*s %.*s\n", key.size,key.data,data.size,data.data);
|
||||
|
||||
(void)(dbp->close)(dbp);
|
||||
@ -119,7 +119,7 @@ int main (argc, argv)
|
||||
char hname[MAXHOSTNAMELEN + 2];
|
||||
|
||||
while ((ch = getopt(argc, argv, "uhcbsfd:i:o:m:")) != -1) {
|
||||
switch(ch) {
|
||||
switch (ch) {
|
||||
case 'f':
|
||||
filter_plusminus++;
|
||||
break;
|
||||
@ -250,7 +250,7 @@ int main (argc, argv)
|
||||
yp_put_record(dbp, &key, &data, 0);
|
||||
}
|
||||
|
||||
while(fgets((char *)&buf, sizeof(buf), ifp)) {
|
||||
while (fgets((char *)&buf, sizeof(buf), ifp)) {
|
||||
char *sep = NULL;
|
||||
int rval;
|
||||
|
||||
@ -259,7 +259,7 @@ int main (argc, argv)
|
||||
*sep = '\0';
|
||||
|
||||
/* handle backslash line continuations */
|
||||
while(buf[strlen(buf) - 1] == '\\') {
|
||||
while (buf[strlen(buf) - 1] == '\\') {
|
||||
fgets((char *)&buf[strlen(buf) - 1],
|
||||
sizeof(buf) - strlen(buf), ifp);
|
||||
if ((sep = strchr(buf, '\n')))
|
||||
@ -312,7 +312,7 @@ int main (argc, argv)
|
||||
data.size = strlen(datbuf);
|
||||
|
||||
if ((rval = yp_put_record(dbp, &key, &data, 0)) != YP_TRUE) {
|
||||
switch(rval) {
|
||||
switch (rval) {
|
||||
case YP_FALSE:
|
||||
warnx("duplicate key '%s' - skipping", keybuf);
|
||||
break;
|
||||
|
@ -235,7 +235,7 @@ int __yp_ping(restricted_addrs, cnt, dom, port)
|
||||
char *dom;
|
||||
short *port;
|
||||
{
|
||||
struct timeval tv = { 5 , 0 };
|
||||
struct timeval tv = { 5, 0 };
|
||||
struct ping_req **reqs;
|
||||
unsigned long i;
|
||||
int async;
|
||||
|
@ -1 +1,5 @@
|
||||
extern int __yp_ping __P(( struct in_addr *, int, char *, short * ));
|
||||
/*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
extern int __yp_ping(struct in_addr *, int, char *, short *);
|
||||
|
@ -95,18 +95,18 @@ extern bool_t xdr_domainname(), xdr_ypbind_resp();
|
||||
extern bool_t xdr_ypreq_key(), xdr_ypresp_val();
|
||||
extern bool_t xdr_ypbind_setdom();
|
||||
|
||||
void checkwork __P((void));
|
||||
void *ypbindproc_null_2_yp __P((SVCXPRT *, void *, CLIENT *));
|
||||
void *ypbindproc_setdom_2_yp __P((SVCXPRT *, struct ypbind_setdom *, CLIENT *));
|
||||
void rpc_received __P((char *, struct sockaddr_in *, int ));
|
||||
void broadcast __P((struct _dom_binding *));
|
||||
int ping __P((struct _dom_binding *));
|
||||
int tell_parent __P((char *, struct sockaddr_in *));
|
||||
void handle_children __P(( struct _dom_binding * ));
|
||||
void reaper __P((int));
|
||||
void terminate __P((int));
|
||||
void yp_restricted_mode __P((char *));
|
||||
int verify __P((struct in_addr));
|
||||
void checkwork(void);
|
||||
void *ypbindproc_null_2_yp(SVCXPRT *, void *, CLIENT *);
|
||||
void *ypbindproc_setdom_2_yp(SVCXPRT *, struct ypbind_setdom *, CLIENT *);
|
||||
void rpc_received(char *, struct sockaddr_in *, int);
|
||||
void broadcast(struct _dom_binding *);
|
||||
int ping(struct _dom_binding *);
|
||||
int tell_parent(char *, struct sockaddr_in *);
|
||||
void handle_children(struct _dom_binding *);
|
||||
void reaper(int);
|
||||
void terminate(int);
|
||||
void yp_restricted_mode(char *);
|
||||
int verify(struct in_addr);
|
||||
|
||||
char *domain_name;
|
||||
struct _dom_binding *ypbindlist;
|
||||
@ -187,28 +187,28 @@ rejecting.", *argp);
|
||||
return(&res);
|
||||
}
|
||||
|
||||
for(ypdb=ypbindlist; ypdb; ypdb=ypdb->dom_pnext) {
|
||||
if( strcmp(ypdb->dom_domain, *argp) == 0)
|
||||
for (ypdb = ypbindlist; ypdb; ypdb = ypdb->dom_pnext) {
|
||||
if (strcmp(ypdb->dom_domain, *argp) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if(ypdb==NULL) {
|
||||
if (ypdb == NULL) {
|
||||
if (yp_restricted) {
|
||||
syslog(LOG_NOTICE, "Running in restricted mode -- request to bind domain \"%s\" rejected.\n", *argp);
|
||||
return &res;
|
||||
return (&res);
|
||||
}
|
||||
|
||||
if (domains >= MAX_DOMAINS) {
|
||||
syslog(LOG_WARNING, "domain limit (%d) exceeded",
|
||||
MAX_DOMAINS);
|
||||
res.ypbind_resp_u.ypbind_error = YPBIND_ERR_RESC;
|
||||
return &res;
|
||||
return (&res);
|
||||
}
|
||||
ypdb = (struct _dom_binding *)malloc(sizeof *ypdb);
|
||||
if (ypdb == NULL) {
|
||||
syslog(LOG_WARNING, "malloc: %m");
|
||||
res.ypbind_resp_u.ypbind_error = YPBIND_ERR_RESC;
|
||||
return &res;
|
||||
return (&res);
|
||||
}
|
||||
bzero((char *)ypdb, sizeof *ypdb);
|
||||
strncpy(ypdb->dom_domain, *argp, sizeof ypdb->dom_domain);
|
||||
@ -225,7 +225,7 @@ rejecting.", *argp);
|
||||
}
|
||||
|
||||
if (ping(ypdb)) {
|
||||
return &res;
|
||||
return (&res);
|
||||
}
|
||||
|
||||
res.ypbind_status = YPBIND_SUCC_VAL;
|
||||
@ -237,7 +237,7 @@ rejecting.", *argp);
|
||||
/*printf("domain %s at %s/%d\n", ypdb->dom_domain,
|
||||
inet_ntoa(ypdb->dom_server_addr.sin_addr),
|
||||
ntohs(ypdb->dom_server_addr.sin_port));*/
|
||||
return &res;
|
||||
return (&res);
|
||||
}
|
||||
|
||||
void *
|
||||
@ -256,9 +256,9 @@ rejecting.", argp->ypsetdom_domain);
|
||||
}
|
||||
fromsin = svc_getcaller(transp);
|
||||
|
||||
switch(ypsetmode) {
|
||||
switch (ypsetmode) {
|
||||
case YPSET_LOCAL:
|
||||
if( fromsin->sin_addr.s_addr != htonl(INADDR_LOOPBACK)) {
|
||||
if (fromsin->sin_addr.s_addr != htonl(INADDR_LOOPBACK)) {
|
||||
svcerr_noprog(transp);
|
||||
return(NULL);
|
||||
}
|
||||
@ -271,12 +271,12 @@ rejecting.", argp->ypsetdom_domain);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
if(ntohs(fromsin->sin_port) >= IPPORT_RESERVED) {
|
||||
if (ntohs(fromsin->sin_port) >= IPPORT_RESERVED) {
|
||||
svcerr_noprog(transp);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
if(argp->ypsetdom_vers != YPVERS) {
|
||||
if (argp->ypsetdom_vers != YPVERS) {
|
||||
svcerr_noprog(transp);
|
||||
return(NULL);
|
||||
}
|
||||
@ -318,10 +318,10 @@ register SVCXPRT *transp;
|
||||
break;
|
||||
|
||||
case YPBINDPROC_SETDOM:
|
||||
switch(rqstp->rq_cred.oa_flavor) {
|
||||
switch (rqstp->rq_cred.oa_flavor) {
|
||||
case AUTH_UNIX:
|
||||
creds = (struct authunix_parms *)rqstp->rq_clntcred;
|
||||
if( creds->aup_uid != 0) {
|
||||
if (creds->aup_uid != 0) {
|
||||
svcerr_auth(transp, AUTH_BADCRED);
|
||||
return;
|
||||
}
|
||||
@ -358,7 +358,7 @@ int sig;
|
||||
{
|
||||
int st;
|
||||
|
||||
while(wait3(&st, WNOHANG, NULL) > 0)
|
||||
while (wait3(&st, WNOHANG, NULL) > 0)
|
||||
children--;
|
||||
}
|
||||
|
||||
@ -371,7 +371,7 @@ int sig;
|
||||
if (ppid != getpid())
|
||||
exit(0);
|
||||
|
||||
for(ypdb=ypbindlist; ypdb; ypdb=ypdb->dom_pnext) {
|
||||
for (ypdb = ypbindlist; ypdb; ypdb = ypdb->dom_pnext) {
|
||||
close(ypdb->dom_lockfd);
|
||||
if (ypdb->dom_broadcast_pid)
|
||||
kill(ypdb->dom_broadcast_pid, SIGINT);
|
||||
@ -400,16 +400,16 @@ char **argv;
|
||||
if ((yplockfd = (open(YPBINDLOCK, O_RDONLY|O_CREAT, 0444))) == -1)
|
||||
err(1, "%s", YPBINDLOCK);
|
||||
|
||||
if(flock(yplockfd, LOCK_EX|LOCK_NB) == -1 && errno == EWOULDBLOCK)
|
||||
if (flock(yplockfd, LOCK_EX|LOCK_NB) == -1 && errno == EWOULDBLOCK)
|
||||
errx(1, "another ypbind is already running. Aborting");
|
||||
|
||||
/* XXX domainname will be overriden if we use restricted mode */
|
||||
yp_get_default_domain(&domain_name);
|
||||
if( domain_name[0] == '\0')
|
||||
if (domain_name[0] == '\0')
|
||||
errx(1, "domainname not set. Aborting");
|
||||
|
||||
for(i=1; i<argc; i++) {
|
||||
if( strcmp("-ypset", argv[i]) == 0)
|
||||
for (i = 1; i<argc; i++) {
|
||||
if (strcmp("-ypset", argv[i]) == 0)
|
||||
ypsetmode = YPSET_ALL;
|
||||
else if (strcmp("-ypsetme", argv[i]) == 0)
|
||||
ypsetmode = YPSET_LOCAL;
|
||||
@ -480,13 +480,13 @@ char **argv;
|
||||
/* Kick off the default domain */
|
||||
broadcast(ypbindlist);
|
||||
|
||||
while(1) {
|
||||
while (1) {
|
||||
fdsr = svc_fdset;
|
||||
|
||||
tv.tv_sec = 60;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
switch(select(_rpc_dtablesize(), &fdsr, NULL, NULL, &tv)) {
|
||||
switch (select(_rpc_dtablesize(), &fdsr, NULL, NULL, &tv)) {
|
||||
case 0:
|
||||
checkwork();
|
||||
break;
|
||||
@ -495,7 +495,7 @@ char **argv;
|
||||
syslog(LOG_WARNING, "select: %m");
|
||||
break;
|
||||
default:
|
||||
for(ypdb=ypbindlist; ypdb; ypdb=next) {
|
||||
for (ypdb = ypbindlist; ypdb; ypdb = next) {
|
||||
next = ypdb->dom_pnext;
|
||||
if (READFD > 0 && FD_ISSET(READFD, &fdsr)) {
|
||||
handle_children(ypdb);
|
||||
@ -517,7 +517,7 @@ checkwork()
|
||||
{
|
||||
struct _dom_binding *ypdb;
|
||||
|
||||
for(ypdb=ypbindlist; ypdb; ypdb=ypdb->dom_pnext)
|
||||
for (ypdb = ypbindlist; ypdb; ypdb = ypdb->dom_pnext)
|
||||
ping(ypdb);
|
||||
}
|
||||
|
||||
@ -555,12 +555,12 @@ struct _dom_binding *ypdb;
|
||||
if (d > 0 && a > 0)
|
||||
rpc_received((char *)&buf, &addr, 0);
|
||||
else {
|
||||
for(y=ypbindlist; y; y=y->dom_pnext) {
|
||||
for (y = ypbindlist; y; y = y->dom_pnext) {
|
||||
if (y == ypdb)
|
||||
break;
|
||||
prev = y;
|
||||
}
|
||||
switch(ypdb->dom_default) {
|
||||
switch (ypdb->dom_default) {
|
||||
case 0:
|
||||
if (prev == NULL)
|
||||
ypbindlist = y->dom_pnext;
|
||||
@ -633,17 +633,17 @@ struct sockaddr_in *addr;
|
||||
bzero((char *)addr, sizeof(struct sockaddr_in));
|
||||
if (tell_parent(broad_domain->dom_domain, addr))
|
||||
syslog(LOG_WARNING, "lost connection to parent");
|
||||
return TRUE;
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
if (yp_restricted && verify(addr->sin_addr)) {
|
||||
retries++;
|
||||
syslog(LOG_NOTICE, "NIS server at %s not in restricted mode access list -- rejecting.\n",inet_ntoa(addr->sin_addr));
|
||||
return FALSE;
|
||||
return (FALSE);
|
||||
} else {
|
||||
if (tell_parent(broad_domain->dom_domain, addr))
|
||||
syslog(LOG_WARNING, "lost connection to parent");
|
||||
return TRUE;
|
||||
return (TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -679,7 +679,7 @@ struct _dom_binding *ypdb;
|
||||
broad_domain = ypdb;
|
||||
flock(ypdb->dom_lockfd, LOCK_UN);
|
||||
|
||||
switch((ypdb->dom_broadcast_pid = fork())) {
|
||||
switch ((ypdb->dom_broadcast_pid = fork())) {
|
||||
case 0:
|
||||
close(READFD);
|
||||
signal(SIGCHLD, SIG_DFL);
|
||||
@ -698,7 +698,7 @@ struct _dom_binding *ypdb;
|
||||
}
|
||||
|
||||
/* Release all locks before doing anything else. */
|
||||
while(ypbindlist) {
|
||||
while (ypbindlist) {
|
||||
close(ypbindlist->dom_lockfd);
|
||||
ypbindlist = ypbindlist->dom_pnext;
|
||||
}
|
||||
@ -833,11 +833,11 @@ int force;
|
||||
/*printf("returned from %s/%d about %s\n", inet_ntoa(raddrp->sin_addr),
|
||||
ntohs(raddrp->sin_port), dom);*/
|
||||
|
||||
if(dom==NULL)
|
||||
if (dom == NULL)
|
||||
return;
|
||||
|
||||
for(ypdb=ypbindlist; ypdb; ypdb=ypdb->dom_pnext) {
|
||||
if( strcmp(ypdb->dom_domain, dom) == 0)
|
||||
for (ypdb = ypbindlist; ypdb; ypdb = ypdb->dom_pnext) {
|
||||
if (strcmp(ypdb->dom_domain, dom) == 0)
|
||||
break;
|
||||
prev = ypdb;
|
||||
}
|
||||
@ -865,7 +865,7 @@ int force;
|
||||
}
|
||||
|
||||
if (raddrp->sin_addr.s_addr == (long)0) {
|
||||
switch(ypdb->dom_default) {
|
||||
switch (ypdb->dom_default) {
|
||||
case 0:
|
||||
if (prev == NULL)
|
||||
ypbindlist = ypdb->dom_pnext;
|
||||
@ -888,7 +888,7 @@ int force;
|
||||
}
|
||||
}
|
||||
|
||||
if(ypdb==NULL) {
|
||||
if (ypdb == NULL) {
|
||||
if (force == 0)
|
||||
return;
|
||||
ypdb = (struct _dom_binding *)malloc(sizeof *ypdb);
|
||||
@ -916,21 +916,21 @@ int force;
|
||||
ypdb->dom_alive = 1;
|
||||
ypdb->dom_broadcast_pid = 0;
|
||||
|
||||
if(ypdb->dom_lockfd != -1)
|
||||
if (ypdb->dom_lockfd != -1)
|
||||
close(ypdb->dom_lockfd);
|
||||
|
||||
sprintf(path, "%s/%s.%ld", BINDINGDIR,
|
||||
ypdb->dom_domain, ypdb->dom_vers);
|
||||
#ifdef O_SHLOCK
|
||||
if( (fd=open(path, O_CREAT|O_SHLOCK|O_RDWR|O_TRUNC, 0644)) == -1) {
|
||||
if ((fd = open(path, O_CREAT|O_SHLOCK|O_RDWR|O_TRUNC, 0644)) == -1) {
|
||||
(void)mkdir(BINDINGDIR, 0755);
|
||||
if( (fd=open(path, O_CREAT|O_SHLOCK|O_RDWR|O_TRUNC, 0644)) == -1)
|
||||
if ((fd = open(path, O_CREAT|O_SHLOCK|O_RDWR|O_TRUNC, 0644)) == -1)
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if( (fd=open(path, O_CREAT|O_RDWR|O_TRUNC, 0644)) == -1) {
|
||||
if ((fd = open(path, O_CREAT|O_RDWR|O_TRUNC, 0644)) == -1) {
|
||||
(void)mkdir(BINDINGDIR, 0755);
|
||||
if( (fd=open(path, O_CREAT|O_RDWR|O_TRUNC, 0644)) == -1)
|
||||
if ((fd = open(path, O_CREAT|O_RDWR|O_TRUNC, 0644)) == -1)
|
||||
return;
|
||||
}
|
||||
flock(fd, LOCK_SH);
|
||||
@ -952,7 +952,7 @@ int force;
|
||||
*(u_int32_t *)&ybr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr = raddrp->sin_addr.s_addr;
|
||||
*(u_short *)&ybr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port = raddrp->sin_port;
|
||||
|
||||
if( writev(ypdb->dom_lockfd, iov, 2) != iov[0].iov_len + iov[1].iov_len) {
|
||||
if (writev(ypdb->dom_lockfd, iov, 2) != iov[0].iov_len + iov[1].iov_len) {
|
||||
syslog(LOG_WARNING, "write: %m");
|
||||
close(ypdb->dom_lockfd);
|
||||
ypdb->dom_lockfd = -1;
|
||||
|
@ -67,8 +67,8 @@ char **argv;
|
||||
|
||||
yp_get_default_domain(&domainname);
|
||||
|
||||
while( (c=getopt(argc, argv, "h:d:")) != -1)
|
||||
switch(c) {
|
||||
while ((c = getopt(argc, argv, "h:d:")) != -1)
|
||||
switch (c) {
|
||||
case 'd':
|
||||
domainname = optarg;
|
||||
break;
|
||||
@ -80,7 +80,7 @@ char **argv;
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
if(optind + 1 != argc )
|
||||
if (optind + 1 != argc)
|
||||
usage();
|
||||
|
||||
inmap = argv[optind];
|
||||
|
@ -40,5 +40,5 @@
|
||||
#ifndef YPPUSH_RESPONSE_TIMEOUT
|
||||
#define YPPUSH_RESPONSE_TIMEOUT 5*60
|
||||
#endif
|
||||
extern int _rpc_dtablesize __P((void));
|
||||
extern void yppush_xfrrespprog_1 __P(( struct svc_req *, SVCXPRT * ));
|
||||
extern int _rpc_dtablesize(void);
|
||||
extern void yppush_xfrrespprog_1(struct svc_req *, SVCXPRT *);
|
||||
|
@ -91,7 +91,7 @@ struct jobs *yppush_joblist; /* Linked list of running jobs. */
|
||||
static char *yppusherr_string(err)
|
||||
int err;
|
||||
{
|
||||
switch(err) {
|
||||
switch (err) {
|
||||
case YPPUSH_TIMEDOUT: return("transfer or callback timed out");
|
||||
case YPPUSH_YPSERV: return("failed to contact ypserv");
|
||||
case YPPUSH_NOHOST: return("no such host");
|
||||
@ -111,7 +111,7 @@ static int yppush_show_status(status, tid)
|
||||
|
||||
job = yppush_joblist;
|
||||
|
||||
while(job) {
|
||||
while (job) {
|
||||
if (job->tid == tid)
|
||||
break;
|
||||
job = job->next;
|
||||
@ -149,7 +149,7 @@ static void yppush_exit(now)
|
||||
int still_pending = 1;
|
||||
|
||||
/* Let all the information trickle in. */
|
||||
while(!now && still_pending) {
|
||||
while (!now && still_pending) {
|
||||
jptr = yppush_joblist;
|
||||
still_pending = 0;
|
||||
while (jptr) {
|
||||
@ -188,7 +188,7 @@ static void yppush_exit(now)
|
||||
|
||||
/* All stats collected and reported -- kill all the stragglers. */
|
||||
jptr = yppush_joblist;
|
||||
while(jptr) {
|
||||
while (jptr) {
|
||||
if (!jptr->polled)
|
||||
yp_error("warning: exiting with transfer \
|
||||
to %s (transid = %lu) still pending", jptr->server, jptr->tid);
|
||||
@ -340,7 +340,7 @@ static int yppush_send_xfr(job)
|
||||
if ((clnt = clnt_create(job->server, YPPROG, YPVERS, "udp")) == NULL) {
|
||||
yp_error("%s: %s",job->server,clnt_spcreateerror("couldn't \
|
||||
create udp handle to NIS server"));
|
||||
switch(rpc_createerr.cf_stat) {
|
||||
switch (rpc_createerr.cf_stat) {
|
||||
case RPC_UNKNOWNHOST:
|
||||
job->stat = YPPUSH_NOHOST;
|
||||
break;
|
||||
@ -546,7 +546,7 @@ main(argc,argv)
|
||||
struct sigaction sa;
|
||||
|
||||
while ((ch = getopt(argc, argv, "d:j:p:h:t:v")) != -1) {
|
||||
switch(ch) {
|
||||
switch (ch) {
|
||||
case 'd':
|
||||
yppush_domain = optarg;
|
||||
break;
|
||||
@ -664,7 +664,7 @@ main(argc,argv)
|
||||
* kick off the transfers by hand.
|
||||
*/
|
||||
tmp = yppush_hostlist;
|
||||
while(tmp) {
|
||||
while (tmp) {
|
||||
yppush_foreach(YP_TRUE, NULL, 0, tmp->name,
|
||||
strlen(tmp->name));
|
||||
tmp = tmp->next;
|
||||
|
@ -74,7 +74,7 @@ char *yp_procs[] = { "ypoldproc_null",
|
||||
"badproc3", /* placeholder */
|
||||
|
||||
/* NIS v2 */
|
||||
"ypproc_null" ,
|
||||
"ypproc_null",
|
||||
"ypproc_domain",
|
||||
"ypproc_domain_nonack",
|
||||
"ypproc_match",
|
||||
@ -121,7 +121,7 @@ void load_securenets()
|
||||
* the list; free the existing list before re-reading the
|
||||
* securenets file.
|
||||
*/
|
||||
while(securenets) {
|
||||
while (securenets) {
|
||||
tmp = securenets->next;
|
||||
free(securenets);
|
||||
securenets = tmp;
|
||||
@ -144,7 +144,7 @@ void load_securenets()
|
||||
|
||||
securenets = NULL;
|
||||
|
||||
while(fgets(linebuf, LINEBUFSZ, fp)) {
|
||||
while (fgets(linebuf, LINEBUFSZ, fp)) {
|
||||
char addr1[20], addr2[20];
|
||||
|
||||
if ((linebuf[0] == '#')
|
||||
@ -280,7 +280,7 @@ not privileged", map, inet_ntoa(rqhost->sin_addr), ntohs(rqhost->sin_port));
|
||||
inet_ntoa(rqhost->sin_addr), "");
|
||||
#else
|
||||
tmp = securenets;
|
||||
while(tmp) {
|
||||
while (tmp) {
|
||||
if (((rqhost->sin_addr.s_addr & ~tmp->mask.s_addr)
|
||||
| tmp->net.s_addr) == rqhost->sin_addr.s_addr) {
|
||||
status = 1;
|
||||
|
@ -181,7 +181,7 @@ void yp_flush_all()
|
||||
{
|
||||
register struct circleq_entry *qptr;
|
||||
|
||||
while(!TAILQ_EMPTY(&qhead)) {
|
||||
while (!TAILQ_EMPTY(&qhead)) {
|
||||
qptr = TAILQ_FIRST(&qhead); /* save this */
|
||||
TAILQ_REMOVE(&qhead, qptr, links);
|
||||
yp_free_qent(qptr);
|
||||
@ -415,7 +415,7 @@ DB *yp_open_db(domain, map)
|
||||
dbp = dbopen(buf,O_RDONLY, PERM_SECURE, DB_HASH, NULL);
|
||||
|
||||
if (dbp == NULL) {
|
||||
switch(errno) {
|
||||
switch (errno) {
|
||||
#ifdef DB_CACHE
|
||||
case ENFILE:
|
||||
/*
|
||||
|
@ -103,7 +103,7 @@ static char *parse(hp)
|
||||
#define BY_DNS_ID 1
|
||||
#define BY_RPC_XID 2
|
||||
|
||||
extern struct hostent *__dns_getanswer __P((char *, int, char *, int));
|
||||
extern struct hostent *__dns_getanswer(char *, int, char *, int);
|
||||
|
||||
static TAILQ_HEAD(dns_qhead, circleq_dnsentry) qhead;
|
||||
|
||||
@ -202,7 +202,7 @@ static struct circleq_dnsentry *yp_find_dnsqent(id, type)
|
||||
register struct circleq_dnsentry *q;
|
||||
|
||||
TAILQ_FOREACH(q, &qhead, links) {
|
||||
switch(type) {
|
||||
switch (type) {
|
||||
case BY_RPC_XID:
|
||||
if (id == q->xid)
|
||||
return(q);
|
||||
@ -232,7 +232,7 @@ static void yp_send_dns_reply(q, buf)
|
||||
* Set up correct reply struct and
|
||||
* XDR filter depending on ypvers.
|
||||
*/
|
||||
switch(q->ypvers) {
|
||||
switch (q->ypvers) {
|
||||
case YPVERS:
|
||||
bzero((char *)&result_v2, sizeof(result_v2));
|
||||
|
||||
@ -319,7 +319,7 @@ void yp_prune_dnsq()
|
||||
register struct circleq_dnsentry *q, *n;
|
||||
|
||||
q = TAILQ_FIRST(&qhead);
|
||||
while(q != NULL) {
|
||||
while (q != NULL) {
|
||||
q->ttl--;
|
||||
n = TAILQ_NEXT(q, links);
|
||||
if (!q->ttl) {
|
||||
|
@ -71,45 +71,45 @@ extern char *yp_dir;
|
||||
extern pid_t yp_pid;
|
||||
|
||||
extern enum ypstat yp_errno;
|
||||
extern void yp_error __P((const char *, ...)) __printflike(1, 2);
|
||||
extern void yp_error(const char *, ...) __printflike(1, 2);
|
||||
#ifdef DB_CACHE
|
||||
extern int yp_get_record __P(( DB *, const DBT *, DBT *, int));
|
||||
extern int yp_get_record(DB *, const DBT *, DBT *, int);
|
||||
#else
|
||||
extern int yp_get_record __P(( const char *, const char *, const DBT *, DBT *, int));
|
||||
extern int yp_get_record(const char *, const char *, const DBT *, DBT *, int);
|
||||
#endif
|
||||
extern int yp_first_record __P((const DB *, DBT *, DBT *, int));
|
||||
extern int yp_next_record __P((const DB *, DBT *, DBT *, int, int));
|
||||
extern char *yp_dnsname __P(( char * ));
|
||||
extern char *yp_dnsaddr __P(( const char * ));
|
||||
extern int yp_first_record(const DB *, DBT *, DBT *, int);
|
||||
extern int yp_next_record(const DB *, DBT *, DBT *, int, int);
|
||||
extern char *yp_dnsname(char *);
|
||||
extern char *yp_dnsaddr(const char *);
|
||||
#ifdef DB_CACHE
|
||||
extern int yp_access __P((const char *, const char *, const struct svc_req * ));
|
||||
extern int yp_access(const char *, const char *, const struct svc_req *);
|
||||
#else
|
||||
extern int yp_access __P((const char *, const struct svc_req * ));
|
||||
extern int yp_access(const char *, const struct svc_req *);
|
||||
#endif
|
||||
extern int yp_validdomain __P((const char * ));
|
||||
extern DB *yp_open_db __P(( const char *, const char *));
|
||||
extern DB *yp_open_db_cache __P(( const char *, const char *, const char *, int ));
|
||||
extern void yp_flush_all __P(( void ));
|
||||
extern void yp_init_dbs __P(( void ));
|
||||
extern int yp_testflag __P(( char *, char *, int ));
|
||||
extern void load_securenets __P(( void ));
|
||||
extern int yp_validdomain(const char *);
|
||||
extern DB *yp_open_db(const char *, const char *);
|
||||
extern DB *yp_open_db_cache(const char *, const char *, const char *, int);
|
||||
extern void yp_flush_all(void);
|
||||
extern void yp_init_dbs(void);
|
||||
extern int yp_testflag(char *, char *, int);
|
||||
extern void load_securenets(void);
|
||||
|
||||
#ifdef DB_CACHE
|
||||
extern ypstat yp_select_map __P(( char *, char *, keydat *, int ));
|
||||
extern ypstat yp_getbykey __P(( keydat *, valdat * ));
|
||||
extern ypstat yp_firstbykey __P(( keydat *, valdat * ));
|
||||
extern ypstat yp_nextbykey __P(( keydat *, valdat * ));
|
||||
extern ypstat yp_select_map(char *, char *, keydat *, int);
|
||||
extern ypstat yp_getbykey(keydat *, valdat *);
|
||||
extern ypstat yp_firstbykey(keydat *, valdat *);
|
||||
extern ypstat yp_nextbykey(keydat *, valdat *);
|
||||
#endif
|
||||
|
||||
extern unsigned long svcudp_set_xid __P(( SVCXPRT *, unsigned long ));
|
||||
extern unsigned long svcudp_get_xid __P(( SVCXPRT * ));
|
||||
extern unsigned long svcudp_set_xid(SVCXPRT *, unsigned long);
|
||||
extern unsigned long svcudp_get_xid(SVCXPRT *);
|
||||
|
||||
#ifndef RESOLVER_TIMEOUT
|
||||
#define RESOLVER_TIMEOUT 3600
|
||||
#endif
|
||||
|
||||
extern int yp_init_resolver __P(( void ));
|
||||
extern void yp_run_dnsq __P(( void ));
|
||||
extern void yp_prune_dnsq __P(( void ));
|
||||
extern ypstat yp_async_lookup_name __P(( struct svc_req *, char * ));
|
||||
extern ypstat yp_async_lookup_addr __P(( struct svc_req *, char * ));
|
||||
extern int yp_init_resolver(void);
|
||||
extern void yp_run_dnsq(void);
|
||||
extern void yp_prune_dnsq(void);
|
||||
extern ypstat yp_async_lookup_name(struct svc_req *, char *);
|
||||
extern ypstat yp_async_lookup_addr(struct svc_req *, char *);
|
||||
|
@ -76,9 +76,9 @@ static int _rpcfdtype;
|
||||
#define _SERVED 1
|
||||
#define _SERVING 2
|
||||
|
||||
extern void ypprog_1 __P((struct svc_req *, register SVCXPRT *));
|
||||
extern void ypprog_2 __P((struct svc_req *, register SVCXPRT *));
|
||||
extern int _rpc_dtablesize __P((void));
|
||||
extern void ypprog_1(struct svc_req *, register SVCXPRT *);
|
||||
extern void ypprog_2(struct svc_req *, register SVCXPRT *);
|
||||
extern int _rpc_dtablesize(void);
|
||||
extern int _rpcsvcstate; /* Set when a request is serviced */
|
||||
char *progname = "ypserv";
|
||||
char *yp_dir = _PATH_YP;
|
||||
@ -235,7 +235,7 @@ main(argc, argv)
|
||||
int ch;
|
||||
|
||||
while ((ch = getopt(argc, argv, "hdnp:")) != -1) {
|
||||
switch(ch) {
|
||||
switch (ch) {
|
||||
case 'd':
|
||||
debug = ypdb_debug = 1;
|
||||
break;
|
||||
|
@ -360,7 +360,7 @@ ypproc_xfr_2_svc(ypreq_xfr *argp, struct svc_req *rqstp)
|
||||
YPXFR_RETURN(YPXFR_REFUSED)
|
||||
}
|
||||
|
||||
switch(yp_fork()) {
|
||||
switch (yp_fork()) {
|
||||
case 0:
|
||||
{
|
||||
char g[11], t[11], p[11];
|
||||
@ -522,7 +522,7 @@ ypproc_all_2_svc(ypreq_nokey *argp, struct svc_req *rqstp)
|
||||
* async socket I/O?)
|
||||
*/
|
||||
if (!debug) {
|
||||
switch(yp_fork()) {
|
||||
switch (yp_fork()) {
|
||||
case 0:
|
||||
break;
|
||||
case -1:
|
||||
@ -660,7 +660,7 @@ static void yp_maplist_free(yp_maplist)
|
||||
{
|
||||
register struct ypmaplist *next;
|
||||
|
||||
while(yp_maplist) {
|
||||
while (yp_maplist) {
|
||||
next = yp_maplist->next;
|
||||
free(yp_maplist->map);
|
||||
free(yp_maplist);
|
||||
|
@ -69,17 +69,17 @@ char *dom, *server;
|
||||
int r;
|
||||
unsigned long server_addr;
|
||||
|
||||
if( (port=htons(getrpcport(server, YPPROG, YPPROC_NULL, IPPROTO_UDP))) == 0)
|
||||
if ((port = htons(getrpcport(server, YPPROG, YPPROC_NULL, IPPROTO_UDP))) == 0)
|
||||
errx(1, "%s not running ypserv", server);
|
||||
|
||||
bzero(&ypsd, sizeof ypsd);
|
||||
|
||||
if( (hp = gethostbyname (server)) != NULL ) {
|
||||
if ((hp = gethostbyname (server)) != NULL) {
|
||||
/* is this the most compatible way?? */
|
||||
bcopy (hp->h_addr_list[0],
|
||||
(u_long *)&ypsd.ypsetdom_binding.ypbind_binding_addr,
|
||||
sizeof (unsigned long));
|
||||
} else if( (long)(server_addr = inet_addr (server)) == -1) {
|
||||
} else if ((long)(server_addr = inet_addr (server)) == -1) {
|
||||
errx(1, "can't find address for %s", server);
|
||||
} else
|
||||
bcopy (&server_addr,
|
||||
@ -95,21 +95,21 @@ char *dom, *server;
|
||||
tv.tv_usec = 0;
|
||||
sock = RPC_ANYSOCK;
|
||||
client = clntudp_create(sin, YPBINDPROG, YPBINDVERS, tv, &sock);
|
||||
if (client==NULL) {
|
||||
if (client == NULL) {
|
||||
warnx("can't yp_bind, reason: %s", yperr_string(YPERR_YPBIND));
|
||||
return YPERR_YPBIND;
|
||||
return (YPERR_YPBIND);
|
||||
}
|
||||
client->cl_auth = authunix_create_default();
|
||||
|
||||
r = clnt_call(client, YPBINDPROC_SETDOM,
|
||||
xdr_ypbind_setdom, &ypsd, xdr_void, NULL, tv);
|
||||
if(r) {
|
||||
if (r) {
|
||||
warnx("sorry, cannot ypset for domain %s on host", dom);
|
||||
clnt_destroy(client);
|
||||
return YPERR_YPBIND;
|
||||
return (YPERR_YPBIND);
|
||||
}
|
||||
clnt_destroy(client);
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
@ -127,15 +127,15 @@ char **argv;
|
||||
sin.sin_family = AF_INET;
|
||||
sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
||||
|
||||
while( (c=getopt(argc, argv, "h:d:")) != -1)
|
||||
switch(c) {
|
||||
while ((c = getopt(argc, argv, "h:d:")) != -1)
|
||||
switch (c) {
|
||||
case 'd':
|
||||
domainname = optarg;
|
||||
break;
|
||||
case 'h':
|
||||
if( (sin.sin_addr.s_addr=inet_addr(optarg)) == -1) {
|
||||
if ((sin.sin_addr.s_addr = inet_addr(optarg)) == -1) {
|
||||
hent = gethostbyname(optarg);
|
||||
if(hent==NULL)
|
||||
if (hent == NULL)
|
||||
errx(1, "host %s unknown", optarg);
|
||||
bcopy(&hent->h_addr_list[0], &sin.sin_addr,
|
||||
sizeof sin.sin_addr);
|
||||
@ -145,7 +145,7 @@ char **argv;
|
||||
usage();
|
||||
}
|
||||
|
||||
if(optind + 1 != argc )
|
||||
if (optind + 1 != argc)
|
||||
usage();
|
||||
|
||||
if (bind_tohost(&sin, domainname, argv[optind]))
|
||||
|
Loading…
Reference in New Issue
Block a user