+2001-06-21 Ezra Peisach <epeisach@mit.edu>
+
+ * 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 <epeisach@mit.edu>
* pmap_prot2.c (xdr_pmaplist): Ensure variable set before use.
* 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;
#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);
}
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);
{
struct hostent *h;
struct protoent *p;
- struct sockaddr_in sin;
+ struct sockaddr_in sockin;
int sock;
struct timeval tv;
CLIENT *client;
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;
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);
}
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);
}
struct sockaddr_in *address;
{
struct pmaplist *head = (struct pmaplist *)NULL;
- int socket = -1;
+ int sock = -1;
struct timeval minutetimeout;
register CLIENT *client;
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) {
}
CLNT_DESTROY(client);
}
- (void)close(socket);
+ (void)close(sock);
address->sin_port = 0;
return (head);
}
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;
}
CLNT_DESTROY(client);
}
- (void)close(socket);
+ (void)close(sock);
address->sin_port = 0;
return (port);
}
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;
} else {
stat = RPC_FAILED;
}
- (void)close(socket);
+ (void)close(sock);
addr->sin_port = 0;
return (stat);
}
{
struct ifconf ifc;
struct ifreq ifreq, *ifr;
- struct sockaddr_in *sin;
+ struct sockaddr_in *sockin;
int n, i;
ifc.ifc_len = GIFCONF_BUFSIZE;
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
}
#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
}
}
} *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,
}
static void
-universal(rqstp, transp)
+universal(rqstp, s_transp)
struct svc_req *rqstp;
- SVCXPRT *transp;
+ SVCXPRT *s_transp;
{
int prog, proc;
char *outdata;
* 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);
}
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);