]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/overlays/auditlog.c
Ignore attempts to Add cn=schema,cn=config
[openldap] / servers / slapd / overlays / auditlog.c
index 56f349bee29b123a0654140b2ac4c7d6cfcc4a41..77d05b37211594b38919bafe10a70a386ab919fa 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2005-2006 The OpenLDAP Foundation.
+ * Copyright 2005-2009 The OpenLDAP Foundation.
  * Portions copyright 2004-2005 Symas Corporation.
  * All rights reserved.
  *
@@ -73,8 +73,8 @@ static int auditlog_response(Operation *op, SlapReply *rs) {
        Attribute *a;
        Modifications *m;
        struct berval *b, *who = NULL;
-       char *what, *suffix;
-       long stamp = slap_get_time();
+       char *what, *whatm, *suffix;
+       time_t stamp;
        int i;
 
        if ( rs->sr_err != LDAP_SUCCESS ) return SLAP_CB_CONTINUE;
@@ -125,8 +125,9 @@ static int auditlog_response(Operation *op, SlapReply *rs) {
                return SLAP_CB_CONTINUE;
        }
 
+       stamp = slap_get_time();
        fprintf(f, "# %s %ld %s%s%s\n",
-               what, stamp, suffix, who ? " " : "", who ? who->bv_val : "");
+               what, (long)stamp, suffix, who ? " " : "", who ? who->bv_val : "");
 
        if ( !BER_BVISEMPTY( &op->o_conn->c_dn ) &&
                (!who || !dn_match( who, &op->o_conn->c_dn )))
@@ -146,15 +147,15 @@ static int auditlog_response(Operation *op, SlapReply *rs) {
          case LDAP_REQ_MODIFY:
                for(m = op->orm_modlist; m; m = m->sml_next) {
                        switch(m->sml_op & LDAP_MOD_OP) {
-                               case LDAP_MOD_ADD:       what = "add";          break;
-                               case LDAP_MOD_REPLACE:   what = "replace";      break;
-                               case LDAP_MOD_DELETE:    what = "delete";       break;
-                               case LDAP_MOD_INCREMENT: what = "increment";    break;
+                               case LDAP_MOD_ADD:       whatm = "add";         break;
+                               case LDAP_MOD_REPLACE:   whatm = "replace";     break;
+                               case LDAP_MOD_DELETE:    whatm = "delete";      break;
+                               case LDAP_MOD_INCREMENT: whatm = "increment";   break;
                                default:
                                        fprintf(f, "# MOD_TYPE_UNKNOWN:%02x\n", m->sml_op & LDAP_MOD_OP);
                                        continue;
                        }
-                       fprintf(f, "%s: %s\n", what, m->sml_desc->ad_cname.bv_val);
+                       fprintf(f, "%s: %s\n", whatm, m->sml_desc->ad_cname.bv_val);
                        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);
@@ -173,7 +174,7 @@ static int auditlog_response(Operation *op, SlapReply *rs) {
                break;
        }
 
-       fprintf(f, "# end %s %ld\n\n", what, stamp);
+       fprintf(f, "# end %s %ld\n\n", what, (long)stamp);
 
        fclose(f);
        ldap_pvt_thread_mutex_unlock(&ad->ad_mutex);
@@ -184,7 +185,8 @@ static slap_overinst auditlog;
 
 static int
 auditlog_db_init(
-       BackendDB *be
+       BackendDB *be,
+       ConfigReply *cr
 )
 {
        slap_overinst *on = (slap_overinst *)be->bd_info;
@@ -197,7 +199,8 @@ auditlog_db_init(
 
 static int
 auditlog_db_close(
-       BackendDB *be
+       BackendDB *be,
+       ConfigReply *cr
 )
 {
        slap_overinst *on = (slap_overinst *)be->bd_info;
@@ -210,7 +213,8 @@ auditlog_db_close(
 
 static int
 auditlog_db_destroy(
-       BackendDB *be
+       BackendDB *be,
+       ConfigReply *cr
 )
 {
        slap_overinst *on = (slap_overinst *)be->bd_info;
@@ -221,32 +225,6 @@ auditlog_db_destroy(
        return 0;
 }
 
-static int
-auditlog_config(
-       BackendDB       *be,
-       const char      *fname,
-       int             lineno,
-       int             argc,
-       char    **argv
-)
-{
-       slap_overinst *on = (slap_overinst *) be->bd_info;
-       auditlog_data *ad = on->on_bi.bi_private;
-
-       /* history log file */
-       if ( strcasecmp( argv[0], "auditlog" ) == 0 ) {
-               if ( argc < 2 ) {
-                       Debug( LDAP_DEBUG_ANY,
-           "%s: line %d: missing filename in \"auditlog <filename>\" line\n",
-                           fname, lineno, 0 );
-                               return( 1 );
-               }
-               ad->ad_logfile = ch_strdup( argv[1] );
-               return 0;
-       }
-       return SLAP_CONF_UNKNOWN;
-}
-
 int auditlog_initialize() {
        int rc;