From a8fc6e2831f6c04c7b16a8eac45dd17c320f3003 Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Fri, 22 Jun 2001 11:26:34 +0000 Subject: [PATCH] * svc_simple.c (universal): Change transp to s_transp to not shadow filewide static definition of name. Move file wide definition of "pl" into respective functions. * pmap_rmt.c: Change sin->sockin and socket->sock. * pmap_getmaps.c, pmap_getport.c: Change socket to sock to not shadow network function. * bindresvport.c, clnt_generic.c: Change sin to sockin to not shadow function declaration. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13486 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/rpc/ChangeLog | 14 ++++++++++++++ src/lib/rpc/bindresvport.c | 18 +++++++++--------- src/lib/rpc/clnt_generic.c | 14 +++++++------- src/lib/rpc/pmap_getmaps.c | 6 +++--- src/lib/rpc/pmap_getport.c | 6 +++--- src/lib/rpc/pmap_rmt.c | 16 ++++++++-------- src/lib/rpc/svc_simple.c | 16 ++++++++-------- 7 files changed, 52 insertions(+), 38 deletions(-) diff --git a/src/lib/rpc/ChangeLog b/src/lib/rpc/ChangeLog index a6ce019e8..540a0ca10 100644 --- a/src/lib/rpc/ChangeLog +++ b/src/lib/rpc/ChangeLog @@ -1,3 +1,17 @@ +2001-06-21 Ezra Peisach + + * svc_simple.c (universal): Change transp to s_transp to not + shadow filewide static definition of name. + Move file wide definition of "pl" into respective functions. + + * pmap_rmt.c: Change sin->sockin and socket->sock. + + * pmap_getmaps.c, pmap_getport.c: Change socket to sock to not + shadow network function. + + * bindresvport.c, clnt_generic.c: Change sin to sockin to not + shadow function declaration. + 2001-06-19 Ezra Peisach * pmap_prot2.c (xdr_pmaplist): Ensure variable set before use. diff --git a/src/lib/rpc/bindresvport.c b/src/lib/rpc/bindresvport.c index ca041dfc1..b23b8e625 100644 --- a/src/lib/rpc/bindresvport.c +++ b/src/lib/rpc/bindresvport.c @@ -45,9 +45,9 @@ static char sccsid[] = "@(#)bindresvport.c 2.2 88/07/29 4.0 RPCSRC 1.8 88/02/08 * Bind a socket to a privileged IP port */ int -gssrpc_bindresvport(sd, sin) +gssrpc_bindresvport(sd, sockin) int sd; - struct sockaddr_in *sin; + struct sockaddr_in *sockin; { int res; static short port; @@ -59,11 +59,11 @@ gssrpc_bindresvport(sd, sin) #define ENDPORT (IPPORT_RESERVED - 1) #define NPORTS (ENDPORT - STARTPORT + 1) - if (sin == (struct sockaddr_in *)0) { - sin = &myaddr; - memset(sin, 0, sizeof (*sin)); - sin->sin_family = AF_INET; - } else if (sin->sin_family != AF_INET) { + if (sockin == (struct sockaddr_in *)0) { + sockin = &myaddr; + memset(sockin, 0, sizeof (*sockin)); + sockin->sin_family = AF_INET; + } else if (sockin->sin_family != AF_INET) { errno = EPFNOSUPPORT; return (-1); } @@ -73,11 +73,11 @@ gssrpc_bindresvport(sd, sin) res = -1; errno = EADDRINUSE; for (i = 0; i < NPORTS && res < 0 && errno == EADDRINUSE; i++) { - sin->sin_port = htons(port++); + sockin->sin_port = htons(port++); if (port > ENDPORT) { port = STARTPORT; } - res = bind(sd, (struct sockaddr *) sin, + res = bind(sd, (struct sockaddr *) sockin, sizeof(struct sockaddr_in)); } return (res); diff --git a/src/lib/rpc/clnt_generic.c b/src/lib/rpc/clnt_generic.c index b0eed3d32..c7cc24e49 100644 --- a/src/lib/rpc/clnt_generic.c +++ b/src/lib/rpc/clnt_generic.c @@ -53,7 +53,7 @@ clnt_create(hostname, prog, vers, proto) { struct hostent *h; struct protoent *p; - struct sockaddr_in sin; + struct sockaddr_in sockin; int sock; struct timeval tv; CLIENT *client; @@ -71,10 +71,10 @@ clnt_create(hostname, prog, vers, proto) rpc_createerr.cf_error.re_errno = EAFNOSUPPORT; return (NULL); } - sin.sin_family = h->h_addrtype; - sin.sin_port = 0; - memset(sin.sin_zero, 0, sizeof(sin.sin_zero)); - memmove((char*)&sin.sin_addr, h->h_addr, sizeof(sin.sin_addr)); + sockin.sin_family = h->h_addrtype; + sockin.sin_port = 0; + memset(sockin.sin_zero, 0, sizeof(sockin.sin_zero)); + memmove((char*)&sockin.sin_addr, h->h_addr, sizeof(sockin.sin_addr)); p = getprotobyname(proto); if (p == NULL) { rpc_createerr.cf_stat = RPC_UNKNOWNPROTO; @@ -86,7 +86,7 @@ clnt_create(hostname, prog, vers, proto) case IPPROTO_UDP: tv.tv_sec = 5; tv.tv_usec = 0; - client = clntudp_create(&sin, prog, vers, tv, &sock); + client = clntudp_create(&sockin, prog, vers, tv, &sock); if (client == NULL) { return (NULL); } @@ -94,7 +94,7 @@ clnt_create(hostname, prog, vers, proto) clnt_control(client, CLSET_TIMEOUT, &tv); break; case IPPROTO_TCP: - client = clnttcp_create(&sin, prog, vers, &sock, 0, 0); + client = clnttcp_create(&sockin, prog, vers, &sock, 0, 0); if (client == NULL) { return (NULL); } diff --git a/src/lib/rpc/pmap_getmaps.c b/src/lib/rpc/pmap_getmaps.c index 187749338..7f9020617 100644 --- a/src/lib/rpc/pmap_getmaps.c +++ b/src/lib/rpc/pmap_getmaps.c @@ -67,7 +67,7 @@ pmap_getmaps(address) struct sockaddr_in *address; { struct pmaplist *head = (struct pmaplist *)NULL; - int socket = -1; + int sock = -1; struct timeval minutetimeout; register CLIENT *client; @@ -75,7 +75,7 @@ pmap_getmaps(address) minutetimeout.tv_usec = 0; address->sin_port = htons(PMAPPORT); client = clnttcp_create(address, PMAPPROG, - PMAPVERS, &socket, 50, 500); + PMAPVERS, &sock, 50, 500); if (client != (CLIENT *)NULL) { if (CLNT_CALL(client, PMAPPROC_DUMP, xdr_void, NULL, xdr_pmaplist, &head, minutetimeout) != RPC_SUCCESS) { @@ -83,7 +83,7 @@ pmap_getmaps(address) } CLNT_DESTROY(client); } - (void)close(socket); + (void)close(sock); address->sin_port = 0; return (head); } diff --git a/src/lib/rpc/pmap_getport.c b/src/lib/rpc/pmap_getport.c index 6fbd14104..7712f1195 100644 --- a/src/lib/rpc/pmap_getport.c +++ b/src/lib/rpc/pmap_getport.c @@ -65,13 +65,13 @@ pmap_getport(address, program, version, protocol) unsigned int protocol; { unsigned short port = 0; - int socket = -1; + int sock = -1; register CLIENT *client; struct pmap parms; address->sin_port = htons(PMAPPORT); client = clntudp_bufcreate(address, PMAPPROG, - PMAPVERS, timeout, &socket, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE); + PMAPVERS, timeout, &sock, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE); if (client != (CLIENT *)NULL) { parms.pm_prog = program; parms.pm_vers = version; @@ -86,7 +86,7 @@ pmap_getport(address, program, version, protocol) } CLNT_DESTROY(client); } - (void)close(socket); + (void)close(sock); address->sin_port = 0; return (port); } diff --git a/src/lib/rpc/pmap_rmt.c b/src/lib/rpc/pmap_rmt.c index faa1fc206..401fd80b6 100644 --- a/src/lib/rpc/pmap_rmt.c +++ b/src/lib/rpc/pmap_rmt.c @@ -79,14 +79,14 @@ pmap_rmtcall(addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout, port_pt struct timeval tout; rpc_u_int32 *port_ptr; { - int socket = -1; + int sock = -1; register CLIENT *client; struct rmtcallargs a; struct rmtcallres r; enum clnt_stat stat; addr->sin_port = htons(PMAPPORT); - client = clntudp_create(addr, PMAPPROG, PMAPVERS, timeout, &socket); + client = clntudp_create(addr, PMAPPROG, PMAPVERS, timeout, &sock); if (client != (CLIENT *)NULL) { a.prog = prog; a.vers = vers; @@ -102,7 +102,7 @@ pmap_rmtcall(addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout, port_pt } else { stat = RPC_FAILED; } - (void)close(socket); + (void)close(sock); addr->sin_port = 0; return (stat); } @@ -176,7 +176,7 @@ getbroadcastnets(addrs, sock, buf) { struct ifconf ifc; struct ifreq ifreq, *ifr; - struct sockaddr_in *sin; + struct sockaddr_in *sockin; int n, i; ifc.ifc_len = GIFCONF_BUFSIZE; @@ -196,16 +196,16 @@ getbroadcastnets(addrs, sock, buf) if ((ifreq.ifr_flags & IFF_BROADCAST) && (ifreq.ifr_flags & IFF_UP) && ifr->ifr_addr.sa_family == AF_INET) { - sin = (struct sockaddr_in *)&ifr->ifr_addr; + sockin = (struct sockaddr_in *)&ifr->ifr_addr; #ifdef SIOCGIFBRDADDR /* 4.3BSD */ if (ioctl(sock, SIOCGIFBRDADDR, (char *)&ifreq) < 0) { addrs[i++].s_addr = INADDR_ANY; #if 0 /* this is uuuuugly */ addrs[i++] = inet_makeaddr(inet_netof #if defined(hpux) || (defined(sun) && defined(__svr4__)) || defined(linux) || (defined(__osf__) && defined(__alpha__)) - (sin->sin_addr), + (sockin->sin_addr), #else /* hpux or solaris */ - (sin->sin_addr.s_addr), + (sockin->sin_addr.s_addr), #endif INADDR_ANY); #endif @@ -215,7 +215,7 @@ getbroadcastnets(addrs, sock, buf) } #else /* 4.2 BSD */ addrs[i++] = inet_makeaddr(inet_netof - (sin->sin_addr.s_addr), INADDR_ANY); + (sockin->sin_addr.s_addr), INADDR_ANY); #endif } } diff --git a/src/lib/rpc/svc_simple.c b/src/lib/rpc/svc_simple.c index 9a58cf626..b4769d02b 100644 --- a/src/lib/rpc/svc_simple.c +++ b/src/lib/rpc/svc_simple.c @@ -53,13 +53,13 @@ static struct proglst { } *proglst; static void universal(); static SVCXPRT *transp; -static struct proglst *pl; int gssrpc_registerrpc(prognum, versnum, procnum, progname, inproc, outproc) char *(*progname)(); xdrproc_t inproc, outproc; { + struct proglst *pl; if (procnum == NULLPROC) { (void) fprintf(stderr, @@ -96,9 +96,9 @@ gssrpc_registerrpc(prognum, versnum, procnum, progname, inproc, outproc) } static void -universal(rqstp, transp) +universal(rqstp, s_transp) struct svc_req *rqstp; - SVCXPRT *transp; + SVCXPRT *s_transp; { int prog, proc; char *outdata; @@ -109,7 +109,7 @@ universal(rqstp, transp) * enforce "procnum 0 is echo" convention */ if (rqstp->rq_proc == NULLPROC) { - if (svc_sendreply(transp, xdr_void, (char *)NULL) == FALSE) { + if (svc_sendreply(s_transp, xdr_void, (char *)NULL) == FALSE) { (void) fprintf(stderr, "xxx\n"); exit(1); } @@ -121,22 +121,22 @@ universal(rqstp, transp) if (pl->p_prognum == prog && pl->p_procnum == proc) { /* decode arguments into a CLEAN buffer */ memset(xdrbuf, 0, sizeof(xdrbuf)); /* required ! */ - if (!svc_getargs(transp, pl->p_inproc, xdrbuf)) { - svcerr_decode(transp); + if (!svc_getargs(s_transp, pl->p_inproc, xdrbuf)) { + svcerr_decode(s_transp); return; } outdata = (*(pl->p_progname))(xdrbuf); if (outdata == NULL && pl->p_outproc != xdr_void) /* there was an error */ return; - if (!svc_sendreply(transp, pl->p_outproc, outdata)) { + if (!svc_sendreply(s_transp, pl->p_outproc, outdata)) { (void) fprintf(stderr, "trouble replying to prog %d\n", pl->p_prognum); exit(1); } /* free the decoded arguments */ - (void)svc_freeargs(transp, pl->p_inproc, xdrbuf); + (void)svc_freeargs(s_transp, pl->p_inproc, xdrbuf); return; } (void) fprintf(stderr, "never registered prog %d\n", prog); -- 2.26.2