Diff for /servers/slapd/overlays/auditlog.c between versions 1.1 and 1.1.2.7

version 1.1, 2005/06/07 01:03:18 version 1.1.2.7, 2007/01/02 21:44:08
Line 1 Line 1
 /* auditlog.c - log modifications for audit/history purposes */  /* auditlog.c - log modifications for audit/history purposes */
 /* $OpenLDAP: pkg/ldap/servers/slapd/auditlog.c,v 0.0 2004/00/00 00:00:00 ozone Exp $ */  /* $OpenLDAP: pkg/ldap/servers/slapd/overlays/auditlog.c,v 1.1.2.6 2006/07/28 13:01:37 kurt Exp $ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.  /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *   *
  * Copyright 2005 The OpenLDAP Foundation.   * Copyright 2005-2007 The OpenLDAP Foundation.
  * Portions copyright 2004-2005 Symas Corporation.   * Portions copyright 2004-2005 Symas Corporation.
  * All rights reserved.   * All rights reserved.
  *   *
Line 36  typedef struct auditlog_data { Line 36  typedef struct auditlog_data {
         char *ad_logfile;          char *ad_logfile;
 } auditlog_data;  } 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;          char *s;
         if((s = ldif_put(LDIF_PUT_VALUE, name, val, len)) == NULL)          if((s = ldif_put(LDIF_PUT_VALUE, name, val, len)) == NULL)
                 return(-1);                  return(-1);
Line 45  int fprint_ldif(FILE *f, char *name, cha Line 45  int fprint_ldif(FILE *f, char *name, cha
         return(0);          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;          slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
         auditlog_data *ad = on->on_bi.bi_private;          auditlog_data *ad = on->on_bi.bi_private;
         FILE *f;          FILE *f;
Line 78  int auditlog_response(Operation *op, Sla Line 78  int auditlog_response(Operation *op, Sla
                 case LDAP_REQ_MODIFY:                  case LDAP_REQ_MODIFY:
                         what = "modify";                          what = "modify";
                         for(m = op->orm_modlist; m; m = m->sml_next)                          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;                                          who = m->sml_values[0].bv_val;
                                         break;                                          break;
                                 }                                  }
Line 158  auditlog_db_init( Line 160  auditlog_db_init(
 )  )
 {  {
         slap_overinst *on = (slap_overinst *)be->bd_info;          slap_overinst *on = (slap_overinst *)be->bd_info;
         auditlog_data *ad = ch_malloc(sizeof(auditlog_data));          auditlog_data *ad = ch_calloc(1, sizeof(auditlog_data));
   
         on->on_bi.bi_private = ad;          on->on_bi.bi_private = ad;
         ldap_pvt_thread_mutex_init( &ad->ad_mutex );          ldap_pvt_thread_mutex_init( &ad->ad_mutex );
Line 175  auditlog_db_close( Line 177  auditlog_db_close(
   
         free( ad->ad_logfile );          free( ad->ad_logfile );
         ad->ad_logfile = NULL;          ad->ad_logfile = NULL;
           return 0;
 }  }
   
 static int  static int
Line 187  auditlog_db_destroy( Line 190  auditlog_db_destroy(
   
         ldap_pvt_thread_mutex_destroy( &ad->ad_mutex );          ldap_pvt_thread_mutex_destroy( &ad->ad_mutex );
         free( ad );          free( ad );
           return 0;
 }  }
   
 static int  static int
Line 215  auditlog_config( Line 219  auditlog_config(
         return SLAP_CONF_UNKNOWN;          return SLAP_CONF_UNKNOWN;
 }  }
   
 int auditlog_init() {  int auditlog_initialize() {
   
         auditlog.on_bi.bi_type = "auditlog";          auditlog.on_bi.bi_type = "auditlog";
         auditlog.on_bi.bi_db_init = auditlog_db_init;          auditlog.on_bi.bi_db_init = auditlog_db_init;
Line 228  int auditlog_init() { Line 232  int auditlog_init() {
 }  }
   
 #if SLAPD_OVER_AUDITLOG == SLAPD_MOD_DYNAMIC && defined(PIC)  #if SLAPD_OVER_AUDITLOG == SLAPD_MOD_DYNAMIC && defined(PIC)
 int init_module( int argc, char *argv[]) {  int
         return auditlog_init();  init_module( int argc, char *argv[] )
   {
           return auditlog_initialize();
 }  }
 #endif  #endif
   

Removed from v.1.1  
changed lines
  Added in v.1.1.2.7


______________
© Copyright 1998-2020, OpenLDAP Foundation, info@OpenLDAP.org