2
* (c) Copyright 1992 by Panagiotis Tsirigotis
3
* (c) Sections Copyright 1998-2001 by Rob Braun
4
* All rights reserved. The file named COPYRIGHT specifies the terms
5
* and conditions for redistribution.
10
#include <sys/socket.h>
25
#include "connection.h"
32
static void stream_logging( struct server *) ;
34
static const struct builtin_service special_services[] =
36
{ LOG_SERVICE_NAME, SOCK_STREAM, { stream_logging, FORK } },
37
{ INTERCEPT_SERVICE_NAME, SOCK_STREAM, { intercept, FORK } },
38
{ INTERCEPT_SERVICE_NAME, SOCK_DGRAM, { intercept, FORK } },
39
{ NULL, 0, { NULL, 0 } }
43
const builtin_s *spec_find( const char *service_name, int type )
46
const struct name_value *nvp ;
47
const char *func = "spec_find" ;
49
if ( (bp = builtin_lookup( special_services, service_name, type )) )
52
nvp = nv_find_name( socket_types, type ) ;
55
msg( LOG_ERR, func, "unknown socket type: %d", type ) ;
60
"special service %s,%s not supported", service_name, nvp->name ) ;
65
status_e spec_service_handler( struct service *sp, connection_s *cp )
67
return(server_run( sp, cp ));
71
static struct service *spec_setup( const char *name, int socket_type,
75
struct service_config *scp ;
77
bp = spec_find( name, socket_type ) ;
81
if ( ( scp = sc_make_special( name, bp, instances ) ) == NULL )
84
return( svc_make_special( scp ) ) ;
89
* Initialize the special services and the corresponding entries in
90
* the program state structure.
92
void spec_include(void)
96
instances = logprocs_option ? logprocs_option_arg : DEFAULT_LOGPROCS ;
97
LOG_SERVICE( ps ) = spec_setup( LOG_SERVICE_NAME, SOCK_STREAM, instances ) ;
101
static void stream_logging( struct server *serp )
103
const char *func = "stream_logging" ;
109
msg( LOG_DEBUG, func, "%d is sleeping", getpid() ) ;
114
result = log_remote_user( serp, LOGUSER_FAILURE_TIMEOUT ) ;
115
if ( (result != IDR_OK) && (result != IDR_NOSERVER) )
116
msg( LOG_ERR, func, "Failed to contact identity server at %s: %s", conn_addrstr( SERVER_CONNECTION( serp ) ), idresult_explain( result ) ) ;