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