Rob Pierce <[email protected]> wrote:
> Running the current ldapd regression tests result in the following (repeated)
> errors in my /var/log/messages:
>
> ... ldapd: vfprintf %s NULL in "current bind dn = %s "
>
> This is because regress/usr.sbin/ldapd/run-tests.pl is performing
> unnecessary unbinds in END { }.
>
> Though the regression test should probably be fixed, the following diff
> ensures that log_debug is not called with a NULL argument.
>
> Does this make sense?
>
> Index: ldape.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ldapd/ldape.c,v
> retrieving revision 1.27
> diff -u -p -r1.27 ldape.c
> --- ldape.c 15 May 2018 11:19:21 -0000 1.27
> +++ ldape.c 3 Jul 2018 23:32:27 -0000
> @@ -229,7 +229,8 @@ ldap_abandon(struct request *req)
> int
> ldap_unbind(struct request *req)
> {
> - log_debug("current bind dn = %s", req->conn->binddn);
> + log_debug("current bind dn = %s",
> + req->conn->binddn == NULL ? "" : req->conn->binddn);
> conn_disconnect(req->conn);
> request_free(req);
> return -1; /* don't send any response */
>
I'd suggest:
if (req->conn->binddn)
log_debug("current bind dn = %s", req->conn->binddn);