source: npl/system/nss_ldap/patches/log_authpriv.patch @ aafe99e

perl-5.22
Last change on this file since aafe99e was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100644
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) 
    698698# else
    699699      sd = __session.ls_conn->ld_sb.sb_sd;
    700700# 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",
    702702              __session.ls_conn, sd);
    703703#endif /* DEBUG */
    704704
    do_close_no_unbind (void) 
    990990  closeSd = do_get_our_socket (&sd);
    991991
    992992#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",
    994994          closeSd ? "" : "not ", __session.ls_conn, sd);
    995995#endif /* DEBUG */
    996996
    do_init (void) 
    11521152
    11531153#ifdef DEBUG
    11541154#ifdef HAVE_PTHREAD_ATFORK
    1155   syslog (LOG_DEBUG,
     1155  syslog (LOG_AUTHPRIV | LOG_DEBUG,
    11561156          "nss_ldap: __session.ls_state=%d, __session.ls_conn=%p, __euid=%i, euid=%i",
    11571157          __session.ls_state, __session.ls_conn, __euid, euid);
    11581158#elif defined(HAVE_LIBC_LOCK_H) || defined(HAVE_BITS_LIBC_LOCK_H)
    1159   syslog (LOG_DEBUG,
     1159  syslog (LOG_AUTHPRIV | LOG_DEBUG,
    11601160          "nss_ldap: libpthreads=%s, __session.ls_state=%d, __session.ls_conn=%p, __pid=%i, pid=%i, __euid=%i, euid=%i",
    11611161          ((__pthread_once == NULL || __pthread_atfork == NULL) ? "FALSE" : "TRUE"),
    11621162          __session.ls_state,
    do_init (void) 
    11641164          ((__pthread_once == NULL || __pthread_atfork == NULL) ? __pid : -1),
    11651165          ((__pthread_once == NULL || __pthread_atfork == NULL) ? pid : -1), __euid, euid);
    11661166#else
    1167   syslog (LOG_DEBUG,
     1167  syslog (LOG_AUTHPRIV | LOG_DEBUG,
    11681168          "nss_ldap: __session.ls_state=%d, __session.ls_conn=%p, __pid=%i, pid=%i, __euid=%i, euid=%i",
    11691169          __session.ls_state, __session.ls_conn, __pid, pid, __euid, euid);
    11701170#endif
    do_init (void) 
    12751275          stat = _nss_ldap_mergeconfigfromdns (__config, &configbufp, &configbuflen);
    12761276          if (stat != NSS_SUCCESS)
    12771277            {
    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");
    12791279            }
    12801280        }
    12811281
    do_start_tls (ldap_session_t * session) 
    14181418          rc = LDAP_TIMEOUT;
    14191419        }
    14201420
    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));
    14221422      debug ("<== do_start_tls (ldap_start_tls failed: %s)", ldap_err2string (rc));
    14231423      return rc;
    14241424    }
    do_open (void) 
    16711671  if (rc != LDAP_SUCCESS)
    16721672    {
    16731673      /* log actual LDAP error code */
    1674       syslog (LOG_INFO,
     1674      syslog (LOG_AUTHPRIV | LOG_INFO,
    16751675              "nss_ldap: failed to bind to LDAP server %s: %s",
    16761676              cfg->ldc_uris[__session.ls_current_uri],
    16771677              ldap_err2string (rc));
    do_bind (LDAP * ld, int timelimit, const 
    18291829#else
    18301830          rc = ld->ld_errno;
    18311831#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));
    18321835          debug ("<== do_bind");
    18331836
    18341837          return rc;
    do_result (ent_context_t * ctx, int all) 
    24812484#else
    24822485          rc = __session.ls_conn->ld_errno;
    24832486#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",
    24852488                  ldap_err2string (rc));
    24862489          do_close();
    24872490          stat = NSS_UNAVAIL;
    do_result (ent_context_t * ctx, int all) 
    25152518                  && parserc != LDAP_MORE_RESULTS_TO_RETURN)
    25162519                {
    25172520                  ldap_abandon (__session.ls_conn, ctx->ec_msgid);
    2518                   syslog (LOG_ERR,
     2521                  syslog (LOG_AUTHPRIV | LOG_ERR,
    25192522                          "nss_ldap: could not get LDAP result - %s",
    25202523                          ldap_err2string (rc));
    25212524                  do_close();
    do_with_reconnect (const char *base, int 
    25912594          else if (backoff < __session.ls_config->ldc_reconnect_maxsleeptime)
    25922595            backoff *= 2;
    25932596
    2594           syslog (LOG_INFO,
     2597          syslog (LOG_AUTHPRIV | LOG_INFO,
    25952598                  "nss_ldap: reconnecting to LDAP server (sleeping %d seconds)...",
    25962599                  backoff);
    25972600          (void) sleep (backoff);
    25982601        }
    2599       else if (tries > 1)
     2602      else if (tries > 0)
    26002603        {
    26012604          /* 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...");
    26032606        }
    26042607
    26052608      /* For each "try", attempt to connect to all specified URIs */
    do_with_reconnect (const char *base, int 
    26502653  switch (stat)
    26512654    {
    26522655    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",
    26542657              ldap_err2string (rc));
    26552658      break;
    26562659    case NSS_TRYAGAIN:
    2657       syslog (LOG_ERR,
     2660      syslog (LOG_AUTHPRIV | LOG_ERR,
    26582661              "nss_ldap: could not %s %sconnect to LDAP server - %s",
    26592662              hard ? "hard" : "soft", tries ? "re" : "",
    26602663              ldap_err2string (rc));
    do_with_reconnect (const char *base, int 
    26692672            uri = "(null)";
    26702673
    26712674          if (tries)
    2672             syslog (LOG_INFO,
     2675            syslog (LOG_AUTHPRIV | LOG_INFO,
    26732676              "nss_ldap: reconnected to LDAP server %s after %d attempt%s",
    26742677              uri, tries, (tries == 1) ? "" : "s");
    26752678          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);
    26772680        }
    26782681      time (&__session.ls_timestamp);
    26792682      break;
  • ldap-nss.h

    a b  
    140140#ifdef DEBUG
    141141#ifdef DEBUG_SYSLOG
    142142#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)
    144144#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)
    146146#endif /* HAVE_NSSWITCH_H */
    147147#else
    148148#ifndef __GNUC__
Note: See TracBrowser for help on using the repository browser.