wok diff portmap/stuff/portmap-5beta-compilation_fixes-3.patch @ rev 19278

Check manpages... to bluez.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Tue Jul 05 19:21:55 2016 +0300 (2016-07-05)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/portmap/stuff/portmap-5beta-compilation_fixes-3.patch	Tue Jul 05 19:21:55 2016 +0300
     1.3 @@ -0,0 +1,705 @@
     1.4 +Submitted By: Kevin P. Fleming <kpfleming at linuxfromscratch dot org>
     1.5 +Date: 2004-05-02
     1.6 +Initial Package Version: 5beta
     1.7 +Origin: http://archives.linuxfromscratch.org/mail-archives/blfs-dev/2003-January/001960.html
     1.8 +Description: The patch was created from the portmap modified package by Mark Heerdink.
     1.9 +This patch provides the following improvements:
    1.10 +    * Link against dynamic tcp_wrappers.
    1.11 +    * Create an install target for portmap.
    1.12 +    * Compilation and security fixes.
    1.13 +    * Documentation fixes.
    1.14 +
    1.15 +Originally created by Tushar Teredesai, updated by kpfleming to ensure
    1.16 +portmap will compile without tcp_wrappers installed.
    1.17 +diff -Naur portmap_5beta/BLURB portmap_5beta.gimli/BLURB
    1.18 +--- portmap_5beta/BLURB	1996-07-06 16:09:46.000000000 -0500
    1.19 ++++ portmap_5beta.gimli/BLURB	2002-01-07 09:13:58.000000000 -0600
    1.20 +@@ -1,3 +1,6 @@
    1.21 ++
    1.22 ++###############################################################################
    1.23 ++
    1.24 + @(#) BLURB 1.5 96/07/06 23:09:45
    1.25 + 
    1.26 + This is the fifth replacement portmapper release.
    1.27 +diff -Naur portmap_5beta/Makefile portmap_5beta.gimli/Makefile
    1.28 +--- portmap_5beta/Makefile	1996-07-06 16:06:19.000000000 -0500
    1.29 ++++ portmap_5beta.gimli/Makefile	2002-07-15 16:00:07.000000000 -0500
    1.30 +@@ -8,7 +8,7 @@
    1.31 + # if you disagree. See `man 3 syslog' for examples. Some syslog versions
    1.32 + # do not provide this flexibility.
    1.33 + #
    1.34 +-FACILITY=LOG_MAIL
    1.35 ++FACILITY=LOG_DAEMON
    1.36 + 
    1.37 + # To disable tcp-wrapper style access control, comment out the following
    1.38 + # macro definitions.  Access control can also be turned off by providing
    1.39 +@@ -16,7 +16,8 @@
    1.40 + # daemon, is always treated as an authorized host.
    1.41 + 
    1.42 + HOSTS_ACCESS= -DHOSTS_ACCESS
    1.43 +-WRAP_LIB = $(WRAP_DIR)/libwrap.a
    1.44 ++#WRAP_LIB = $(WRAP_DIR)/libwrap.a
    1.45 ++WRAP_LIB = -lwrap
    1.46 + 
    1.47 + # Comment out if your RPC library does not allocate privileged ports for
    1.48 + # requests from processes with root privilege, or the new portmap will
    1.49 +@@ -71,7 +72,7 @@
    1.50 + # With verbose logging on, HP-UX 9.x and AIX 4.1 leave zombies behind when
    1.51 + # SIGCHLD is not ignored. Enable next macro for a fix.
    1.52 + #
    1.53 +-# ZOMBIES = -DIGNORE_SIGCHLD	# AIX 4.x, HP-UX 9.x
    1.54 ++ZOMBIES = -DIGNORE_SIGCHLD	# AIX 4.x, HP-UX 9.x
    1.55 + 
    1.56 + # Uncomment the following macro if your system does not have u_long.
    1.57 + #
    1.58 +@@ -81,7 +82,7 @@
    1.59 + # libwrap.a object library. WRAP_DIR should specify the directory with
    1.60 + # that library.
    1.61 + 
    1.62 +-WRAP_DIR= ../tcp_wrappers
    1.63 ++WRAP_DIR= $(TCPD_DIR)
    1.64 + 
    1.65 + # Auxiliary object files that may be missing from your C library.
    1.66 + #
    1.67 +@@ -99,22 +100,31 @@
    1.68 + 
    1.69 + # Comment out if your compiler talks ANSI and understands const
    1.70 + #
    1.71 +-CONST   = -Dconst=
    1.72 ++#CONST   = -Dconst=
    1.73 + 
    1.74 + ### End of configurable stuff.
    1.75 + ##############################
    1.76 + 
    1.77 ++GLIBC=$(shell grep -s -c __GLIBC__ /usr/include/features.h)
    1.78 ++
    1.79 ++ifeq ($(GLIBC),0)
    1.80 ++LIBS   += # -lbsd
    1.81 ++else
    1.82 ++LIBS   += -lnsl
    1.83 ++endif
    1.84 ++
    1.85 ++
    1.86 + SHELL	= /bin/sh
    1.87 + 
    1.88 +-COPT	= $(CONST) -Dperror=xperror $(HOSTS_ACCESS) $(CHECK_PORT) \
    1.89 ++COPT	= $(CONST) $(HOSTS_ACCESS) $(CHECK_PORT) \
    1.90 + 	$(SYS) -DFACILITY=$(FACILITY) $(ULONG) $(ZOMBIES) $(SA_LEN) \
    1.91 + 	$(LOOPBACK) $(SETPGRP)
    1.92 +-CFLAGS	= $(COPT) -O $(NSARCHS)
    1.93 ++CFLAGS	= -Wall $(COPT) -O2 $(NSARCHS)
    1.94 + OBJECTS	= portmap.o pmap_check.o from_local.o $(AUX)
    1.95 + 
    1.96 + all:	portmap pmap_dump pmap_set
    1.97 + 
    1.98 +-portmap: $(OBJECTS) $(WRAP_DIR)/libwrap.a
    1.99 ++portmap: $(OBJECTS) # $(WRAP_DIR)/libwrap.a
   1.100 + 	$(CC) $(CFLAGS) -o $@ $(OBJECTS) $(WRAP_LIB) $(LIBS)
   1.101 + 
   1.102 + pmap_dump: pmap_dump.c
   1.103 +@@ -129,6 +139,17 @@
   1.104 + get_myaddress: get_myaddress.c
   1.105 + 	cc $(CFLAGS) -DTEST -o $@ get_myaddress.c $(LIBS)
   1.106 + 
   1.107 ++install: all
   1.108 ++	install -o root -g root -m 0755 -s portmap ${BASEDIR}/sbin
   1.109 ++	install -o root -g root -m 0755 -s pmap_dump ${BASEDIR}/usr/sbin
   1.110 ++	install -o root -g root -m 0755 -s pmap_set ${BASEDIR}/usr/sbin
   1.111 ++	install -o root -g root -m 0644 portmap.8 ${BASEDIR}/usr/share/man/man8
   1.112 ++	install -o root -g root -m 0644 pmap_dump.8 ${BASEDIR}/usr/share/man/man8
   1.113 ++	install -o root -g root -m 0644 pmap_set.8 ${BASEDIR}/usr/share/man/man8
   1.114 ++#	cat README BLURB >${BASEDIR}/usr/share/doc/portmap/portmapper.txt
   1.115 ++#	gzip -9f ${BASEDIR}/usr/share/doc/portmap/portmapper.txt
   1.116 ++
   1.117 ++
   1.118 + lint:	
   1.119 + 	lint $(COPT) $(OBJECTS:%.o=%.c)
   1.120 + 
   1.121 +diff -Naur portmap_5beta/daemon.c portmap_5beta.gimli/daemon.c
   1.122 +--- portmap_5beta/daemon.c	1992-06-11 15:53:12.000000000 -0500
   1.123 ++++ portmap_5beta.gimli/daemon.c	2002-01-07 09:22:24.000000000 -0600
   1.124 +@@ -36,16 +36,13 @@
   1.125 + #endif /* LIBC_SCCS and not lint */
   1.126 + 
   1.127 + #include <fcntl.h>
   1.128 +-
   1.129 +-/* From unistd.h */
   1.130 +-#define STDIN_FILENO	0
   1.131 +-#define STDOUT_FILENO	1
   1.132 +-#define STDERR_FILENO	2
   1.133 ++#include <unistd.h>
   1.134 ++#include <sys/types.h>
   1.135 + 
   1.136 + /* From paths.h */
   1.137 + #define _PATH_DEVNULL	"/dev/null"
   1.138 + 
   1.139 +-daemon(nochdir, noclose)
   1.140 ++int daemon(nochdir, noclose)
   1.141 + 	int nochdir, noclose;
   1.142 + {
   1.143 + 	int cpid;
   1.144 +diff -Naur portmap_5beta/from_local.c portmap_5beta.gimli/from_local.c
   1.145 +--- portmap_5beta/from_local.c	1996-05-31 08:52:58.000000000 -0500
   1.146 ++++ portmap_5beta.gimli/from_local.c	2002-01-07 09:25:49.000000000 -0600
   1.147 +@@ -35,7 +35,7 @@
   1.148 +  * Mountain View, California  94043
   1.149 +  */
   1.150 + 
   1.151 +-#ifndef lint
   1.152 ++#ifdef lint
   1.153 + static char sccsid[] = "@(#) from_local.c 1.3 96/05/31 15:52:57";
   1.154 + #endif
   1.155 + 
   1.156 +@@ -51,6 +51,9 @@
   1.157 + #include <net/if.h>
   1.158 + #include <sys/ioctl.h>
   1.159 + #include <syslog.h>
   1.160 ++#include <stdlib.h>
   1.161 ++#include <string.h>
   1.162 ++#include <unistd.h>
   1.163 + 
   1.164 + #ifndef TRUE
   1.165 + #define	TRUE	1
   1.166 +@@ -96,7 +99,7 @@
   1.167 + 
   1.168 + /* find_local - find all IP addresses for this host */
   1.169 + 
   1.170 +-find_local()
   1.171 ++int find_local()
   1.172 + {
   1.173 +     struct ifconf ifc;
   1.174 +     struct ifreq ifreq;
   1.175 +@@ -154,7 +157,7 @@
   1.176 + 
   1.177 + /* from_local - determine whether request comes from the local system */
   1.178 + 
   1.179 +-from_local(addr)
   1.180 ++int from_local(addr)
   1.181 + struct sockaddr_in *addr;
   1.182 + {
   1.183 +     int     i;
   1.184 +diff -Naur portmap_5beta/pmap_check.c portmap_5beta.gimli/pmap_check.c
   1.185 +--- portmap_5beta/pmap_check.c	1996-07-07 03:49:10.000000000 -0500
   1.186 ++++ portmap_5beta.gimli/pmap_check.c	2002-01-07 09:37:58.000000000 -0600
   1.187 +@@ -32,7 +32,7 @@
   1.188 +   * Computing Science, Eindhoven University of Technology, The Netherlands.
   1.189 +   */
   1.190 + 
   1.191 +-#ifndef lint
   1.192 ++#ifdef lint
   1.193 + static char sccsid[] = "@(#) pmap_check.c 1.8 96/07/07 10:49:10";
   1.194 + #endif
   1.195 + 
   1.196 +@@ -45,6 +45,11 @@
   1.197 + #include <netinet/in.h>
   1.198 + #include <rpc/rpcent.h>
   1.199 + #endif
   1.200 ++#include <sys/types.h>
   1.201 ++#include <unistd.h>
   1.202 ++#ifdef HOSTS_ACCESS
   1.203 ++#include <tcpd.h>
   1.204 ++#endif
   1.205 + 
   1.206 + extern char *inet_ntoa();
   1.207 + 
   1.208 +@@ -110,7 +113,7 @@
   1.209 + 
   1.210 + /* check_default - additional checks for NULL, DUMP, GETPORT and unknown */
   1.211 + 
   1.212 +-check_default(addr, proc, prog)
   1.213 ++int check_default(addr, proc, prog)
   1.214 + struct sockaddr_in *addr;
   1.215 + u_long  proc;
   1.216 + u_long  prog;
   1.217 +@@ -128,7 +131,7 @@
   1.218 + 
   1.219 + /* check_privileged_port - additional checks for privileged-port updates */
   1.220 + 
   1.221 +-check_privileged_port(addr, proc, prog, port)
   1.222 ++int check_privileged_port(addr, proc, prog, port)
   1.223 + struct sockaddr_in *addr;
   1.224 + u_long  proc;
   1.225 + u_long  prog;
   1.226 +@@ -173,7 +176,7 @@
   1.227 + 
   1.228 + #else
   1.229 + 
   1.230 +-check_setunset(addr, proc, prog, port)
   1.231 ++int check_setunset(addr, proc, prog, port)
   1.232 + struct sockaddr_in *addr;
   1.233 + u_long  proc;
   1.234 + u_long  prog;
   1.235 +@@ -197,7 +200,7 @@
   1.236 + 
   1.237 + /* check_callit - additional checks for forwarded requests */
   1.238 + 
   1.239 +-check_callit(addr, proc, prog, aproc)
   1.240 ++int check_callit(addr, proc, prog, aproc)
   1.241 + struct sockaddr_in *addr;
   1.242 + u_long  proc;
   1.243 + u_long  prog;
   1.244 +@@ -249,13 +252,13 @@
   1.245 +     };
   1.246 +     struct proc_map *procp;
   1.247 +     static struct proc_map procmap[] = {
   1.248 +-	PMAPPROC_CALLIT, "callit",
   1.249 +-	PMAPPROC_DUMP, "dump",
   1.250 +-	PMAPPROC_GETPORT, "getport",
   1.251 +-	PMAPPROC_NULL, "null",
   1.252 +-	PMAPPROC_SET, "set",
   1.253 +-	PMAPPROC_UNSET, "unset",
   1.254 +-	0, 0,
   1.255 ++	{ PMAPPROC_CALLIT, "callit" },
   1.256 ++	{ PMAPPROC_DUMP, "dump" },
   1.257 ++	{ PMAPPROC_GETPORT, "getport" },
   1.258 ++	{ PMAPPROC_NULL, "null" },
   1.259 ++	{ PMAPPROC_SET, "set" },
   1.260 ++	{ PMAPPROC_UNSET, "unset" },
   1.261 ++	{ 0, 0 }
   1.262 +     };
   1.263 + 
   1.264 +     /*
   1.265 +@@ -269,7 +272,7 @@
   1.266 + 
   1.267 + 	if (prognum == 0) {
   1.268 + 	    progname = "";
   1.269 +-	} else if (rpc = getrpcbynumber((int) prognum)) {
   1.270 ++	} else if ((rpc = getrpcbynumber((int) prognum)) != NULL) {
   1.271 + 	    progname = rpc->r_name;
   1.272 + 	} else {
   1.273 + 	    sprintf(progname = progbuf, "%lu", prognum);
   1.274 +diff -Naur portmap_5beta/pmap_dump.8 portmap_5beta.gimli/pmap_dump.8
   1.275 +--- portmap_5beta/pmap_dump.8	1969-12-31 18:00:00.000000000 -0600
   1.276 ++++ portmap_5beta.gimli/pmap_dump.8	2002-01-07 09:13:58.000000000 -0600
   1.277 +@@ -0,0 +1,24 @@
   1.278 ++.TH PMAP_DUMP 8 "21th June 1997" Linux "Linux Programmer's Manual"
   1.279 ++.SH NAME
   1.280 ++pmap_dump \- print a list of all registered RPC programs
   1.281 ++.SH SYNOPSIS
   1.282 ++.B pmap_dump
   1.283 ++.SH DESCRIPTION
   1.284 ++The
   1.285 ++.B pmap_dump
   1.286 ++command can be used to restart a running portmapper or to print
   1.287 ++a list of all registered RPC programs on the local host. If you
   1.288 ++want to use the program to restart the portmapper you have to
   1.289 ++redirect the output of
   1.290 ++.B pmap_dump
   1.291 ++to a file. After this you can restart the portmapper and restore
   1.292 ++the list of the registered RPC programs by feeding the output
   1.293 ++of
   1.294 ++.B pmap_dump
   1.295 ++to the
   1.296 ++.B pmap_set
   1.297 ++command.
   1.298 ++.SH SEE ALSO
   1.299 ++.BR pmap_set (8),
   1.300 ++.BR rpc.portmap (8)
   1.301 ++
   1.302 +diff -Naur portmap_5beta/pmap_dump.c portmap_5beta.gimli/pmap_dump.c
   1.303 +--- portmap_5beta/pmap_dump.c	1992-06-11 15:53:16.000000000 -0500
   1.304 ++++ portmap_5beta.gimli/pmap_dump.c	2002-01-07 09:20:19.000000000 -0600
   1.305 +@@ -5,7 +5,7 @@
   1.306 +   * Computing Science, Eindhoven University of Technology, The Netherlands.
   1.307 +   */
   1.308 + 
   1.309 +-#ifndef lint
   1.310 ++#ifdef lint
   1.311 + static char sccsid[] = "@(#) pmap_dump.c 1.1 92/06/11 22:53:15";
   1.312 + #endif
   1.313 + 
   1.314 +@@ -23,7 +23,20 @@
   1.315 + 
   1.316 + static char *protoname();
   1.317 + 
   1.318 +-main(argc, argv)
   1.319 ++#ifndef INADDR_LOOPBACK
   1.320 ++#define INADDR_LOOPBACK ntohl(inet_addr("127.0.0.1"))
   1.321 ++#endif
   1.322 ++
   1.323 ++static void    get_myloopaddress(addrp)
   1.324 ++struct sockaddr_in *addrp;
   1.325 ++{
   1.326 ++    memset((char *) addrp, 0, sizeof(*addrp));
   1.327 ++    addrp->sin_family = AF_INET;
   1.328 ++    addrp->sin_port = htons(PMAPPORT);
   1.329 ++    addrp->sin_addr.s_addr = htonl(INADDR_LOOPBACK);
   1.330 ++}
   1.331 ++
   1.332 ++int main(argc, argv)
   1.333 + int     argc;
   1.334 + char  **argv;
   1.335 + {
   1.336 +@@ -31,7 +44,7 @@
   1.337 +     register struct pmaplist *list;
   1.338 +     register struct rpcent *rpc;
   1.339 + 
   1.340 +-    get_myaddress(&addr);
   1.341 ++    get_myloopaddress(&addr);
   1.342 + 
   1.343 +     for (list = pmap_getmaps(&addr); list; list = list->pml_next) {
   1.344 + 	rpc = getrpcbynumber((int) list->pml_map.pm_prog);
   1.345 +diff -Naur portmap_5beta/pmap_set.8 portmap_5beta.gimli/pmap_set.8
   1.346 +--- portmap_5beta/pmap_set.8	1969-12-31 18:00:00.000000000 -0600
   1.347 ++++ portmap_5beta.gimli/pmap_set.8	2002-01-07 09:13:58.000000000 -0600
   1.348 +@@ -0,0 +1,24 @@
   1.349 ++.TH PMAP_SET 8 "21th June 1997" Linux "Linux Programmer's Manual"
   1.350 ++.SH NAME
   1.351 ++pmap_set \- set the list of registered RPC programs
   1.352 ++.SH SYNOPSIS
   1.353 ++.B pmap_set
   1.354 ++.SH DESCRIPTION
   1.355 ++The
   1.356 ++.B pmap_set
   1.357 ++command can be used to restart a running portmapper or to set
   1.358 ++the list of registered RPC programs on the local host. If you
   1.359 ++want to use the program to restart the portmapper you have to
   1.360 ++redirect the output of
   1.361 ++.B pmap_dump
   1.362 ++to a file. After this you can restart the portmapper and restore
   1.363 ++the list of the registered RPC programs by feeding the output
   1.364 ++of
   1.365 ++.B pmap_dump
   1.366 ++to the
   1.367 ++.B pmap_set
   1.368 ++command.
   1.369 ++.SH SEE ALSO
   1.370 ++.BR pmap_dump (8),
   1.371 ++.BR rpc.portmap (8)
   1.372 ++
   1.373 +diff -Naur portmap_5beta/pmap_set.c portmap_5beta.gimli/pmap_set.c
   1.374 +--- portmap_5beta/pmap_set.c	1996-07-06 16:06:23.000000000 -0500
   1.375 ++++ portmap_5beta.gimli/pmap_set.c	2002-01-07 09:22:10.000000000 -0600
   1.376 +@@ -5,7 +5,7 @@
   1.377 +   * Computing Science, Eindhoven University of Technology, The Netherlands.
   1.378 +   */
   1.379 + 
   1.380 +-#ifndef lint
   1.381 ++#ifdef lint
   1.382 + static char sccsid[] = "@(#) pmap_set.c 1.2 96/07/06 23:06:23";
   1.383 + #endif
   1.384 + 
   1.385 +@@ -17,7 +17,9 @@
   1.386 + #include <rpc/rpc.h>
   1.387 + #include <rpc/pmap_clnt.h>
   1.388 + 
   1.389 +-main(argc, argv)
   1.390 ++int parse_line(char *buf, u_long *prog, u_long *vers, int *prot, unsigned *port);
   1.391 ++
   1.392 ++int main(argc, argv)
   1.393 + int     argc;
   1.394 + char  **argv;
   1.395 + {
   1.396 +@@ -40,16 +42,16 @@
   1.397 + 
   1.398 + /* parse_line - convert line to numbers */
   1.399 + 
   1.400 +-parse_line(buf, prog, vers, prot, port)
   1.401 ++int parse_line(buf, prog, vers, prot, port)
   1.402 + char   *buf;
   1.403 + u_long *prog;
   1.404 + u_long *vers;
   1.405 + int    *prot;
   1.406 + unsigned *port;
   1.407 + {
   1.408 +-    char    proto_name[BUFSIZ];
   1.409 ++    char    proto_name[256];
   1.410 + 
   1.411 +-    if (sscanf(buf, "%lu %lu %s %u", prog, vers, proto_name, port) != 4) {
   1.412 ++    if (sscanf(buf, "%lu %lu %255s %u", prog, vers, proto_name, port) != 4) {
   1.413 + 	return (0);
   1.414 +     }
   1.415 +     if (strcmp(proto_name, "tcp") == 0) {
   1.416 +diff -Naur portmap_5beta/portmap.8 portmap_5beta.gimli/portmap.8
   1.417 +--- portmap_5beta/portmap.8	1969-12-31 18:00:00.000000000 -0600
   1.418 ++++ portmap_5beta.gimli/portmap.8	2002-01-07 09:13:58.000000000 -0600
   1.419 +@@ -0,0 +1,146 @@
   1.420 ++.\" Copyright (c) 1987 Sun Microsystems
   1.421 ++.\" Copyright (c) 1990, 1991 The Regents of the University of California.
   1.422 ++.\" All rights reserved.
   1.423 ++.\"
   1.424 ++.\" Redistribution and use in source and binary forms, with or without
   1.425 ++.\" modification, are permitted provided that the following conditions
   1.426 ++.\" are met:
   1.427 ++.\" 1. Redistributions of source code must retain the above copyright
   1.428 ++.\"    notice, this list of conditions and the following disclaimer.
   1.429 ++.\" 2. Redistributions in binary form must reproduce the above copyright
   1.430 ++.\"    notice, this list of conditions and the following disclaimer in the
   1.431 ++.\"    documentation and/or other materials provided with the distribution.
   1.432 ++.\" 3. All advertising materials mentioning features or use of this software
   1.433 ++.\"    must display the following acknowledgement:
   1.434 ++.\"	This product includes software developed by the University of
   1.435 ++.\"	California, Berkeley and its contributors.
   1.436 ++.\" 4. Neither the name of the University nor the names of its contributors
   1.437 ++.\"    may be used to endorse or promote products derived from this software
   1.438 ++.\"    without specific prior written permission.
   1.439 ++.\"
   1.440 ++.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   1.441 ++.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   1.442 ++.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   1.443 ++.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   1.444 ++.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   1.445 ++.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   1.446 ++.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   1.447 ++.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   1.448 ++.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   1.449 ++.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   1.450 ++.\" SUCH DAMAGE.
   1.451 ++.\"
   1.452 ++.\"     from: @(#)portmap.8	5.3 (Berkeley) 3/16/91
   1.453 ++.\"	$Id: portmap-5beta-compilation_fixes-3.patch,v 1.1 2004/06/08 04:53:09 jim Exp $
   1.454 ++.\"
   1.455 ++.Dd March 16, 1991
   1.456 ++.Dt PORTMAP 8
   1.457 ++.Os BSD 4.3
   1.458 ++.Sh NAME
   1.459 ++.Nm portmap
   1.460 ++.Nd
   1.461 ++.Tn DARPA
   1.462 ++port to
   1.463 ++.Tn RPC
   1.464 ++program number mapper
   1.465 ++.Sh SYNOPSIS
   1.466 ++.Nm portmap
   1.467 ++.Op Fl d
   1.468 ++.Op Fl v
   1.469 ++.Sh DESCRIPTION
   1.470 ++.Nm Portmap
   1.471 ++is a server that converts
   1.472 ++.Tn RPC
   1.473 ++program numbers into
   1.474 ++.Tn DARPA
   1.475 ++protocol port numbers.
   1.476 ++It must be running in order to make
   1.477 ++.Tn RPC
   1.478 ++calls.
   1.479 ++.Pp
   1.480 ++When an
   1.481 ++.Tn RPC
   1.482 ++server is started, it will tell
   1.483 ++.Nm portmap
   1.484 ++what port number it is listening to, and what
   1.485 ++.Tn RPC
   1.486 ++program numbers it is prepared to serve.
   1.487 ++When a client wishes to make an
   1.488 ++.Tn RPC
   1.489 ++call to a given program number,
   1.490 ++it will first contact
   1.491 ++.Nm portmap
   1.492 ++on the server machine to determine
   1.493 ++the port number where
   1.494 ++.Tn RPC
   1.495 ++packets should be sent.
   1.496 ++.Pp
   1.497 ++.Nm Portmap
   1.498 ++must be started before any
   1.499 ++.Tn RPC
   1.500 ++servers are invoked.
   1.501 ++.Pp
   1.502 ++Normally
   1.503 ++.Nm portmap
   1.504 ++forks and dissociates itself from the terminal
   1.505 ++like any other daemon.
   1.506 ++.Nm Portmap
   1.507 ++then logs errors using
   1.508 ++.Xr syslog 3 .
   1.509 ++.Pp
   1.510 ++Option available:
   1.511 ++.Bl -tag -width Ds
   1.512 ++.It Fl d
   1.513 ++(debug) prevents
   1.514 ++.Nm portmap
   1.515 ++from running as a daemon,
   1.516 ++and causes errors and debugging information
   1.517 ++to be printed to the standard error output.
   1.518 ++.It Fl v
   1.519 ++(verbose) run
   1.520 ++.Nm portmap
   1.521 ++in verbose mode.
   1.522 ++.El
   1.523 ++
   1.524 ++This
   1.525 ++.Nm portmap
   1.526 ++version is protected by the
   1.527 ++.Nm tcp_wrapper
   1.528 ++library. You have to give the clients access to
   1.529 ++.Nm portmap
   1.530 ++if they should be allowed to use it. To allow connects from clients of
   1.531 ++the .bar.com domain you could use the following line in /etc/hosts.allow:
   1.532 ++
   1.533 ++portmap: .bar.com
   1.534 ++
   1.535 ++You have to use the daemon name 
   1.536 ++.Nm portmap
   1.537 ++for the daemon name (even if the binary has a different name). For the
   1.538 ++client names you can only use the keyword ALL or IP addresses (NOT
   1.539 ++host or domain names).
   1.540 ++
   1.541 ++For further information please have a look at the
   1.542 ++.Xr tcpd 8 ,
   1.543 ++.Xr hosts_allow 5
   1.544 ++and
   1.545 ++.Xr hosts_access 5
   1.546 ++manual pages.
   1.547 ++
   1.548 ++.Sh SEE ALSO
   1.549 ++.Xr inetd.conf 5 ,
   1.550 ++.Xr rpcinfo 8 ,
   1.551 ++.Xr pmap_set 8 ,
   1.552 ++.Xr pmap_dump 8 ,
   1.553 ++.Xr inetd 8
   1.554 ++.Xr tcpd 8
   1.555 ++.Xr hosts_access 5
   1.556 ++.Xr hosts_options 5
   1.557 ++.Sh BUGS
   1.558 ++If
   1.559 ++.Nm portmap
   1.560 ++crashes, all servers must be restarted.
   1.561 ++.Sh HISTORY
   1.562 ++The
   1.563 ++.Nm
   1.564 ++command appeared in
   1.565 ++.Bx 4.3
   1.566 +diff -Naur portmap_5beta/portmap.c portmap_5beta.gimli/portmap.c
   1.567 +--- portmap_5beta/portmap.c	1996-07-06 16:06:24.000000000 -0500
   1.568 ++++ portmap_5beta.gimli/portmap.c	2002-01-07 09:26:41.000000000 -0600
   1.569 +@@ -37,7 +37,7 @@
   1.570 +  All rights reserved.\n";
   1.571 + #endif /* not lint */
   1.572 + 
   1.573 +-#ifndef lint
   1.574 ++#ifdef lint
   1.575 + static char sccsid[] = "@(#) portmap.c 1.6 96/07/06 23:06:23";
   1.576 + #endif /* not lint */
   1.577 + 
   1.578 +@@ -80,6 +80,9 @@
   1.579 +  * Mountain View, California  94043
   1.580 +  */
   1.581 + 
   1.582 ++#if defined(__GLIBC__)
   1.583 ++#include <rpc/xdr.h>
   1.584 ++#endif /* __GLIBC__ */
   1.585 + #include <rpc/rpc.h>
   1.586 + #include <rpc/pmap_prot.h>
   1.587 + #include <stdio.h>
   1.588 +@@ -94,6 +97,8 @@
   1.589 + #ifdef SYSV40
   1.590 + #include <netinet/in.h>
   1.591 + #endif
   1.592 ++#include <sys/types.h>
   1.593 ++#include <unistd.h>
   1.594 + 
   1.595 + extern char *strerror();
   1.596 + #include <stdlib.h>
   1.597 +@@ -148,7 +153,7 @@
   1.598 + #endif
   1.599 + #endif
   1.600 + 
   1.601 +-main(argc, argv)
   1.602 ++int main(argc, argv)
   1.603 + 	int argc;
   1.604 + 	char **argv;
   1.605 + {
   1.606 +@@ -350,7 +355,7 @@
   1.607 + 		 */
   1.608 + 		/* remote host authorization check */
   1.609 + 		check_default(svc_getcaller(xprt), rqstp->rq_proc, (u_long) 0);
   1.610 +-		if (!svc_sendreply(xprt, xdr_void, (caddr_t)0) && debugging) {
   1.611 ++		if (!svc_sendreply(xprt, (xdrproc_t) xdr_void, (caddr_t)0) && debugging) {
   1.612 + 			abort();
   1.613 + 		}
   1.614 + 		break;
   1.615 +@@ -359,7 +364,7 @@
   1.616 + 		/*
   1.617 + 		 * Set a program,version to port mapping
   1.618 + 		 */
   1.619 +-		if (!svc_getargs(xprt, xdr_pmap, &reg))
   1.620 ++		if (!svc_getargs(xprt, (xdrproc_t) xdr_pmap, (caddr_t) &reg))
   1.621 + 			svcerr_decode(xprt);
   1.622 + 		else {
   1.623 + 			/* reject non-local requests, protect priv. ports */
   1.624 +@@ -401,7 +406,7 @@
   1.625 + 				ans = 1;
   1.626 + 			}
   1.627 + 		done:
   1.628 +-			if ((!svc_sendreply(xprt, xdr_int, (caddr_t)&ans)) &&
   1.629 ++			if ((!svc_sendreply(xprt, (xdrproc_t) xdr_int, (caddr_t)&ans)) &&
   1.630 + 			    debugging) {
   1.631 + 				(void) fprintf(stderr, "svc_sendreply\n");
   1.632 + 				abort();
   1.633 +@@ -413,7 +418,7 @@
   1.634 + 		/*
   1.635 + 		 * Remove a program,version to port mapping.
   1.636 + 		 */
   1.637 +-		if (!svc_getargs(xprt, xdr_pmap, &reg))
   1.638 ++		if (!svc_getargs(xprt, (xdrproc_t) xdr_pmap, (caddr_t) &reg))
   1.639 + 			svcerr_decode(xprt);
   1.640 + 		else {
   1.641 + 			ans = 0;
   1.642 +@@ -447,7 +452,7 @@
   1.643 + 					prevpml->pml_next = pml;
   1.644 + 				free(t);
   1.645 + 			}
   1.646 +-			if ((!svc_sendreply(xprt, xdr_int, (caddr_t)&ans)) &&
   1.647 ++			if ((!svc_sendreply(xprt, (xdrproc_t) xdr_int, (caddr_t)&ans)) &&
   1.648 + 			    debugging) {
   1.649 + 				(void) fprintf(stderr, "svc_sendreply\n");
   1.650 + 				abort();
   1.651 +@@ -459,7 +464,7 @@
   1.652 + 		/*
   1.653 + 		 * Lookup the mapping for a program,version and return its port
   1.654 + 		 */
   1.655 +-		if (!svc_getargs(xprt, xdr_pmap, &reg))
   1.656 ++		if (!svc_getargs(xprt, (xdrproc_t) xdr_pmap, (caddr_t) &reg))
   1.657 + 			svcerr_decode(xprt);
   1.658 + 		else {
   1.659 + 			/* remote host authorization check */
   1.660 +@@ -474,7 +479,7 @@
   1.661 + 				port = fnd->pml_map.pm_port;
   1.662 + 			else
   1.663 + 				port = 0;
   1.664 +-			if ((!svc_sendreply(xprt, xdr_int, (caddr_t)&port)) &&
   1.665 ++			if ((!svc_sendreply(xprt, (xdrproc_t) xdr_int, (caddr_t)&port)) &&
   1.666 + 			    debugging) {
   1.667 + 				(void) fprintf(stderr, "svc_sendreply\n");
   1.668 + 				abort();
   1.669 +@@ -486,7 +491,7 @@
   1.670 + 		/*
   1.671 + 		 * Return the current set of mapped program,version
   1.672 + 		 */
   1.673 +-		if (!svc_getargs(xprt, xdr_void, NULL))
   1.674 ++		if (!svc_getargs(xprt, (xdrproc_t) xdr_void, (caddr_t) NULL))
   1.675 + 			svcerr_decode(xprt);
   1.676 + 		else {
   1.677 + 			/* remote host authorization check */
   1.678 +@@ -497,7 +502,7 @@
   1.679 + 			} else {
   1.680 + 				p = pmaplist;
   1.681 + 			}
   1.682 +-			if ((!svc_sendreply(xprt, xdr_pmaplist,
   1.683 ++			if ((!svc_sendreply(xprt, (xdrproc_t) xdr_pmaplist,
   1.684 + 			    (caddr_t)&p)) && debugging) {
   1.685 + 				(void) fprintf(stderr, "svc_sendreply\n");
   1.686 + 				abort();
   1.687 +@@ -645,7 +650,7 @@
   1.688 + 	timeout.tv_sec = 5;
   1.689 + 	timeout.tv_usec = 0;
   1.690 + 	a.rmt_args.args = buf;
   1.691 +-	if (!svc_getargs(xprt, xdr_rmtcall_args, &a))
   1.692 ++	if (!svc_getargs(xprt, (xdrproc_t) xdr_rmtcall_args, (caddr_t) &a))
   1.693 + 		return;
   1.694 + 	/* host and service access control */
   1.695 + 	if (!check_callit(svc_getcaller(xprt), 
   1.696 +@@ -674,9 +679,9 @@
   1.697 + 			   au->aup_uid, au->aup_gid, au->aup_len, au->aup_gids);
   1.698 + 		}
   1.699 + 		a.rmt_port = (u_long)port;
   1.700 +-		if (clnt_call(client, a.rmt_proc, xdr_opaque_parms, &a,
   1.701 +-		    xdr_len_opaque_parms, &a, timeout) == RPC_SUCCESS) {
   1.702 +-			svc_sendreply(xprt, xdr_rmtcall_result, (caddr_t)&a);
   1.703 ++		if (clnt_call(client, a.rmt_proc, (xdrproc_t) xdr_opaque_parms, (char*) &a,
   1.704 ++		    (xdrproc_t) xdr_len_opaque_parms, (char*) &a, timeout) == RPC_SUCCESS) {
   1.705 ++			svc_sendreply(xprt, (xdrproc_t) xdr_rmtcall_result, (caddr_t)&a);
   1.706 + 		}
   1.707 + 		AUTH_DESTROY(client->cl_auth);
   1.708 + 		clnt_destroy(client);