Red Hat Bugzilla – Bug 251262
ldap-agent needs to find slapd.stats file dynamically
Last modified: 2015-12-07 12:04:38 EST
Our SNMP subagent (ldap-agent) currently requires a full path to a DS instance
in it's config file. It is hardcoded to look in the log subdirectory for the
slapd.stats file. It also uses expects a config subdirectory to find the
dse.ldif. This will no longer work now that DS has been restructured to follow
The proposed fix changes the ldap-agent config to simply expect the instance
name (i.e - slapd-foo). The subagent will then use this instance name to load
the dse.ldif from the proper location in $SYSCONFDIR/$PACKAGE_NAME. The
subagent will look up the value of nsslapd-tmpdir to find out where the
slapd.stats file is for that particular instance. I also improved the error
checking around processing the ldap-agent config file.
Created attachment 160867 [details]
That's not going to work if the value for nsslapd-tmpdir wraps to the next line,
which probably won't happen in production systems, but might in weird install
cases or QA.
Created attachment 160880 [details]
Rich brings up a good point about dealing with wrapped lines in the dse.ldif.
This new set of diffs addresses this concern by using the ldif parsing
functions from the libldif library that is part of the Mozilla LDAP C SDK. I
also did some error checking cleanup, particularly ensuring that we close any
files that we opened if we encounter an error condition while processing the
I have also tested that these changes work when there is a wrapped line for one
of the attributes that we read in dse.ldif.
Checked into HEAD. Thanks for the review Rich!
Checking in Makefile.am;
/cvs/dirsec/ldapserver/Makefile.am,v <-- Makefile.am
new revision: 1.54; previous revision: 1.53
Checking in Makefile.in;
/cvs/dirsec/ldapserver/Makefile.in,v <-- Makefile.in
new revision: 1.63; previous revision: 1.62
Checking in ltmain.sh;
/cvs/dirsec/ldapserver/ltmain.sh,v <-- ltmain.sh
new revision: 1.17; previous revision: 1.16
Checking in ldap/servers/snmp/main.c;
/cvs/dirsec/ldapserver/ldap/servers/snmp/main.c,v <-- main.c
new revision: 1.11; previous revision: 1.10