summaryrefslogtreecommitdiffstats
path: root/ldap/servers/slapd/configdse.c
blob: 317c78dba1e09c721432db32f317bfc0c11f7fb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
/** BEGIN COPYRIGHT BLOCK
 * This Program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; version 2 of the License.
 * 
 * This Program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
 * Place, Suite 330, Boston, MA 02111-1307 USA.
 * 
 * In addition, as a special exception, Red Hat, Inc. gives You the additional
 * right to link the code of this Program with code not covered under the GNU
 * General Public License ("Non-GPL Code") and to distribute linked combinations
 * including the two, subject to the limitations in this paragraph. Non-GPL Code
 * permitted under this exception must only link to the code of this Program
 * through those well defined interfaces identified in the file named EXCEPTION
 * found in the source code files (the "Approved Interfaces"). The files of
 * Non-GPL Code may instantiate templates or use macros or inline functions from
 * the Approved Interfaces without causing the resulting work to be covered by
 * the GNU General Public License. Only Red Hat, Inc. may make changes or
 * additions to the list of Approved Interfaces. You must obey the GNU General
 * Public License in all respects for all of the Program code and other code used
 * in conjunction with the Program except the Non-GPL Code covered by this
 * exception. If you modify this file, you may extend this exception to your
 * version of the file, but you are not obligated to do so. If you do not wish to
 * provide this exception without modification, you must delete this exception
 * statement from your version and license this file solely under the GPL without
 * exception. 
 * 
 * 
 * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
 * Copyright (C) 2005 Red Hat, Inc.
 * All rights reserved.
 * END COPYRIGHT BLOCK **/

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

/* configdse.c - routines to manage the config DSE */

#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <errno.h>
#ifndef _WIN32
#include <sys/socket.h>
#include <sys/param.h>
#endif
#include "log.h"
#include "slap.h"
#include "pw.h"

static int check_all_maxdiskspace_and_mlogsize(Slapi_PBlock *pb, LDAPMod **mod, char *returntext);
static void get_log_max_size(   LDAPMod *mod,
                    char *maxdiskspace_str,
                    char *mlogsize_str,
                    int *maxdiskspace,
                    int *mlogsize);

/* List of attributes which require server restart to take effect */
static const char *requires_restart[] = {
    "cn=config:nsslapd-port",
    "cn=config:nsslapd-secureport",
    "cn=config:" CONFIG_LDAPI_FILENAME_ATTRIBUTE,
    "cn=config:" CONFIG_LDAPI_SWITCH_ATTRIBUTE,
    "cn=config:nsslapd-workingdir",
    "cn=config:nsslapd-plugin",
    "cn=config:nsslapd-sslclientauth",
    "cn=config:nsslapd-changelogdir",
    "cn=config:nsslapd-changelogsuffix",
    "cn=config:nsslapd-changelogmaxentries",
    "cn=config:nsslapd-changelogmaxage",
    "cn=config:nsslapd-db-locks",
#if !defined(_WIN32) && !defined(AIX)
    "cn=config:nsslapd-maxdescriptors",
#endif
    "cn=config:" CONFIG_RETURN_EXACT_CASE_ATTRIBUTE,
    "cn=config:" CONFIG_SCHEMA_IGNORE_TRAILING_SPACES,
    "cn=config,cn=ldbm:nsslapd-idlistscanlimit",
    "cn=config,cn=ldbm:nsslapd-parentcheck",
    "cn=config,cn=ldbm:nsslapd-dbcachesize",
    "cn=config,cn=ldbm:nsslapd-dbncache",
    "cn=config,cn=ldbm:nsslapd-cachesize",
    "cn=config,cn=ldbm:nsslapd-plugin",
    "cn=encryption,cn=config:nssslsessiontimeout",
    "cn=encryption,cn=config:nssslclientauth",
    "cn=encryption,cn=config:nsssl2",
    "cn=encryption,cn=config:nsssl3" };

static int
isASyntaxOrMrPluginOrPss(Slapi_Entry *e)
{
	char *ptype = slapi_entry_attr_get_charptr(e, ATTR_PLUGIN_TYPE);
	int retval = (ptype && !strcasecmp(ptype, "syntax"));
	if (!retval)
		retval = (ptype && !strcasecmp(ptype, "matchingrule"));
	if (!retval)
		retval = (ptype && !strcasecmp(ptype, "pwdstoragescheme"));
	if (!retval)
		retval = (ptype && !strcasecmp(ptype, "reverpwdstoragescheme"));
	slapi_ch_free_string(&ptype);
	return retval;
}

