View | Details | Raw Unified | Return to bug 51910
Collapse All | Expand All

(-)openldap-2.4.31.orig/configure (-1 / +66 lines)
 Lines 780-785    Link Here 
780
SLAPD_NDB_LIBS
780
SLAPD_NDB_LIBS
781
BDB_LIBS
781
BDB_LIBS
782
SLAPD_LIBS
782
SLAPD_LIBS
783
BUILD_TRANSLOG
783
LDAP_LIBS
784
LDAP_LIBS
784
BUILD_VALSORT
785
BUILD_VALSORT
785
BUILD_UNIQUE
786
BUILD_UNIQUE
 Lines 1708-1713    Link Here 
1708
    --enable-translucent  Translucent Proxy overlay no|yes|mod [no]
1709
    --enable-translucent  Translucent Proxy overlay no|yes|mod [no]
1709
    --enable-unique       Attribute Uniqueness overlay no|yes|mod [no]
1710
    --enable-unique       Attribute Uniqueness overlay no|yes|mod [no]
1710
    --enable-valsort      Value Sorting overlay no|yes|mod [no]
1711
    --enable-valsort      Value Sorting overlay no|yes|mod [no]
1712
    --enable-translog	  Transactions Log overlay no|yes|mod [no]
1711
1713
1712
Library Generation & Linking Options
1714
Library Generation & Linking Options
1713
  --enable-static[=PKGS]  build static libraries [default=yes]
1715
  --enable-static[=PKGS]  build static libraries [default=yes]
 Lines 3640-3645    Link Here 
3640
fi
3642
fi
3641
# end --with-cyrus_sasl
3643
# end --with-cyrus_sasl
3642
3644
3645
# OpenLDAP --enable-translog
3646
	# Check whether --enable-translog or --disable-translog was given.
3647
if test "${enable_translog+set}" = set; then
3648
  enableval="$enable_translog"
3649
3650
	ol_arg=invalid
3651
	for ol_val in no yes mod ; do
3652
		if test "$enableval" = "$ol_val" ; then
3653
			ol_arg="$ol_val"
3654
		fi
3655
	done
3656
	if test "$ol_arg" = "invalid" ; then
3657
		{ { echo "$as_me:$LINENO: error: bad value $enableval for --enable-translog" >&5
3658
echo "$as_me: error: bad value $enableval for --enable-translog" >&2;}
3659
   { (exit 1); exit 1; }; }
3660
	fi
3661
	ol_enable_translog="$ol_arg"
3662
3663
else
3664
  	ol_enable_translog="no"
3665
fi; # end --enable-translog
3666
3643
# OpenLDAP --with-fetch
3667
# OpenLDAP --with-fetch
3644
3668
3645
# Check whether --with-fetch was given.
3669
# Check whether --with-fetch was given.
 Lines 4423-4429    Link Here 
4423
	syncprov \
4447
	syncprov \
4424
	translucent \
4448
	translucent \
4425
	unique \
4449
	unique \
4426
	valsort"
4450
	valsort \
4451
	translog"
4427
4452
4428
# Check whether --enable-xxslapoverlays was given.
4453
# Check whether --enable-xxslapoverlays was given.
4429
if test "${enable_xxslapoverlays+set}" = set; then :
4454
if test "${enable_xxslapoverlays+set}" = set; then :
 Lines 4890-4895    Link Here 
4890
4915
4891
# end --enable-valsort
4916
# end --enable-valsort
4892
4917
4918
# OpenLDAP --enable-translog
4919
4920
	# Check whether --enable-translog or --disable-translog was given.
4921
if test "${enable_translog+set}" = set; then
4922
  enableval="$enable_translog"
4923
4924
	ol_arg=invalid
4925
	for ol_val in no yes mod ; do
4926
		if test "$enableval" = "$ol_val" ; then
4927
			ol_arg="$ol_val"
4928
		fi
4929
	done
4930
	if test "$ol_arg" = "invalid" ; then
4931
		{ { echo "$as_me:$LINENO: error: bad value $enableval for --enable-translog" >&5
4932
echo "$as_me: error: bad value $enableval for --enable-translog" >&2;}
4933
   { (exit 1); exit 1; }; }
4934
	fi
4935
	ol_enable_translog="$ol_arg"
4936
4937
else
4938
  	ol_enable_translog=${ol_enable_overlays:-no}
