rpcb_svc_com.c (96788) | rpcb_svc_com.c (104592) |
---|---|
1/* $NetBSD: rpcb_svc_com.c,v 1.6 2000/08/03 00:07:22 fvdl Exp $ */ | 1/* $NetBSD: rpcb_svc_com.c,v 1.6 2000/08/03 00:07:22 fvdl Exp $ */ |
2/* $FreeBSD: head/usr.sbin/rpcbind/rpcb_svc_com.c 96788 2002-05-17 05:27:52Z jmallett $ */ | 2/* $FreeBSD: head/usr.sbin/rpcbind/rpcb_svc_com.c 104592 2002-10-07 02:56:59Z alfred $ */ |
3 4/* 5 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 6 * unrestricted use provided that this legend is included on all tape 7 * media and as a part of the software program in whole or part. Users 8 * may copy or modify Sun RPC without charge, but are not authorized 9 * to license or distribute it to anyone else except as part of a product or 10 * program developed by the user. --- 105 unchanged lines hidden (view full) --- 116static int add_pmaplist __P((RPCB *)); 117static int del_pmaplist __P((RPCB *)); 118 119/* 120 * Set a mapping of program, version, netid 121 */ 122/* ARGSUSED */ 123void * | 3 4/* 5 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 6 * unrestricted use provided that this legend is included on all tape 7 * media and as a part of the software program in whole or part. Users 8 * may copy or modify Sun RPC without charge, but are not authorized 9 * to license or distribute it to anyone else except as part of a product or 10 * program developed by the user. --- 105 unchanged lines hidden (view full) --- 116static int add_pmaplist __P((RPCB *)); 117static int del_pmaplist __P((RPCB *)); 118 119/* 120 * Set a mapping of program, version, netid 121 */ 122/* ARGSUSED */ 123void * |
124rpcbproc_set_com(void *arg, struct svc_req *rqstp, SVCXPRT *transp, | 124rpcbproc_set_com(void *arg, struct svc_req *rqstp __unused, SVCXPRT *transp, |
125 rpcvers_t rpcbversnum) 126{ 127 RPCB *regp = (RPCB *)arg; 128 static bool_t ans; 129 char owner[64]; 130 131#ifdef RPCBIND_DEBUG 132 if (debugging) --- 71 unchanged lines hidden (view full) --- 204 return (TRUE); 205} 206 207/* 208 * Unset a mapping of program, version, netid 209 */ 210/* ARGSUSED */ 211void * | 125 rpcvers_t rpcbversnum) 126{ 127 RPCB *regp = (RPCB *)arg; 128 static bool_t ans; 129 char owner[64]; 130 131#ifdef RPCBIND_DEBUG 132 if (debugging) --- 71 unchanged lines hidden (view full) --- 204 return (TRUE); 205} 206 207/* 208 * Unset a mapping of program, version, netid 209 */ 210/* ARGSUSED */ 211void * |
212rpcbproc_unset_com(void *arg, struct svc_req *rqstp, SVCXPRT *transp, | 212rpcbproc_unset_com(void *arg, struct svc_req *rqstp __unused, SVCXPRT *transp, |
213 rpcvers_t rpcbversnum) 214{ 215 RPCB *regp = (RPCB *)arg; 216 static bool_t ans; 217 char owner[64]; 218 219#ifdef RPCBIND_DEBUG 220 if (debugging) --- 58 unchanged lines hidden (view full) --- 279 * We return 1 either when the entry was not there or it 280 * was able to unset it. It can come to this point only if 281 * atleast one of the conditions is true. 282 */ 283 return (1); 284} 285 286void | 213 rpcvers_t rpcbversnum) 214{ 215 RPCB *regp = (RPCB *)arg; 216 static bool_t ans; 217 char owner[64]; 218 219#ifdef RPCBIND_DEBUG 220 if (debugging) --- 58 unchanged lines hidden (view full) --- 279 * We return 1 either when the entry was not there or it 280 * was able to unset it. It can come to this point only if 281 * atleast one of the conditions is true. 282 */ 283 return (1); 284} 285 286void |
287delete_prog(int prog) | 287delete_prog(unsigned int prog) |
288{ 289 RPCB reg; 290 register rpcblist_ptr rbl; 291 292 for (rbl = list_rbl; rbl != NULL; rbl = rbl->rpcb_next) { 293 if ((rbl->rpcb_map.r_prog != prog)) 294 continue; 295 if (is_bound(rbl->rpcb_map.r_netid, rbl->rpcb_map.r_addr)) 296 continue; 297 reg.r_prog = rbl->rpcb_map.r_prog; 298 reg.r_vers = rbl->rpcb_map.r_vers; 299 reg.r_netid = strdup(rbl->rpcb_map.r_netid); 300 (void) map_unset(®, "superuser"); 301 free(reg.r_netid); 302 } 303} 304 305void * | 288{ 289 RPCB reg; 290 register rpcblist_ptr rbl; 291 292 for (rbl = list_rbl; rbl != NULL; rbl = rbl->rpcb_next) { 293 if ((rbl->rpcb_map.r_prog != prog)) 294 continue; 295 if (is_bound(rbl->rpcb_map.r_netid, rbl->rpcb_map.r_addr)) 296 continue; 297 reg.r_prog = rbl->rpcb_map.r_prog; 298 reg.r_vers = rbl->rpcb_map.r_vers; 299 reg.r_netid = strdup(rbl->rpcb_map.r_netid); 300 (void) map_unset(®, "superuser"); 301 free(reg.r_netid); 302 } 303} 304 305void * |
306rpcbproc_getaddr_com(RPCB *regp, struct svc_req *rqstp, SVCXPRT *transp, 307 rpcvers_t rpcbversnum, rpcvers_t verstype) | 306rpcbproc_getaddr_com(RPCB *regp, struct svc_req *rqstp __unused, 307 SVCXPRT *transp, rpcvers_t rpcbversnum, rpcvers_t verstype) |
308{ 309 static char *uaddr; 310 char *saddr = NULL; 311 rpcblist_ptr fnd; 312 313 if (uaddr != NULL && uaddr != nullstring) { 314 free(uaddr); 315 uaddr = NULL; --- 25 unchanged lines hidden (view full) --- 341 /* XXX: should have used some defined constant here */ 342 rpcbs_getaddr(rpcbversnum - 2, regp->r_prog, regp->r_vers, 343 transp->xp_netid, uaddr); 344 return (void *)&uaddr; 345} 346 347/* ARGSUSED */ 348void * | 308{ 309 static char *uaddr; 310 char *saddr = NULL; 311 rpcblist_ptr fnd; 312 313 if (uaddr != NULL && uaddr != nullstring) { 314 free(uaddr); 315 uaddr = NULL; --- 25 unchanged lines hidden (view full) --- 341 /* XXX: should have used some defined constant here */ 342 rpcbs_getaddr(rpcbversnum - 2, regp->r_prog, regp->r_vers, 343 transp->xp_netid, uaddr); 344 return (void *)&uaddr; 345} 346 347/* ARGSUSED */ 348void * |
349rpcbproc_gettime_com(void *arg, struct svc_req *rqstp, SVCXPRT *transp, 350 rpcvers_t rpcbversnum) | 349rpcbproc_gettime_com(void *arg __unused, struct svc_req *rqstp __unused, 350 SVCXPRT *transp __unused, rpcvers_t rpcbversnum __unused) |
351{ 352 static time_t curtime; 353 354 (void) time(&curtime); 355 return (void *)&curtime; 356} 357 358/* 359 * Convert uaddr to taddr. Should be used only by 360 * local servers/clients. (kernel level stuff only) 361 */ 362/* ARGSUSED */ 363void * | 351{ 352 static time_t curtime; 353 354 (void) time(&curtime); 355 return (void *)&curtime; 356} 357 358/* 359 * Convert uaddr to taddr. Should be used only by 360 * local servers/clients. (kernel level stuff only) 361 */ 362/* ARGSUSED */ 363void * |
364rpcbproc_uaddr2taddr_com(void *arg, struct svc_req *rqstp, SVCXPRT *transp, 365 rpcvers_t rpcbversnum) | 364rpcbproc_uaddr2taddr_com(void *arg, struct svc_req *rqstp __unused, 365 SVCXPRT *transp, rpcvers_t rpcbversnum __unused) |
366{ 367 char **uaddrp = (char **)arg; 368 struct netconfig *nconf; 369 static struct netbuf nbuf; 370 static struct netbuf *taddr; 371 372 if (taddr) { 373 free(taddr->buf); --- 9 unchanged lines hidden (view full) --- 383} 384 385/* 386 * Convert taddr to uaddr. Should be used only by 387 * local servers/clients. (kernel level stuff only) 388 */ 389/* ARGSUSED */ 390void * | 366{ 367 char **uaddrp = (char **)arg; 368 struct netconfig *nconf; 369 static struct netbuf nbuf; 370 static struct netbuf *taddr; 371 372 if (taddr) { 373 free(taddr->buf); --- 9 unchanged lines hidden (view full) --- 383} 384 385/* 386 * Convert taddr to uaddr. Should be used only by 387 * local servers/clients. (kernel level stuff only) 388 */ 389/* ARGSUSED */ 390void * |
391rpcbproc_taddr2uaddr_com(void *arg, struct svc_req *rqstp, SVCXPRT *transp, 392 rpcvers_t rpcbversnum) | 391rpcbproc_taddr2uaddr_com(void *arg, struct svc_req *rqstp __unused, 392 SVCXPRT *transp, rpcvers_t rpcbversnum __unused) |
393{ 394 struct netbuf *taddr = (struct netbuf *)arg; 395 static char *uaddr; 396 struct netconfig *nconf; 397 398#ifdef CHEW_FDS 399 int fd; 400 --- 891 unchanged lines hidden (view full) --- 1292 (void) free_slot_by_xid(reply_msg.rm_xid); 1293 return; 1294} 1295 1296static void 1297find_versions(rpcprog_t prog, char *netid, rpcvers_t *lowvp, rpcvers_t *highvp) 1298{ 1299 register rpcblist_ptr rbl; | 393{ 394 struct netbuf *taddr = (struct netbuf *)arg; 395 static char *uaddr; 396 struct netconfig *nconf; 397 398#ifdef CHEW_FDS 399 int fd; 400 --- 891 unchanged lines hidden (view full) --- 1292 (void) free_slot_by_xid(reply_msg.rm_xid); 1293 return; 1294} 1295 1296static void 1297find_versions(rpcprog_t prog, char *netid, rpcvers_t *lowvp, rpcvers_t *highvp) 1298{ 1299 register rpcblist_ptr rbl; |
1300 int lowv = 0; 1301 int highv = 0; | 1300 unsigned int lowv = 0; 1301 unsigned int highv = 0; |
1302 1303 for (rbl = list_rbl; rbl != NULL; rbl = rbl->rpcb_next) { 1304 if ((rbl->rpcb_map.r_prog != prog) || 1305 ((rbl->rpcb_map.r_netid != NULL) && 1306 (strcasecmp(rbl->rpcb_map.r_netid, netid) != 0))) 1307 continue; 1308 if (lowv == 0) { 1309 highv = rbl->rpcb_map.r_vers; --- 111 unchanged lines hidden (view full) --- 1421/* 1422 * Delete this from the pmap list only if it is UDP or TCP. 1423 */ 1424static int 1425del_pmaplist(RPCB *arg) 1426{ 1427 struct pmaplist *pml; 1428 struct pmaplist *prevpml, *fnd; | 1302 1303 for (rbl = list_rbl; rbl != NULL; rbl = rbl->rpcb_next) { 1304 if ((rbl->rpcb_map.r_prog != prog) || 1305 ((rbl->rpcb_map.r_netid != NULL) && 1306 (strcasecmp(rbl->rpcb_map.r_netid, netid) != 0))) 1307 continue; 1308 if (lowv == 0) { 1309 highv = rbl->rpcb_map.r_vers; --- 111 unchanged lines hidden (view full) --- 1421/* 1422 * Delete this from the pmap list only if it is UDP or TCP. 1423 */ 1424static int 1425del_pmaplist(RPCB *arg) 1426{ 1427 struct pmaplist *pml; 1428 struct pmaplist *prevpml, *fnd; |
1429 long prot; | 1429 unsigned long prot; |
1430 1431 if (strcmp(arg->r_netid, udptrans) == 0) { 1432 /* It is UDP! */ 1433 prot = IPPROTO_UDP; 1434 } else if (strcmp(arg->r_netid, tcptrans) == 0) { 1435 /* It is TCP */ 1436 prot = IPPROTO_TCP; 1437 } else if (arg->r_netid[0] == NULL) { --- 26 unchanged lines hidden --- | 1430 1431 if (strcmp(arg->r_netid, udptrans) == 0) { 1432 /* It is UDP! */ 1433 prot = IPPROTO_UDP; 1434 } else if (strcmp(arg->r_netid, tcptrans) == 0) { 1435 /* It is TCP */ 1436 prot = IPPROTO_TCP; 1437 } else if (arg->r_netid[0] == NULL) { --- 26 unchanged lines hidden --- |