/* these attr types are ignored for the purposes of configuration search/modify */
static int
ignore_attr_type(const char *attr_type)
{
	if ( !attr_type ||
		 (strcasecmp (attr_type, "cn") == 0) ||
		 (strcasecmp (attr_type, "aci") == 0) ||
		 (strcasecmp (attr_type, "objectclass") == 0) ||
		 (strcasecmp (attr_type, "numsubordinates") == 0) ||
		 (strcasecmp (attr_type, "modifytimestamp") == 0) ||
		 (strcasecmp (attr_type, "modifiersname") == 0)) {
		return 1;
	}

	return 0;
}

int 
read_config_dse (Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter, int *returncode, char *returntext, void *arg)
{
	struct berval    	*vals[2];
	struct berval     	val;
	Slapi_Backend		*be;
	slapdFrontendConfig_t *slapdFrontendConfig;
	struct slapdplugin *pPlugin;
	char *cookie;
	int i;

	slapdFrontendConfig = getFrontendConfig();
   
	vals[0] = &val;
	vals[1] = NULL;

	/* 
	 * We can skip using the config accessor functions here because we're holding
	 * the read lock explicitly 
	 */
	CFG_LOCK_READ(slapdFrontendConfig);

	/* show backend config */
	attrlist_delete ( &e->e_attrs, "nsslapd-backendconfig");
	for ( i = 0; 
		  slapdFrontendConfig->backendconfig && 
			  slapdFrontendConfig->backendconfig[i]; 
		  i++) {
		val.bv_val = slapdFrontendConfig->backendconfig[i];
		val.bv_len = strlen ( val.bv_val );
		attrlist_merge ( &e->e_attrs, "nsslapd-backendconfig", vals);
	}
  
	CFG_UNLOCK_READ(slapdFrontendConfig);

    /* show other config entries */
    attrlist_delete ( &e->e_attrs, "nsslapd-backendconfig");
	cookie = NULL;
    be = slapi_get_first_backend (&cookie);
    while ( be )
    {
        if(!be->be_private)
        {
		    Slapi_DN dn;
			slapi_sdn_init(&dn);
            be_getconfigdn(be,&dn);
            val.bv_val = (char*)slapi_sdn_get_ndn(&dn);
            val.bv_len = strlen (val.bv_val);
            attrlist_merge ( &e->e_attrs, "nsslapd-backendconfig", vals);
			slapi_sdn_done(&dn);
        }

		be = slapi_get_next_backend (cookie);
    }

	slapi_ch_free_string (&cookie);

	/* show be_type */
	attrlist_delete( &e->e_attrs, "nsslapd-betype");
	cookie = NULL;
	be = slapi_get_first_backend(&cookie);
	while ( be ) {
		if( !be->be_private )
		{
			val.bv_val = be->be_type;
			val.bv_len = strlen (be->be_type);
			attrlist_replace( &e->e_attrs, "nsslapd-betype", vals );
		}

		be = slapi_get_next_backend(cookie);
	}

	slapi_ch_free_string (&cookie);

    /* show private suffixes */
    attrlist_delete ( &e->e_attrs, "nsslapd-privatenamespaces");
	cookie = NULL;
	be = slapi_get_first_backend(&cookie);    
    while ( be )
    {
        if(be->be_private)
        {
            int n= 0;
            const Slapi_DN *base= NULL;
            do {
                base= slapi_be_getsuffix(be,n);
                if(base!=NULL)
                {
                    val.bv_val = (void*)slapi_sdn_get_dn(base); /* jcm: had to cast away const */
                    val.bv_len = strlen (val.bv_val);
                    attrlist_merge ( &e->e_attrs, "nsslapd-privatenamespaces", vals);
                }
                n++;
            } while (base!=NULL);
        }

		be = slapi_get_next_backend(cookie);    	
    }

	slapi_ch_free_string (&cookie);

	/* show syntax plugins */
	attrlist_delete ( &e->e_attrs, CONFIG_PLUGIN_ATTRIBUTE );
	for ( pPlugin = slapi_get_global_syntax_plugins(); pPlugin != NULL;
		  pPlugin = pPlugin->plg_next ) {
		val.bv_val = pPlugin->plg_dn;
		val.bv_len = strlen ( val.bv_val );
		attrlist_merge ( &e->e_attrs, CONFIG_PLUGIN_ATTRIBUTE, vals );
	}

	/* show matching rule plugins */
	for ( pPlugin = slapi_get_global_mr_plugins(); pPlugin != NULL;
		  pPlugin = pPlugin->plg_next ) {
		val.bv_val = pPlugin->plg_dn;
		val.bv_len = strlen ( val.bv_val );
		attrlist_merge ( &e->e_attrs, CONFIG_PLUGIN_ATTRIBUTE, vals );
	}

	/* show requiresrestart */
	attrlist_delete( &e->e_attrs, "nsslapd-requiresrestart");
	for ( i = 0; i < sizeof(requires_restart)/sizeof(requires_restart[0]); i++ ) {
		val.bv_val = (char *)requires_restart[i];
		val.bv_len = strlen (val.bv_val);
		attrlist_merge ( &e->e_attrs, "nsslapd-requiresrestart", vals);
	}

	/* show the rest of the configuration parameters */
	*returncode= config_set_entry(e);

	return SLAPI_DSE_CALLBACK_OK;
}

