Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Sep 2002 13:01:46 -0700 (PDT)
From:      Yuri Victorovich <yuri@tsoft.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/42336: [PATCH] ISO-fication of /usr/src/contrib/tcp_wrappers: fixes also PR#42327
Message-ID:  <200209022001.g82K1kBa098197@www.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         42336
>Category:       misc
>Synopsis:       [PATCH] ISO-fication of /usr/src/contrib/tcp_wrappers: fixes also PR#42327
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 02 13:10:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Yuri Victorovich
>Release:        4.6-STABLE, 5.0
>Organization:
Optima Inc
>Environment:
FreeBSD sunflower.syrec.org 4.6-STABLE FreeBSD 4.6-STABLE #23: Sat Aug 10 11:25:55 EDT 2002     root@sunflower.syrec.org:/usr/src/sys/compile/GENERIC  i386

>Description:
Conversion of /usr/include/tcpd.h file to modern-style
function declarations. Also removed __STDC__ idfefs
since it's always defined.

MySQL-server was using those functions w/out parameters.
And it worked correctly just by accident on i386 and
crased on Alpha. I asked MySQL folks to fix the usage
but now MySQL breaks with new gcc-3.2 and with old tcpd.h.

So this also fixes PR:
http://www.FreeBSD.org/cgi/query-pr.cgi?pr=ports/42327
>How-To-Repeat:
N/A
>Fix:
diff -u /usr/src/contrib/tcp_wrappers/inetcf.h /home/yuri/usr/src/contrib/tcp_wrappers/inetcf.h
--- /usr/src/contrib/tcp_wrappers/inetcf.h      Sun Mar 14 12:13:19 1999
+++ /home/yuri/usr/src/contrib/tcp_wrappers/inetcf.h    Fri Aug 23 22:22:45 2002
@@ -4,9 +4,9 @@
   * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
   */

-extern char *inet_cfg();               /* read inetd.conf file */
-extern void inet_set();                        /* remember internet service */
-extern int inet_get();                 /* look up internet service */
+extern char *inet_cfg(char *conf);      /* read inetd.conf file */
+extern void inet_set(char *name, int type);/* remember internet service */
+extern int inet_get(char *name);       /* look up internet service */

 #define WR_UNKNOWN     (-1)            /* service unknown */
 #define WR_NOT         1               /* may not be wrapped */
diff -u /usr/src/contrib/tcp_wrappers/mystdarg.h /home/yuri/usr/src/contrib/tcp_wrappers/mystdarg.h
--- /usr/src/contrib/tcp_wrappers/mystdarg.h    Sun Mar 14 12:13:19 1999
+++ /home/yuri/usr/src/contrib/tcp_wrappers/mystdarg.h  Fri Aug 23 22:23:53 2002
@@ -16,4 +16,4 @@
 #define VAEND(ap)              va_end(ap);}
 #endif

-extern char *percent_m();
+extern char *percent_m(char *obuf, char *ibuf);
diff -u /usr/src/contrib/tcp_wrappers/scaffold.h /home/yuri/usr/src/contrib/tcp_wrappers/scaffold.h
--- /usr/src/contrib/tcp_wrappers/scaffold.h    Tue Jul 18 04:34:55 2000
+++ /home/yuri/usr/src/contrib/tcp_wrappers/scaffold.h  Fri Aug 23 22:26:20 2002
@@ -7,9 +7,9 @@
   */

 #ifdef INET6
-extern struct addrinfo *find_inet_addr();
+extern struct addrinfo *find_inet_addr(char *name);
 #else
-extern struct hostent *find_inet_addr();
+extern struct hostent *find_inet_addr(char *name);
 #endif
-extern int check_dns();
-extern int check_path();
+extern int check_dns(char *host);
+extern int check_path(char *path, struct stat *st);
diff -u /usr/src/contrib/tcp_wrappers/tcpd.h /home/yuri/usr/src/contrib/tcp_wrappers/tcpd.h
--- /usr/src/contrib/tcp_wrappers/tcpd.h        Thu Feb  3 05:26:59 2000
+++ /home/yuri/usr/src/contrib/tcp_wrappers/tcpd.h      Mon Sep  2 14:34:18 2002
@@ -31,10 +31,10 @@
     char    pid[10];                   /* access via eval_pid(request) */
     struct host_info client[1];                /* client endpoint info */
     struct host_info server[1];                /* server endpoint info */
-    void  (*sink) ();                  /* datagram sink function or 0 */
-    void  (*hostname) ();              /* address to printable hostname */
-    void  (*hostaddr) ();              /* address to printable address */
-    void  (*cleanup) ();               /* cleanup function or 0 */
+    void  (*sink) (int fd);            /* datagram sink function or 0 */
+    void  (*hostname) (struct host_info *); /* address to printable hostname */
+    void  (*hostaddr) (struct host_info *); /* address to printable address */
+    void  (*cleanup) (struct request_info *);  /* cleanup function or 0 */
     struct netconfig *config;          /* netdir handle */
 };

@@ -67,20 +67,28 @@
 /* Global functions. */

 #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
-extern void fromhost();                        /* get/validate client host info */
+extern void fromhost(struct request_info *);/* get/validate client host info */
 #else
 #define fromhost sock_host             /* no TLI support needed */
 #endif

