]> git.sur5r.net Git - openldap/blob - servers/slurpd/globals.c
Apply ldbm bind() change to bdb2 code.
[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 #include <stdlib.h>
21 #include <ac/string.h>
22
23 #include "slurp.h"
24 #include "globals.h"
25
26 Globals          *sglob;
27
28 int ldap_syslog = 0;
29 int ldap_syslog_level = LOG_DEBUG;
30 int ldap_debug = 0;
31
32
33 /*
34  * Initialize the globals
35  */
36 Globals *
37 init_globals( void )
38 {
39     Globals *g;
40
41     g = ( Globals * ) malloc( sizeof( Globals ));
42     if ( g == NULL ) {
43         return NULL;
44     }
45
46     g->slapd_configfile = SLAPD_DEFAULT_CONFIGFILE;
47     g->no_work_interval = DEFAULT_NO_WORK_INTERVAL;
48     g->slurpd_shutdown = 0;
49     g->num_replicas = 0;
50     g->replicas = NULL;
51     g->slurpd_rdir = DEFAULT_SLURPD_REPLICA_DIR;
52     strcpy( g->slurpd_status_file, DEFAULT_SLURPD_STATUS_FILE );
53     g->slapd_replogfile[ 0 ] = '\0';
54     g->slurpd_replogfile[ 0 ] = '\0';
55     g->slurpd_status_file[ 0 ] = '\0';
56     g->one_shot_mode = 0;
57     g->myname = NULL;
58     g->srpos = 0L;
59     if ( St_init( &(g->st)) < 0 ) {
60         fprintf( stderr, "Cannot initialize status data\n" );
61         exit( 1 );
62     }
63     ldap_pvt_thread_mutex_init( &(g->rej_mutex) );
64     if ( Rq_init( &(g->rq)) < 0 ) {
65         fprintf( stderr, "Cannot initialize queue\n" );
66         exit( 1 );
67     }
68 #ifdef HAVE_KERBEROS
69     g->default_srvtab = SRVTAB;
70 #endif /* HAVE_KERBEROS */
71 #if defined( HAVE_LWP )
72     g->tsl_list = NULL;
73     mon_create( &g->tsl_mon ); 
74 #endif /* HAVE_LWP */
75
76     return g;
77 }