int
load_config_dse(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* ignored, int *returncode, char *returntext, void *arg)
{
	int retval = LDAP_SUCCESS;
	Slapi_Attr *attr = 0;

	for (slapi_entry_first_attr(e, &attr); (retval == LDAP_SUCCESS) && attr;
		 slapi_entry_next_attr(e, attr, &attr))
	{
		char *attr_name = 0;
		struct berval **values = 0;
		int nvals = 0;

		slapi_attr_get_type(attr, &attr_name);
		if (ignore_attr_type(attr_name))
			continue;

		slapi_attr_get_numvalues(attr, &nvals);

		/* convert the values into an array of bervals */
		if (nvals)
		{
			Slapi_Value *v = 0;
			int index = 0;

			values = (struct berval **)slapi_ch_malloc((nvals+1) *
													   sizeof(struct berval *));
			values[nvals] = 0;
			for (index = slapi_attr_first_value(attr, &v);
				 v && (index != -1);
				 index = slapi_attr_next_value(attr, index, &v))
			{
				values[index] = (struct berval *)slapi_value_get_berval(v);
			}
		}

		if (attr_name)
		{
			retval = config_set(attr_name, values, returntext, 1 /* force apply */);
			if ((strcasecmp(attr_name, CONFIG_MAXDESCRIPTORS_ATTRIBUTE) == 0) ||
				(strcasecmp(attr_name, CONFIG_RESERVEDESCRIPTORS_ATTRIBUTE) == 0) ||
				(strcasecmp(attr_name, CONFIG_CONNTABLESIZE_ATTRIBUTE) == 0)) {
				/* We should not treat an LDAP_UNWILLING_TO_PERFORM as fatal for
				 * the these config attributes.  This error is returned when
				 * the value we are trying to set is higher than the current
				 * process limit.  The set function will auto-adjust the runtime
				 * value to the current process limit when this happens.  We want
				 * to allow the server to still start in this case. */
				if (retval == LDAP_UNWILLING_TO_PERFORM) {
					slapi_log_error (SLAPI_LOG_FATAL, NULL, "Config Warning: - %s\n", returntext);
					retval = LDAP_SUCCESS;
				}
			} else {
				if ((retval != LDAP_SUCCESS) &&
					slapi_attr_flag_is_set(attr, SLAPI_ATTR_FLAG_OPATTR)) {
					retval = LDAP_SUCCESS; /* ignore attempts to modify operational attrs */
				}
			}
		}

		if (values)
		{
			/* slapi_value_get_berval returns the actual memory owned by the
			   slapi attr, so we cannot free it */
			slapi_ch_free((void **)&values);
		}
	}

	*returncode = retval;
	return (retval == LDAP_SUCCESS) ? SLAPI_DSE_CALLBACK_OK
			: SLAPI_DSE_CALLBACK_ERROR;
}

int
load_plugin_entry(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* ignored, int *returncode, char *returntext, void *arg)
{
	int retval = LDAP_SUCCESS;

	if (isASyntaxOrMrPluginOrPss(e))
	{
		/*
		 * syntax/matching/passwd storage scheme rule plugins are loaded
		 * at bootstrap time, so no need to load them here.  BUT -- the
		 * descriptive information that is registered by the plugin is
		 * thrown away during bootstrap time, so we set it here.
		 */
		(void)plugin_add_descriptive_attributes( e, NULL );

	} else {
		/*
		 * Process plugins that were not loaded during bootstrap.
		 */
		retval = plugin_setup(e, 0, 0, 1);
		
		/* 
		 * well this damn well sucks, but this function is used as a callback
		 * and to ensure we do not continue if a plugin fails to load or init
		 * properly we must exit here.
		 */
		if(retval)
		{
			char dnbuf[ BUFSIZ ];

			slapi_log_error( SLAPI_LOG_FATAL, NULL,
					"Unable to load plugin \"%s\"\n",
					escape_string( slapi_entry_get_dn_const( e ), dnbuf ));
			exit(1);
		}
	}

	*returncode = retval;
	return (retval == LDAP_SUCCESS) ? SLAPI_DSE_CALLBACK_OK
			: SLAPI_DSE_CALLBACK_ERROR;
}

