source:
npl/system/nss_ldap/patches/log_authpriv.patch
@
0105685
Last change on this file since 0105685 was c5c522c, checked in by , 8 years ago | |
---|---|
|
|
File size: 6.3 KB |
-
ldap-nss.c
Description: use LOG_AUTHPRIV facility with syslog() calls Author: Stephen Frost <sfrost@debian.org> Bug-Debian: http://bugs.debian.org/310421
a b do_close (void) 698 698 # else 699 699 sd = __session.ls_conn->ld_sb.sb_sd; 700 700 # endif /* LDAP_OPT_DESC */ 701 syslog (LOG_ INFO, "nss_ldap: closing connection %p fd %d",701 syslog (LOG_AUTHPRIV | LOG_INFO, "nss_ldap: closing connection %p fd %d", 702 702 __session.ls_conn, sd); 703 703 #endif /* DEBUG */ 704 704 … … do_close_no_unbind (void) 990 990 closeSd = do_get_our_socket (&sd); 991 991 992 992 #if defined(DEBUG) || defined(DEBUG_SOCKETS) 993 syslog (LOG_ INFO, "nss_ldap: %sclosing connection (no unbind) %p fd %d",993 syslog (LOG_AUTHPRIV | LOG_INFO, "nss_ldap: %sclosing connection (no unbind) %p fd %d", 994 994 closeSd ? "" : "not ", __session.ls_conn, sd); 995 995 #endif /* DEBUG */ 996 996 … … do_init (void) 1152 1152 1153 1153 #ifdef DEBUG 1154 1154 #ifdef HAVE_PTHREAD_ATFORK 1155 syslog (LOG_ DEBUG,1155 syslog (LOG_AUTHPRIV | LOG_DEBUG, 1156 1156 "nss_ldap: __session.ls_state=%d, __session.ls_conn=%p, __euid=%i, euid=%i", 1157 1157 __session.ls_state, __session.ls_conn, __euid, euid); 1158 1158 #elif defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H) 1159 syslog (LOG_ DEBUG,1159 syslog (LOG_AUTHPRIV | LOG_DEBUG, 1160 1160 "nss_ldap: libpthreads=%s, __session.ls_state=%d, __session.ls_conn=%p, __pid=%i, pid=%i, __euid=%i, euid=%i", 1161 1161 ((__pthread_once == NULL || __pthread_atfork == NULL) ? "FALSE" : "TRUE"), 1162 1162 __session.ls_state, … … do_init (void) 1164 1164 ((__pthread_once == NULL || __pthread_atfork == NULL) ? __pid : -1), 1165 1165 ((__pthread_once == NULL || __pthread_atfork == NULL) ? pid : -1), __euid, euid); 1166 1166 #else 1167 syslog (LOG_ DEBUG,1167 syslog (LOG_AUTHPRIV | LOG_DEBUG, 1168 1168 "nss_ldap: __session.ls_state=%d, __session.ls_conn=%p, __pid=%i, pid=%i, __euid=%i, euid=%i", 1169 1169 __session.ls_state, __session.ls_conn, __pid, pid, __euid, euid); 1170 1170 #endif … … do_init (void) 1275 1275 stat = _nss_ldap_mergeconfigfromdns (__config, &configbufp, &configbuflen); 1276 1276 if (stat != NSS_SUCCESS) 1277 1277 { 1278 syslog (LOG_ ERR, "nss_ldap: could not determine LDAP server from ldap.conf or DNS");1278 syslog (LOG_AUTHPRIV | LOG_ERR, "nss_ldap: could not determine LDAP server from ldap.conf or DNS"); 1279 1279 } 1280 1280 } 1281 1281 … … do_start_tls (ldap_session_t * session) 1418 1418 rc = LDAP_TIMEOUT; 1419 1419 } 1420 1420 1421 syslog (LOG_ INFO, "nss_ldap: ldap_start_tls failed: %s", ldap_err2string (rc));1421 syslog (LOG_AUTHPRIV | LOG_INFO, "nss_ldap: ldap_start_tls failed: %s", ldap_err2string (rc)); 1422 1422 debug ("<== do_start_tls (ldap_start_tls failed: %s)", ldap_err2string (rc)); 1423 1423 return rc; 1424 1424 } … … do_open (void) 1671 1671 if (rc != LDAP_SUCCESS) 1672 1672 { 1673 1673 /* log actual LDAP error code */ 1674 syslog (LOG_ INFO,1674 syslog (LOG_AUTHPRIV | LOG_INFO, 1675 1675 "nss_ldap: failed to bind to LDAP server %s: %s", 1676 1676 cfg->ldc_uris[__session.ls_current_uri], 1677 1677 ldap_err2string (rc)); … … do_bind (LDAP * ld, int timelimit, const 1829 1829 #else 1830 1830 rc = ld->ld_errno; 1831 1831 #endif /* LDAP_OPT_ERROR_NUMBER */ 1832 /* Notify if we failed. */ 1833 syslog (LOG_AUTHPRIV | LOG_ERR, "nss_ldap: could not connect to any LDAP server as %s - %s", 1834 dn, ldap_err2string (rc)); 1832 1835 debug ("<== do_bind"); 1833 1836 1834 1837 return rc; … … do_result (ent_context_t * ctx, int all) 2481 2484 #else 2482 2485 rc = __session.ls_conn->ld_errno; 2483 2486 #endif /* LDAP_OPT_ERROR_NUMBER */ 2484 syslog (LOG_ ERR, "nss_ldap: could not get LDAP result - %s",2487 syslog (LOG_AUTHPRIV | LOG_ERR, "nss_ldap: could not get LDAP result - %s", 2485 2488 ldap_err2string (rc)); 2486 2489 do_close(); 2487 2490 stat = NSS_UNAVAIL; … … do_result (ent_context_t * ctx, int all) 2515 2518 && parserc != LDAP_MORE_RESULTS_TO_RETURN) 2516 2519 { 2517 2520 ldap_abandon (__session.ls_conn, ctx->ec_msgid); 2518 syslog (LOG_ ERR,2521 syslog (LOG_AUTHPRIV | LOG_ERR, 2519 2522 "nss_ldap: could not get LDAP result - %s", 2520 2523 ldap_err2string (rc)); 2521 2524 do_close(); … … do_with_reconnect (const char *base, int 2591 2594 else if (backoff < __session.ls_config->ldc_reconnect_maxsleeptime) 2592 2595 backoff *= 2; 2593 2596 2594 syslog (LOG_ INFO,2597 syslog (LOG_AUTHPRIV | LOG_INFO, 2595 2598 "nss_ldap: reconnecting to LDAP server (sleeping %d seconds)...", 2596 2599 backoff); 2597 2600 (void) sleep (backoff); 2598 2601 } 2599 else if (tries > 1)2602 else if (tries > 0) 2600 2603 { 2601 2604 /* Don't sleep, reconnect immediately. */ 2602 syslog (LOG_ INFO, "nss_ldap: reconnecting to LDAP server...");2605 syslog (LOG_AUTHPRIV | LOG_INFO, "nss_ldap: reconnecting to LDAP server..."); 2603 2606 } 2604 2607 2605 2608 /* For each "try", attempt to connect to all specified URIs */ … … do_with_reconnect (const char *base, int 2650 2653 switch (stat) 2651 2654 { 2652 2655 case NSS_UNAVAIL: 2653 syslog (LOG_ ERR, "nss_ldap: could not search LDAP server - %s",2656 syslog (LOG_AUTHPRIV | LOG_ERR, "nss_ldap: could not search LDAP server - %s", 2654 2657 ldap_err2string (rc)); 2655 2658 break; 2656 2659 case NSS_TRYAGAIN: 2657 syslog (LOG_ ERR,2660 syslog (LOG_AUTHPRIV | LOG_ERR, 2658 2661 "nss_ldap: could not %s %sconnect to LDAP server - %s", 2659 2662 hard ? "hard" : "soft", tries ? "re" : "", 2660 2663 ldap_err2string (rc)); … … do_with_reconnect (const char *base, int 2669 2672 uri = "(null)"; 2670 2673 2671 2674 if (tries) 2672 syslog (LOG_ INFO,2675 syslog (LOG_AUTHPRIV | LOG_INFO, 2673 2676 "nss_ldap: reconnected to LDAP server %s after %d attempt%s", 2674 2677 uri, tries, (tries == 1) ? "" : "s"); 2675 2678 else 2676 syslog (LOG_ INFO, "nss_ldap: reconnected to LDAP server %s", uri);2679 syslog (LOG_AUTHPRIV | LOG_INFO, "nss_ldap: reconnected to LDAP server %s", uri); 2677 2680 } 2678 2681 time (&__session.ls_timestamp); 2679 2682 break; -
ldap-nss.h
a b 140 140 #ifdef DEBUG 141 141 #ifdef DEBUG_SYSLOG 142 142 #ifdef HAVE_NSSWITCH_H 143 #define debug(fmt, args...) syslog(LOG_ DEBUG, "nss_ldap: %s:%d thread %u - " fmt, __FILE__, __LINE__, thr_self() , ## args)143 #define debug(fmt, args...) syslog(LOG_AUTHPRIV | LOG_DEBUG, "nss_ldap: %s:%d thread %u - " fmt, __FILE__, __LINE__, thr_self() , ## args) 144 144 #else 145 #define debug(fmt, args...) syslog(LOG_ DEBUG, "nss_ldap: %s:%d thread %u - " fmt, __FILE__, __LINE__, pthread_self() , ## args)145 #define debug(fmt, args...) syslog(LOG_AUTHPRIV | LOG_DEBUG, "nss_ldap: %s:%d thread %u - " fmt, __FILE__, __LINE__, pthread_self() , ## args) 146 146 #endif /* HAVE_NSSWITCH_H */ 147 147 #else 148 148 #ifndef __GNUC__
Note: See TracBrowser
for help on using the repository browser.