1999-09-09 03:06:24 +08:00
|
|
|
/* $OpenLDAP$ */
|
1999-08-05 07:59:13 +08:00
|
|
|
/*
|
2003-01-04 04:20:47 +08:00
|
|
|
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
1999-08-05 07:59:13 +08:00
|
|
|
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
|
|
|
*/
|
1998-08-09 08:43:13 +08:00
|
|
|
#include "portable.h"
|
1998-10-25 09:41:42 +08:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <ac/socket.h>
|
|
|
|
#include <ac/string.h>
|
|
|
|
#include <ac/time.h>
|
Protoized, moved extern definitions to .h files, fixed related bugs.
Most function and variable definitions are now preceded by its extern
definition, for error checking. Retyped a number of functions, usually
to return void. Fixed a number of printf format errors.
API changes (in ldap/include):
Added avl_dup_ok, avl_prefixapply, removed ber_fatten (probably typo
for ber_flatten), retyped ldap_sort_strcasecmp, grew lutil.h.
A number of `extern' declarations are left (some added by protoize), to
be cleaned away later. Mostly strdup(), strcasecmp(), mktemp(), optind,
optarg, errno.
1998-11-16 06:40:11 +08:00
|
|
|
#include <ac/unistd.h>
|
1999-03-28 00:21:44 +08:00
|
|
|
#include <ac/wait.h>
|
|
|
|
#include <ac/errno.h>
|
1998-10-25 09:41:42 +08:00
|
|
|
|
2001-11-18 00:18:07 +08:00
|
|
|
#include "ldap_pvt.h"
|
|
|
|
|
Protoized, moved extern definitions to .h files, fixed related bugs.
Most function and variable definitions are now preceded by its extern
definition, for error checking. Retyped a number of functions, usually
to return void. Fixed a number of printf format errors.
API changes (in ldap/include):
Added avl_dup_ok, avl_prefixapply, removed ber_fatten (probably typo
for ber_flatten), retyped ldap_sort_strcasecmp, grew lutil.h.
A number of `extern' declarations are left (some added by protoize), to
be cleaned away later. Mostly strdup(), strcasecmp(), mktemp(), optind,
optarg, errno.
1998-11-16 06:40:11 +08:00
|
|
|
#include "slap.h"
|
1999-06-19 07:53:05 +08:00
|
|
|
#include "lutil.h"
|
2001-09-25 08:03:24 +08:00
|
|
|
#include "ldif.h"
|
1998-08-09 08:43:13 +08:00
|
|
|
|
2003-02-10 10:09:00 +08:00
|
|
|
#ifdef LDAP_SLAPI
|
|
|
|
#include "slapi.h"
|
|
|
|
#endif
|
|
|
|
|
1999-03-29 17:04:35 +08:00
|
|
|
#ifdef LDAP_SIGCHLD
|
1999-03-28 00:21:44 +08:00
|
|
|
static RETSIGTYPE wait4child( int sig );
|
|
|
|
#endif
|
|
|
|
|
1999-11-02 05:25:22 +08:00
|
|
|
#ifdef HAVE_NT_SERVICE_MANAGER
|
1999-06-19 05:33:39 +08:00
|
|
|
#define MAIN_RETURN(x) return
|
2001-12-27 10:03:57 +08:00
|
|
|
static struct sockaddr_in bind_addr;
|
1999-06-18 02:46:02 +08:00
|
|
|
|
1999-11-02 06:00:18 +08:00
|
|
|
#define SERVICE_EXIT( e, n ) do { \
|
|
|
|
if ( is_NT_Service ) { \
|
2003-03-03 19:46:05 +08:00
|
|
|
lutil_ServiceStatus.dwWin32ExitCode = (e); \
|
|
|
|
lutil_ServiceStatus.dwServiceSpecificExitCode = (n); \
|
1999-11-02 06:00:18 +08:00
|
|
|
} \
|
|
|
|
} while ( 0 )
|
|
|
|
|
1999-06-18 02:46:02 +08:00
|
|
|
#else
|
|
|
|
#define SERVICE_EXIT( e, n )
|
1999-06-19 05:33:39 +08:00
|
|
|
#define MAIN_RETURN(x) return(x)
|
1999-06-18 02:46:02 +08:00
|
|
|
#endif
|
|
|
|
|
1999-01-05 23:40:58 +08:00
|
|
|
/*
|
|
|
|
* when more than one slapd is running on one machine, each one might have
|
|
|
|
* it's own LOCAL for syslogging and must have its own pid/args files
|
|
|
|
*/
|
|
|
|
|
1999-05-19 09:12:33 +08:00
|
|
|
#ifndef HAVE_MKVERSION
|
1999-05-21 11:53:37 +08:00
|
|
|
const char Versionstr[] =
|
|
|
|
OPENLDAP_PACKAGE " " OPENLDAP_VERSION " Standalone LDAP Server (slapd)";
|
1999-05-19 09:12:33 +08:00
|
|
|
#endif
|
|
|
|
|
1999-01-05 23:40:58 +08:00
|
|
|
#ifdef LOG_LOCAL4
|
|
|
|
|
|
|
|
#define DEFAULT_SYSLOG_USER LOG_LOCAL4
|
|
|
|
|
|
|
|
typedef struct _str2intDispatch {
|
2001-01-18 00:35:53 +08:00
|
|
|
char *stringVal;
|
|
|
|
int abbr;
|
|
|
|
int intVal;
|
1999-01-05 23:40:58 +08:00
|
|
|
} STRDISP, *STRDISP_P;
|
|
|
|
|
|
|
|
|
|
|
|
/* table to compute syslog-options to integer */
|
2001-01-18 00:35:53 +08:00
|
|
|
static STRDISP syslog_types[] = {
|
1999-08-25 14:44:08 +08:00
|
|
|
{ "LOCAL0", sizeof("LOCAL0"), LOG_LOCAL0 },
|
|
|
|
{ "LOCAL1", sizeof("LOCAL1"), LOG_LOCAL1 },
|
|
|
|
{ "LOCAL2", sizeof("LOCAL2"), LOG_LOCAL2 },
|
|
|
|
{ "LOCAL3", sizeof("LOCAL3"), LOG_LOCAL3 },
|
|
|
|
{ "LOCAL4", sizeof("LOCAL4"), LOG_LOCAL4 },
|
|
|
|
{ "LOCAL5", sizeof("LOCAL5"), LOG_LOCAL5 },
|
|
|
|
{ "LOCAL6", sizeof("LOCAL6"), LOG_LOCAL6 },
|
|
|
|
{ "LOCAL7", sizeof("LOCAL7"), LOG_LOCAL7 },
|
2003-01-19 21:38:44 +08:00
|
|
|
{ NULL, 0, 0 }
|
1999-01-05 23:40:58 +08:00
|
|
|
};
|
|
|
|
|
1999-03-04 21:51:14 +08:00
|
|
|
static int cnvt_str2int( char *, STRDISP_P, int );
|
1999-01-05 23:40:58 +08:00
|
|
|
|
2001-01-18 00:35:53 +08:00
|
|
|
#endif /* LOG_LOCAL4 */
|
1999-01-05 23:40:58 +08:00
|
|
|
|
2002-04-16 01:32:08 +08:00
|
|
|
static int check_config = 0;
|
1999-01-05 23:40:58 +08:00
|
|
|
|
1998-11-05 14:49:49 +08:00
|
|
|
static void
|
Protoized, moved extern definitions to .h files, fixed related bugs.
Most function and variable definitions are now preceded by its extern
definition, for error checking. Retyped a number of functions, usually
to return void. Fixed a number of printf format errors.
API changes (in ldap/include):
Added avl_dup_ok, avl_prefixapply, removed ber_fatten (probably typo
for ber_flatten), retyped ldap_sort_strcasecmp, grew lutil.h.
A number of `extern' declarations are left (some added by protoize), to
be cleaned away later. Mostly strdup(), strcasecmp(), mktemp(), optind,
optarg, errno.
1998-11-16 06:40:11 +08:00
|
|
|
usage( char *name )
|
1998-08-09 08:43:13 +08:00
|
|
|
{
|
1999-07-20 03:40:33 +08:00
|
|
|
fprintf( stderr,
|
|
|
|
"usage: %s options\n", name );
|
|
|
|
fprintf( stderr,
|
2002-06-16 06:01:39 +08:00
|
|
|
"\t-4\t\tIPv4 only\n"
|
|
|
|
"\t-6\t\tIPv6 only\n"
|
2002-04-16 01:32:08 +08:00
|
|
|
"\t-d level\tDebug level" "\n"
|
|
|
|
"\t-f filename\tConfiguration file\n"
|
1999-07-20 03:40:33 +08:00
|
|
|
#if defined(HAVE_SETUID) && defined(HAVE_SETGID)
|
2002-03-26 00:30:06 +08:00
|
|
|
"\t-g group\tGroup (id or name) to run as\n"
|
1999-04-02 06:31:24 +08:00
|
|
|
#endif
|
2002-04-16 01:32:08 +08:00
|
|
|
"\t-h URLs\t\tList of URLs to serve\n"
|
1999-01-05 23:40:58 +08:00
|
|
|
#ifdef LOG_LOCAL4
|
2002-04-16 01:32:08 +08:00
|
|
|
"\t-l facility\tSyslog facility (default: LOCAL4)\n"
|
1999-04-03 11:19:07 +08:00
|
|
|
#endif
|
2002-04-16 01:32:08 +08:00
|
|
|
"\t-n serverName\tService name\n"
|
2000-08-17 12:21:20 +08:00
|
|
|
#ifdef HAVE_CHROOT
|
2002-04-16 01:32:08 +08:00
|
|
|
"\t-r directory\tSandbox directory to chroot to\n"
|
2000-08-17 12:21:20 +08:00
|
|
|
#endif
|
2002-04-16 01:32:08 +08:00
|
|
|
"\t-s level\tSyslog level\n"
|
|
|
|
"\t-t\t\tCheck configuration file and exit\n"
|
1999-07-20 03:40:33 +08:00
|
|
|
#if defined(HAVE_SETUID) && defined(HAVE_SETGID)
|
2002-04-16 01:32:08 +08:00
|
|
|
"\t-u user\t\tUser (id or name) to run as\n"
|
1999-07-20 03:40:33 +08:00
|
|
|
#endif
|
|
|
|
);
|
|
|
|
}
|
1999-03-22 15:14:54 +08:00
|
|
|
|
1999-11-02 05:25:22 +08:00
|
|
|
#ifdef HAVE_NT_SERVICE_MANAGER
|
1999-06-18 02:46:02 +08:00
|
|
|
void WINAPI ServiceMain( DWORD argc, LPTSTR *argv )
|
|
|
|
#else
|
|
|
|
int main( int argc, char **argv )
|
|
|
|
#endif
|
1999-06-19 07:53:05 +08:00
|
|
|
{
|
1999-09-05 04:24:40 +08:00
|
|
|
int i, no_detach = 0;
|
2001-11-18 00:18:07 +08:00
|
|
|
int rc = 1;
|
1999-07-20 03:40:33 +08:00
|
|
|
char *urls = NULL;
|
1999-06-18 02:46:02 +08:00
|
|
|
#if defined(HAVE_SETUID) && defined(HAVE_SETGID)
|
|
|
|
char *username = NULL;
|
|
|
|
char *groupname = NULL;
|
1999-06-17 08:51:12 +08:00
|
|
|
#endif
|
2000-05-11 07:30:52 +08:00
|
|
|
#if defined(HAVE_CHROOT)
|
|
|
|
char *sandbox = NULL;
|
|
|
|
#endif
|
1999-01-05 23:40:58 +08:00
|
|
|
#ifdef LOG_LOCAL4
|
2001-01-18 00:35:53 +08:00
|
|
|
int syslogUser = DEFAULT_SYSLOG_USER;
|
1999-04-03 11:19:07 +08:00
|
|
|
#endif
|
2001-12-27 10:03:57 +08:00
|
|
|
|
|
|
|
int g_argc = argc;
|
|
|
|
char **g_argv = argv;
|
1999-11-02 06:00:18 +08:00
|
|
|
|
|
|
|
#ifdef HAVE_NT_SERVICE_MANAGER
|
1999-06-18 02:46:02 +08:00
|
|
|
char *configfile = ".\\slapd.conf";
|
|
|
|
#else
|
|
|
|
char *configfile = SLAPD_DEFAULT_CONFIGFILE;
|
1999-01-05 23:40:58 +08:00
|
|
|
#endif
|
2001-01-18 00:35:53 +08:00
|
|
|
char *serverName = NULL;
|
|
|
|
int serverMode = SLAP_SERVER_MODE;
|
1998-08-09 08:43:13 +08:00
|
|
|
|
1999-08-20 01:06:28 +08:00
|
|
|
#ifdef CSRIMALLOC
|
|
|
|
FILE *leakfile;
|
|
|
|
if( ( leakfile = fopen( "slapd.leak", "w" )) == NULL ) {
|
|
|
|
leakfile = stderr;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1999-11-02 05:25:22 +08:00
|
|
|
#ifdef HAVE_NT_SERVICE_MANAGER
|
1999-06-18 02:46:02 +08:00
|
|
|
{
|
1999-07-20 03:40:33 +08:00
|
|
|
int *i;
|
1999-06-18 02:46:02 +08:00
|
|
|
char *newConfigFile;
|
2000-05-12 04:50:20 +08:00
|
|
|
char *newUrls;
|
2000-05-13 05:26:30 +08:00
|
|
|
char *regService = NULL;
|
1999-08-31 13:18:06 +08:00
|
|
|
|
|
|
|
if ( is_NT_Service ) {
|
2000-05-27 14:21:23 +08:00
|
|
|
serverName = argv[0];
|
2003-03-03 19:46:05 +08:00
|
|
|
lutil_CommenceStartupProcessing( serverName, slap_sig_shutdown );
|
2000-05-27 14:21:23 +08:00
|
|
|
if ( strcmp(serverName, SERVICE_NAME) )
|
|
|
|
regService = serverName;
|
1999-08-31 13:18:06 +08:00
|
|
|
}
|
|
|
|
|
2003-03-03 19:46:05 +08:00
|
|
|
i = (int*)lutil_getRegParam( regService, "DebugLevel" );
|
1999-07-20 03:40:33 +08:00
|
|
|
if ( i != NULL )
|
1999-06-18 02:46:02 +08:00
|
|
|
{
|
1999-07-20 03:40:33 +08:00
|
|
|
slap_debug = *i;
|
2001-01-16 03:17:29 +08:00
|
|
|
#ifdef NEW_LOGGING
|
2002-07-12 04:33:24 +08:00
|
|
|
lutil_log_initialize( argc, argv );
|
|
|
|
LDAP_LOG( SLAPD, INFO,
|
|
|
|
"main: new debug level from registry is: %d\n",
|
|
|
|
slap_debug, 0, 0 );
|
2001-01-16 03:17:29 +08:00
|
|
|
#else
|
1999-06-18 02:46:02 +08:00
|
|
|
Debug( LDAP_DEBUG_ANY, "new debug level from registry is: %d\n", slap_debug, 0, 0 );
|
2001-01-16 03:17:29 +08:00
|
|
|
#endif
|
1999-06-18 02:46:02 +08:00
|
|
|
}
|
2000-05-12 04:50:20 +08:00
|
|
|
|
2003-03-03 19:46:05 +08:00
|
|
|
newUrls = (char *) lutil_getRegParam(regService, "Urls");
|
2000-05-12 04:50:20 +08:00
|
|
|
if (newUrls)
|
|
|
|
{
|
|
|
|
if (urls)
|
|
|
|
ch_free(urls);
|
|
|
|
|
|
|
|
urls = ch_strdup(newUrls);
|
2001-01-16 03:17:29 +08:00
|
|
|
#ifdef NEW_LOGGING
|
2002-07-12 04:33:24 +08:00
|
|
|
LDAP_LOG( SLAPD, INFO,
|
|
|
|
"main: new urls from registry: %s\n", urls, 0, 0 );
|
2001-01-16 03:17:29 +08:00
|
|
|
#else
|
2000-05-12 04:50:20 +08:00
|
|
|
Debug(LDAP_DEBUG_ANY, "new urls from registry: %s\n",
|
|
|
|
urls, 0, 0);
|
2001-01-16 03:17:29 +08:00
|
|
|
#endif
|
|
|
|
|
2000-05-12 04:50:20 +08:00
|
|
|
}
|
|
|
|
|
2003-03-03 19:46:05 +08:00
|
|
|
newConfigFile = (char*)lutil_getRegParam( regService, "ConfigFile" );
|
1999-06-18 02:46:02 +08:00
|
|
|
if ( newConfigFile != NULL )
|
|
|
|
{
|
|
|
|
configfile = newConfigFile;
|
2001-01-16 03:17:29 +08:00
|
|
|
#ifdef NEW_LOGGING
|
2002-07-12 04:33:24 +08:00
|
|
|
LDAP_LOG( SLAPD, INFO,
|
|
|
|
"main: new config file from registry is: %s\n", configfile, 0, 0 );
|
2001-01-16 03:17:29 +08:00
|
|
|
#else
|
1999-06-18 02:46:02 +08:00
|
|
|
Debug ( LDAP_DEBUG_ANY, "new config file from registry is: %s\n", configfile, 0, 0 );
|
2001-01-16 03:17:29 +08:00
|
|
|
#endif
|
|
|
|
|
1999-06-18 02:46:02 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1999-04-02 06:31:24 +08:00
|
|
|
while ( (i = getopt( argc, argv,
|
2002-04-16 01:32:08 +08:00
|
|
|
"d:f:h:s:n:t"
|
2002-06-16 06:01:39 +08:00
|
|
|
#if LDAP_PF_INET6
|
|
|
|
"46"
|
|
|
|
#endif
|
2000-05-11 07:30:52 +08:00
|
|
|
#ifdef HAVE_CHROOT
|
|
|
|
"r:"
|
|
|
|
#endif
|
1999-04-02 06:31:24 +08:00
|
|
|
#ifdef LOG_LOCAL4
|
|
|
|
"l:"
|
|
|
|
#endif
|
1999-04-21 08:40:20 +08:00
|
|
|
#if defined(HAVE_SETUID) && defined(HAVE_SETGID)
|
|
|
|
"u:g:"
|
1999-02-12 22:36:16 +08:00
|
|
|
#endif
|
1999-04-02 06:31:24 +08:00
|
|
|
)) != EOF ) {
|
1998-08-09 08:43:13 +08:00
|
|
|
switch ( i ) {
|
2002-06-16 06:01:39 +08:00
|
|
|
#ifdef LDAP_PF_INET6
|
|
|
|
case '4':
|
|
|
|
slap_inet4or6 = AF_INET;
|
|
|
|
break;
|
|
|
|
case '6':
|
|
|
|
slap_inet4or6 = AF_INET6;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
1999-07-20 03:40:33 +08:00
|
|
|
case 'h': /* listen URLs */
|
1999-08-22 11:36:19 +08:00
|
|
|
if ( urls != NULL ) free( urls );
|
1999-07-20 03:40:33 +08:00
|
|
|
urls = ch_strdup( optarg );
|
2001-01-18 00:35:53 +08:00
|
|
|
break;
|
1999-03-17 11:56:25 +08:00
|
|
|
|
1999-09-05 04:24:40 +08:00
|
|
|
case 'd': /* set debug level and 'do not detach' flag */
|
|
|
|
no_detach = 1;
|
1998-08-09 08:43:13 +08:00
|
|
|
#ifdef LDAP_DEBUG
|
1999-07-20 03:40:33 +08:00
|
|
|
slap_debug |= atoi( optarg );
|
1998-08-09 08:43:13 +08:00
|
|
|
#else
|
1999-09-05 04:24:40 +08:00
|
|
|
if ( atoi( optarg ) != 0 )
|
|
|
|
fputs( "must compile with LDAP_DEBUG for debugging\n",
|
|
|
|
stderr );
|
1998-08-09 08:43:13 +08:00
|
|
|
#endif
|
1999-09-05 04:24:40 +08:00
|
|
|
break;
|
1998-08-09 08:43:13 +08:00
|
|
|
|
|
|
|
case 'f': /* read config file */
|
1998-11-28 04:21:54 +08:00
|
|
|
configfile = ch_strdup( optarg );
|
1998-08-09 08:43:13 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 's': /* set syslog level */
|
|
|
|
ldap_syslog = atoi( optarg );
|
|
|
|
break;
|
|
|
|
|
1999-01-05 23:40:58 +08:00
|
|
|
#ifdef LOG_LOCAL4
|
|
|
|
case 'l': /* set syslog local user */
|
1999-07-20 03:40:33 +08:00
|
|
|
syslogUser = cnvt_str2int( optarg,
|
|
|
|
syslog_types, DEFAULT_SYSLOG_USER );
|
1999-01-05 23:40:58 +08:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2000-05-11 07:30:52 +08:00
|
|
|
#ifdef HAVE_CHROOT
|
|
|
|
case 'r':
|
|
|
|
if( sandbox ) free(sandbox);
|
|
|
|
sandbox = ch_strdup( optarg );
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
1999-05-01 05:32:12 +08:00
|
|
|
#if defined(HAVE_SETUID) && defined(HAVE_SETGID)
|
1999-04-21 08:40:20 +08:00
|
|
|
case 'u': /* user name */
|
|
|
|
if( username ) free(username);
|
1999-04-03 11:19:07 +08:00
|
|
|
username = ch_strdup( optarg );
|
|
|
|
break;
|
|
|
|
|
1999-04-21 08:40:20 +08:00
|
|
|
case 'g': /* group name */
|
|
|
|
if( groupname ) free(groupname);
|
1999-04-03 11:19:07 +08:00
|
|
|
groupname = ch_strdup( optarg );
|
|
|
|
break;
|
1999-04-21 08:40:20 +08:00
|
|
|
#endif /* SETUID && GETUID */
|
1999-07-20 03:40:33 +08:00
|
|
|
|
1999-06-19 07:53:05 +08:00
|
|
|
case 'n': /* NT service name */
|
2000-05-27 03:52:40 +08:00
|
|
|
if( serverName != NULL ) free( serverName );
|
|
|
|
serverName = ch_strdup( optarg );
|
1999-06-19 05:33:39 +08:00
|
|
|
break;
|
2000-05-27 03:52:40 +08:00
|
|
|
|
2002-04-16 01:32:08 +08:00
|
|
|
case 't':
|
|
|
|
check_config++;
|
|
|
|
break;
|
|
|
|
|
1998-08-09 08:43:13 +08:00
|
|
|
default:
|
|
|
|
usage( argv[0] );
|
1999-06-18 02:46:02 +08:00
|
|
|
rc = 1;
|
|
|
|
SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 15 );
|
|
|
|
goto stop;
|
1998-08-09 08:43:13 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-10-26 00:50:45 +08:00
|
|
|
#ifdef NEW_LOGGING
|
2001-01-18 00:35:53 +08:00
|
|
|
lutil_log_initialize( argc, argv );
|
2002-07-12 04:33:24 +08:00
|
|
|
#else
|
2000-10-14 04:24:49 +08:00
|
|
|
lutil_set_debug_level( "slapd", slap_debug );
|
1999-05-19 09:12:33 +08:00
|
|
|
ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &slap_debug);
|
1998-12-22 09:34:01 +08:00
|
|
|
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &slap_debug);
|
|
|
|
ldif_debug = slap_debug;
|
2002-07-12 04:33:24 +08:00
|
|
|
#endif
|
1998-12-22 09:34:01 +08:00
|
|
|
|
2001-01-16 03:17:29 +08:00
|
|
|
#ifdef NEW_LOGGING
|
2002-07-12 04:33:24 +08:00
|
|
|
LDAP_LOG( SLAPD, INFO, "%s", Versionstr, 0, 0 );
|
2001-01-16 03:17:29 +08:00
|
|
|
#else
|
1998-08-09 08:43:13 +08:00
|
|
|
Debug( LDAP_DEBUG_TRACE, "%s", Versionstr, 0, 0 );
|
2001-01-16 03:17:29 +08:00
|
|
|
#endif
|
|
|
|
|
2000-05-27 03:52:40 +08:00
|
|
|
if( serverName == NULL ) {
|
|
|
|
if ( (serverName = strrchr( argv[0], *LDAP_DIRSEP )) == NULL ) {
|
2001-12-15 20:05:58 +08:00
|
|
|
serverName = argv[0];
|
2000-05-27 03:52:40 +08:00
|
|
|
} else {
|
2001-12-15 20:05:58 +08:00
|
|
|
serverName = serverName + 1;
|
2000-05-27 03:52:40 +08:00
|
|
|
}
|
1998-08-09 08:43:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef LOG_LOCAL4
|
1999-01-05 23:40:58 +08:00
|
|
|
openlog( serverName, OPENLOG_OPTIONS, syslogUser );
|
1999-11-02 02:14:26 +08:00
|
|
|
#elif LOG_DEBUG
|
1999-01-05 23:40:58 +08:00
|
|
|
openlog( serverName, OPENLOG_OPTIONS );
|
1998-08-09 08:43:13 +08:00
|
|
|
#endif
|
|
|
|
|
2002-04-16 01:32:08 +08:00
|
|
|
if( !check_config && slapd_daemon_init( urls ) != 0 ) {
|
1999-07-20 04:48:19 +08:00
|
|
|
rc = 1;
|
|
|
|
SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 16 );
|
|
|
|
goto stop;
|
|
|
|
}
|
1999-07-20 03:40:33 +08:00
|
|
|
|
2000-05-11 07:30:52 +08:00
|
|
|
#if defined(HAVE_CHROOT)
|
2000-10-10 07:38:30 +08:00
|
|
|
if ( sandbox ) {
|
|
|
|
if ( chdir( sandbox ) ) {
|
|
|
|
perror("chdir");
|
|
|
|
rc = 1;
|
|
|
|
goto stop;
|
|
|
|
}
|
|
|
|
if ( chroot( sandbox ) ) {
|
|
|
|
perror("chroot");
|
|
|
|
rc = 1;
|
|
|
|
goto stop;
|
|
|
|
}
|
2000-05-11 07:30:52 +08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1999-04-21 08:40:20 +08:00
|
|
|
#if defined(HAVE_SETUID) && defined(HAVE_SETGID)
|
1999-07-20 03:40:33 +08:00
|
|
|
if ( username != NULL || groupname != NULL ) {
|
1999-04-03 11:19:07 +08:00
|
|
|
slap_init_user( username, groupname );
|
1999-07-20 03:40:33 +08:00
|
|
|
}
|
1999-04-03 11:19:07 +08:00
|
|
|
#endif
|
|
|
|
|
1999-12-10 06:33:22 +08:00
|
|
|
extops_init();
|
|
|
|
|
1999-11-10 05:22:12 +08:00
|
|
|
#ifdef SLAPD_MODULES
|
|
|
|
if ( module_init() != 0 ) {
|
|
|
|
rc = 1;
|
|
|
|
SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 17 );
|
|
|
|
goto destroy;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1999-02-12 22:36:16 +08:00
|
|
|
if ( slap_init( serverMode, serverName ) != 0 ) {
|
1999-02-05 17:03:47 +08:00
|
|
|
rc = 1;
|
1999-06-18 02:46:02 +08:00
|
|
|
SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 18 );
|
1999-02-05 17:03:47 +08:00
|
|
|
goto destroy;
|
|
|
|
}
|
|
|
|
|
2002-01-10 08:17:21 +08:00
|
|
|
if ( slap_schema_init( ) != 0 ) {
|
2001-01-16 03:17:29 +08:00
|
|
|
#ifdef NEW_LOGGING
|
2002-07-12 04:33:24 +08:00
|
|
|
LDAP_LOG( OPERATION, CRIT, "main: schema initialization error\n", 0, 0, 0 );
|
2001-01-16 03:17:29 +08:00
|
|
|
#else
|
2000-05-16 04:04:36 +08:00
|
|
|
Debug( LDAP_DEBUG_ANY,
|
|
|
|
"schema initialization error\n",
|
|
|
|
0, 0, 0 );
|
2001-01-16 03:17:29 +08:00
|
|
|
#endif
|
|
|
|
|
2000-05-16 04:04:36 +08:00
|
|
|
goto destroy;
|
|
|
|
}
|
|
|
|
|
2003-02-28 20:34:35 +08:00
|
|
|
if ( slap_controls_init( ) != 0 ) {
|
|
|
|
#ifdef NEW_LOGGING
|
|
|
|
LDAP_LOG( OPERATION, CRIT, "main: controls initialization error\n", 0, 0, 0 );
|
|
|
|
#else
|
|
|
|
Debug( LDAP_DEBUG_ANY,
|
|
|
|
"controls initialization error\n",
|
|
|
|
0, 0, 0 );
|
|
|
|
#endif
|
|
|
|
|
|
|
|
goto destroy;
|
|
|
|
}
|
|
|
|
|
2002-05-04 08:07:12 +08:00
|
|
|
#ifdef HAVE_TLS
|
|
|
|
/* Library defaults to full certificate checking. This is correct when
|
|
|
|
* a client is verifying a server because all servers should have a
|
|
|
|
* valid cert. But few clients have valid certs, so we want our default
|
|
|
|
* to be no checking. The config file can override this as usual.
|
|
|
|
*/
|
|
|
|
rc = 0;
|
|
|
|
(void) ldap_pvt_tls_set_option( NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &rc );
|
|
|
|
#endif
|
|
|
|
|
2002-12-08 01:19:29 +08:00
|
|
|
#ifdef LDAP_SLAPI
|
|
|
|
if ( slapi_init() != 0 ) {
|
|
|
|
#ifdef NEW_LOGGING
|
|
|
|
LDAP_LOG( OPERATION, CRIT, "main: slapi initialization error\n", 0, 0, 0 );
|
|
|
|
#else
|
|
|
|
Debug( LDAP_DEBUG_ANY,
|
|
|
|
"slapi initialization error\n",
|
|
|
|
0, 0, 0 );
|
|
|
|
#endif
|
|
|
|
|
|
|
|
goto destroy;
|
|
|
|
}
|
|
|
|
#endif /* LDAP_SLAPI */
|
|
|
|
|
2002-08-07 16:22:43 +08:00
|
|
|
if ( read_config( configfile, 0 ) != 0 ) {
|
1999-02-05 17:03:47 +08:00
|
|
|
rc = 1;
|
1999-06-18 02:46:02 +08:00
|
|
|
SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 19 );
|
2002-04-16 01:32:08 +08:00
|
|
|
|
|
|
|
if ( check_config ) {
|
|
|
|
fprintf( stderr, "config check failed\n" );
|
|
|
|
}
|
|
|
|
|
|
|
|
goto destroy;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( check_config ) {
|
|
|
|
rc = 0;
|
|
|
|
fprintf( stderr, "config check succeeded\n" );
|
1999-02-05 17:03:47 +08:00
|
|
|
goto destroy;
|
|
|
|
}
|
|
|
|
|
2001-12-10 20:09:40 +08:00
|
|
|
if ( glue_sub_init( ) != 0 ) {
|
|
|
|
#ifdef NEW_LOGGING
|
2002-07-12 04:33:24 +08:00
|
|
|
LDAP_LOG( SLAPD, CRIT, "main: subordinate config error\n", 0, 0, 0 );
|
2001-12-10 20:09:40 +08:00
|
|
|
#else
|
|
|
|
Debug( LDAP_DEBUG_ANY,
|
|
|
|
"subordinate config error\n",
|
|
|
|
0, 0, 0 );
|
|
|
|
#endif
|
|
|
|
goto destroy;
|
|
|
|
}
|
|
|
|
|
2002-01-10 08:17:21 +08:00
|
|
|
if ( slap_schema_check( ) != 0 ) {
|
2001-01-16 03:17:29 +08:00
|
|
|
#ifdef NEW_LOGGING
|
2002-07-12 04:33:24 +08:00
|
|
|
LDAP_LOG( SLAPD, CRIT, "main: schema prep error\n", 0, 0, 0 );
|
2001-01-16 03:17:29 +08:00
|
|
|
#else
|
2000-05-16 04:04:36 +08:00
|
|
|
Debug( LDAP_DEBUG_ANY,
|
|
|
|
"schema prep error\n",
|
|
|
|
0, 0, 0 );
|
2001-01-16 03:17:29 +08:00
|
|
|
#endif
|
|
|
|
|
2000-05-16 04:04:36 +08:00
|
|
|
goto destroy;
|
|
|
|
}
|
|
|
|
|
1999-07-16 05:07:01 +08:00
|
|
|
#ifdef HAVE_TLS
|
2000-09-22 05:30:02 +08:00
|
|
|
rc = ldap_pvt_tls_init();
|
2001-08-02 11:37:20 +08:00
|
|
|
if( rc != 0) {
|
|
|
|
#ifdef NEW_LOGGING
|
2002-07-12 04:33:24 +08:00
|
|
|
LDAP_LOG( SLAPD, CRIT, "main: tls init failed: %d\n", rc, 0, 0 );
|
2001-08-02 11:37:20 +08:00
|
|
|
#else
|
|
|
|
Debug( LDAP_DEBUG_ANY,
|
|
|
|
"main: TLS init failed: %d\n",
|
|
|
|
0, 0, 0 );
|
|
|
|
#endif
|
|
|
|
rc = 1;
|
|
|
|
SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 20 );
|
|
|
|
goto destroy;
|
|
|
|
}
|
2000-05-12 04:50:20 +08:00
|
|
|
|
2001-08-02 11:37:20 +08:00
|
|
|
rc = ldap_pvt_tls_init_def_ctx();
|
|
|
|
if( rc != 0) {
|
|
|
|
#ifdef NEW_LOGGING
|
2002-07-12 04:33:24 +08:00
|
|
|
LDAP_LOG( SLAPD, CRIT, "main: tls init def ctx failed: %d\n", rc, 0, 0 );
|
2001-08-02 11:37:20 +08:00
|
|
|
#else
|
|
|
|
Debug( LDAP_DEBUG_ANY,
|
|
|
|
"main: TLS init def ctx failed: %d\n",
|
2002-11-10 00:09:50 +08:00
|
|
|
rc, 0, 0 );
|
2001-08-02 11:37:20 +08:00
|
|
|
#endif
|
2000-05-12 04:50:20 +08:00
|
|
|
rc = 1;
|
|
|
|
SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 20 );
|
|
|
|
goto destroy;
|
|
|
|
}
|
1999-07-16 05:07:01 +08:00
|
|
|
#endif
|
|
|
|
|
1999-08-31 13:18:06 +08:00
|
|
|
(void) SIGNAL( LDAP_SIGUSR1, slap_sig_wake );
|
|
|
|
(void) SIGNAL( LDAP_SIGUSR2, slap_sig_shutdown );
|
|
|
|
|
1999-03-02 06:37:05 +08:00
|
|
|
#ifdef SIGPIPE
|
1999-03-22 15:14:54 +08:00
|
|
|
(void) SIGNAL( SIGPIPE, SIG_IGN );
|
1999-03-02 06:37:05 +08:00
|
|
|
#endif
|
|
|
|
#ifdef SIGHUP
|
1999-08-31 13:18:06 +08:00
|
|
|
(void) SIGNAL( SIGHUP, slap_sig_shutdown );
|
1999-03-02 06:37:05 +08:00
|
|
|
#endif
|
1999-08-31 13:18:06 +08:00
|
|
|
(void) SIGNAL( SIGINT, slap_sig_shutdown );
|
|
|
|
(void) SIGNAL( SIGTERM, slap_sig_shutdown );
|
1999-03-29 17:04:35 +08:00
|
|
|
#ifdef LDAP_SIGCHLD
|
|
|
|
(void) SIGNAL( LDAP_SIGCHLD, wait4child );
|
1999-03-28 00:21:44 +08:00
|
|
|
#endif
|
1999-06-19 07:53:05 +08:00
|
|
|
#ifdef SIGBREAK
|
1999-06-19 05:33:39 +08:00
|
|
|
/* SIGBREAK is generated when Ctrl-Break is pressed. */
|
1999-08-31 13:18:06 +08:00
|
|
|
(void) SIGNAL( SIGBREAK, slap_sig_shutdown );
|
1999-06-18 02:46:02 +08:00
|
|
|
#endif
|
1999-02-07 00:00:00 +08:00
|
|
|
|
1999-06-18 02:46:02 +08:00
|
|
|
#ifndef HAVE_WINSOCK
|
1999-11-02 06:00:18 +08:00
|
|
|
lutil_detach( no_detach, 0 );
|
1999-07-20 03:40:33 +08:00
|
|
|
#endif /* HAVE_WINSOCK */
|
1999-02-05 17:03:47 +08:00
|
|
|
|
1999-08-20 01:06:28 +08:00
|
|
|
#ifdef CSRIMALLOC
|
|
|
|
mal_leaktrace(1);
|
|
|
|
#endif
|
|
|
|
|
1999-08-18 03:00:59 +08:00
|
|
|
if ( slap_startup( NULL ) != 0 ) {
|
1999-03-22 15:14:54 +08:00
|
|
|
rc = 1;
|
2000-05-12 04:50:20 +08:00
|
|
|
SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 21 );
|
1999-03-22 15:14:54 +08:00
|
|
|
goto shutdown;
|
|
|
|
}
|
1998-08-09 08:43:13 +08:00
|
|
|
|
2001-01-16 03:17:29 +08:00
|
|
|
#ifdef NEW_LOGGING
|
2003-02-20 04:47:57 +08:00
|
|
|
LDAP_LOG( SLAPD, INFO, "main: slapd starting.\n", 0, 0, 0 );
|
2001-01-16 03:17:29 +08:00
|
|
|
#else
|
2003-02-20 04:47:57 +08:00
|
|
|
Debug( LDAP_DEBUG_ANY, "slapd starting\n", 0, 0, 0 );
|
2001-01-16 03:17:29 +08:00
|
|
|
#endif
|
|
|
|
|
1998-12-30 08:06:27 +08:00
|
|
|
|
2003-02-20 04:47:57 +08:00
|
|
|
if ( slapd_pid_file != NULL ) {
|
|
|
|
FILE *fp = fopen( slapd_pid_file, "w" );
|
|
|
|
|
|
|
|
if( fp != NULL ) {
|
1999-03-22 15:14:54 +08:00
|
|
|
fprintf( fp, "%d\n", (int) getpid() );
|
|
|
|
fclose( fp );
|
2003-02-20 04:47:57 +08:00
|
|
|
|
|
|
|
} else {
|
|
|
|
free(slapd_pid_file);
|
|
|
|
slapd_pid_file = NULL;
|
1998-08-09 08:43:13 +08:00
|
|
|
}
|
2003-02-20 04:47:57 +08:00
|
|
|
}
|
1998-08-09 08:43:13 +08:00
|
|
|
|
2003-02-20 04:47:57 +08:00
|
|
|
if ( slapd_args_file != NULL ) {
|
|
|
|
FILE *fp = fopen( slapd_args_file, "w" );
|
|
|
|
|
|
|
|
if( fp != NULL ) {
|
1999-03-22 15:14:54 +08:00
|
|
|
for ( i = 0; i < g_argc; i++ ) {
|
|
|
|
fprintf( fp, "%s ", g_argv[i] );
|
1998-08-09 08:43:13 +08:00
|
|
|
}
|
1999-03-22 15:14:54 +08:00
|
|
|
fprintf( fp, "\n" );
|
|
|
|
fclose( fp );
|
2003-02-20 04:47:57 +08:00
|
|
|
} else {
|
|
|
|
free(slapd_args_file);
|
|
|
|
slapd_args_file = NULL;
|
1999-03-22 15:14:54 +08:00
|
|
|
}
|
|
|
|
}
|
1998-08-09 08:43:13 +08:00
|
|
|
|
1999-11-02 06:00:18 +08:00
|
|
|
#ifdef HAVE_NT_EVENT_LOG
|
2000-05-12 04:50:20 +08:00
|
|
|
if (is_NT_Service)
|
2003-03-03 19:46:05 +08:00
|
|
|
lutil_LogStartedEvent( serverName, slap_debug, configfile, urls );
|
1999-06-18 02:46:02 +08:00
|
|
|
#endif
|
|
|
|
|
1999-07-20 03:40:33 +08:00
|
|
|
rc = slapd_daemon();
|
1999-06-18 02:46:02 +08:00
|
|
|
|
1999-11-02 05:25:22 +08:00
|
|
|
#ifdef HAVE_NT_SERVICE_MANAGER
|
1999-06-19 05:33:39 +08:00
|
|
|
/* Throw away the event that we used during the startup process. */
|
1999-06-18 02:46:02 +08:00
|
|
|
if ( is_NT_Service )
|
|
|
|
ldap_pvt_thread_cond_destroy( &started_event );
|
|
|
|
#endif
|
1998-08-09 08:43:13 +08:00
|
|
|
|
1999-02-05 17:03:47 +08:00
|
|
|
shutdown:
|
1999-02-08 19:42:14 +08:00
|
|
|
/* remember an error during shutdown */
|
1999-08-18 03:00:59 +08:00
|
|
|
rc |= slap_shutdown( NULL );
|
1999-08-20 01:06:28 +08:00
|
|
|
|
1999-02-05 17:03:47 +08:00
|
|
|
destroy:
|
1999-02-08 19:42:14 +08:00
|
|
|
/* remember an error during destroy */
|
|
|
|
rc |= slap_destroy();
|
|
|
|
|
1999-11-10 05:22:12 +08:00
|
|
|
#ifdef SLAPD_MODULES
|
|
|
|
module_kill();
|
|
|
|
#endif
|
|
|
|
|
1999-12-10 06:33:22 +08:00
|
|
|
extops_kill();
|
|
|
|
|
1999-06-18 02:46:02 +08:00
|
|
|
stop:
|
1999-11-02 06:00:18 +08:00
|
|
|
#ifdef HAVE_NT_EVENT_LOG
|
2000-05-12 04:50:20 +08:00
|
|
|
if (is_NT_Service)
|
2003-03-03 19:46:05 +08:00
|
|
|
lutil_LogStoppedEvent( serverName );
|
1999-06-18 02:46:02 +08:00
|
|
|
#endif
|
1999-07-20 03:40:33 +08:00
|
|
|
|
2001-01-16 03:17:29 +08:00
|
|
|
#ifdef NEW_LOGGING
|
2002-07-12 04:33:24 +08:00
|
|
|
LDAP_LOG( SLAPD, CRIT, "main: slapd stopped.\n", 0, 0, 0 );
|
2001-01-16 03:17:29 +08:00
|
|
|
#else
|
1999-02-08 19:42:14 +08:00
|
|
|
Debug( LDAP_DEBUG_ANY, "slapd stopped.\n", 0, 0, 0 );
|
2001-01-16 03:17:29 +08:00
|
|
|
#endif
|
|
|
|
|
1999-07-20 03:40:33 +08:00
|
|
|
|
1999-11-02 05:25:22 +08:00
|
|
|
#ifdef HAVE_NT_SERVICE_MANAGER
|
2003-03-03 19:46:05 +08:00
|
|
|
lutil_ReportShutdownComplete();
|
1999-06-18 02:46:02 +08:00
|
|
|
#endif
|
1999-02-08 19:42:14 +08:00
|
|
|
|
1999-11-02 02:14:26 +08:00
|
|
|
#ifdef LOG_DEBUG
|
1999-06-18 02:46:02 +08:00
|
|
|
closelog();
|
1999-11-02 02:14:26 +08:00
|
|
|
#endif
|
1999-07-20 03:40:33 +08:00
|
|
|
slapd_daemon_destroy();
|
1999-04-06 09:55:11 +08:00
|
|
|
|
2003-02-28 20:34:35 +08:00
|
|
|
controls_destroy();
|
|
|
|
|
2001-11-07 09:03:49 +08:00
|
|
|
schema_destroy();
|
|
|
|
|
2001-11-07 04:52:59 +08:00
|
|
|
#ifdef HAVE_TLS
|
|
|
|
ldap_pvt_tls_destroy();
|
|
|
|
#endif
|
|
|
|
|
2003-02-20 04:47:57 +08:00
|
|
|
if ( slapd_pid_file != NULL ) {
|
|
|
|
unlink( slapd_pid_file );
|
|
|
|
}
|
|
|
|
if ( slapd_args_file != NULL ) {
|
|
|
|
unlink( slapd_args_file );
|
|
|
|
}
|
|
|
|
|
2001-12-15 20:05:58 +08:00
|
|
|
config_destroy();
|
|
|
|
|
1999-08-20 01:06:28 +08:00
|
|
|
#ifdef CSRIMALLOC
|
|
|
|
mal_dumpleaktrace( leakfile );
|
|
|
|
#endif
|
|
|
|
|
1999-06-19 05:33:39 +08:00
|
|
|
MAIN_RETURN(rc);
|
1998-08-09 08:43:13 +08:00
|
|
|
}
|
1999-01-05 23:40:58 +08:00
|
|
|
|
|
|
|
|
1999-03-29 17:04:35 +08:00
|
|
|
#ifdef LDAP_SIGCHLD
|
1999-03-28 00:21:44 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Catch and discard terminated child processes, to avoid zombies.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static RETSIGTYPE
|
|
|
|
wait4child( int sig )
|
|
|
|
{
|
|
|
|
int save_errno = errno;
|
1999-04-02 12:12:18 +08:00
|
|
|
|
|
|
|
#ifdef WNOHANG
|
1999-03-28 00:21:44 +08:00
|
|
|
errno = 0;
|
1999-04-02 12:12:18 +08:00
|
|
|
#ifdef HAVE_WAITPID
|
2000-11-22 05:59:35 +08:00
|
|
|
while ( waitpid( (pid_t)-1, NULL, WNOHANG ) > 0 || errno == EINTR )
|
1999-03-28 00:21:44 +08:00
|
|
|
; /* NULL */
|
1999-04-02 12:12:18 +08:00
|
|
|
#else
|
2000-11-22 05:59:35 +08:00
|
|
|
while ( wait3( NULL, WNOHANG, NULL ) > 0 || errno == EINTR )
|
1999-03-28 00:21:44 +08:00
|
|
|
; /* NULL */
|
1999-04-02 12:12:18 +08:00
|
|
|
#endif
|
1999-04-02 16:30:02 +08:00
|
|
|
#else
|
1999-03-28 00:21:44 +08:00
|
|
|
(void) wait( NULL );
|
|
|
|
#endif
|
2000-07-22 08:37:51 +08:00
|
|
|
(void) SIGNAL_REINSTALL( sig, wait4child );
|
1999-03-28 00:21:44 +08:00
|
|
|
errno = save_errno;
|
|
|
|
}
|
|
|
|
|
2002-10-17 12:35:55 +08:00
|
|
|
#endif /* LDAP_SIGCHLD */
|
1999-03-28 00:21:44 +08:00
|
|
|
|
|
|
|
|
1999-01-05 23:40:58 +08:00
|
|
|
#ifdef LOG_LOCAL4
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Convert a string to an integer by means of a dispatcher table
|
|
|
|
* if the string is not in the table return the default
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int
|
1999-03-04 21:51:14 +08:00
|
|
|
cnvt_str2int( char *stringVal, STRDISP_P dispatcher, int defaultVal )
|
1999-01-05 23:40:58 +08:00
|
|
|
{
|
2001-01-18 00:35:53 +08:00
|
|
|
int retVal = defaultVal;
|
1999-01-05 23:40:58 +08:00
|
|
|
STRDISP_P disp;
|
|
|
|
|
|
|
|
for (disp = dispatcher; disp->stringVal; disp++) {
|
|
|
|
|
2001-01-18 00:35:53 +08:00
|
|
|
if (!strncasecmp (stringVal, disp->stringVal, disp->abbr)) {
|
1999-01-05 23:40:58 +08:00
|
|
|
|
2001-01-18 00:35:53 +08:00
|
|
|
retVal = disp->intVal;
|
|
|
|
break;
|
1999-01-05 23:40:58 +08:00
|
|
|
|
2001-01-18 00:35:53 +08:00
|
|
|
}
|
1999-01-05 23:40:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return (retVal);
|
1999-07-20 03:40:33 +08:00
|
|
|
}
|
1999-01-05 23:40:58 +08:00
|
|
|
|
2001-01-18 00:35:53 +08:00
|
|
|
#endif /* LOG_LOCAL4 */
|