int
modify_config_dse(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e, int *returncode, char *returntext, void *arg)
{
	char *config_attr;
	LDAPMod **mods;
	int rc = LDAP_SUCCESS;
	int apply_mods = 0;
	char *pwd = 0;
	int checked_all_maxdiskspace_and_mlogsize = 0;
  
	slapi_pblock_get( pb, SLAPI_MODIFY_MODS, &mods );
    
	returntext[0] = '\0';

	/*
	 * First pass: set apply mods to 0 so only input validation will be done;
	 * 2nd pass: set apply mods to 1 to apply changes to internal storage
	 */
	for ( apply_mods = 0; apply_mods <= 1; apply_mods++ ) {
		int i = 0;
		for (i = 0; (mods[i] && (LDAP_SUCCESS == rc)); i++) {
			if ((mods[i]->mod_op & LDAP_MOD_DELETE) ||
				(mods[i]->mod_op & LDAP_MOD_ADD)) {
				rc= LDAP_UNWILLING_TO_PERFORM;
				PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE, "%s attributes is not allowed",
						(mods[i]->mod_op & LDAP_MOD_DELETE) ? "Deleting" : "Adding");
			} else if (mods[i]->mod_op & LDAP_MOD_REPLACE) {
				/* send all aci modifications to the backend */
				config_attr = (char *)mods[i]->mod_type;
				if (ignore_attr_type(config_attr))
					continue;

				if (  (checked_all_maxdiskspace_and_mlogsize == 0 ) && 
					((strcasecmp( mods[i]->mod_type, CONFIG_ERRORLOG_MAXLOGDISKSPACE_ATTRIBUTE) == 0) ||
					(strcasecmp( mods[i]->mod_type, CONFIG_ERRORLOG_MAXLOGSIZE_ATTRIBUTE) == 0) ||
					(strcasecmp( mods[i]->mod_type, CONFIG_ACCESSLOG_MAXLOGDISKSPACE_ATTRIBUTE) == 0) ||
					(strcasecmp( mods[i]->mod_type, CONFIG_ACCESSLOG_MAXLOGSIZE_ATTRIBUTE) == 0) ||
					(strcasecmp( mods[i]->mod_type, CONFIG_AUDITLOG_MAXLOGDISKSPACE_ATTRIBUTE) == 0) ||
					(strcasecmp( mods[i]->mod_type, CONFIG_AUDITLOG_MAXLOGSIZE_ATTRIBUTE) == 0)) )
				{
					checked_all_maxdiskspace_and_mlogsize = 1;
					if ( (rc=check_all_maxdiskspace_and_mlogsize(pb, mods, returntext)) != LDAP_SUCCESS )
					{
						goto finish_and_return;
					}
				}

				rc = config_set(config_attr, mods[i]->mod_bvalues, returntext,
								apply_mods);
			}
		}
	}

finish_and_return:
	/*
	 * The DSE code will be writing the resultant entry value to the
	 * dse.ldif file.  We *must*not* write plain passwords into here.
	 */
	slapi_entry_attr_delete( e, CONFIG_ROOTPW_ATTRIBUTE );
	/* if the password has been set, it will be hashed */
	if ((pwd = config_get_rootpw()) != NULL) {
		slapi_entry_attr_set_charptr(e, CONFIG_ROOTPW_ATTRIBUTE, pwd);
		slapi_ch_free_string(&pwd);
	}

	*returncode= rc;
	if(LDAP_SUCCESS == rc) {
		return(SLAPI_DSE_CALLBACK_OK);	/* success -- apply the mods. */
	}
	else {
		return(SLAPI_DSE_CALLBACK_ERROR);	/* failure -- reject the mods. */
	}
}

