"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xinetd/sconf.c" between
xinetd-2.3.15.tar.gz and xinetd-2.3.15.4.tar.xz

About: xinetd is a secure replacement for inetd, the internet services daemon (openSUSE fork).

sconf.c  (xinetd-2.3.15):sconf.c  (xinetd-2.3.15.4.tar.xz)
/* /*
* (c) Copyright 1992 by Panagiotis Tsirigotis * (c) Copyright 1992 by Panagiotis Tsirigotis
* (c) Sections Copyright 1998-2001 by Rob Braun * (c) Sections Copyright 1998-2001 by Rob Braun
* All rights reserved. The file named COPYRIGHT specifies the terms * All rights reserved. The file named COPYRIGHT specifies the terms
* and conditions for redistribution. * and conditions for redistribution.
*/ */
#include "config.h" #include "config.h"
#ifdef HAVE_NETDB_H
#include <netdb.h> #include <netdb.h>
#endif
#include "str.h" #include "str.h"
#include "sio.h" #include "sio.h"
#include "sconf.h" #include "sconf.h"
#include "timex.h" #include "timex.h"
#include "addr.h" #include "addr.h"
#include "nvlists.h" #include "nvlists.h"
#include "xmdns.h"
#define NEW_SCONF() NEW( struct service_config ) #define NEW_SCONF() NEW( struct service_config )
#define FREE_SCONF( scp ) FREE( scp ) #define FREE_SCONF( scp ) FREE( scp )
/* /*
* Conditional free; checks if the pointer is NULL * Conditional free; checks if the pointer is NULL
*/ */
#define COND_FREE( x ) if ( x ) \ #define COND_FREE( x ) if ( x ) \
{ \ { \
*x = NUL ; \ *x = NUL ; \
skipping to change at line 51 skipping to change at line 48
const char *func = "sc_alloc" ; const char *func = "sc_alloc" ;
scp = NEW_SCONF() ; scp = NEW_SCONF() ;
if ( scp == NULL ) if ( scp == NULL )
{ {
out_of_memory( func ) ; out_of_memory( func ) ;
return( NULL ) ; return( NULL ) ;
} }
CLEAR( *scp ) ; CLEAR( *scp ) ;
SC_NAME(scp) = new_string( name ) ; SC_NAME(scp) = new_string( name ) ;
#ifdef HAVE_MDNS
xinetd_mdns_svc_init(scp);
#endif
return( scp ) ; return( scp ) ;
} }
static void release_string_pset( pset_h pset ) static void release_string_pset( pset_h pset )
{ {
pset_apply( pset, free, NULL ) ; pset_apply( pset, free, NULL ) ;
pset_destroy( pset ) ; pset_destroy( pset ) ;
} }
/* /*
* Free all malloc'ed memory for the specified service * Free all malloc'ed memory for the specified service
*/ */
void sc_free( struct service_config *scp ) void sc_free( struct service_config *scp )
{ {
#ifdef HAVE_MDNS
COND_FREE( SC_MDNS_NAME(scp) );
xinetd_mdns_svc_free(scp);
#endif
#ifdef LIBWRAP #ifdef LIBWRAP
COND_FREE( SC_LIBWRAP(scp) ); COND_FREE( SC_LIBWRAP(scp) );
#endif #endif
COND_FREE( SC_NAME(scp) ) ; COND_FREE( SC_NAME(scp) ) ;
COND_FREE( SC_ID(scp) ) ; COND_FREE( SC_ID(scp) ) ;
COND_FREE( SC_PROTONAME(scp) ) ; COND_FREE( SC_PROTONAME(scp) ) ;
COND_FREE( SC_SERVER(scp) ) ; COND_FREE( SC_SERVER(scp) ) ;
COND_FREE( (char *)SC_REDIR_ADDR(scp) ) ; COND_FREE( (char *)SC_REDIR_ADDR(scp) ) ;
COND_FREE( (char *)SC_BIND_ADDR(scp) ) ; COND_FREE( (char *)SC_BIND_ADDR(scp) ) ;
COND_FREE( (char *)SC_ORIG_BIND_ADDR(scp) ) ; COND_FREE( (char *)SC_ORIG_BIND_ADDR(scp) ) ;
skipping to change at line 151 skipping to change at line 141
struct service_config *scp ; struct service_config *scp ;
const char *func = "sc_make" ; const char *func = "sc_make" ;
if ( ( scp = sc_alloc( service_name ) ) == NULL ) if ( ( scp = sc_alloc( service_name ) ) == NULL )
return( NULL ) ; return( NULL ) ;
SC_ID(scp) = new_string( SC_NAME(scp) ) ; SC_ID(scp) = new_string( SC_NAME(scp) ) ;
if ( SC_ID(scp) == NULL ) if ( SC_ID(scp) == NULL )
{ {
out_of_memory( func ) ; out_of_memory( func ) ;
/*
* Since we're returning instead of exiting, it's probably a good idea to
* free scp
*/
sc_free( scp );
return( NULL ) ; return( NULL ) ;
} }
SC_SPECIFY( scp, A_ID ) ; SC_SPECIFY( scp, A_ID ) ;
/* /*
* All special services are internal * All special services are internal
*/ */
M_SET( SC_TYPE(scp), ST_SPECIAL ) ; M_SET( SC_TYPE(scp), ST_SPECIAL ) ;
M_SET( SC_TYPE(scp), ST_INTERNAL ) ; M_SET( SC_TYPE(scp), ST_INTERNAL ) ;
SC_BUILTIN(scp) = bp ; SC_BUILTIN(scp) = bp ;
 End of changes. 6 change blocks. 
10 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)