1998-08-09 08:43:13 +08:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
1998-10-25 09:41:42 +08:00
|
|
|
#include "portable.h"
|
|
|
|
|
1998-08-09 08:43:13 +08:00
|
|
|
#include <stdio.h>
|
1998-11-12 07:37:38 +08:00
|
|
|
#include <stdlib.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/string.h>
|
1998-08-09 08:43:13 +08:00
|
|
|
|
|
|
|
#include "slurp.h"
|
|
|
|
#include "globals.h"
|
|
|
|
|
|
|
|
Globals *sglob;
|
|
|
|
|
|
|
|
int ldap_syslog = 0;
|
|
|
|
int ldap_syslog_level = LOG_DEBUG;
|
|
|
|
int ldap_debug = 0;
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize the globals
|
|
|
|
*/
|
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
|
|
|
Globals *
|
|
|
|
init_globals( void )
|
1998-08-09 08:43:13 +08:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
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->myname = NULL;
|
|
|
|
g->srpos = 0L;
|
|
|
|
if ( St_init( &(g->st)) < 0 ) {
|
|
|
|
fprintf( stderr, "Cannot initialize status data\n" );
|
|
|
|
exit( 1 );
|
|
|
|
}
|
1999-01-28 12:34:55 +08:00
|
|
|
ldap_pvt_thread_mutex_init( &(g->rej_mutex) );
|
1998-08-09 08:43:13 +08:00
|
|
|
if ( Rq_init( &(g->rq)) < 0 ) {
|
|
|
|
fprintf( stderr, "Cannot initialize queue\n" );
|
|
|
|
exit( 1 );
|
|
|
|
}
|
1998-10-25 09:41:42 +08:00
|
|
|
#ifdef HAVE_KERBEROS
|
1998-08-09 08:43:13 +08:00
|
|
|
g->default_srvtab = SRVTAB;
|
1998-10-25 09:41:42 +08:00
|
|
|
#endif /* HAVE_KERBEROS */
|
1998-08-09 08:43:13 +08:00
|
|
|
|
|
|
|
return g;
|
|
|
|
}
|