int
postop_modify_config_dse(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e, int *returncode, char *returntext, void *arg)
{
	static int num_requires_restart = sizeof(requires_restart)/sizeof(char*);
	LDAPMod **mods;
	int i, j;
	char *p;

	slapi_pblock_get( pb, SLAPI_MODIFY_MODS, &mods );
	returntext[0] = '\0';

	for (i = 0; mods[i]; i++) {
		if (mods[i]->mod_op & LDAP_MOD_REPLACE ) {
			/* Check if the server needs to be restarted */
			for (j = 0; j < num_requires_restart; j++)
			{
				p = strchr (requires_restart[j], ':');
				if (p == NULL)
					continue;
				while ( *(++p) == ' ' || *p == '\t' );
				if ( strcasecmp (p, mods[i]->mod_type) == 0 ) {
					PR_snprintf(returntext, SLAPI_DSE_RETURNTEXT_SIZE,
						"The change of %s will not take effect "
						"until the server is restarted", mods[i]->mod_type);
					slapi_log_error (SLAPI_LOG_FATAL, NULL, "%s\n", returntext);
					break;
				}
			}
			if (j < num_requires_restart) {
				/* That's enough, don't check remaining mods any more */
				break;
			}
		}
	}

	*returncode = LDAP_SUCCESS;
	return *returncode;
}

static int 
check_all_maxdiskspace_and_mlogsize(Slapi_PBlock *pb, LDAPMod **mods, char *returntext)
{ 
	int i = 0;
	int rc = LDAP_SUCCESS;
    int errormaxdiskspace = -1;
    int errormlogsize = -1;
    int accessmaxdiskspace = -1;
    int accessmlogsize = -1;
    int auditmaxdiskspace = -1;
    int auditmlogsize = -1;

	for (i = 0; mods[i] ; i++)
	{
        get_log_max_size(mods[i],
                        CONFIG_ERRORLOG_MAXLOGDISKSPACE_ATTRIBUTE,
                        CONFIG_ERRORLOG_MAXLOGSIZE_ATTRIBUTE,
                        &errormaxdiskspace,
                        &errormlogsize);

        get_log_max_size(mods[i],
                        CONFIG_ACCESSLOG_MAXLOGDISKSPACE_ATTRIBUTE,
                        CONFIG_ACCESSLOG_MAXLOGSIZE_ATTRIBUTE,
                        &accessmaxdiskspace,
                        &accessmlogsize);

        get_log_max_size(mods[i],
                        CONFIG_AUDITLOG_MAXLOGDISKSPACE_ATTRIBUTE,
                        CONFIG_AUDITLOG_MAXLOGSIZE_ATTRIBUTE,
                        &auditmaxdiskspace,
                        &auditmlogsize);
	}

    if ( (rc=check_log_max_size(
                    CONFIG_ERRORLOG_MAXLOGDISKSPACE_ATTRIBUTE,
                    CONFIG_ERRORLOG_MAXLOGSIZE_ATTRIBUTE,
                    errormaxdiskspace,
                    errormlogsize,
					returntext, 
                    SLAPD_ERROR_LOG)) != LDAP_SUCCESS )
    {
        return rc;
    }
    if ( (rc=check_log_max_size(
                    CONFIG_ACCESSLOG_MAXLOGDISKSPACE_ATTRIBUTE,
                    CONFIG_ACCESSLOG_MAXLOGSIZE_ATTRIBUTE,
                    accessmaxdiskspace,
                    accessmlogsize,
					returntext, 
                    SLAPD_ACCESS_LOG)) != LDAP_SUCCESS )
    {
        return rc;
    }
    if ( (rc=check_log_max_size(
                    CONFIG_AUDITLOG_MAXLOGDISKSPACE_ATTRIBUTE,
                    CONFIG_AUDITLOG_MAXLOGSIZE_ATTRIBUTE,
                    auditmaxdiskspace,
                    auditmlogsize,
					returntext, 
                    SLAPD_AUDIT_LOG)) != LDAP_SUCCESS )
    {
        return rc;
    }
	return rc;
}

static void
get_log_max_size(   LDAPMod *mod,
                    char *maxdiskspace_str,
                    char *mlogsize_str,
                    int *maxdiskspace,
                    int *mlogsize)
{
    if ( mod->mod_bvalues != NULL &&
         (strcasecmp( mod->mod_type, maxdiskspace_str ) == 0) )
    {
        *maxdiskspace = atoi((char *) mod->mod_bvalues[0]->bv_val);
    }

    if ( mod->mod_bvalues != NULL &&
         (strcasecmp( mod->mod_type, mlogsize_str ) == 0) )
    {
        *mlogsize = atoi((char *) mod->mod_bvalues[0]->bv_val);
    }
}