summaryrefslogtreecommitdiff
path: root/usr.sbin/portmap
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-07-18 11:41:00 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-07-18 11:41:00 +0000
commit8bc47f8925e04f4b1c5f86738f112c5eb8a94ac3 (patch)
tree504c1bc536826bfbf6776741e946eb873cbde167 /usr.sbin/portmap
parent108684c912fa4b9b545dc00046bebe704de04595 (diff)
more readable
Diffstat (limited to 'usr.sbin/portmap')
-rw-r--r--usr.sbin/portmap/portmap.c120
1 files changed, 60 insertions, 60 deletions
diff --git a/usr.sbin/portmap/portmap.c b/usr.sbin/portmap/portmap.c
index 1539bd9411e..9831f0f06f3 100644
--- a/usr.sbin/portmap/portmap.c
+++ b/usr.sbin/portmap/portmap.c
@@ -40,7 +40,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)portmap.c 5.4 (Berkeley) 4/19/91";*/
-static char rcsid[] = "$Id: portmap.c,v 1.5 1996/07/07 20:15:10 deraadt Exp $";
+static char rcsid[] = "$Id: portmap.c,v 1.6 1996/07/18 11:40:59 deraadt Exp $";
#endif /* not lint */
/*
@@ -306,51 +306,49 @@ reg_service(rqstp, xprt)
svcerr_noproc(xprt);
return;
}
- if (!svc_getargs(xprt, xdr_pmap, (caddr_t)&reg))
+ if (!svc_getargs(xprt, xdr_pmap, (caddr_t)&reg)) {
svcerr_decode(xprt);
- else {
- /*
- * check to see if already used
- * find_service returns a hit even if
- * the versions don't match, so check for it
- */
- fnd = find_service(reg.pm_prog, reg.pm_vers, reg.pm_prot);
- if (fnd && fnd->pml_map.pm_vers == reg.pm_vers) {
- if (fnd->pml_map.pm_port == reg.pm_port)
- ans = 1;
- goto done;
- }
+ break;
+ }
+ /*
+ * check to see if already used
+ * find_service returns a hit even if
+ * the versions don't match, so check for it
+ */
+ fnd = find_service(reg.pm_prog, reg.pm_vers, reg.pm_prot);
+ if (fnd && fnd->pml_map.pm_vers == reg.pm_vers) {
+ if (fnd->pml_map.pm_port == reg.pm_port)
+ ans = 1;
+ goto done;
+ }
- /* check if secure */
- if ((pml->pml_map.pm_port < IPPORT_RESERVED ||
- pml->pml_map.pm_port == NFS_PORT) &&
- htons(fromsin->sin_port) >= IPPORT_RESERVED) {
- syslog(LOG_WARNING,
- "resvport set attempt by non-root");
- goto done;
- }
+ /* check if secure */
+ if ((pml->pml_map.pm_port < IPPORT_RESERVED ||
+ pml->pml_map.pm_port == NFS_PORT) &&
+ htons(fromsin->sin_port) >= IPPORT_RESERVED) {
+ syslog(LOG_WARNING, "resvport set attempt by non-root");
+ goto done;
+ }
- /*
- * add to END of list
- */
- pml = (struct pmaplist *)
- malloc((u_int)sizeof(struct pmaplist));
- pml->pml_map = reg;
- pml->pml_next = 0;
- if (pmaplist == 0) {
- pmaplist = pml;
- } else {
- for (fnd = pmaplist; fnd->pml_next != 0;
- fnd = fnd->pml_next);
- fnd->pml_next = pml;
- }
- ans = 1;
- done:
- if ((!svc_sendreply(xprt, xdr_long, (caddr_t)&ans)) &&
- debugging) {
- (void) fprintf(stderr, "svc_sendreply\n");
- abort();
- }
+ /*
+ * add to END of list
+ */
+ pml = (struct pmaplist *)malloc(sizeof(struct pmaplist));
+ pml->pml_map = reg;
+ pml->pml_next = 0;
+ if (pmaplist == 0) {
+ pmaplist = pml;
+ } else {
+ for (fnd = pmaplist; fnd->pml_next != 0;
+ fnd = fnd->pml_next);
+ fnd->pml_next = pml;
+ }
+ ans = 1;
+ done:
+ if ((!svc_sendreply(xprt, xdr_long, (caddr_t)&ans)) &&
+ debugging) {
+ (void) fprintf(stderr, "svc_sendreply\n");
+ abort();
}
break;
@@ -397,7 +395,7 @@ reg_service(rqstp, xprt)
}
if ((!svc_sendreply(xprt, xdr_long, (caddr_t)&ans)) &&
debugging) {
- (void) fprintf(stderr, "svc_sendreply\n");
+ fprintf(stderr, "svc_sendreply\n");
abort();
}
break;
@@ -406,19 +404,19 @@ reg_service(rqstp, xprt)
/*
* Lookup the mapping for a program,version and return its port
*/
- if (!svc_getargs(xprt, xdr_pmap, (caddr_t)&reg))
+ if (!svc_getargs(xprt, xdr_pmap, (caddr_t)&reg)) {
svcerr_decode(xprt);
- else {
- fnd = find_service(reg.pm_prog, reg.pm_vers, reg.pm_prot);
- if (fnd)
- port = fnd->pml_map.pm_port;
- else
- port = 0;
- if ((!svc_sendreply(xprt, xdr_long, (caddr_t)&port)) &&
- debugging) {
- (void) fprintf(stderr, "svc_sendreply\n");
- abort();
- }
+ break;
+ }
+ fnd = find_service(reg.pm_prog, reg.pm_vers, reg.pm_prot);
+ if (fnd)
+ port = fnd->pml_map.pm_port;
+ else
+ port = 0;
+ if ((!svc_sendreply(xprt, xdr_long, (caddr_t)&port)) &&
+ debugging) {
+ fprintf(stderr, "svc_sendreply\n");
+ abort();
}
break;
@@ -426,11 +424,13 @@ reg_service(rqstp, xprt)
/*
* Return the current set of mapped program,version
*/
- if (!svc_getargs(xprt, xdr_void, NULL))
+ if (!svc_getargs(xprt, xdr_void, NULL)) {
svcerr_decode(xprt);
- else if ((!svc_sendreply(xprt, xdr_pmaplist,
- (caddr_t)&pmaplist)) && debugging) {
- (void) fprintf(stderr, "svc_sendreply\n");
+ break;
+ }
+ if (!svc_sendreply(xprt, xdr_pmaplist, (caddr_t)&pmaplist) &&
+ debugging) {
+ fprintf(stderr, "svc_sendreply\n");
abort();
}
break;