4939
fi;
4940
# end --enable-translog
4893
4941
4894
# Check whether --enable-xxliboptions was given.
4942
# Check whether --enable-xxliboptions was given.
4895
if test "${enable_xxliboptions+set}" = set; then :
4943
if test "${enable_xxliboptions+set}" = set; then :
 Lines 5113-5118    Link Here 
5113
BUILD_TRANSLUCENT=no
5161
BUILD_TRANSLUCENT=no
5114
BUILD_UNIQUE=no
5162
BUILD_UNIQUE=no
5115
BUILD_VALSORT=no
5163
BUILD_VALSORT=no
5164
BUILD_TRANSLOG=no
5116
5165
5117
SLAPD_STATIC_OVERLAYS=
5166
SLAPD_STATIC_OVERLAYS=
5118
SLAPD_DYNAMIC_OVERLAYS=
5167
SLAPD_DYNAMIC_OVERLAYS=
 Lines 24710-24715    Link Here 
24710
24759
24711
fi
24760
fi
24712
24761
24762
if test "$ol_enable_translog" != no ; then
24763
	BUILD_TRANSLOG=$ol_enable_translog
24764
	if test "$ol_enable_translog" = mod ; then
24765
		MFLAG=SLAPD_MOD_DYNAMIC
24766
		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS translog.la"
24767
	else
24768
		MFLAG=SLAPD_MOD_STATIC
24769
		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS translog.o"
24770
	fi
24771
24772
cat >>confdefs.h <<_ACEOF
24773
#define SLAPD_OVER_TRANSLOG $MFLAG
24774
_ACEOF
24775
24776
fi
24777
24713
if test "$ol_enable_valsort" != no ; then
24778
if test "$ol_enable_valsort" != no ; then
24714
	BUILD_VALSORT=$ol_enable_valsort
24779
	BUILD_VALSORT=$ol_enable_valsort
24715
	if test "$ol_enable_valsort" = mod ; then
24780
	if test "$ol_enable_valsort" = mod ; then
(-)openldap-2.4.31.orig/configure.in (-1 / +18 lines)
 Lines 355-361    Link Here 
355
	syncprov \
355
	syncprov \
356
	translucent \
356
	translucent \
357
	unique \
357
	unique \
358
	valsort"
358
	valsort \
359
	translog"
359
360
360
AC_ARG_ENABLE(xxslapoverlays,[
361
AC_ARG_ENABLE(xxslapoverlays,[
361
SLAPD Overlay Options:])
362
SLAPD Overlay Options:])
 Lines 402-407    Link Here 
402
	no, [no yes mod], ol_enable_overlays)
403
	no, [no yes mod], ol_enable_overlays)
403
OL_ARG_ENABLE(valsort,[    --enable-valsort      Value Sorting overlay],
404
OL_ARG_ENABLE(valsort,[    --enable-valsort      Value Sorting overlay],
404
	no, [no yes mod], ol_enable_overlays)
405
	no, [no yes mod], ol_enable_overlays)
406
OL_ARG_ENABLE(translog,[    --enable-translog      Transactions Log overlay],
407
	no, [no yes mod], ol_enable_overlays)
