OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

274 lines
10 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../tcp_wrappers/0010-tcp_wrappers-7.6-sharedlib-weaksym.patch
  5. # Copyright (C) 2011 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. --- a/Makefile
  17. +++ b/Makefile
  18. @@ -150,15 +150,15 @@ netbsd:
  19. linux:
  20. @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  21. - LIBS=-lnsl RANLIB=ranlib ARFLAGS=rv AUX_OBJ= \
  22. + LIBS=-lnsl RANLIB=ranlib ARFLAGS=rv AUX_OBJ=weak_symbols.o \
  23. NETGROUP="-DNETGROUP" TLI= VSYSLOG= BUGS= \
  24. - EXTRA_CFLAGS="-DSYS_ERRLIST_DEFINED -DHAVE_STRERROR -DINET6=1 -Dss_family=__ss_family -Dss_len=__ss_len" all
  25. + EXTRA_CFLAGS="-DSYS_ERRLIST_DEFINED -DHAVE_STRERROR -DHAVE_WEAKSYMS -D_REENTRANT -DINET6=1 -Dss_family=__ss_family -Dss_len=__ss_len" all
  26. gnu:
  27. @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  28. - LIBS=-lnsl RANLIB=ranlib ARFLAGS=rv AUX_OBJ= \
  29. + LIBS=-lnsl RANLIB=ranlib ARFLAGS=rv AUX_OBJ=weak_symbols.o \
  30. NETGROUP=-DNETGROUP TLI= VSYSLOG= BUGS= \
  31. - EXTRA_CFLAGS="-DSYS_ERRLIST_DEFINED -DHAVE_STRERROR" all
  32. + EXTRA_CFLAGS="-DSYS_ERRLIST_DEFINED -DHAVE_STRERROR -DHAVE_WEAKSYMS -D_REENTRANT" all
  33. # This is good for many SYSV+BSD hybrids with NIS, probably also for HP-UX 7.x.
  34. hpux hpux8 hpux9 hpux10:
  35. @@ -713,7 +713,22 @@ KIT = README miscd.c tcpd.c fromhost.c h
  36. LIB = libwrap.a
  37. -all other: config-check tcpd tcpdmatch try-from safe_finger tcpdchk
  38. +shared/%.o: %.c
  39. + $(CC) $(CFLAGS) $(SHCFLAGS) -c $< -o $@
  40. +
  41. +SOMAJOR = 0
  42. +SOMINOR = 7.6
  43. +
  44. +SHLIB = shared/libwrap.so.$(SOMAJOR).$(SOMINOR)
  45. +SHLIBSOMAJ = shared/libwrap.so.$(SOMAJOR)
  46. +SHLIBSO = shared/libwrap.so
  47. +SHLIBFLAGS = -Lshared -lwrap
  48. +
  49. +SHLINKFLAGS = -fpic -shared -Wl,-soname,libwrap.so.$(SOMAJOR) -Wl,--version-script=libwrap.lds $(LIBS)
  50. +SHCFLAGS = -fpic -shared -D_REENTRANT
  51. +SHLIB_OBJ= $(addprefix shared/, $(LIB_OBJ));
  52. +
  53. +all other: config-check tcpd tcpdmatch try-from safe_finger tcpdchk $(LIB)
  54. # Invalidate all object files when the compiler options (CFLAGS) have changed.
  55. @@ -731,27 +746,33 @@ $(LIB): $(LIB_OBJ)
  56. $(AR) $(ARFLAGS) $(LIB) $(LIB_OBJ)
  57. -$(RANLIB) $(LIB)
  58. -tcpd: tcpd.o $(LIB)
  59. - $(CC) $(CFLAGS) -o $@ tcpd.o $(LIB) $(LIBS)
  60. +$(SHLIB): libwrap.lds $(SHLIB_OBJ)
  61. + rm -f $(SHLIB)
  62. + $(CC) -o $(SHLIB) $(SHLINKFLAGS) $(SHLIB_OBJ)
  63. + ln -sf $(notdir $(SHLIB)) $(SHLIBSOMAJ)
  64. + ln -sf $(notdir $(SHLIBSOMAJ)) $(SHLIBSO)
  65. +
  66. +tcpd: tcpd.o $(SHLIB)
  67. + $(CC) $(CFLAGS) -o $@ tcpd.o $(SHLIBFLAGS)
  68. miscd: miscd.o $(LIB)
  69. $(CC) $(CFLAGS) -o $@ miscd.o $(LIB) $(LIBS)
  70. -safe_finger: safe_finger.o $(LIB)
  71. - $(CC) $(CFLAGS) -o $@ safe_finger.o $(LIB) $(LIBS)
  72. +safe_finger: safe_finger.o
  73. + $(CC) $(CFLAGS) -o $@ safe_finger.o
  74. TCPDMATCH_OBJ = tcpdmatch.o fakelog.o inetcf.o scaffold.o
  75. -tcpdmatch: $(TCPDMATCH_OBJ) $(LIB)
  76. - $(CC) $(CFLAGS) -o $@ $(TCPDMATCH_OBJ) $(LIB) $(LIBS)
  77. +tcpdmatch: $(TCPDMATCH_OBJ) $(SHLIB)
  78. + $(CC) $(CFLAGS) -o $@ $(TCPDMATCH_OBJ) $(SHLIBFLAGS)
  79. -try-from: try-from.o fakelog.o $(LIB)
  80. - $(CC) $(CFLAGS) -o $@ try-from.o fakelog.o $(LIB) $(LIBS)
  81. +try-from: try-from.o fakelog.o $(SHLIB)
  82. + $(CC) $(CFLAGS) -o $@ try-from.o fakelog.o $(SHLIBFLAGS)
  83. TCPDCHK_OBJ = tcpdchk.o fakelog.o inetcf.o scaffold.o
  84. -tcpdchk: $(TCPDCHK_OBJ) $(LIB)
  85. - $(CC) $(CFLAGS) -o $@ $(TCPDCHK_OBJ) $(LIB) $(LIBS)
  86. +tcpdchk: $(TCPDCHK_OBJ) $(SHLIB)
  87. + $(CC) $(CFLAGS) -o $@ $(TCPDCHK_OBJ) $(SHLIBFLAGS)
  88. shar: $(KIT)
  89. @shar $(KIT)
  90. @@ -767,7 +788,9 @@ archive:
  91. clean:
  92. rm -f tcpd miscd safe_finger tcpdmatch tcpdchk try-from *.[oa] core \
  93. + libwrap*.so* \
  94. cflags
  95. + rm -rf shared/
  96. tidy: clean
  97. chmod -R a+r .
  98. @@ -913,5 +936,6 @@ update.o: cflags
  99. update.o: mystdarg.h
  100. update.o: tcpd.h
  101. vfprintf.o: cflags
  102. +weak_symbols.o: tcpd.h
  103. workarounds.o: cflags
  104. workarounds.o: tcpd.h
  105. --- a/tcpd.h
  106. +++ b/tcpd.h
  107. @@ -4,6 +4,15 @@
  108. * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
  109. */
  110. +#ifndef _TCPWRAPPERS_TCPD_H
  111. +#define _TCPWRAPPERS_TCPD_H
  112. +
  113. +/* Need definitions of struct sockaddr_in and FILE. */
  114. +#include <netinet/in.h>
  115. +#include <stdio.h>
  116. +
  117. +__BEGIN_DECLS
  118. +
  119. /* Structure to describe one communications endpoint. */
  120. #define STRING_LENGTH 128 /* hosts, users, processes */
  121. @@ -29,10 +38,10 @@ struct request_info {
  122. char pid[10]; /* access via eval_pid(request) */
  123. struct host_info client[1]; /* client endpoint info */
  124. struct host_info server[1]; /* server endpoint info */
  125. - void (*sink) (); /* datagram sink function or 0 */
  126. - void (*hostname) (); /* address to printable hostname */
  127. - void (*hostaddr) (); /* address to printable address */
  128. - void (*cleanup) (); /* cleanup function or 0 */
  129. + void (*sink) (int); /* datagram sink function or 0 */
  130. + void (*hostname) (struct host_info *); /* address to printable hostname */
  131. + void (*hostaddr) (struct host_info *); /* address to printable address */
  132. + void (*cleanup) (struct request_info *); /* cleanup function or 0 */
  133. struct netconfig *config; /* netdir handle */
  134. };
  135. @@ -70,20 +79,27 @@ extern void fromhost(); /* get/validat
  136. #define fromhost sock_host /* no TLI support needed */
  137. #endif
  138. -extern int hosts_access(); /* access control */
  139. -extern void shell_cmd(); /* execute shell command */
  140. -extern char *percent_x(); /* do %<char> expansion */
  141. -extern void rfc931(); /* client name from RFC 931 daemon */
  142. -extern void clean_exit(); /* clean up and exit */
  143. -extern void refuse(); /* clean up and exit */
  144. -extern char *xgets(); /* fgets() on steroids */
  145. -extern char *split_at(); /* strchr() and split */
  146. -extern unsigned long dot_quad_addr(); /* restricted inet_addr() */
  147. +extern int hosts_access(struct request_info *request); /* access control */
  148. +extern void shell_cmd(char *); /* execute shell command */
  149. +extern char *percent_x(char *, int, char *, struct request_info *);
  150. + /* do %<char> expansion */
  151. +extern void rfc931(struct sockaddr *, struct sockaddr *, char *);
  152. + /* client name from RFC 931 daemon */
  153. +extern void clean_exit(struct request_info *); /* clean up and exit */
  154. +extern void refuse(struct request_info *); /* clean up and exit */
  155. +extern char *xgets(char *, int, FILE *); /* fgets() on steroids */
  156. +extern char *split_at(char *, int); /* strchr() and split */
  157. +extern unsigned long dot_quad_addr(char *); /* restricted inet_addr() */
  158. /* Global variables. */
  159. +#ifdef HAVE_WEAKSYMS
  160. +extern int allow_severity __attribute__ ((weak)); /* for connection logging */
  161. +extern int deny_severity __attribute__ ((weak)); /* for connection logging */
  162. +#else
  163. extern int allow_severity; /* for connection logging */
  164. extern int deny_severity; /* for connection logging */
  165. +#endif
  166. extern char *hosts_allow_table; /* for verification mode redirection */
  167. extern char *hosts_deny_table; /* for verification mode redirection */
  168. extern int hosts_access_verbose; /* for verbose matching mode */
  169. @@ -98,6 +114,8 @@ extern int resident; /* > 0 if residen
  170. #ifdef __STDC__
  171. extern struct request_info *request_init(struct request_info *,...);
  172. extern struct request_info *request_set(struct request_info *,...);
  173. +extern int hosts_ctl(char *daemon, char *client_name, char *client_addr,
  174. + char *client_user);
  175. #else
  176. extern struct request_info *request_init(); /* initialize request */
  177. extern struct request_info *request_set(); /* update request structure */
  178. @@ -121,20 +139,23 @@ extern struct request_info *request_set(
  179. * host_info structures serve as caches for the lookup results.
  180. */
  181. -extern char *eval_user(); /* client user */
  182. -extern char *eval_hostname(); /* printable hostname */
  183. -extern char *eval_hostaddr(); /* printable host address */
  184. -extern char *eval_hostinfo(); /* host name or address */
  185. -extern char *eval_client(); /* whatever is available */
  186. -extern char *eval_server(); /* whatever is available */
  187. +extern char *eval_user(struct request_info *); /* client user */
  188. +extern char *eval_hostname(struct host_info *); /* printable hostname */
  189. +extern char *eval_hostaddr(struct host_info *); /* printable host address */
  190. +extern char *eval_hostinfo(struct host_info *); /* host name or address */
  191. +extern char *eval_client(struct request_info *);/* whatever is available */
  192. +extern char *eval_server(struct request_info *);/* whatever is available */
  193. #define eval_daemon(r) ((r)->daemon) /* daemon process name */
  194. #define eval_pid(r) ((r)->pid) /* process id */
  195. /* Socket-specific methods, including DNS hostname lookups. */
  196. -extern void sock_host(); /* look up endpoint addresses */
  197. -extern void sock_hostname(); /* translate address to hostname */
  198. -extern void sock_hostaddr(); /* address to printable address */
  199. +/* look up endpoint addresses */
  200. +extern void sock_host(struct request_info *);
  201. +/* translate address to hostname */
  202. +extern void sock_hostname(struct host_info *);
  203. +/* address to printable address */
  204. +extern void sock_hostaddr(struct host_info *);
  205. #define sock_methods(r) \
  206. { (r)->hostname = sock_hostname; (r)->hostaddr = sock_hostaddr; }
  207. @@ -182,7 +203,7 @@ extern struct tcpd_context tcpd_context;
  208. * behavior.
  209. */
  210. -extern void process_options(); /* execute options */
  211. +extern void process_options(char *, struct request_info *);/* execute options */
  212. extern int dry_run; /* verification flag */
  213. /* Bug workarounds. */
  214. @@ -221,3 +242,7 @@ extern char *fix_strtok();
  215. #define strtok my_strtok
  216. extern char *my_strtok();
  217. #endif
  218. +
  219. +__END_DECLS
  220. +
  221. +#endif
  222. --- /dev/null
  223. +++ b/weak_symbols.c
  224. @@ -0,0 +1,12 @@
  225. + /*
  226. + * @(#) weak_symbols.h 1.5 99/12/29 23:50
  227. + *
  228. + * Author: Anthony Towns <ajt@debian.org>
  229. + */
  230. +
  231. +#ifdef HAVE_WEAKSYMS
  232. +#include "tcpd.h"
  233. +#include <syslog.h>
  234. +int deny_severity = LOG_WARNING;
  235. +int allow_severity = SEVERITY;
  236. +#endif
  237. --- /dev/null
  238. +++ b/libwrap.lds
  239. @@ -0,0 +1,4 @@
  240. +{
  241. + local:
  242. + aclexec_matched;
  243. +};