Blame SOURCES/tcp_wrappers-7.6-shared.patch

23cc51
diff -up tcp_wrappers_7.6/Makefile.patch11 tcp_wrappers_7.6/Makefile
23cc51
--- tcp_wrappers_7.6/Makefile.patch11	2008-08-29 09:45:12.000000000 +0200
23cc51
+++ tcp_wrappers_7.6/Makefile	2008-08-29 09:45:12.000000000 +0200
23cc51
@@ -150,8 +150,8 @@ netbsd:
23cc51
 
23cc51
 linux:
23cc51
 	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
23cc51
-	LIBS="-lnsl" RANLIB=ranlib ARFLAGS=rv AUX_OBJ= \
23cc51
-	NETGROUP="-DNETGROUP" TLI= EXTRA_CFLAGS="$(RPM_OPT_FLAGS) -DUSE_STRERROR -DSYS_ERRLIST_DEFINED -DBROKEN_SO_LINGER -Dss_family=__ss_family -Dss_len=__ss_len" all
23cc51
+	LIBS="-lnsl" RANLIB=ranlib ARFLAGS=rv AUX_OBJ=weak_symbols.o \
23cc51
+	NETGROUP="-DNETGROUP" TLI= EXTRA_CFLAGS="$(RPM_OPT_FLAGS)  -fPIC -DPIC -D_REENTRANT -DUSE_STRERROR -DSYS_ERRLIST_DEFINED -DBROKEN_SO_LINGER -Dss_family=__ss_family -Dss_len=__ss_len -DHAVE_WEAKSYMS" all
23cc51
 
23cc51
 linux-old:
23cc51
 	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
23cc51
@@ -249,7 +249,7 @@ tandem:
23cc51
 
23cc51
 # Amdahl UTS 2.1.5 (Richard.Richmond@bridge.bst.bls.com)
23cc51
 uts215:
23cc51
-	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \   
23cc51
+	@make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
23cc51
 	LIBS="-lsocket" RANLIB=echo \
23cc51
 	ARFLAGS=rv AUX_OBJ=setenv.o NETGROUP=-DNO_NETGROUP TLI= all
23cc51
 
23cc51
@@ -706,8 +706,9 @@ KIT	= README miscd.c tcpd.c fromhost.c h
23cc51
 	scaffold.h tcpdmatch.8 README.NIS
23cc51
 
23cc51
 LIB	= libwrap.a
23cc51
+SHLIB 	= libwrap.so
23cc51
 
23cc51
-all other: config-check tcpd tcpdmatch try-from safe_finger tcpdchk
23cc51
+all other: config-check tcpd tcpdmatch try-from safe_finger tcpdchk $(SHLIB)
23cc51
 
23cc51
 # Invalidate all object files when the compiler options (CFLAGS) have changed.
23cc51
 
23cc51
@@ -724,6 +725,12 @@ $(LIB):	$(LIB_OBJ)
23cc51
 	$(AR) $(ARFLAGS) $(LIB) $(LIB_OBJ)
23cc51
 	-$(RANLIB) $(LIB)
23cc51
 
23cc51
+$(SHLIB): $(LIB_OBJ)
23cc51
+	gcc -shared -fPIC -Wl,-soname -Wl,$(SHLIB).$(MAJOR) \
23cc51
+		-o $(SHLIB).$(MAJOR).$(MINOR).$(REL) $^ $(LIBS)
23cc51
+	ln -s $(SHLIB).$(MAJOR).$(MINOR).$(REL) $(SHLIB).$(MAJOR)
23cc51
+	ln -s $(SHLIB).$(MAJOR).$(MINOR).$(REL) $(SHLIB)
23cc51
+
23cc51
 tcpd:	tcpd.o $(LIB)
23cc51
 	$(CC) $(CFLAGS) -o $@ tcpd.o $(LIB) $(LIBS)
23cc51
 
23cc51
@@ -906,5 +913,6 @@ update.o: cflags
23cc51
 update.o: mystdarg.h
23cc51
 update.o: tcpd.h
23cc51
 vfprintf.o: cflags
23cc51
+weak_symbols.o: tcpd.h
23cc51
 workarounds.o: cflags
