portmap-02-4.0-malloc.patch 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  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
  4. @@ -35,7 +35,9 @@
  5. static char sccsid[] = "@(#)daemon.c 5.3 (Berkeley) 12/28/90";
  6. #endif /* LIBC_SCCS and not lint */
  7. +#include <sys/types.h>
  8. #include <fcntl.h>
  9. +#include <unistd.h>
  10. /* From unistd.h */
  11. #define STDIN_FILENO 0
  12. @@ -44,7 +46,7 @@
  13. /* From paths.h */
  14. #define _PATH_DEVNULL "/dev/null"
  15. -
  16. +int
  17. daemon(nochdir, noclose)
  18. int nochdir, noclose;
  19. {
  20. diff -urN portmap_4/from_local.c portmap_4.new/from_local.c
  21. --- portmap_4/from_local.c Fri May 31 06:52:58 1996
  22. +++ portmap_4.new/from_local.c Tue Nov 30 01:21:27 1999
  23. @@ -46,12 +46,14 @@
  24. #include <sys/types.h>
  25. #include <sys/socket.h>
  26. #include <stdio.h>
  27. -#include <stdlib.h>
  28. +#include <unistd.h>
  29. #include <netdb.h>
  30. #include <netinet/in.h>
  31. #include <net/if.h>
  32. #include <sys/ioctl.h>
  33. #include <syslog.h>
  34. +#include <stdlib.h>
  35. +#include <string.h>
  36. #ifndef TRUE
  37. #define TRUE 1
  38. @@ -95,7 +98,7 @@
  39. }
  40. /* find_local - find all IP addresses for this host */
  41. -
  42. +int
  43. find_local()
  44. {
  45. struct ifconf ifc;
  46. @@ -153,7 +156,7 @@
  47. }
  48. /* from_local - determine whether request comes from the local system */
  49. -
  50. +int
  51. from_local(addr)
  52. struct sockaddr_in *addr;
  53. {
  54. diff -urN portmap_4/pmap_check.c portmap_4.new/pmap_check.c
  55. --- portmap_4/pmap_check.c Sun Nov 21 11:59:01 1993
  56. +++ portmap_4.new/pmap_check.c Tue Nov 30 01:19:37 1999
  57. @@ -34,7 +34,7 @@
  58. #ifndef lint
  59. static char sccsid[] = "@(#) pmap_check.c 1.6 93/11/21 20:58:59";
  60. #endif
  61. -
  62. +#include <unistd.h>
  63. #include <rpc/rpc.h>
  64. #include <rpc/pmap_prot.h>
  65. #include <syslog.h>
  66. @@ -66,6 +66,9 @@
  67. /* A handful of macros for "readability". */
  68. +/* coming from libwrap.a (tcp_wrappers) */
  69. +extern int hosts_ctl(char *daemon, char *name, char *addr, char *user);
  70. +
  71. #define good_client(a) hosts_ctl("portmap", "", inet_ntoa(a->sin_addr), "")
  72. #define legal_port(a,p) \
  73. @@ -104,6 +107,7 @@
  74. /* check_default - additional checks for NULL, DUMP, GETPORT and unknown */
  75. +int
  76. check_default(addr, proc, prog)
  77. struct sockaddr_in *addr;
  78. u_long proc;
  79. @@ -121,7 +125,7 @@
  80. }
  81. /* check_privileged_port - additional checks for privileged-port updates */
  82. -
  83. +int
  84. check_privileged_port(addr, proc, prog, port)
  85. struct sockaddr_in *addr;
  86. u_long proc;
  87. @@ -147,6 +147,6 @@
  88. #ifdef LOOPBACK_SETUNSET
  89. -
  90. +int
  91. check_setunset(xprt, ludp_xprt, ltcp_xprt, proc, prog, port)
  92. SVCXPRT *xprt;
  93. SVCXPRT *ludp_xprt;
  94. @@ -173,6 +174,6 @@
  95. #else
  96. -
  97. +int
  98. check_setunset(addr, proc, prog, port)
  99. struct sockaddr_in *addr;
  100. u_long proc;
  101. @@ -160,7 +164,7 @@
  102. }
  103. /* check_callit - additional checks for forwarded requests */
  104. -
  105. +int
  106. check_callit(addr, proc, prog, aproc)
  107. struct sockaddr_in *addr;
  108. u_long proc;
  109. @@ -213,13 +217,13 @@
  110. };
  111. struct proc_map *procp;
  112. static struct proc_map procmap[] = {
  113. - PMAPPROC_CALLIT, "callit",
  114. - PMAPPROC_DUMP, "dump",
  115. - PMAPPROC_GETPORT, "getport",
  116. - PMAPPROC_NULL, "null",
  117. - PMAPPROC_SET, "set",
  118. - PMAPPROC_UNSET, "unset",
  119. - 0, 0,
  120. + { PMAPPROC_CALLIT, "callit"},
  121. + { PMAPPROC_DUMP, "dump"},
  122. + { PMAPPROC_GETPORT, "getport"},
  123. + { PMAPPROC_NULL, "null"},
  124. + { PMAPPROC_SET, "set"},
  125. + { PMAPPROC_UNSET, "unset"},
  126. + { 0, 0},
  127. };
  128. /*
  129. @@ -233,7 +237,7 @@
  130. if (prognum == 0) {
  131. progname = "";
  132. - } else if (rpc = getrpcbynumber((int) prognum)) {
  133. + } else if ((rpc = getrpcbynumber((int) prognum))) {
  134. progname = rpc->r_name;
  135. } else {
  136. sprintf(progname = progbuf, "%lu", prognum);
  137. diff -urN portmap_4/pmap_dump.c portmap_4.new/pmap_dump.c
  138. --- portmap_4/pmap_dump.c Thu Jun 11 13:53:16 1992
  139. +++ portmap_4.new/pmap_dump.c Tue Nov 30 01:22:07 1999
  140. @@ -22,7 +22,7 @@
  141. #include <rpc/pmap_prot.h>
  142. static char *protoname();
  143. -
  144. +int
  145. main(argc, argv)
  146. int argc;
  147. char **argv;
  148. diff -urN portmap_4/pmap_set.c portmap_4.new/pmap_set.c
  149. --- portmap_4/pmap_set.c Thu Jun 11 13:53:17 1992
  150. +++ portmap_4.new/pmap_set.c Tue Nov 30 01:23:49 1999
  151. @@ -17,6 +17,9 @@
  152. #include <rpc/rpc.h>
  153. #include <rpc/pmap_clnt.h>
  154. +int parse_line(char *buf, u_long *, u_long *, int *, unsigned *);
  155. +
  156. +int
  157. main(argc, argv)
  158. int argc;
  159. char **argv;
  160. @@ -42,7 +45,7 @@
  161. }
  162. /* parse_line - convert line to numbers */
  163. -
  164. +int
  165. parse_line(buf, prog, vers, prot, port)
  166. char *buf;
  167. u_long *prog;
  168. diff -urN portmap_4/portmap.c portmap_4.new/portmap.c
  169. --- portmap_4/portmap.c Fri May 31 06:52:59 1996
  170. +++ portmap_4.new/portmap.c Tue Nov 30 01:01:32 1999
  171. @@ -83,6 +83,7 @@
  172. #include <rpc/rpc.h>
  173. #include <rpc/pmap_prot.h>
  174. #include <stdio.h>
  175. +#include <unistd.h>
  176. #include <syslog.h>
  177. #include <netdb.h>
  178. #include <sys/socket.h>
  179. @@ -128,6 +129,7 @@
  180. #include "pmap_check.h"
  181. +int
  182. main(argc, argv)
  183. int argc;
  184. char **argv;
  185. @@ -229,6 +231,7 @@
  186. svc_run();
  187. syslog(LOG_ERR, "run_svc returned unexpectedly");
  188. abort();
  189. + /* never reached */
  190. }
  191. #ifndef lint
  192. @@ -290,7 +293,7 @@
  193. */
  194. /* remote host authorization check */
  195. check_default(svc_getcaller(xprt), rqstp->rq_proc, (u_long) 0);
  196. - if (!svc_sendreply(xprt, xdr_void, (caddr_t)0) && debugging) {
  197. + if (!svc_sendreply(xprt, (xdrproc_t)xdr_void, (caddr_t)0) && debugging) {
  198. abort();
  199. }
  200. break;
  201. @@ -299,7 +302,7 @@
  202. /*
  203. * Set a program,version to port mapping
  204. */
  205. - if (!svc_getargs(xprt, xdr_pmap, &reg))
  206. + if (!svc_getargs(xprt, (xdrproc_t)xdr_pmap, (caddr_t)&reg))
  207. svcerr_decode(xprt);
  208. else {
  209. /* reject non-local requests, protect priv. ports */
  210. @@ -341,7 +344,7 @@
  211. ans = 1;
  212. }
  213. done:
  214. - if ((!svc_sendreply(xprt, xdr_int, (caddr_t)&ans)) &&
  215. + if ((!svc_sendreply(xprt, (xdrproc_t)xdr_int, (caddr_t)&ans)) &&
  216. debugging) {
  217. (void) fprintf(stderr, "svc_sendreply\n");
  218. abort();
  219. @@ -353,7 +356,7 @@
  220. /*
  221. * Remove a program,version to port mapping.
  222. */
  223. - if (!svc_getargs(xprt, xdr_pmap, &reg))
  224. + if (!svc_getargs(xprt, (xdrproc_t)xdr_pmap, (caddr_t)&reg))
  225. svcerr_decode(xprt);
  226. else {
  227. ans = 0;
  228. @@ -387,7 +390,7 @@
  229. prevpml->pml_next = pml;
  230. free(t);
  231. }
  232. - if ((!svc_sendreply(xprt, xdr_int, (caddr_t)&ans)) &&
  233. + if ((!svc_sendreply(xprt, (xdrproc_t)xdr_int, (caddr_t)&ans)) &&
  234. debugging) {
  235. (void) fprintf(stderr, "svc_sendreply\n");
  236. abort();
  237. @@ -399,7 +402,7 @@
  238. /*
  239. * Lookup the mapping for a program,version and return its port
  240. */
  241. - if (!svc_getargs(xprt, xdr_pmap, &reg))
  242. + if (!svc_getargs(xprt, (xdrproc_t)xdr_pmap, (caddr_t)&reg))
  243. svcerr_decode(xprt);
  244. else {
  245. /* remote host authorization check */
  246. @@ -414,7 +417,7 @@
  247. port = fnd->pml_map.pm_port;
  248. else
  249. port = 0;
  250. - if ((!svc_sendreply(xprt, xdr_int, (caddr_t)&port)) &&
  251. + if ((!svc_sendreply(xprt, (xdrproc_t)xdr_int, (caddr_t)&port)) &&
  252. debugging) {
  253. (void) fprintf(stderr, "svc_sendreply\n");
  254. abort();
  255. @@ -426,7 +429,7 @@
  256. /*
  257. * Return the current set of mapped program,version
  258. */
  259. - if (!svc_getargs(xprt, xdr_void, NULL))
  260. + if (!svc_getargs(xprt, (xdrproc_t)xdr_void, NULL))
  261. svcerr_decode(xprt);
  262. else {
  263. /* remote host authorization check */
  264. @@ -437,7 +440,7 @@
  265. } else {
  266. p = pmaplist;
  267. }
  268. - if ((!svc_sendreply(xprt, xdr_pmaplist,
  269. + if ((!svc_sendreply(xprt, (xdrproc_t)xdr_pmaplist,
  270. (caddr_t)&p)) && debugging) {
  271. (void) fprintf(stderr, "svc_sendreply\n");
  272. abort();
  273. @@ -481,7 +484,7 @@
  274. struct encap_parms *epp;
  275. {
  276. - return (xdr_bytes(xdrs, &(epp->args), &(epp->arglen), ARGSIZE));
  277. + return (xdr_bytes(xdrs, &(epp->args), (u_int *)&(epp->arglen), ARGSIZE));
  278. }
  279. struct rmtcallargs {
  280. @@ -585,7 +588,7 @@
  281. timeout.tv_sec = 5;
  282. timeout.tv_usec = 0;
  283. a.rmt_args.args = buf;
  284. - if (!svc_getargs(xprt, xdr_rmtcall_args, &a))
  285. + if (!svc_getargs(xprt, (xdrproc_t)xdr_rmtcall_args, (caddr_t)&a))
  286. return;
  287. /* host and service access control */
  288. if (!check_callit(svc_getcaller(xprt),
  289. @@ -614,9 +617,9 @@
  290. au->aup_uid, au->aup_gid, au->aup_len, au->aup_gids);
  291. }
  292. a.rmt_port = (u_long)port;
  293. - if (clnt_call(client, a.rmt_proc, xdr_opaque_parms, &a,
  294. - xdr_len_opaque_parms, &a, timeout) == RPC_SUCCESS) {
  295. - svc_sendreply(xprt, xdr_rmtcall_result, (caddr_t)&a);
  296. + if (clnt_call(client, a.rmt_proc, (xdrproc_t)xdr_opaque_parms, (caddr_t)&a,
  297. + (xdrproc_t)xdr_len_opaque_parms, (caddr_t)&a, timeout) == RPC_SUCCESS) {
  298. + svc_sendreply(xprt, (xdrproc_t)xdr_rmtcall_result, (caddr_t)&a);
  299. }
  300. AUTH_DESTROY(client->cl_auth);
  301. clnt_destroy(client);
  302. +--------------------------------------------------------------------+
  303. | Ste'phane ERANIAN | Email eranian@hpl.hp.com |
  304. | Hewlett-Packard Laboratories | |
  305. | 1501, Page Mill Road MS 1U-15 | |
  306. | Palo Alto, CA 94303-096 | |
  307. | USA | |
  308. | Tel : (650) 857-7174 | |
  309. | Fax : (650) 857-5548 | |
  310. +--------------------------------------------------------------------+