Current patches for portability and libwrap
Matthias Andree <[email protected]> Fri, 08 Aug 2003 17:00:59 +0200
| Newsgroups | gmane.network.xinetd |
|---|---|
| Message-ID | <[email protected]> |
--=-=-=
Hi,
I am attaching the two patch sets, generated against current CVS.
The first is the portability stuff (I hope it doesn't break older BSD),
the second is the libwrap stuff.
--
Matthias Andree
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=portable.patch
Content-Description: enhance xinetd portability
Index: libs/src/portable/libportable.h
===================================================================
RCS file: /cvs/xinetd/xinetd/libs/src/portable/libportable.h,v
retrieving revision 1.2
diff -u -r1.2 libportable.h
--- libs/src/portable/libportable.h 25 Apr 2003 17:39:00 -0000 1.2
+++ libs/src/portable/libportable.h 8 Aug 2003 14:52:29 -0000
@@ -83,21 +83,21 @@
#ifndef IN6_IS_ADDR_LOOPBACK
# define IN6_IS_ADDR_LOOPBACK(a) \
- (((u_int32_t *) (a))[0] == 0 && ((u_int32_t *) (a))[1] == 0 && \
- ((u_int32_t *) (a))[2] == 0 && ((u_int32_t *) (a))[3] == htonl (1))
+ (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+ ((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == htonl (1))
#endif /* !IN6_IS_ADDR_LOOPBACK */
#ifndef HAVE_STRUCT_IN6_ADDR
struct in6_addr {
- u_int8_t s6_addr[16];
+ uint8_t s6_addr[16];
};
#endif /* !HAVE_STRUCT_IN6_ADDR */
#ifndef HAVE_STRUCT_SOCKADDR_IN6
struct sockaddr_in6 {
unsigned short sin6_family;
- u_int16_t sin6_port;
- u_int32_t sin6_flowinfo;
+ uint16_t sin6_port;
+ uint32_t sin6_flowinfo;
struct in6_addr sin6_addr;
};
#endif /* !HAVE_STRUCT_SOCKADDR_IN6 */
Index: xinetd/udpint.c
===================================================================
RCS file: /cvs/xinetd/xinetd/xinetd/udpint.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 udpint.c
--- xinetd/udpint.c 19 Feb 2003 17:29:28 -0000 1.1.1.1
+++ xinetd/udpint.c 8 Aug 2003 14:52:32 -0000
@@ -27,11 +27,7 @@
#include "log.h"
#include "msg.h"
#include "sconf.h"
-
-/*
- * Datagrams greater than this will be truncated
- */
-#define MAX_DATAGRAM_SIZE ( 32 * 1024 )
+#include "udp.h"
struct packet
{
Index: xinetd/util.c
===================================================================
RCS file: /cvs/xinetd/xinetd/xinetd/util.c,v
retrieving revision 1.6
diff -u -r1.6 util.c
--- xinetd/util.c 15 Jul 2003 13:36:38 -0000 1.6
+++ xinetd/util.c 8 Aug 2003 14:52:32 -0000
@@ -44,6 +44,7 @@
#include "str.h"
#include "util.h"
#include "msg.h"
+#include "udp.h"
void out_of_memory( const char *func )
{
--- /dev/null 2002-09-09 22:24:09.000000000 +0200
+++ xinetd/udp.h 2003-06-19 03:30:39.000000000 +0200
@@ -0,0 +1,4 @@
+/*
+ * Datagrams greater than this will be truncated
+ */
+#define MAX_DATAGRAM_SIZE ( 32 * 1024 )
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=libwrap.patch
Content-Description: add \"libwrap\" configuration parameter
Index: xinetd/access.c
===================================================================
RCS file: /cvs/xinetd/xinetd/xinetd/access.c,v
retrieving revision 1.4
diff -u -r1.4 access.c
--- xinetd/access.c 6 Aug 2003 06:12:10 -0000 1.4
+++ xinetd/access.c 8 Aug 2003 14:52:30 -0000
@@ -229,6 +229,9 @@
else
server++;
+ if (scp->sc_libwrap != NULL)
+ server = scp->sc_libwrap;
+
if ( server == NULL )
{
msg(deny_severity, func,
Index: xinetd/attr.h
===================================================================
RCS file: /cvs/xinetd/xinetd/xinetd/attr.h,v
retrieving revision 1.2
diff -u -r1.2 attr.h
--- xinetd/attr.h 29 May 2003 00:27:03 -0000 1.2
+++ xinetd/attr.h 8 Aug 2003 14:52:30 -0000
@@ -60,6 +60,7 @@
#define A_ENABLED 42
#define A_DISABLED 43
#define A_MDNS 44
+#define A_LIBWRAP 45
/*
* SERVICE_ATTRIBUTES is the number of service attributes and also
Index: xinetd/defs.h
===================================================================
RCS file: /cvs/xinetd/xinetd/xinetd/defs.h,v
retrieving revision 1.2
diff -u -r1.2 defs.h
--- xinetd/defs.h 8 May 2003 14:52:24 -0000 1.2
+++ xinetd/defs.h 8 Aug 2003 14:52:30 -0000
@@ -14,6 +14,7 @@
#include "config.h"
+#include "libportable.h"
#include <memory.h>
#include <string.h>
#include <stdlib.h>
Index: xinetd/parse.c
===================================================================
RCS file: /cvs/xinetd/xinetd/xinetd/parse.c,v
retrieving revision 1.13
diff -u -r1.13 parse.c
--- xinetd/parse.c 6 Aug 2003 06:12:10 -0000 1.13
+++ xinetd/parse.c 8 Aug 2003 14:52:30 -0000
@@ -52,6 +52,9 @@
{ "group", A_GROUP, 1, group_parser },
{ "server", A_SERVER, 1, server_parser },
{ "server_args", A_SERVER_ARGS, -1, server_args_parser },
+#ifdef LIBWRAP
+ { "libwrap", A_LIBWRAP, 1, libwrap_parser },
+#endif
{ "instances", A_INSTANCES, 1, instances_parser },
{ "log_on_success", A_LOG_ON_SUCCESS,-2, log_on_success_parser },
{ "log_on_failure", A_LOG_ON_FAILURE,-2, log_on_failure_parser },
Index: xinetd/parsers.c
===================================================================
RCS file: /cvs/xinetd/xinetd/xinetd/parsers.c,v
retrieving revision 1.13
diff -u -r1.13 parsers.c
--- xinetd/parsers.c 6 Aug 2003 06:12:10 -0000 1.13
+++ xinetd/parsers.c 8 Aug 2003 14:52:31 -0000
@@ -373,6 +373,23 @@
return( OK );
}
+#ifdef LIBWRAP
+status_e libwrap_parser( pset_h values,
+ struct service_config *scp,
+ enum assign_op op )
+{
+ char *libwrap = (char *) pset_pointer( values, 0 ) ;
+ const char *func = "libwrap_parser" ;
+
+ scp->sc_libwrap = new_string( libwrap ) ;
+ if ( scp->sc_libwrap == NULL )
+ {
+ out_of_memory( func ) ;
+ return( FAILED ) ;
+ }
+ return( OK ) ;
+}
+#endif
status_e server_parser( pset_h values,
struct service_config *scp,
Index: xinetd/parsers.h
===================================================================
RCS file: /cvs/xinetd/xinetd/xinetd/parsers.h,v
retrieving revision 1.2
diff -u -r1.2 parsers.h
--- xinetd/parsers.h 29 May 2003 00:27:03 -0000 1.2
+++ xinetd/parsers.h 8 Aug 2003 14:52:31 -0000
@@ -18,6 +18,9 @@
status_e group_parser(pset_h, struct service_config *, enum assign_op) ;
status_e server_parser(pset_h, struct service_config *, enum assign_op) ;
status_e server_args_parser(pset_h, struct service_config *, enum assign_op) ;
+#ifdef LIBWRAP
+status_e libwrap_parser(pset_h, struct service_config *, enum assign_op) ;
+#endif
status_e instances_parser(pset_h, struct service_config *, enum assign_op) ;
status_e log_on_success_parser(pset_h, struct service_config *, enum assign_op) ;
status_e log_on_failure_parser(pset_h, struct service_config *, enum assign_op) ;
Index: xinetd/sconf.c
===================================================================
RCS file: /cvs/xinetd/xinetd/xinetd/sconf.c,v
retrieving revision 1.12
diff -u -r1.12 sconf.c
--- xinetd/sconf.c 6 Aug 2003 06:12:10 -0000 1.12
+++ xinetd/sconf.c 8 Aug 2003 14:52:31 -0000
@@ -72,6 +72,7 @@
COND_FREE( SC_ID(scp) ) ;
COND_FREE( SC_PROTONAME(scp) ) ;
COND_FREE( SC_SERVER(scp) ) ;
+ COND_FREE( SC_LIBWRAP(scp) ) ;
COND_FREE( (char *)SC_REDIR_ADDR(scp) ) ;
COND_FREE( (char *)SC_BIND_ADDR(scp) ) ;
COND_FREE( (char *)SC_ORIG_BIND_ADDR(scp) ) ;
@@ -350,7 +351,14 @@
else
Sprint( fd, " (NULL)");
Sputchar( fd, '\n' ) ;
- }
+ }
+
+#ifdef LIBWRAP
+ if ( scp->sc_libwrap != NULL)
+ {
+ tabprint( fd, tab_level+1, "Libwrap = %s\n", scp->sc_libwrap ) ;
+ }
+#endif
if ( SC_REDIR_ADDR(scp) != NULL )
{
Index: xinetd/sconf.h
===================================================================
RCS file: /cvs/xinetd/xinetd/xinetd/sconf.h,v
retrieving revision 1.8
diff -u -r1.8 sconf.h
--- xinetd/sconf.h 6 Aug 2003 06:12:10 -0000 1.8
+++ xinetd/sconf.h 8 Aug 2003 14:52:31 -0000
@@ -112,6 +112,7 @@
gid_t sc_user_gid ; /* gid corresponding to uid */
gid_t sc_gid ; /* gid corresponding to group */
char *sc_server ;
+ char *sc_libwrap ; /* e.g. "myservice" */
char **sc_server_argv ;
int sc_instances ;
int sc_nice ; /* argument for nice(3) */
@@ -180,6 +181,7 @@
#define SC_UID( scp ) (scp)->sc_uid
#define SC_GID( scp ) (scp)->sc_gid
#define SC_USER_GID( scp ) (scp)->sc_user_gid
+#define SC_LIBWRAP( scp ) (scp)->sc_libwrap
#define SC_SERVER( scp ) (scp)->sc_server
#define SC_SERVER_ARGV( scp ) (scp)->sc_server_argv
#define SC_ONLY_FROM( scp ) (scp)->sc_only_from
Index: xinetd/xinetd.conf.man
===================================================================
RCS file: /cvs/xinetd/xinetd/xinetd/xinetd.conf.man,v
retrieving revision 1.14
diff -u -r1.14 xinetd.conf.man
--- xinetd/xinetd.conf.man 23 Jun 2003 18:31:06 -0000 1.14
+++ xinetd/xinetd.conf.man 8 Aug 2003 14:52:33 -0000
@@ -223,6 +223,12 @@
determines the arguments passed to the server. In contrast to \fBinetd\fP,
the server name should \fInot\fP be included in \fIserver_args\fP.
.TP
+.B libwrap
+overrides the service name passed to libwrap (which defaults to the
+server name, the first server_args component with NAMEINARGS, the id
+for internal services and the service name for redirected services).
+Only valid if xinetd has been compiled with the libwrap option.
+.TP
.B only_from
determines the remote hosts to which the particular
service is available.
--=-=-=--