/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2005 The OpenLDAP Foundation.
+ * Copyright 2005-2006 The OpenLDAP Foundation.
* Portions copyright 2004-2005 Symas Corporation.
* All rights reserved.
*
char *ad_logfile;
} auditlog_data;
-int fprint_ldif(FILE *f, char *name, char *val, ber_len_t len) {
+static int fprint_ldif(FILE *f, char *name, char *val, ber_len_t len) {
char *s;
if((s = ldif_put(LDIF_PUT_VALUE, name, val, len)) == NULL)
return(-1);
return(0);
}
-int auditlog_response(Operation *op, SlapReply *rs) {
+static int auditlog_response(Operation *op, SlapReply *rs) {
slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
auditlog_data *ad = on->on_bi.bi_private;
FILE *f;
Attribute *a;
Modifications *m;
struct berval *b;
- char *what, *subop, *suffix, *who = NULL;
+ char *what, *suffix, *who = NULL;
long stamp = slap_get_time();
int i;
if ( rs->sr_err != LDAP_SUCCESS ) return SLAP_CB_CONTINUE;
- if ( !op->o_bd || !ad->ad_logfile ) return SLAP_CB_CONTINUE;
+ if ( !ad->ad_logfile ) return SLAP_CB_CONTINUE;
/*
** add or modify: use modifiersName if present
case LDAP_REQ_MODIFY:
what = "modify";
for(m = op->orm_modlist; m; m = m->sml_next)
- if( m->sml_desc == slap_schema.si_ad_modifiersName ) {
+ if( m->sml_desc == slap_schema.si_ad_modifiersName &&
+ ( m->sml_op == LDAP_MOD_ADD ||
+ m->sml_op == LDAP_MOD_REPLACE )) {
who = m->sml_values[0].bv_val;
break;
}
switch(op->o_tag) {
case LDAP_REQ_ADD:
for(a = op->ora_e->e_attrs; a; a = a->a_next)
- if(b = a->a_vals)
+ if((b = a->a_vals) != NULL)
for(i = 0; b[i].bv_val; i++)
fprint_ldif(f, a->a_desc->ad_cname.bv_val, b[i].bv_val, b[i].bv_len);
break;
continue;
}
fprintf(f, "%s: %s\n", what, m->sml_desc->ad_cname.bv_val);
- if(b = m->sml_values) for(i = 0; b[i].bv_val; i++)
+ if((b = m->sml_values) != NULL)
+ for(i = 0; b[i].bv_val; i++)
fprint_ldif(f, m->sml_desc->ad_cname.bv_val, b[i].bv_val, b[i].bv_len);
fprintf(f, "-\n");
}
free( ad->ad_logfile );
ad->ad_logfile = NULL;
+ return 0;
}
static int
ldap_pvt_thread_mutex_destroy( &ad->ad_mutex );
free( ad );
+ return 0;
}
static int
return SLAP_CONF_UNKNOWN;
}
-int auditlog_init() {
+int auditlog_initialize() {
auditlog.on_bi.bi_type = "auditlog";
auditlog.on_bi.bi_db_init = auditlog_db_init;
}
#if SLAPD_OVER_AUDITLOG == SLAPD_MOD_DYNAMIC && defined(PIC)
-int init_module( int argc, char *argv[]) {
- return auditlog_init();
+int
+init_module( int argc, char *argv[] )
+{
+ return auditlog_initialize();
}
#endif