xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-extended/tcp-wrappers/tcp-wrappers-7.6/socklen_t.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyuncommit 88b6984ef0bf3b703c1c851092662b95e91db1ff
2*4882a593SmuzhiyunAuthor: farrah rashid <farrah.rashid@windriver.com>
3*4882a593SmuzhiyunDate:   Tue Feb 12 09:53:50 2013 -0500
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun    tcp-wrappers Support for building with glibc
6*4882a593Smuzhiyun
7*4882a593Smuzhiyun    Added support for socklen_t type to len argument passed to socket related
8*4882a593Smuzhiyun    calls. This fixes a bug that causes tcp wrappers to fail when using sshd.
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunUpstream-Status: Pending
11*4882a593SmuzhiyunSigned-off-by: farrah rashid <farrah.rashid@windriver.com>
12*4882a593Smuzhiyun
13*4882a593Smuzhiyundiff --git a/fix_options.c b/fix_options.c
14*4882a593Smuzhiyunindex 7473adf..fe2b442 100644
15*4882a593Smuzhiyun--- a/fix_options.c
16*4882a593Smuzhiyun+++ b/fix_options.c
17*4882a593Smuzhiyun@@ -38,7 +38,12 @@ struct request_info *request;
18*4882a593Smuzhiyun #ifdef IP_OPTIONS
19*4882a593Smuzhiyun     unsigned char optbuf[BUFFER_SIZE / 3], *cp;
20*4882a593Smuzhiyun     char    lbuf[BUFFER_SIZE], *lp;
21*4882a593Smuzhiyun-    int     optsize = sizeof(optbuf), ipproto;
22*4882a593Smuzhiyun+#ifdef __GLIBC__
23*4882a593Smuzhiyun+    socklen_t  optsize = sizeof(optbuf);
24*4882a593Smuzhiyun+#else
25*4882a593Smuzhiyun+    int     optsize = sizeof(optbuf);
26*4882a593Smuzhiyun+#endif
27*4882a593Smuzhiyun+    int ipproto;
28*4882a593Smuzhiyun     struct protoent *ip;
29*4882a593Smuzhiyun     int     fd = request->fd;
30*4882a593Smuzhiyun     unsigned int opt;
31*4882a593Smuzhiyundiff --git a/socket.c b/socket.c
32*4882a593Smuzhiyunindex 4b2c575..a0d2987 100644
33*4882a593Smuzhiyun--- a/socket.c
34*4882a593Smuzhiyun+++ b/socket.c
35*4882a593Smuzhiyun@@ -95,7 +95,11 @@ struct request_info *request;
36*4882a593Smuzhiyun     static struct sockaddr_in client;
37*4882a593Smuzhiyun     static struct sockaddr_in server;
38*4882a593Smuzhiyun #endif
39*4882a593Smuzhiyun+#ifdef __GLIBC__
40*4882a593Smuzhiyun+    socklen_t  len;
41*4882a593Smuzhiyun+#else
42*4882a593Smuzhiyun     int     len;
43*4882a593Smuzhiyun+#endif
44*4882a593Smuzhiyun     char    buf[BUFSIZ];
45*4882a593Smuzhiyun     int     fd = request->fd;
46*4882a593Smuzhiyun
47*4882a593Smuzhiyun@@ -426,7 +430,11 @@ int     fd;
48*4882a593Smuzhiyun #else
49*4882a593Smuzhiyun     struct sockaddr_in sin;
50*4882a593Smuzhiyun #endif
51*4882a593Smuzhiyun+#ifdef __GLIBC__
52*4882a593Smuzhiyun+    socklen_t  size = sizeof(sin);
53*4882a593Smuzhiyun+#else
54*4882a593Smuzhiyun     int     size = sizeof(sin);
55*4882a593Smuzhiyun+#endif
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun     /*
58*4882a593Smuzhiyun      * Eat up the not-yet received datagram. Some systems insist on a
59