]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/overlays/auditlog.c
Merge remote-tracking branch 'origin/mdb.master'
[openldap] / servers / slapd / overlays / auditlog.c
index 7782ad394964ddacef0000572597065f22a98909..974b7a4ad3959a18ae78ab19223ae43cd6c6c006 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2005-2010 The OpenLDAP Foundation.
+ * Copyright 2005-2012 The OpenLDAP Foundation.
  * Portions copyright 2004-2005 Symas Corporation.
  * All rights reserved.
  *
@@ -72,7 +72,7 @@ static int auditlog_response(Operation *op, SlapReply *rs) {
        FILE *f;
        Attribute *a;
        Modifications *m;
-       struct berval *b, *who = NULL;
+       struct berval *b, *who = NULL, peername;
        char *what, *whatm, *suffix;
        time_t stamp;
        int i;
@@ -119,6 +119,7 @@ static int auditlog_response(Operation *op, SlapReply *rs) {
        if ( !who )
                who = &op->o_dn;
 
+       peername = op->o_conn->c_peer_name;
        ldap_pvt_thread_mutex_lock(&ad->ad_mutex);
        if((f = fopen(ad->ad_logfile, "a")) == NULL) {
                ldap_pvt_thread_mutex_unlock(&ad->ad_mutex);
@@ -126,8 +127,9 @@ static int auditlog_response(Operation *op, SlapReply *rs) {
        }
 
        stamp = slap_get_time();
-       fprintf(f, "# %s %ld %s%s%s\n",
-               what, (long)stamp, suffix, who ? " " : "", who ? who->bv_val : "");
+       fprintf(f, "# %s %ld %s%s%s %s conn=%ld\n",
+               what, (long)stamp, suffix, who ? " " : "", who ? who->bv_val : "",
+               peername.bv_val ? peername.bv_val: "", op->o_conn->c_connid);
 
        if ( !BER_BVISEMPTY( &op->o_conn->c_dn ) &&
                (!who || !dn_match( who, &op->o_conn->c_dn )))