-extern int hosts_access();             /* access control */
-extern void shell_cmd();               /* execute shell command */
-extern char *percent_x();              /* do %<char> expansion */
-extern void rfc931();                  /* client name from RFC 931 daemon */
-extern void clean_exit();              /* clean up and exit */
-extern void refuse();                  /* clean up and exit */
-extern char *xgets();                  /* fgets() on steroids */
-extern char *split_at();               /* strchr() and split */
-extern unsigned long dot_quad_addr();  /* restricted inet_addr() */
+int hosts_access(struct request_info *request);  /* access control */
+void shell_cmd(char *command);          /* execute shell command */
+char *percent_x(char *result, int result_len, char *string,
+  struct request_info *request);        /* do %<char> expansion */
+void rfc931(                            /* client name from RFC 931 daemon */
+#ifdef INET6
+        struct sockaddr *rmt_sin, struct sockaddr *our_sin, char *dest
+#else
+        struct sockaddr_in *rmt_sin, struct sockaddr_in *our_sin, char *dest
+#endif
+);
+
+void clean_exit(struct request_info *request);   /* clean up and exit */
+void refuse(struct request_info *request);       /* clean up and exit */
+char *xgets(char *ptr, int len, FILE *fp);       /* fgets() on steroids */
+char *split_at(char *string, int delimiter);     /* strchr() and split */
+unsigned long dot_quad_addr(char *str);          /* restricted inet_addr() */

 /* Global variables. */

@@ -97,13 +105,10 @@
   * attributes. Each attribute has its own key.
   */

-#ifdef __STDC__
+/* initialize request */
 extern struct request_info *request_init(struct request_info *,...);
+/* update request structure */
 extern struct request_info *request_set(struct request_info *,...);
-#else
-extern struct request_info *request_init();    /* initialize request */
-extern struct request_info *request_set();     /* update request structure */
-#endif

 #define RQ_FILE                1               /* file descriptor */
 #define RQ_DAEMON      2               /* server process (argv[0]) */
@@ -123,27 +128,27 @@
   * host_info structures serve as caches for the lookup results.
   */

-extern char *eval_user();              /* client user */
-extern char *eval_hostname();          /* printable hostname */
-extern char *eval_hostaddr();          /* printable host address */
-extern char *eval_hostinfo();          /* host name or address */
-extern char *eval_client();            /* whatever is available */
-extern char *eval_server();            /* whatever is available */
+extern char *eval_user(struct request_info *); /* client user */
+extern char *eval_hostname(struct host_info *host);    /* printable hostname */
+extern char *eval_hostaddr(struct host_info *);/* printable host address */
+extern char *eval_hostinfo(struct host_info *);        /* host name or address */
+extern char *eval_client(struct request_info *);/* whatever is available */
+extern char *eval_server(struct request_info *);/* whatever is available */
 #define eval_daemon(r) ((r)->daemon)   /* daemon process name */
 #define eval_pid(r)    ((r)->pid)      /* process id */

 /* Socket-specific methods, including DNS hostname lookups. */

-extern void sock_host();               /* look up endpoint addresses */
-extern void sock_hostname();           /* translate address to hostname */
-extern void sock_hostaddr();           /* address to printable address */
+extern void sock_host(struct request_info *);/* look up endpoint addresses */
+extern void sock_hostname(struct host_info *);/*translate address to hostname*/
+extern void sock_hostaddr(struct host_info *);/* address to printable address */
 #define sock_methods(r) \
        { (r)->hostname = sock_hostname; (r)->hostaddr = sock_hostaddr; }

 /* The System V Transport-Level Interface (TLI) interface. */

 #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
-extern void tli_host();                        /* look up endpoint addresses etc. */
+extern void tli_host(struct request_info *);/*look up endpoint addresses etc.*/
 #endif

  /*
@@ -152,13 +157,8 @@
   * everyone would have to include <setjmp.h>.
   */

-#ifdef __STDC__
 extern void tcpd_warn(char *, ...);    /* report problem and proceed */
 extern void tcpd_jump(char *, ...);    /* report problem and jump */
-#else
-extern void tcpd_warn();
-extern void tcpd_jump();
-#endif

 struct tcpd_context {
     char   *file;                      /* current file */
@@ -184,42 +184,44 @@
   * behavior.
   */

-extern void process_options();         /* execute options */
+/* execute options */
+extern void process_options(char   *options, struct request_info *request);
 extern int dry_run;                    /* verification flag */

 /* Bug workarounds. */

 #ifdef INET_ADDR_BUG                   /* inet_addr() returns struct */
 #define inet_addr fix_inet_addr
-extern long fix_inet_addr();
+extern long fix_inet_addr(char *string);
 #endif

 #ifdef BROKEN_FGETS                    /* partial reads from sockets */
 #define fgets fix_fgets
-extern char *fix_fgets();
+extern char *fix_fgets(char *buf, int len, FILE *fp);
 #endif

 #ifdef RECVFROM_BUG                    /* no address family info */
 #define recvfrom fix_recvfrom
-extern int fix_recvfrom();
+extern int fix_recvfrom(int sock, char *buf, int buflen, int flags,
+                        struct sockaddr *from, int *fromlen);
 #endif

 #ifdef GETPEERNAME_BUG                 /* claims success with UDP */
 #define getpeername fix_getpeername
-extern int fix_getpeername();
+extern int fix_getpeername(int sock, struct sockaddr *sa, int len);
 #endif

 #ifdef SOLARIS_24_GETHOSTBYNAME_BUG    /* lists addresses as aliases */
 #define gethostbyname fix_gethostbyname
-extern struct hostent *fix_gethostbyname();
+extern struct hostent *fix_gethostbyname(char *name);
 #endif

 #ifdef USE_STRSEP                      /* libc calls strtok() */
 #define strtok fix_strtok
-extern char *fix_strtok();
+extern char *fix_strtok(char *buf, char *sep);
 #endif

 #ifdef LIBC_CALLS_STRTOK               /* libc calls strtok() */
 #define strtok my_strtok
-extern char *my_strtok();
+extern char *my_strtok(char *buf, char *sep);
 #endif
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209022001.g82K1kBa098197>