globals.c 1.87 KB
Newer Older
Kurt Zeilenga's avatar
Kurt Zeilenga committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/*
 * 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
 */

17
18
#include "portable.h"

Kurt Zeilenga's avatar
Kurt Zeilenga committed
19
#include <stdio.h>
20
#include <stdlib.h>
21
#include <ac/string.h>
Kurt Zeilenga's avatar
Kurt Zeilenga committed
22
23
24
25
26
27
28
29
30
31
32
33
34
35

#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
 */
36
37
Globals *
init_globals( void )
Kurt Zeilenga's avatar
Kurt Zeilenga committed
38
39
40
41
42
43
44
45
46
47
48
49
50
{
    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;
51
    g->slurpd_rdir = DEFAULT_SLURPD_REPLICA_DIR "/replica";
Kurt Zeilenga's avatar
Kurt Zeilenga committed
52
53
54
55
56
57
58
59
60
61
62
    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 );
    }
Kurt Zeilenga's avatar
Kurt Zeilenga committed
63
    ldap_pvt_thread_mutex_init( &(g->rej_mutex) );
Kurt Zeilenga's avatar
Kurt Zeilenga committed
64
65
66
67
    if ( Rq_init( &(g->rq)) < 0 ) {
	fprintf( stderr, "Cannot initialize queue\n" );
	exit( 1 );
    }
68
#ifdef HAVE_KERBEROS
Kurt Zeilenga's avatar
Kurt Zeilenga committed
69
    g->default_srvtab = SRVTAB;
70
71
#endif /* HAVE_KERBEROS */
#if defined( HAVE_LWP )
Kurt Zeilenga's avatar
Kurt Zeilenga committed
72
73
    g->tsl_list = NULL;
    mon_create( &g->tsl_mon ); 
74
#endif /* HAVE_LWP */
Kurt Zeilenga's avatar
Kurt Zeilenga committed
75
76
77

    return g;
}