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