1
# * Modified syslog() calls to use LOG_AUTHPRIV facility, Closes: #310421
2
--- libnss-ldap-255.orig/ldap-nss.c
3
+++ libnss-ldap-255/ldap-nss.c
6
sd = __session.ls_conn->ld_sb.sb_sd;
7
# endif /* LDAP_OPT_DESC */
8
- syslog (LOG_INFO, "nss_ldap: closing connection %p fd %d",
9
+ syslog (LOG_AUTHPRIV | LOG_INFO, "nss_ldap: closing connection %p fd %d",
10
__session.ls_conn, sd);
14
closeSd = do_get_our_socket (&sd);
16
#if defined(DEBUG) || defined(DEBUG_SOCKETS)
17
- syslog (LOG_INFO, "nss_ldap: %sclosing connection (no unbind) %p fd %d",
18
+ syslog (LOG_AUTHPRIV | LOG_INFO, "nss_ldap: %sclosing connection (no unbind) %p fd %d",
19
closeSd ? "" : "not ", __session.ls_conn, sd);
22
@@ -1128,11 +1190,11 @@
25
#ifdef HAVE_PTHREAD_ATFORK
27
+ syslog (LOG_AUTHPRIV | LOG_DEBUG,
28
"nss_ldap: __session.ls_state=%d, __session.ls_conn=%p, __euid=%i, euid=%i",
29
__session.ls_state, __session.ls_conn, __euid, euid);
30
#elif defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
32
+ syslog (LOG_AUTHPRIV | LOG_DEBUG,
33
"nss_ldap: libpthreads=%s, __session.ls_state=%d, __session.ls_conn=%p, __pid=%i, pid=%i, __euid=%i, euid=%i",
34
(__pthread_once == NULL ? "FALSE" : "TRUE"),
37
(__pthread_once == NULL ? __pid : -1),
38
(__pthread_once == NULL ? pid : -1), __euid, euid);
41
+ syslog (LOG_AUTHPRIV | LOG_DEBUG,
42
"nss_ldap: __session.ls_state=%d, __session.ls_conn=%p, __pid=%i, pid=%i, __euid=%i, euid=%i",
43
__session.ls_state, __session.ls_conn, __pid, pid, __euid, euid);
46
if (rc != LDAP_SUCCESS)
48
/* log actual LDAP error code */
50
+ syslog (LOG_AUTHPRIV | LOG_INFO,
51
"nss_ldap: failed to bind to LDAP server %s: %s",
52
cfg->ldc_uris[__session.ls_current_uri],
53
ldap_err2string (rc));
57
#endif /* LDAP_OPT_ERROR_NUMBER */
58
+ /* Notify if we failed. */
59
+ syslog (LOG_AUTHPRIV | LOG_ERR, "nss_ldap: could not connect to any LDAP server as %s - %s",
60
+ dn, ldap_err2string (rc));
61
debug ("<== do_bind");
66
rc = __session.ls_conn->ld_errno;
67
#endif /* LDAP_OPT_ERROR_NUMBER */
68
- syslog (LOG_ERR, "nss_ldap: could not get LDAP result - %s",
69
+ syslog (LOG_AUTHPRIV | LOG_ERR, "nss_ldap: could not get LDAP result - %s",
70
ldap_err2string (rc));
76
ldap_abandon (__session.ls_conn, ctx->ec_msgid);
78
+ syslog (LOG_AUTHPRIV | LOG_ERR,
79
"nss_ldap: could not get LDAP result - %s",
80
ldap_err2string (rc));
82
@@ -2502,15 +2567,15 @@
83
else if (backoff < __session.ls_config->ldc_reconnect_maxsleeptime)
87
+ syslog (LOG_AUTHPRIV | LOG_INFO,
88
"nss_ldap: reconnecting to LDAP server (sleeping %d seconds)...",
90
(void) sleep (backoff);
95
/* Don't sleep, reconnect immediately. */
96
- syslog (LOG_INFO, "nss_ldap: reconnecting to LDAP server...");
97
+ syslog (LOG_AUTHPRIV | LOG_INFO, "nss_ldap: reconnecting to LDAP server...");
100
/* For each "try", attempt to connect to all specified URIs */
101
@@ -2561,11 +2626,11 @@
105
- syslog (LOG_ERR, "nss_ldap: could not search LDAP server - %s",
106
+ syslog (LOG_AUTHPRIV | LOG_ERR, "nss_ldap: could not search LDAP server - %s",
107
ldap_err2string (rc));
111
+ syslog (LOG_AUTHPRIV | LOG_ERR,
112
"nss_ldap: could not %s %sconnect to LDAP server - %s",
113
hard ? "hard" : "soft", tries ? "re" : "",
114
ldap_err2string (rc));
115
@@ -2580,11 +2645,11 @@
120
+ syslog (LOG_AUTHPRIV | LOG_INFO,
121
"nss_ldap: reconnected to LDAP server %s after %d attempt%s",
122
uri, tries, (tries == 1) ? "" : "s");
124
- syslog (LOG_INFO, "nss_ldap: reconnected to LDAP server %s", uri);
125
+ syslog (LOG_AUTHPRIV | LOG_INFO, "nss_ldap: reconnected to LDAP server %s", uri);
127
time (&__session.ls_timestamp);