mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-27 03:20:22 +08:00
3d491808a8
must include <ac/stdlib.h> to get MAX_PATH defined. use LDAP_DIRSEP instead of '/' in paths define truncate/ftruncate macros, etc.
85 lines
2.1 KiB
C
85 lines
2.1 KiB
C
/* $OpenLDAP$ */
|
|
/*
|
|
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
|
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
|
*/
|
|
/*
|
|
* Copyright (c) 1996 Regents of the University of Michigan.
|
|
* All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms are permitted
|
|
* provided that this notice is preserved and that due credit is given
|
|
* to the University of Michigan at Ann Arbor. The name of the University
|
|
* may not be used to endorse or promote products derived from this
|
|
* software without specific prior written permission. This software
|
|
* is provided ``as is'' without express or implied warranty.
|
|
*/
|
|
|
|
/*
|
|
* globals.c - initialization code for global data
|
|
*/
|
|
|
|
#include "portable.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <ac/stdlib.h>
|
|
#include <ac/string.h>
|
|
|
|
#include "slurp.h"
|
|
#include "globals.h"
|
|
|
|
Globals *sglob;
|
|
|
|
int ldap_syslog = 0;
|
|
#ifdef LOG_DEBUG
|
|
int ldap_syslog_level = LOG_DEBUG;
|
|
#else
|
|
int ldap_syslog_level = 0;
|
|
#endif
|
|
int ldap_debug = 0;
|
|
|
|
|
|
/*
|
|
* Initialize the globals
|
|
*/
|
|
Globals *
|
|
init_globals( void )
|
|
{
|
|
Globals *g;
|
|
|
|
g = ( Globals * ) malloc( sizeof( Globals ));
|
|
if ( g == NULL ) {
|
|
return NULL;
|
|
}
|
|
|
|
g->slapd_configfile = SLAPD_DEFAULT_CONFIGFILE;
|
|
g->no_work_interval = DEFAULT_NO_WORK_INTERVAL;
|
|
g->slurpd_shutdown = 0;
|
|
g->num_replicas = 0;
|
|
g->replicas = NULL;
|
|
g->slurpd_rdir = DEFAULT_SLURPD_REPLICA_DIR "/replica";
|
|
strcpy( g->slurpd_status_file, DEFAULT_SLURPD_STATUS_FILE );
|
|
g->slapd_replogfile[ 0 ] = '\0';
|
|
g->slurpd_replogfile[ 0 ] = '\0';
|
|
g->slurpd_status_file[ 0 ] = '\0';
|
|
g->one_shot_mode = 0;
|
|
g->no_detach = 0;
|
|
g->myname = NULL;
|
|
g->srpos = 0L;
|
|
if ( St_init( &(g->st)) < 0 ) {
|
|
fprintf( stderr, "Cannot initialize status data\n" );
|
|
exit( EXIT_FAILURE );
|
|
}
|
|
ldap_pvt_thread_mutex_init( &(g->rej_mutex) );
|
|
if ( Rq_init( &(g->rq)) < 0 ) {
|
|
fprintf( stderr, "Cannot initialize queue\n" );
|
|
exit( EXIT_FAILURE );
|
|
}
|
|
#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
|
|
g->default_srvtab = SRVTAB;
|
|
#endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND */
|
|
|
|
return g;
|
|
}
|