[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
log_rdns.patch
- To: openldap-technical@openldap.org
- Subject: log_rdns.patch
- From: "A. Schulze" <sca@andreasschulze.de>
- Date: Wed, 09 Mar 2016 08:46:06 +0100
- Dkim-filter: OpenDKIM Filter v2.11.0 mail.somaf.de 3qKlp71YK9zDbs
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=andreasschulze.de; s=ybz; t=1457509567; bh=YEC3YUbtF/o37l6Ywm/XEXwBfudKYyUe1sREaocQ2OA=; h=Date:From:To:Subject; b=UDY5uzn52SRzcJEbUCtTMZVY28Z1On5lyM5Wy+Bths/5aa+OOA057TagTNeLds6R9 akDdLrb4stTd7pM71Hu4rz8ragpruUmNe3H/4rdiFEXr4whXLjvyoCJwUYQ70VBljQ AU10z3a896FVJEUPvzeC+EKyWt5U2EoPaY06D5ng7kZEcQZcug16EXU2CW47bU21zm 8Mrv8xJ2GFLvBQ61UqmSLvgMiSjo/oRUOOb6kk9Y6Mwy5DzvJXuHuTJeNZk8hSDy/Q 3evarspkZLiqEOe40gPjHq+zaNQVwibNuwszwbwS4S2omw8KCO2i4ECuCde2oaarBF ELhLlYnjayvNg==
- User-agent: Horde Application Framework 5
Hi again,
this is my third and last patch I send today :-)
I compiled openldap with '--enable-rlookups' and set 'reverse-lookup
on' in slapd.conf
I like to see the remote hostname logged. That didn't work somehow.
( I wrote this patch months ago and could not describe the real
problem anymore)
Anyway: the patch modify log output:
reverse-lookup off:
conn=4846 fd=42 ACCEPT from IP=127.0.0.1:46058 (IP=127.0.0.1:389)
reverse-lookup on:
conn=4191 fd=18 ACCEPT from localhost (IP=127.0.0.1:389)
I never tested with ldapi:// connections.
Also I expect the patch is not optimal for performance. But it works
here in a small environment.
Andreas
Description: log FQDN instead of IP if "reverse-lookup on" in slapd.conf
Author: A. Schulze
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: openldap-2.4.44/servers/slapd/connection.c
===================================================================
--- openldap-2.4.44.orig/servers/slapd/connection.c
+++ openldap-2.4.44/servers/slapd/connection.c
@@ -574,10 +574,14 @@ Connection * connection_init(
backend_connection_init(c);
ldap_pvt_thread_mutex_unlock( &c->c_mutex );
- if ( !(flags & CONN_IS_UDP ))
+ if ( !(flags & CONN_IS_UDP )) {
+ const char* dns_or_peername;
+
+ dns_or_peername = strcmp(dnsname, SLAP_STRING_UNKNOWN) ? dnsname : peername;
Statslog( LDAP_DEBUG_STATS,
"conn=%ld fd=%ld ACCEPT from %s (%s)\n",
- id, (long) s, peername, listener->sl_name.bv_val, 0 );
+ id, (long) s, dns_or_peername, listener->sl_name.bv_val, 0 );
+ }
return c;
}