From 6076eddf9c73f076ec891158a82c241bf80a5f2f Mon Sep 17 00:00:00 2001 From: Philip Homburg Date: Thu, 10 Aug 2006 14:11:25 +0000 Subject: [PATCH] Use syslog for logging. --- lib/ip/servxcheck.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/lib/ip/servxcheck.c b/lib/ip/servxcheck.c index a6229628a..db5d4e9f7 100755 --- a/lib/ip/servxcheck.c +++ b/lib/ip/servxcheck.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -214,7 +215,7 @@ int servxcheck(ipaddr_t peer, const char *service, if (c != '-' && c != '+') { if (logf == nil) { - fprintf(stderr, "%s: strange check word '%s'\n", + syslog(LOG_ERR, "%s: strange check word '%s'\n", path_servacces, word); } continue; @@ -264,28 +265,8 @@ int servxcheck(ipaddr_t peer, const char *service, if (logf != nil) { (*logf)(state == PASS, name); } else { - int lfd; - char line[128+WLEN]; - time_t t; - struct tm *tm; - char month[][4]= { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", - }; - - if ((lfd= open("/usr/adm/log", O_WRONLY|O_APPEND)) != -1) { - time(&t); - tm= localtime(&t); - sprintf(line, "%s %02d %02d:%02d:%02d service '%s' %s to %s\n", - month[tm->tm_mon], - tm->tm_mday, - tm->tm_hour, tm->tm_min, tm->tm_sec, - service, - state == PASS ? "granted" : "denied", - name); - (void) write(lfd, line, strlen(line)); - close(lfd); - } + syslog(LOG_NOTICE, "service '%s' %s to %s\n", + service, state == PASS ? "granted" : "denied", name); } } return state == PASS; -- 2.44.0