23cc51
 workarounds.o: tcpd.h
23cc51
diff -up tcp_wrappers_7.6/tcpd.h.patch11 tcp_wrappers_7.6/tcpd.h
23cc51
--- tcp_wrappers_7.6/tcpd.h.patch11	2008-08-29 09:45:12.000000000 +0200
23cc51
+++ tcp_wrappers_7.6/tcpd.h	2008-08-29 09:45:12.000000000 +0200
23cc51
@@ -4,6 +4,25 @@
23cc51
   * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
23cc51
   */
23cc51
 
23cc51
+#ifndef _TCPWRAPPERS_TCPD_H
23cc51
+#define _TCPWRAPPERS_TCPD_H
23cc51
+
23cc51
+/* someone else may have defined this */
23cc51
+#undef  __P
23cc51
+
23cc51
+/* use prototypes if we have an ANSI C compiler or are using C++ */
23cc51
+#if defined(__STDC__) || defined(__cplusplus)
23cc51
+#define __P(args)       args
23cc51
+#else
23cc51
+#define __P(args)       ()
23cc51
+#endif
23cc51
+
23cc51
+/* Need definitions of struct sockaddr_in and FILE. */
23cc51
+#include <netinet/in.h>
23cc51
+#include <stdio.h>
23cc51
+
23cc51
+__BEGIN_DECLS
23cc51
+
23cc51
 /* Structure to describe one communications endpoint. */
23cc51
 
23cc51
 #define STRING_LENGTH	128		/* hosts, users, processes */
23cc51
@@ -92,10 +111,10 @@ struct request_info {
23cc51
     char    pid[10];			/* access via eval_pid(request) */
23cc51
     struct host_info client[1];		/* client endpoint info */
23cc51
     struct host_info server[1];		/* server endpoint info */
23cc51
-    void  (*sink) ();			/* datagram sink function or 0 */
23cc51
-    void  (*hostname) ();		/* address to printable hostname */
23cc51
-    void  (*hostaddr) ();		/* address to printable address */
23cc51
-    void  (*cleanup) ();		/* cleanup function or 0 */
23cc51
+    void  (*sink) __P((int));		/* datagram sink function or 0 */
23cc51
+    void  (*hostname) __P((struct host_info *)); /* address to printable hostname */
23cc51
+    void  (*hostaddr) __P((struct host_info *)); /* address to printable address */
23cc51
+    void  (*cleanup) __P((struct request_info *)); /* cleanup function or 0 */
23cc51
     struct netconfig *config;		/* netdir handle */
23cc51
 };
23cc51
 
23cc51
@@ -132,33 +151,38 @@ extern char paranoid[];
23cc51
 /* Global functions. */
23cc51
 
23cc51
 #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
23cc51
-extern void fromhost();			/* get/validate client host info */
23cc51
+extern void fromhost __P((struct request_info *));			/* get/validate client host info */
23cc51
 #else
23cc51
 #define fromhost sock_host		/* no TLI support needed */
23cc51
 #endif
23cc51
 
23cc51
-extern int hosts_access();		/* access control */
23cc51
-extern void shell_cmd();		/* execute shell command */
23cc51
-extern char *percent_x();		/* do %<char> expansion */
23cc51
-extern void rfc931();			/* client name from RFC 931 daemon */
23cc51
-extern void clean_exit();		/* clean up and exit */
23cc51
-extern void refuse();			/* clean up and exit */
23cc51
-extern char *xgets();			/* fgets() on steroids */
23cc51
-extern char *split_at();		/* strchr() and split */
23cc51
-extern unsigned long dot_quad_addr();	/* restricted inet_addr() */
23cc51
-extern int numeric_addr();		/* IP4/IP6 inet_addr (restricted) */
23cc51
-extern struct hostent *tcpd_gethostbyname();
23cc51
+extern void shell_cmd __P((char *));		/* execute shell command */
23cc51
+extern char *percent_x __P((char *, int, char *, struct request_info *));		/* do %<char> expansion */
23cc51
+extern void rfc931 __P((struct sockaddr_gen *, struct sockaddr_gen *, char *));			/* client name from RFC 931 daemon */
23cc51
+extern void clean_exit __P((struct request_info *));		/* clean up and exit */
23cc51
+extern void refuse __P((struct request_info *));			/* clean up and exit */
23cc51
+extern char *xgets __P((char *, int, FILE *));			/* fgets() on steroids */
23cc51
+extern char *split_at __P((char *, int));		/* strchr() and split */
23cc51
+extern unsigned long dot_quad_addr __P((char *));	/* restricted inet_addr() */
23cc51
+extern int numeric_addr __P((char *, union gen_addr *, int *, int *));		/* IP4/IP6 inet_addr (restricted) */
23cc51
+extern struct hostent *tcpd_gethostbyname __P((char *, int));
23cc51
 					/* IP4/IP6 gethostbyname */
23cc51
 #ifdef HAVE_IPV6
23cc51
-extern char *skip_ipv6_addrs();		/* skip over colons in IPv6 addrs */
23cc51
+extern char *skip_ipv6_addrs __P((char *));		/* skip over colons in IPv6 addrs */
23cc51
 #else
23cc51
 #define skip_ipv6_addrs(x)	x
23cc51
 #endif
23cc51
 
23cc51
 /* Global variables. */
23cc51
 
23cc51
+#ifdef HAVE_WEAKSYMS
23cc51
+extern int allow_severity __attribute__ ((weak)); /* for connection logging */
23cc51
+extern int deny_severity __attribute__ ((weak)); /* for connection logging */
23cc51
+#else
23cc51
 extern int allow_severity;		/* for connection logging */
23cc51
 extern int deny_severity;		/* for connection logging */
23cc51
+#endif
23cc51
+
23cc51
 extern char *hosts_allow_table;		/* for verification mode redirection */
23cc51
 extern char *hosts_deny_table;		/* for verification mode redirection */
23cc51
 extern int hosts_access_verbose;	/* for verbose matching mode */
23cc51
@@ -171,9 +195,14 @@ extern int resident;			/* > 0 if residen
23cc51
   */
23cc51
 
23cc51
 #ifdef __STDC__
23cc51
+extern int hosts_access(struct request_info *request);
23cc51
+extern int hosts_ctl(char *daemon, char *client_name, char *client_addr, 
23cc51
+                     char *client_user);
23cc51
 extern struct request_info *request_init(struct request_info *,...);
23cc51
 extern struct request_info *request_set(struct request_info *,...);
23cc51
 #else
23cc51
+extern int hosts_access();
23cc51
+extern int hosts_ctl();
23cc51
 extern struct request_info *request_init();	/* initialize request */
23cc51
 extern struct request_info *request_set();	/* update request structure */
23cc51
 #endif
23cc51
@@ -196,27 +225,31 @@ extern struct request_info *request_set(
23cc51
   * host_info structures serve as caches for the lookup results.
23cc51
   */
23cc51
 
23cc51
-extern char *eval_user();		/* client user */
23cc51
-extern char *eval_hostname();		/* printable hostname */
23cc51
-extern char *eval_hostaddr();		/* printable host address */
23cc51
-extern char *eval_hostinfo();		/* host name or address */
23cc51
-extern char *eval_client();		/* whatever is available */
23cc51
-extern char *eval_server();		/* whatever is available */
23cc51
+extern char *eval_user __P((struct request_info *));	/* client user */
23cc51
+extern char *eval_hostname __P((struct host_info *));	/* printable hostname */
23cc51
+extern char *eval_hostaddr __P((struct host_info *));	/* printable host address */
23cc51
+extern char *eval_hostinfo __P((struct host_info *));	/* host name or address */
23cc51
+extern char *eval_client __P((struct request_info *));	/* whatever is available */
23cc51
+extern char *eval_server __P((struct request_info *));	/* whatever is available */
23cc51
 #define eval_daemon(r)	((r)->daemon)	/* daemon process name */
23cc51
 #define eval_pid(r)	((r)->pid)	/* process id */
23cc51
 
23cc51
 /* Socket-specific methods, including DNS hostname lookups. */
23cc51
 
23cc51
-extern void sock_host();		/* look up endpoint addresses */
23cc51
-extern void sock_hostname();		/* translate address to hostname */
23cc51
-extern void sock_hostaddr();		/* address to printable address */
23cc51
+/* look up endpoint addresses */
23cc51
+extern void sock_host __P((struct request_info *));
23cc51
+/* translate address to hostname */
23cc51
+extern void sock_hostname __P((struct host_info *));
23cc51
+/* address to printable address */
23cc51
+extern void sock_hostaddr __P((struct host_info *));
23cc51
+
23cc51
 #define sock_methods(r) \
23cc51
 	{ (r)->hostname = sock_hostname; (r)->hostaddr = sock_hostaddr; }
23cc51
 
23cc51
 /* The System V Transport-Level Interface (TLI) interface. */
23cc51
 
23cc51
 #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
23cc51
-extern void tli_host();			/* look up endpoint addresses etc. */
23cc51
+extern void tli_host __P((struct request_info *));	/* look up endpoint addresses etc. */
23cc51
 #endif
23cc51
 
23cc51
  /*
23cc51
@@ -257,7 +290,7 @@ extern struct tcpd_context tcpd_context;
23cc51
   * behavior.
23cc51
   */
23cc51
 
23cc51
-extern void process_options();		/* execute options */
23cc51
+extern void process_options __P((char *, struct request_info *)); /* execute options */
23cc51
 extern int dry_run;			/* verification flag */
23cc51
 
23cc51
 /* Bug workarounds. */
23cc51
@@ -296,3 +329,7 @@ extern char *fix_strtok();
23cc51
 #define strtok	my_strtok
23cc51
 extern char *my_strtok();
23cc51
 #endif
23cc51
+
23cc51
+__END_DECLS
23cc51
+
23cc51
+#endif /* tcpd.h */
23cc51
diff -up /dev/null tcp_wrappers_7.6/weak_symbols.c
23cc51
--- /dev/null	2008-08-29 10:35:15.589003986 +0200
23cc51
+++ tcp_wrappers_7.6/weak_symbols.c	2008-08-29 09:45:12.000000000 +0200
23cc51
@@ -0,0 +1,11 @@
23cc51
+ /*
23cc51
+  * @(#) weak_symbols.h 1.5 99/12/29 23:50
23cc51
+  * 
23cc51
+  * Author: Anthony Towns <ajt@debian.org>
23cc51
+  */
23cc51
+
23cc51
+#ifdef HAVE_WEAKSYMS
23cc51
+#include <syslog.h>
23cc51
+int deny_severity = LOG_WARNING;
23cc51
+int allow_severity = SEVERITY; 
23cc51
+#endif
23cc51
diff -up tcp_wrappers_7.6/scaffold.c.patch11 tcp_wrappers_7.6/scaffold.c
23cc51
--- tcp_wrappers_7.6/scaffold.c.patch11	2013-01-28 11:08:48.598273563 +0100
23cc51
+++ tcp_wrappers_7.6/scaffold.c	2013-01-28 11:08:56.069316992 +0100
23cc51
@@ -25,7 +25,7 @@ static char sccs_id[] = "@(#) scaffold.c
23cc51
 #define	INADDR_NONE	(-1)		/* XXX should be 0xffffffff */
23cc51
 #endif
23cc51
 
23cc51
-extern char *malloc();
23cc51
+extern void *malloc(size_t);
23cc51
 
23cc51
 /* Application-specific. */
23cc51
 
23cc51
@@ -180,10 +180,12 @@ struct request_info *request;
23cc51
 
23cc51
 /* ARGSUSED */
23cc51
 
23cc51
-void    rfc931(request)
23cc51
-struct request_info *request;
23cc51
+void    rfc931(rmt_sin, our_sin, dest)
23cc51
+struct sockaddr_gen *rmt_sin;
23cc51
+struct sockaddr_gen *our_sin;
23cc51
+char   *dest;
23cc51
 {
23cc51
-    strcpy(request->user, unknown);
23cc51
+    strcpy(dest, unknown);
23cc51
 }
23cc51
 
23cc51
 /* check_path - examine accessibility */