1 diff -urN portmap_4/daemon.c portmap_4.new/daemon.c
2 --- portmap_4/daemon.c Thu Jun 11 13:53:12 1992
3 +++ portmap_4.new/daemon.c Mon Nov 29 18:37:28 1999
5 static char sccsid[] = "@(#)daemon.c 5.3 (Berkeley) 12/28/90";
6 #endif /* LIBC_SCCS and not lint */
8 +#include <sys/types.h>
13 #define STDIN_FILENO 0
17 #define _PATH_DEVNULL "/dev/null"
20 daemon(nochdir, noclose)
23 diff -urN portmap_4/from_local.c portmap_4.new/from_local.c
24 --- portmap_4/from_local.c Fri May 31 06:52:58 1996
25 +++ portmap_4.new/from_local.c Tue Nov 30 01:21:27 1999
27 #include <sys/types.h>
28 #include <sys/socket.h>
33 #include <netinet/in.h>
35 #include <sys/ioctl.h>
45 /* find_local - find all IP addresses for this host */
54 /* from_local - determine whether request comes from the local system */
58 struct sockaddr_in *addr;
60 diff -urN portmap_4/pmap_check.c portmap_4.new/pmap_check.c
61 --- portmap_4/pmap_check.c Sun Nov 21 11:59:01 1993
62 +++ portmap_4.new/pmap_check.c Tue Nov 30 01:19:37 1999
65 static char sccsid[] = "@(#) pmap_check.c 1.6 93/11/21 20:58:59";
70 #include <rpc/pmap_prot.h>
74 /* A handful of macros for "readability". */
76 +/* coming from libwrap.a (tcp_wrappers) */
77 +extern int hosts_ctl(char *daemon, char *name, char *addr, char *user);
79 #define good_client(a) hosts_ctl("portmap", "", inet_ntoa(a->sin_addr), "")
81 #define legal_port(a,p) \
84 /* check_default - additional checks for NULL, DUMP, GETPORT and unknown */
87 check_default(addr, proc, prog)
88 struct sockaddr_in *addr;
93 /* check_privileged_port - additional checks for privileged-port updates */
96 check_privileged_port(addr, proc, prog, port)
97 struct sockaddr_in *addr;
101 #ifdef LOOPBACK_SETUNSET
104 check_setunset(xprt, ludp_xprt, ltcp_xprt, proc, prog, port)
112 check_setunset(addr, proc, prog, port)
113 struct sockaddr_in *addr;
118 /* check_callit - additional checks for forwarded requests */
121 check_callit(addr, proc, prog, aproc)
122 struct sockaddr_in *addr;
124 @@ -213,13 +217,13 @@
126 struct proc_map *procp;
127 static struct proc_map procmap[] = {
128 - PMAPPROC_CALLIT, "callit",
129 - PMAPPROC_DUMP, "dump",
130 - PMAPPROC_GETPORT, "getport",
131 - PMAPPROC_NULL, "null",
132 - PMAPPROC_SET, "set",
133 - PMAPPROC_UNSET, "unset",
135 + { PMAPPROC_CALLIT, "callit"},
136 + { PMAPPROC_DUMP, "dump"},
137 + { PMAPPROC_GETPORT, "getport"},
138 + { PMAPPROC_NULL, "null"},
139 + { PMAPPROC_SET, "set"},
140 + { PMAPPROC_UNSET, "unset"},
149 - } else if (rpc = getrpcbynumber((int) prognum)) {
150 + } else if ((rpc = getrpcbynumber((int) prognum))) {
151 progname = rpc->r_name;
153 sprintf(progname = progbuf, "%lu", prognum);
154 diff -urN portmap_4/pmap_dump.c portmap_4.new/pmap_dump.c
155 --- portmap_4/pmap_dump.c Thu Jun 11 13:53:16 1992
156 +++ portmap_4.new/pmap_dump.c Tue Nov 30 01:22:07 1999
158 #include <rpc/pmap_prot.h>
160 static char *protoname();
166 diff -urN portmap_4/pmap_set.c portmap_4.new/pmap_set.c
167 --- portmap_4/pmap_set.c Thu Jun 11 13:53:17 1992
168 +++ portmap_4.new/pmap_set.c Tue Nov 30 01:23:49 1999
171 #include <rpc/pmap_clnt.h>
173 +int parse_line(char *buf, u_long *, u_long *, int *, unsigned *);
182 /* parse_line - convert line to numbers */
185 parse_line(buf, prog, vers, prot, port)
188 diff -urN portmap_4/portmap.c portmap_4.new/portmap.c
189 --- portmap_4/portmap.c Fri May 31 06:52:59 1996
190 +++ portmap_4.new/portmap.c Tue Nov 30 01:01:32 1999
193 #include <rpc/pmap_prot.h>
198 #include <sys/socket.h>
201 #include "pmap_check.h"
209 syslog(LOG_ERR, "run_svc returned unexpectedly");
211 + /* never reached */
217 /* remote host authorization check */
218 check_default(svc_getcaller(xprt), rqstp->rq_proc, (u_long) 0);
219 - if (!svc_sendreply(xprt, xdr_void, (caddr_t)0) && debugging) {
220 + if (!svc_sendreply(xprt, (xdrproc_t)xdr_void, (caddr_t)0) && debugging) {
226 * Set a program,version to port mapping
228 - if (!svc_getargs(xprt, xdr_pmap, ®))
229 + if (!svc_getargs(xprt, (xdrproc_t)xdr_pmap, (caddr_t)®))
232 /* reject non-local requests, protect priv. ports */
237 - if ((!svc_sendreply(xprt, xdr_int, (caddr_t)&ans)) &&
238 + if ((!svc_sendreply(xprt, (xdrproc_t)xdr_int, (caddr_t)&ans)) &&
240 (void) fprintf(stderr, "svc_sendreply\n");
244 * Remove a program,version to port mapping.
246 - if (!svc_getargs(xprt, xdr_pmap, ®))
247 + if (!svc_getargs(xprt, (xdrproc_t)xdr_pmap, (caddr_t)®))
252 prevpml->pml_next = pml;
255 - if ((!svc_sendreply(xprt, xdr_int, (caddr_t)&ans)) &&
256 + if ((!svc_sendreply(xprt, (xdrproc_t)xdr_int, (caddr_t)&ans)) &&
258 (void) fprintf(stderr, "svc_sendreply\n");
262 * Lookup the mapping for a program,version and return its port
264 - if (!svc_getargs(xprt, xdr_pmap, ®))
265 + if (!svc_getargs(xprt, (xdrproc_t)xdr_pmap, (caddr_t)®))
268 /* remote host authorization check */
270 port = fnd->pml_map.pm_port;
273 - if ((!svc_sendreply(xprt, xdr_int, (caddr_t)&port)) &&
274 + if ((!svc_sendreply(xprt, (xdrproc_t)xdr_int, (caddr_t)&port)) &&
276 (void) fprintf(stderr, "svc_sendreply\n");
280 * Return the current set of mapped program,version
282 - if (!svc_getargs(xprt, xdr_void, NULL))
283 + if (!svc_getargs(xprt, (xdrproc_t)xdr_void, NULL))
286 /* remote host authorization check */
291 - if ((!svc_sendreply(xprt, xdr_pmaplist,
292 + if ((!svc_sendreply(xprt, (xdrproc_t)xdr_pmaplist,
293 (caddr_t)&p)) && debugging) {
294 (void) fprintf(stderr, "svc_sendreply\n");
297 struct encap_parms *epp;
300 - return (xdr_bytes(xdrs, &(epp->args), &(epp->arglen), ARGSIZE));
301 + return (xdr_bytes(xdrs, &(epp->args), (u_int *)&(epp->arglen), ARGSIZE));
308 a.rmt_args.args = buf;
309 - if (!svc_getargs(xprt, xdr_rmtcall_args, &a))
310 + if (!svc_getargs(xprt, (xdrproc_t)xdr_rmtcall_args, (caddr_t)&a))
312 /* host and service access control */
313 if (!check_callit(svc_getcaller(xprt),
315 au->aup_uid, au->aup_gid, au->aup_len, au->aup_gids);
317 a.rmt_port = (u_long)port;
318 - if (clnt_call(client, a.rmt_proc, xdr_opaque_parms, &a,
319 - xdr_len_opaque_parms, &a, timeout) == RPC_SUCCESS) {
320 - svc_sendreply(xprt, xdr_rmtcall_result, (caddr_t)&a);
321 + if (clnt_call(client, a.rmt_proc, (xdrproc_t)xdr_opaque_parms, (caddr_t)&a,
322 + (xdrproc_t)xdr_len_opaque_parms, (caddr_t)&a, timeout) == RPC_SUCCESS) {
323 + svc_sendreply(xprt, (xdrproc_t)xdr_rmtcall_result, (caddr_t)&a);
325 AUTH_DESTROY(client->cl_auth);
326 clnt_destroy(client);
328 +--------------------------------------------------------------------+
329 | Ste'phane ERANIAN | Email eranian@hpl.hp.com |
330 | Hewlett-Packard Laboratories | |
331 | 1501, Page Mill Road MS 1U-15 | |
332 | Palo Alto, CA 94303-096 | |
334 | Tel : (650) 857-7174 | |
335 | Fax : (650) 857-5548 | |
336 +--------------------------------------------------------------------+