tcp-wrappers-7.6-shared.patch 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. --- tcp_wrappers_7.6/tcpd.h.shared 2003-02-10 20:12:26.000000000 +0100
  2. +++ tcp_wrappers_7.6/tcpd.h 2003-02-10 20:12:26.000000000 +0100
  3. @@ -4,6 +4,25 @@
  4. * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
  5. */
  6. +#ifndef _TCPWRAPPERS_TCPD_H
  7. +#define _TCPWRAPPERS_TCPD_H
  8. +
  9. +/* someone else may have defined this */
  10. +#undef __P
  11. +
  12. +/* use prototypes if we have an ANSI C compiler or are using C++ */
  13. +#if defined(__STDC__) || defined(__cplusplus)
  14. +#define __P(args) args
  15. +#else
  16. +#define __P(args) ()
  17. +#endif
  18. +
  19. +/* Need definitions of struct sockaddr_in and FILE. */
  20. +#include <netinet/in.h>
  21. +#include <stdio.h>
  22. +
  23. +__BEGIN_DECLS
  24. +
  25. /* Structure to describe one communications endpoint. */
  26. #define STRING_LENGTH 128 /* hosts, users, processes */
  27. @@ -29,10 +48,10 @@
  28. char pid[10]; /* access via eval_pid(request) */
  29. struct host_info client[1]; /* client endpoint info */
  30. struct host_info server[1]; /* server endpoint info */
  31. - void (*sink) (); /* datagram sink function or 0 */
  32. - void (*hostname) (); /* address to printable hostname */
  33. - void (*hostaddr) (); /* address to printable address */
  34. - void (*cleanup) (); /* cleanup function or 0 */
  35. + void (*sink) __P((int)); /* datagram sink function or 0 */
  36. + void (*hostname) __P((struct host_info *)); /* address to printable hostname */
  37. + void (*hostaddr) __P((struct host_info *)); /* address to printable address */
  38. + void (*cleanup) __P((struct request_info *)); /* cleanup function or 0 */
  39. struct netconfig *config; /* netdir handle */
  40. };
  41. @@ -65,25 +84,34 @@
  42. /* Global functions. */
  43. #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
  44. -extern void fromhost(); /* get/validate client host info */
  45. +extern void fromhost __P((struct request_info *)); /* get/validate client host info */
  46. #else
  47. #define fromhost sock_host /* no TLI support needed */
  48. #endif
  49. -extern int hosts_access(); /* access control */
  50. -extern void shell_cmd(); /* execute shell command */
  51. -extern char *percent_x(); /* do %<char> expansion */
  52. -extern void rfc931(); /* client name from RFC 931 daemon */
  53. -extern void clean_exit(); /* clean up and exit */
  54. -extern void refuse(); /* clean up and exit */
  55. -extern char *xgets(); /* fgets() on steroids */
  56. -extern char *split_at(); /* strchr() and split */
  57. -extern unsigned long dot_quad_addr(); /* restricted inet_addr() */
  58. +extern void shell_cmd __P((char *)); /* execute shell command */
  59. +extern char *percent_x __P((char *, int, char *, struct request_info *)); /* do %<char> expansion */
  60. +#ifdef INET6
  61. +extern void rfc931 __P((struct sockaddr *, struct sockaddr *, char *)); /* client name from RFC 931 daemon */
  62. +#else
  63. +extern void rfc931 __P((struct sockaddr_in *, struct sockaddr_in *, char *)); /* client name from RFC 931 daemon */
  64. +#endif
  65. +extern void clean_exit __P((struct request_info *)); /* clean up and exit */
  66. +extern void refuse __P((struct request_info *)); /* clean up and exit */
  67. +extern char *xgets __P((char *, int, FILE *)); /* fgets() on steroids */
  68. +extern char *split_at __P((char *, int)); /* strchr() and split */
  69. +extern unsigned long dot_quad_addr __P((char *)); /* restricted inet_addr() */
  70. /* Global variables. */
  71. +#ifdef HAVE_WEAKSYMS
  72. +extern int allow_severity __attribute__ ((weak)); /* for connection logging */
  73. +extern int deny_severity __attribute__ ((weak)); /* for connection logging */
  74. +#else
  75. extern int allow_severity; /* for connection logging */
  76. extern int deny_severity; /* for connection logging */
  77. +#endif
  78. +
  79. extern char *hosts_allow_table; /* for verification mode redirection */
  80. extern char *hosts_deny_table; /* for verification mode redirection */
  81. extern int hosts_access_verbose; /* for verbose matching mode */
  82. @@ -96,9 +124,14 @@
  83. */
  84. #ifdef __STDC__
  85. +extern int hosts_access(struct request_info *request);
  86. +extern int hosts_ctl(char *daemon, char *client_name, char *client_addr,
  87. + char *client_user);
  88. extern struct request_info *request_init(struct request_info *,...);
  89. extern struct request_info *request_set(struct request_info *,...);
  90. #else
  91. +extern int hosts_access();
  92. +extern int hosts_ctl();
  93. extern struct request_info *request_init(); /* initialize request */
  94. extern struct request_info *request_set(); /* update request structure */
  95. #endif
  96. @@ -121,27 +154,31 @@
  97. * host_info structures serve as caches for the lookup results.
  98. */
  99. -extern char *eval_user(); /* client user */
  100. -extern char *eval_hostname(); /* printable hostname */
  101. -extern char *eval_hostaddr(); /* printable host address */
  102. -extern char *eval_hostinfo(); /* host name or address */
  103. -extern char *eval_client(); /* whatever is available */
  104. -extern char *eval_server(); /* whatever is available */
  105. +extern char *eval_user __P((struct request_info *)); /* client user */
  106. +extern char *eval_hostname __P((struct host_info *)); /* printable hostname */
  107. +extern char *eval_hostaddr __P((struct host_info *)); /* printable host address */
  108. +extern char *eval_hostinfo __P((struct host_info *)); /* host name or address */
  109. +extern char *eval_client __P((struct request_info *)); /* whatever is available */
  110. +extern char *eval_server __P((struct request_info *)); /* whatever is available */
  111. #define eval_daemon(r) ((r)->daemon) /* daemon process name */
  112. #define eval_pid(r) ((r)->pid) /* process id */
  113. /* Socket-specific methods, including DNS hostname lookups. */
  114. -extern void sock_host(); /* look up endpoint addresses */
  115. -extern void sock_hostname(); /* translate address to hostname */
  116. -extern void sock_hostaddr(); /* address to printable address */
  117. +/* look up endpoint addresses */
  118. +extern void sock_host __P((struct request_info *));
  119. +/* translate address to hostname */
  120. +extern void sock_hostname __P((struct host_info *));
  121. +/* address to printable address */
  122. +extern void sock_hostaddr __P((struct host_info *));
  123. +
  124. #define sock_methods(r) \
  125. { (r)->hostname = sock_hostname; (r)->hostaddr = sock_hostaddr; }
  126. /* The System V Transport-Level Interface (TLI) interface. */
  127. #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
  128. -extern void tli_host(); /* look up endpoint addresses etc. */
  129. +extern void tli_host __P((struct request_info *)); /* look up endpoint addresses etc. */
  130. #endif
  131. /*
  132. @@ -182,7 +219,7 @@
  133. * behavior.
  134. */
  135. -extern void process_options(); /* execute options */
  136. +extern void process_options __P((char *, struct request_info *)); /* execute options */
  137. extern int dry_run; /* verification flag */
  138. /* Bug workarounds. */
  139. @@ -221,3 +258,7 @@
  140. #define strtok my_strtok
  141. extern char *my_strtok();
  142. #endif
  143. +
  144. +__END_DECLS
  145. +
  146. +#endif /* tcpd.h */
  147. --- tcp_wrappers_7.6/scaffold.c.shared 2003-02-10 20:12:26.000000000 +0100
  148. +++ tcp_wrappers_7.6/scaffold.c 2003-02-10 20:12:26.000000000 +0100
  149. @@ -237,10 +237,17 @@
  150. /* ARGSUSED */
  151. -void rfc931(request)
  152. -struct request_info *request;
  153. +void rfc931(rmt_sin, our_sin, dest)
  154. +#ifndef INET6
  155. +struct sockaddr_in *rmt_sin;
  156. +struct sockaddr_in *our_sin;
  157. +#else
  158. +struct sockaddr *rmt_sin;
  159. +struct sockaddr *our_sin;
  160. +#endif
  161. +char *dest;
  162. {
  163. - strcpy(request->user, unknown);
  164. + strcpy(dest, unknown);
  165. }
  166. /* check_path - examine accessibility */
  167. --- /dev/null 2003-01-30 11:24:37.000000000 +0100
  168. +++ tcp_wrappers_7.6/weak_symbols.c 2003-02-10 20:12:26.000000000 +0100
  169. @@ -0,0 +1,11 @@
  170. + /*
  171. + * @(#) weak_symbols.h 1.5 99/12/29 23:50
  172. + *
  173. + * Author: Anthony Towns <ajt@debian.org>
  174. + */
  175. +
  176. +#ifdef HAVE_WEAKSYMS
  177. +#include <syslog.h>
  178. +int deny_severity = LOG_WARNING;
  179. +int allow_severity = SEVERITY;
  180. +#endif
  181. --- tcp_wrappers_7.6/Makefile.shared 2003-02-10 20:12:26.000000000 +0100
  182. +++ tcp_wrappers_7.6/Makefile 2003-02-10 20:14:05.000000000 +0100
  183. @@ -143,7 +143,7 @@
  184. linux:
  185. @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  186. - LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ= \
  187. + LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=weak_symbols.o \
  188. NETGROUP= TLI= EXTRA_CFLAGS="$(PARDUS_OPT) -DSYS_ERRLIST_DEFINED -DBROKEN_SO_LINGER" all
  189. # This is good for many SYSV+BSD hybrids with NIS, probably also for HP-UX 7.x.
  190. @@ -686,8 +686,9 @@
  191. scaffold.h tcpdmatch.8 README.NIS
  192. LIB = libwrap.a
  193. +SHLIB = libwrap.so
  194. -all other: config-check tcpd tcpdmatch try-from safe_finger tcpdchk
  195. +all other: config-check tcpd tcpdmatch try-from safe_finger tcpdchk $(SHLIB)
  196. # Invalidate all object files when the compiler options (CFLAGS) have changed.
  197. @@ -704,6 +705,12 @@
  198. $(AR) $(ARFLAGS) $(LIB) $(LIB_OBJ)
  199. -$(RANLIB) $(LIB)
  200. +$(SHLIB): $(LIB_OBJ)
  201. + gcc -shared -fPIC -Wl,-soname -Wl,$(SHLIB).$(MAJOR) \
  202. + -o $(SHLIB).$(MAJOR).$(MINOR).$(REL) $^ $(LIBS)
  203. + ln -s $(SHLIB).$(MAJOR).$(MINOR).$(REL) $(SHLIB).$(MAJOR)
  204. + ln -s $(SHLIB).$(MAJOR).$(MINOR).$(REL) $(SHLIB)
  205. +
  206. tcpd: tcpd.o $(LIB)
  207. $(CC) $(CFLAGS) -o $@ tcpd.o $(LIB) $(LIBS)
  208. @@ -886,5 +893,6 @@
  209. update.o: mystdarg.h
  210. update.o: tcpd.h
  211. vfprintf.o: cflags
  212. +weak_symbols.o: tcpd.h
  213. workarounds.o: cflags
  214. workarounds.o: tcpd.h