405
408
406
dnl ----------------------------------------------------------------
409
dnl ----------------------------------------------------------------
407
AC_ARG_ENABLE(xxliboptions,[
410
AC_ARG_ENABLE(xxliboptions,[
 Lines 570-575    Link Here 
570
BUILD_TRANSLUCENT=no
573
BUILD_TRANSLUCENT=no
571
BUILD_UNIQUE=no
574
BUILD_UNIQUE=no
572
BUILD_VALSORT=no
575
BUILD_VALSORT=no
576
BUILD_TRANSLOG=no
573
577
574
SLAPD_STATIC_OVERLAYS=
578
SLAPD_STATIC_OVERLAYS=
575
SLAPD_DYNAMIC_OVERLAYS=
579
SLAPD_DYNAMIC_OVERLAYS=
 Lines 3043-3048    Link Here 
3043
	AC_DEFINE_UNQUOTED(SLAPD_OVER_VALSORT,$MFLAG,[define for Value Sorting overlay])
3047
	AC_DEFINE_UNQUOTED(SLAPD_OVER_VALSORT,$MFLAG,[define for Value Sorting overlay])
3044
fi
3048
fi
3045
3049
3050
if test "$ol_enable_translog" != no ; then
3051
	BUILD_TRANSLOG=$ol_enable_translog
3052
	if test "$ol_enable_translog" = mod ; then
3053
		MFLAG=SLAPD_MOD_DYNAMIC
3054
		SLAPD_DYNAMIC_OVERLAYS="$SLAPD_DYNAMIC_OVERLAYS translog.la"
3055
	else
3056
		MFLAG=SLAPD_MOD_STATIC
3057
		SLAPD_STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS translog.o"
3058
	fi
3059
	AC_DEFINE_UNQUOTED(SLAPD_OVER_TRANSLOG,$MFLAG,[define for Transactions Log overlay])
3060
fi
3061
3046
if test "$ol_enable_rewrite" != no ; then
3062
if test "$ol_enable_rewrite" != no ; then
3047
	AC_DEFINE(ENABLE_REWRITE,1,[define to enable rewriting in back-ldap and back-meta])
3063
	AC_DEFINE(ENABLE_REWRITE,1,[define to enable rewriting in back-ldap and back-meta])
3048
	BUILD_REWRITE=yes
3064
	BUILD_REWRITE=yes
 Lines 3120-3125    Link Here 
3120
  AC_SUBST(BUILD_TRANSLUCENT)
3136
  AC_SUBST(BUILD_TRANSLUCENT)
3121
  AC_SUBST(BUILD_UNIQUE)
3137
  AC_SUBST(BUILD_UNIQUE)
3122
  AC_SUBST(BUILD_VALSORT)
3138
  AC_SUBST(BUILD_VALSORT)
3139
  AC_SUBST(BUILD_TRANSLOG)
3123
3140
3124
AC_SUBST(LDAP_LIBS)
3141
AC_SUBST(LDAP_LIBS)
3125
AC_SUBST(SLAPD_LIBS)
3142
AC_SUBST(SLAPD_LIBS)
(-)openldap-2.4.31.orig/include/portable.hin (+3 lines)
 Lines 1026-1031    Link Here 
1026
/* define for Value Sorting overlay */
1026
/* define for Value Sorting overlay */
1027
#undef SLAPD_OVER_VALSORT
1027
#undef SLAPD_OVER_VALSORT
1028
1028
1029
/* define for Translog overlay */
1030
#undef SLAPD_OVER_TRANSLOG
1031
1029
/* define to support PASSWD backend */
1032
/* define to support PASSWD backend */
1030
#undef SLAPD_PASSWD
1033
#undef SLAPD_PASSWD
1031
1034
(-)openldap-2.4.31.orig/servers/slapd/overlays/Makefile.in (-1 / +5 lines)
 Lines 33-39    Link Here 
33
	syncprov.c \
33
	syncprov.c \
34
	translucent.c \
34
	translucent.c \
35
	unique.c \
35
	unique.c \
36
	valsort.c
36
	valsort.c \
37
	translog.c
37
OBJS = statover.o \
38
OBJS = statover.o \
38
	@SLAPD_STATIC_OVERLAYS@ \
39
	@SLAPD_STATIC_OVERLAYS@ \
39
	overlays.o
40
	overlays.o
 Lines 125-130    Link Here 
125
valsort.la : valsort.lo
126
valsort.la : valsort.lo
126
	$(LTLINK_MOD) -module -o $@ valsort.lo version.lo $(LINK_LIBS)
127
	$(LTLINK_MOD) -module -o $@ valsort.lo version.lo $(LINK_LIBS)
127
128
129
translog.la : translog.lo
130
	$(LTLINK_MOD) -module -o $@ translog.lo version.lo $(LINK_LIBS)
131
128
install-local:	$(PROGRAMS)
132
install-local:	$(PROGRAMS)
129
	@if test -n "$?" ; then \
133
	@if test -n "$?" ; then \
130
		$(MKDIR) $(DESTDIR)$(moduledir); \
134
		$(MKDIR) $(DESTDIR)$(moduledir); \
(-)openldap-2.4.31.orig/servers/slapd/overlays/translog.c (+322 lines)
Line 0    Link Here 
1
/* translog.c - log modifications for replication purposes */
2
3
#include "portable.h"
4
5
#ifdef SLAPD_OVER_TRANSLOG
6
7
#include <stdio.h>
8
#include <unistd.h>
9
#include <ac/string.h>
10
#include <ac/ctype.h>
11
#include "slap.h"
12
13
//#define O_DEBUG		/* enable debug messages */
14
15
typedef struct translog_data {
16
	ldap_pvt_thread_mutex_t ad_mutex;
17
	char *ad_logfile;
18
} translog_data;
19
20
static const char LAST_ID[] = "/var/lib/univention-ldap/last_id";
21
static const char LAST_ID_TMP[] = "/var/lib/univention-ldap/last_id.new";
22
static const char TRANSACTION[] = "/var/lib/univention-ldap/notify/transaction";
23
24
static FILE* fopen_lock(const char *name, const char *type, FILE **l_file)
25
{
26
	char buf[PATH_MAX];
27
	FILE *file;
28
	int fd;
29
30
	if (snprintf(buf, sizeof(buf), "%s.lock", name) >= sizeof(buf))
31
		return NULL;
32
33
	if ((*l_file = fopen(buf, type)) == NULL)
34
		return NULL;
35
36
	fd = fileno(*l_file);
37
	lockf(fd, F_LOCK, 0);
38
39
	if ((file = fopen(name, type)) == NULL) {
40
		fclose(*l_file);
41
		*l_file  = NULL;
42
	}
43
44
	return file;
45
}
46
47
static int fclose_lock(FILE **file, FILE **l_file)
48
{
49
	int ret = 0;
50
51
	if (*file != NULL) {
52
		ret = fclose(*file);
53
		*file = NULL;
54
	}
55
56
	if (*l_file != NULL) {
57
		fclose(*l_file);
58
		*l_file = NULL;
59
	}
60
61
	return ret;
62
}
63
64
static long from_lastid()
65
{
66
	/* if the file /var/lib/univention-ldap/last_id exists, we read the last id
67
	 * from this file
68
	 */
69
	FILE *f;
70
	long id = -1;
71
72
	if ((f = fopen(LAST_ID, "r")) != NULL) {
73
		int n = fscanf(f, "%ld", &id);
74
		fclose(f);
75
76
		if (n != 1)
77
			Debug(LDAP_DEBUG_ANY, "OVER: Failed to parse %s\n", LAST_ID, 0, 0);
78
	}
79
80
	return id;
81
}
82
83
static long from_translog(const char *filename)
84
{
85
	FILE *f;
86
	long off = 2;
87
	int c;
88
	long id = -1;
89
90
	if ((f = fopen(filename, "r")) == NULL) {
91
		Debug( LDAP_DEBUG_ANY, "OVER: unable to open file %s\n", filename, 0, 0);
92
		return -1;
93
	}
94
95
	do {
96
		off++;
97
		if (!fseek(f, -off, SEEK_END))
98
			Debug(LDAP_DEBUG_ANY, "OVER: seek failed on %s\n", filename, 0, 0);
99
		c = fgetc(f);
100
	} while (c != '\n' && c != EOF && ftell(f) != 1);
101
102
	if (c == EOF) {
103
		/* emty file */
104
		id = 0;
105
	} else {
106
		if (ftell(f) == 1) {
107
			/* only one entry */
108
			if (fseek(f, 0, SEEK_SET))
109
				Debug(LDAP_DEBUG_ANY, "OVER: seek failed on %s\n", filename, 0, 0);
110
		}
111
		int n = fscanf(f, "%ld", &id);
112
		if (n != 1)
113
			Debug(LDAP_DEBUG_ANY, "OVER: Failed to parse %s at %ld\n", filename, off, 0);
114
	}
115
116
	fclose(f);
117
	return id;
118
}
119
120
static long get_last_id(Operation *op)
121
{
122
	/* Get the last used Transaction ID from Transaction-Log file
123
	 * Returns:
124
	 * 	-1 und errors
125
	 * 	0 if Transaction-Log file is empty
126
	 * 	last Transaction ID if Transaction-Log file is nonempty
127
	 */
128
	long id;
129
130
	Debug( LDAP_DEBUG_TRACE, "OVER: get_last_id\n", 0, 0, 0);
131
132
	id = from_lastid();
133
	if (id >= 1)
134
		return id;
135
136
	/* File must be locked to prevent UDN from renaming it underneth */
137
	slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
138
	translog_data *ad = on->on_bi.bi_private;
139
	id = from_translog(ad->ad_logfile);
140
	if (id >= 1)
141
		return id;
142
143
	id = from_translog(TRANSACTION);
144
	return id;
145
}
146
147
static int translog_response(Operation *op, SlapReply *rs) {
148
	/* Handel all requests and responses from and to database backend
149
	 * Returns:
150
	 * 	SLAP_CB_CONTINUE in all cases
151
	 */
152
	slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
153
	translog_data *ad = on->on_bi.bi_private;
154
	FILE *file, *l_file;
155
	char what;
156
	long lastid = -1;
157
	int failure = 0;
158
159
	if ( rs->sr_err != LDAP_SUCCESS ) {
160
		Debug( LDAP_DEBUG_TRACE, "OVER: rs->sr_err != LDAP_SUCCESS on \"%s\" ERR: 0x%02x\n", op->o_req_dn.bv_val, rs->sr_err, 0 );
161
		return SLAP_CB_CONTINUE;
162
	}
163
164
	if ( !op->o_bd || !ad->ad_logfile ) {
165
		Debug( LDAP_DEBUG_TRACE, "OVER: BackendDB or logfile not specified\n", 0, 0, 0 );
166
		return SLAP_CB_CONTINUE;
167
	}
168
169
	switch(op->o_tag) {
170
		case LDAP_REQ_MODRDN:	what = 'r';	break; /* 0x6cU == LDAP_REQ_MODDN == LDAP_REQ_RENAME */
171
		case LDAP_REQ_DELETE:	what = 'd';	break; /* 0x4aU */
172
		case LDAP_REQ_ADD:		what = 'a';	break; /* 0x68U */
173
		case LDAP_REQ_MODIFY:	what = 'm';	break; /* 0x66U */
174
		case LDAP_REQ_SEARCH:	return SLAP_CB_CONTINUE; /* 0x63U get rid of search debug messages */
175
		default:
176
			Debug( LDAP_DEBUG_TRACE, "OVER: SWITCH(o_tag) default, case was: \"%lu\"\n", (unsigned long) op->o_tag, 0, 0 );
177
			return SLAP_CB_CONTINUE;
178
	}
179
180
	ldap_pvt_thread_mutex_lock(&ad->ad_mutex);
181
182
	if ((file = fopen_lock(ad->ad_logfile, "a", &l_file)) == NULL) {
183
		Debug( LDAP_DEBUG_ANY, "OVER: Could not open translog file %s\n", ad->ad_logfile, 0, 0 );
184
185
		ldap_pvt_thread_mutex_unlock(&ad->ad_mutex);
186
		return SLAP_CB_CONTINUE;
187
	}
188
189
	lastid = get_last_id(op);
190
	if ( lastid > -1 ) {
191
		Debug( LDAP_DEBUG_TRACE, "OVER: Found ID \"%ld\"\n", lastid, 0, 0 );
192
		failure |= fprintf(file, "%ld %s %c\n", ++lastid, op->o_req_dn.bv_val, what) <= 0;
193
		if ( what == 'r' && op->orr_newSup ) {
194
			/* print newsuperior as add in translog file */
195
			failure |= fprintf(file, "%ld %s,%s a\n", ++lastid, op->orr_newrdn.bv_val, op->orr_newSup->bv_val) <= 0;
196
		} else if ( what == 'r' ) {
197
			struct berval   pdn;
198
			dnParent( &op->o_req_dn, &pdn );
199
			failure |= fprintf(file, "%ld %s,%s a\n", ++lastid, op->orr_newrdn.bv_val, pdn.bv_val) <= 0;
200
		}
201
	} else {
202
		Debug( LDAP_DEBUG_ANY, "OVER: Could not find last ID, lastid seems to be: \"%ld\"\n", lastid, 0, 0 );
203
		failure |= fprintf(file, "<TransID> %s %c\n", op->o_req_dn.bv_val, what) <= 0;
204
		if ( what == 'r' && op->orr_newSup ) {
205
			/* print newsuperior as add in translog file */
206
			failure |= fprintf(file, "<TransID> %s,%s a\n", op->orr_newrdn.bv_val, op->orr_newSup->bv_val) <= 0;
207
		} else if ( what == 'r' ) {
208
			struct berval   pdn;
209
			dnParent( &op->o_req_dn, &pdn );
210
			failure |= fprintf(file, "<TransID> %s,%s a\n", op->orr_newrdn.bv_val, pdn.bv_val) <= 0;
211
		}
212
	}
213
214
	failure |= fclose_lock(&file, &l_file) != 0;
215
	if (failure)
216
		Debug(LDAP_DEBUG_ANY, "OVER: Could not append file %s\n", ad->ad_logfile, 0, 0);
217
218
	if ((file = fopen(LAST_ID_TMP, "w")) == NULL ||
219
		fprintf(file, "%ld", lastid) <= 0 ||
220
		!fclose(file)) {
221
		Debug(LDAP_DEBUG_ANY, "OVER: Could not write file %s\n", LAST_ID_TMP, 0, 0);
222
	} else {
223
		if (rename(LAST_ID_TMP, LAST_ID))
224
			Debug(LDAP_DEBUG_ANY, "OVER: Could not rename file %s\n", LAST_ID_TMP, 0, 0);
225
	}
226
227
#ifdef O_DEBUG
228
	/* Test if the entry is in backend allready */
229
	int rc;
230
	Entry *e;
231
	/* set "real" backend as next backend */
232
	op->o_bd->bd_info = on->on_info->oi_orig;
233
	rc = be_entry_get_rw( op, &op->o_req_ndn, NULL, NULL, 0, &e );
234
	Debug( LDAP_DEBUG_TRACE, "OVER: Fetched Object, returncode was \"%d\"\n", rc, 0, 0);
235
	if ( e ) {
236
		Debug( LDAP_DEBUG_TRACE, "OVER: Fetched Object \"%s\"\n", e->e_ndn, 0, 0);
237
	}
238
	op->o_bd->bd_info = (BackendInfo *)on;
239
#endif
240
241
	ldap_pvt_thread_mutex_unlock(&ad->ad_mutex);
242
	return SLAP_CB_CONTINUE;
243
}
244
245
static slap_overinst translog;
246
247
static int translog_db_init( BackendDB *be ) {
248
	Debug( LDAP_DEBUG_TRACE, "OVER: db_init\n", 0, 0, 0 );
249
250
	slap_overinst *on = (slap_overinst *)be->bd_info;
251
	translog_data *ad = ch_calloc(1, sizeof(translog_data));
252
253
	on->on_bi.bi_private = ad;
254
	ldap_pvt_thread_mutex_init( &ad->ad_mutex );
255
	return 0;
256
}
257
258
static int translog_db_close( BackendDB *be ) {
259
	Debug( LDAP_DEBUG_TRACE, "OVER: db_close\n", 0, 0, 0 );
260
261
	slap_overinst *on = (slap_overinst *)be->bd_info;
262
	translog_data *ad = on->on_bi.bi_private;
263
264
	free( ad->ad_logfile );
265
	ad->ad_logfile = NULL;
266
	return 0;
267
}
268
269
static int translog_db_destroy( BackendDB *be ) {
270
	Debug( LDAP_DEBUG_TRACE, "OVER: db_destroy\n", 0, 0, 0 );
271
272
	slap_overinst *on = (slap_overinst *)be->bd_info;
273
	translog_data *ad = on->on_bi.bi_private;
274
275
	ldap_pvt_thread_mutex_destroy( &ad->ad_mutex );
276
	free( ad );
277
	return 0;
278
}
279
280
static int translog_config( BackendDB *be, const char *fname, int lineno, int argc, char **argv ) {
281
	slap_overinst *on = (slap_overinst *) be->bd_info;
282
	translog_data *ad = on->on_bi.bi_private;
283
284
	Debug( LDAP_DEBUG_CONFIG|LDAP_DEBUG_TRACE, "OVER: Configuring Translog Overlay\n", 0, 0, 0 );
285
286
	/* log file */
287
	if ( strcasecmp( argv[0], "translog" ) == 0 ) {
288
		if ( argc < 2 ) {
289
			Debug( LDAP_DEBUG_ANY, "%s: line %d: missing filename in \"translog <filename>\" line\n", fname, lineno, 0 );
290
			return(1);
291
		}
292
		Debug(LDAP_DEBUG_CONFIG, "OVER: Configured Translog Overlay to use file \"%s\"\n", argv[1], 0, 0);
293
294
		/* save filename in translog_data */
295
		ad->ad_logfile = ch_strdup( argv[1] );
296
		return 0;
297
	}
298
	return SLAP_CONF_UNKNOWN;
299
}
300
301
int translog_init() {
302
	Debug( LDAP_DEBUG_TRACE, "OVER: Loading Translog Overlay\n", 0, 0, 0 );
303
304
	translog.on_bi.bi_type = "translog";
305
	translog.on_bi.bi_db_init = translog_db_init;
306
	translog.on_bi.bi_db_config = translog_config;
307
	translog.on_bi.bi_db_close = translog_db_close;
308
	translog.on_bi.bi_db_destroy = translog_db_destroy;
309
	translog.on_response = translog_response;
310
311
	return overlay_register(&translog);
312
}
313
314
#if SLAPD_OVER_TRANSLOG == SLAPD_MOD_DYNAMIC
315
int
316
init_module( int argc, char *argv[] )
317
{
318
	return translog_init();
319
}
320
#endif
321
322
#endif /* SLAPD_OVER_TRANSLOG */

Return to bug 51910