]> git.sur5r.net Git - openldap/blob - servers/slurpd/globals.c
merged with autoconf branch
[openldap] / servers / slurpd / globals.c
1 /*
2  * Copyright (c) 1996 Regents of the University of Michigan.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that this notice is preserved and that due credit is given
7  * to the University of Michigan at Ann Arbor. The name of the University
8  * may not be used to endorse or promote products derived from this
9  * software without specific prior written permission. This software
10  * is provided ``as is'' without express or implied warranty.
11  */
12
13 /*
14  * globals.c - initialization code for global data
15  */
16
17 #include "portable.h"
18
19 #include <stdio.h>
20
21 #include "slurp.h"
22 #include "globals.h"
23
24 Globals          *sglob;
25
26 int ldap_syslog = 0;
27 int ldap_syslog_level = LOG_DEBUG;
28 int ldap_debug = 0;
29
30
31 /*
32  * Initialize the globals
33  */
34 Globals *init_globals()
35 {
36     Globals *g;
37
38     g = ( Globals * ) malloc( sizeof( Globals ));
39     if ( g == NULL ) {
40         return NULL;
41     }
42
43     g->slapd_configfile = SLAPD_DEFAULT_CONFIGFILE;
44     g->no_work_interval = DEFAULT_NO_WORK_INTERVAL;
45     g->slurpd_shutdown = 0;
46     g->num_replicas = 0;
47     g->replicas = NULL;
48     g->slurpd_rdir = DEFAULT_SLURPD_REPLICA_DIR;
49     strcpy( g->slurpd_status_file, DEFAULT_SLURPD_STATUS_FILE );
50     g->slapd_replogfile[ 0 ] = '\0';
51     g->slurpd_replogfile[ 0 ] = '\0';
52     g->slurpd_status_file[ 0 ] = '\0';
53     g->one_shot_mode = 0;
54     g->myname = NULL;
55     g->srpos = 0L;
56     if ( St_init( &(g->st)) < 0 ) {
57         fprintf( stderr, "Cannot initialize status data\n" );
58         exit( 1 );
59     }
60     pthread_mutex_init( &(g->rej_mutex), pthread_mutexattr_default );
61     if ( Rq_init( &(g->rq)) < 0 ) {
62         fprintf( stderr, "Cannot initialize queue\n" );
63         exit( 1 );
64     }
65 #ifdef HAVE_KERBEROS
66     g->default_srvtab = SRVTAB;
67 #endif /* HAVE_KERBEROS */
68 #if defined( HAVE_LWP )
69     g->tsl_list = NULL;
70     mon_create( &g->tsl_mon ); 
71 #endif /* HAVE_LWP */
72
73     return g;
74 }