From d8f6dd3b5ee925dd0f41964ca9267ad36cd9e5b8 Mon Sep 17 00:00:00 2001 From: Petar Kapris Date: Thu, 17 Dec 2020 17:11:39 +0100 Subject: [PATCH] Replace SYSLOG_DEBUG constant with LOG_DEBUG --- timeoutd.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/timeoutd.c b/timeoutd.c index cbdcdcf..d168e7d 100644 --- a/timeoutd.c +++ b/timeoutd.c @@ -55,7 +55,6 @@ #endif #define OPENLOG_FLAGS LOG_CONS|LOG_PID -#define SYSLOG_DEBUG LOG_DEBUG #ifndef CONFIG #define CONFIG "/etc/timeouts" @@ -206,7 +205,7 @@ char *argv[]; /* This is a bit of a shameless hack, but, well, it works. */ if (argc == 3) { #ifdef DEBUG - syslog(SYSLOG_DEBUG, "Running in user check mode. Checking user %s on %s.", argv[1], + syslog(LOG_DEBUG, "Running in user check mode. Checking user %s on %s.", argv[1], argv[2]); #endif strncpy(dev, argv[2], sizeof(dev) - 1); @@ -231,7 +230,7 @@ char *argv[]; exit(20); case ACTIVE: #ifdef DEBUG - syslog(SYSLOG_DEBUG, "User %s on %s passed login check.", argv[1], argv[2]); + syslog(LOG_DEBUG, "User %s on %s passed login check.", argv[1], argv[2]); #endif free_wtmp(); exit(0); @@ -288,7 +287,7 @@ char *argv[]; read_wtmp(); /* Read in today's wtmp entries */ setutent(); #ifdef DEBUG - syslog(SYSLOG_DEBUG, "Time to check utmp for exceeded limits."); + syslog(LOG_DEBUG, "Time to check utmp for exceeded limits."); #endif while ((utmpp = getutent()) != (struct utmp *) NULL) check_idle(); @@ -297,7 +296,7 @@ char *argv[]; if (pending_reread) reread_config(SIGHUP); #ifdef DEBUG - syslog(SYSLOG_DEBUG, "Finished checking utmp... sleeping for 1 minute."); + syslog(LOG_DEBUG, "Finished checking utmp... sleeping for 1 minute."); #endif sleep(60); } @@ -313,14 +312,14 @@ void read_wtmp() struct tm *tm; #ifdef DEBUG - syslog(SYSLOG_DEBUG, "Reading today's wtmp entries."); + syslog(LOG_DEBUG, "Reading today's wtmp entries."); #endif if ((fp = fopen(WTMP_FILE, "r")) == NULL) bailout("Could not open wtmp file!", 1); #ifdef DEBUG - syslog(SYSLOG_DEBUG, "Seek to end of wtmp"); + syslog(LOG_DEBUG, "Seek to end of wtmp"); #endif /* Go to end of file minus one structure */ fseek(fp, -1L * sizeof(struct utmp), SEEK_END); @@ -351,7 +350,7 @@ void read_wtmp() } fclose(fp); #ifdef DEBUG - syslog(SYSLOG_DEBUG, "Finished reading today's wtmp entries."); + syslog(LOG_DEBUG, "Finished reading today's wtmp entries."); #endif } @@ -361,7 +360,7 @@ void free_wtmp() { struct ut_list *ut_list_p; #ifdef DEBUG - syslog(SYSLOG_DEBUG, "Freeing list of today's wtmp entries."); + syslog(LOG_DEBUG, "Freeing list of today's wtmp entries."); #endif while (wtmplist) { @@ -378,7 +377,7 @@ void free_wtmp() free(ut_list_p); } #ifdef DEBUG - syslog(SYSLOG_DEBUG, "Finished freeing list of today's wtmp entries."); + syslog(LOG_DEBUG, "Finished freeing list of today's wtmp entries."); #endif } @@ -714,12 +713,12 @@ char *host; char cmdbuf[1024]; #ifdef DEBUG - syslog(SYSLOG_DEBUG, "Warning %s@%s on %s of pending logoff in %d minutes.", user, host, tty, + syslog(LOG_DEBUG, "Warning %s@%s on %s of pending logoff in %d minutes.", user, host, tty, time_remaining); #endif if (chk_xsession(tty, host)) { - syslog(SYSLOG_DEBUG, + syslog(LOG_DEBUG, "Warning %s running X on %s for pending logout! (%d min%s left)", user, tty, time_remaining, time_remaining == 1 ? "" : "s"); @@ -730,9 +729,9 @@ char *host; user, host, time_remaining, time_remaining == 1 ? "" : "s", limit_names[limit_type]); system(cmdbuf); - /*#ifdef DEBUG */ +#ifdef DEBUG syslog(LOG_DEBUG, "cmdbuf=%s", cmdbuf); - /*#endif */ +#endif sleep(KWAIT); /* and give the user some time to read the message ;) */ return; } @@ -778,7 +777,7 @@ int session; } #ifdef DEBUG - syslog(SYSLOG_DEBUG, "Checking user %s group %s tty %s.", user, gr->gr_name, tty); + syslog(LOG_DEBUG, "Checking user %s group %s tty %s.", user, gr->gr_name, tty); #endif /* Check to see if current user matches any entry based on tty/user/group */ @@ -801,8 +800,8 @@ int session; if (timematch && ttymatch && usermatch && groupmatch) { get_day_time(user); #ifdef DEBUG - syslog(SYSLOG_DEBUG, "Matched entry %d", configline); - syslog(SYSLOG_DEBUG, + syslog(LOG_DEBUG, "Matched entry %d", configline); + syslog(LOG_DEBUG, "Idle=%d (max=%d) Sess=%d (max=%d) Daily=%d (max=%d) warntime=%d", idle, config[configline]->idlemax, session, config[configline]->sessmax, daytime, config[configline]->daymax, @@ -878,7 +877,7 @@ void check_idle() if (aktconfigline > 0) { /* > 0 if user is not in config */ #ifdef DEBUG - syslog(SYSLOG_DEBUG, "User %s or * not in config -> No restrictions. Not checking %s on %s", + syslog(LOG_DEBUG, "User %s or * not in config -> No restrictions. Not checking %s on %s", user, user, dev); #endif return; /* now, we return because the user beeing checked is not in config, so he has no restrictions */ @@ -903,7 +902,7 @@ void check_idle() #ifdef TIMEOUTDX11 if (chk_xsession(dev, host) && !chk_xterm(dev, host)) { /* check idle for Xsession, but not for xterm */ idle = get_xidle(user, host) / 1000 / 60; /* get_xidle returns millisecs, we need mins */ - syslog(SYSLOG_DEBUG, "get_xidle(%s,%s) returned %d mins idle for %s.", dev, host, + syslog(LOG_DEBUG, "get_xidle(%s,%s) returned %d mins idle for %s.", dev, host, (int) idle, user); } else if (chk_xterm(dev, host)) return; @@ -915,7 +914,7 @@ void check_idle() switch (chk_timeout(user, dev, host, idle, sesstime)) { case ACTIVE: #ifdef DEBUG - syslog(SYSLOG_DEBUG, "User %s is active.", user); + syslog(LOG_DEBUG, "User %s is active.", user); #endif break; case IDLEMAX: