From 156d3eaa1b5d85cb70a79046bd874ab832df6ff1 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Wed, 6 Feb 2013 00:48:58 +0100 Subject: [PATCH] SYSLOG: more places to correct the loglevel parameters. --- webcit/auth.c | 10 ++-- webcit/availability.c | 6 +- webcit/bbsview_renderer.c | 2 +- webcit/calendar.c | 8 +-- webcit/calendar_tools.c | 10 ++-- webcit/context_loop.c | 6 +- webcit/crypto.c | 10 ++-- webcit/dav_propfind.c | 4 +- webcit/dav_put.c | 14 ++--- webcit/event.c | 2 +- webcit/gettext.c | 16 +++--- webcit/html2html.c | 18 +++--- webcit/ical_dezonify.c | 28 +++++----- webcit/ical_subst.c | 2 +- webcit/inetconf.c | 2 +- webcit/locate_host.c | 2 +- webcit/messages.c | 14 ++--- webcit/msg_renderers.c | 4 +- webcit/paramhandling.c | 18 +++--- webcit/roomlist.c | 10 ++-- webcit/roomops.c | 4 +- webcit/roomviews.c | 2 +- webcit/scripts/mk_module_init.sh | 22 ++++---- webcit/serv_func.c | 6 +- webcit/siteconfig.c | 2 +- webcit/static.c | 12 ++-- webcit/subst.c | 42 +++++++------- webcit/sysdep.c | 36 ++++++------ webcit/tasks.c | 10 ++-- webcit/tcp_sockets.c | 96 ++++++++++++++++---------------- webcit/useredit.c | 2 +- webcit/vcard_edit.c | 6 +- webcit/webcit.c | 26 ++++----- webcit/webserver.c | 24 ++++---- webcit/webserver.h | 2 +- 35 files changed, 239 insertions(+), 239 deletions(-) diff --git a/webcit/auth.c b/webcit/auth.c index 8b60dac3d..c6ee328e4 100644 --- a/webcit/auth.c +++ b/webcit/auth.c @@ -390,7 +390,7 @@ void finalize_openid_login(void) /* Something went VERY wrong if we get to this point */ else { - syslog(1, "finalize_openid_login() failed to do anything. This is a code problem.\n"); + syslog(LOG_DEBUG, "finalize_openid_login() failed to do anything. This is a code problem.\n"); begin_burst(); output_headers(1, 0, 0, 0, 1, 0); wc_printf(""); @@ -462,7 +462,7 @@ void do_welcome(void) if (StrLength(Buf) == 0) { StrBufAppendBufPlain(Buf, "dotgoto?room=_BASEROOM_", -1, 0); } - syslog(9, "Redirecting to user's start page: %s\n", ChrPtr(Buf)); + syslog(LOG_DEBUG, "Redirecting to user's start page: %s\n", ChrPtr(Buf)); http_redirect(ChrPtr(Buf)); } @@ -684,7 +684,7 @@ void display_reg(int during_login) Buf = NewStrBuf(); memset(&Room, 0, sizeof(folder)); if (goto_config_room(Buf, &Room) != 0) { - syslog(9, "display_reg() exiting because goto_config_room() failed\n"); + syslog(LOG_WARNING, "display_reg() exiting because goto_config_room() failed\n"); if (during_login) { pop_destination(); } @@ -700,7 +700,7 @@ void display_reg(int during_login) FreeStrBuf(&Buf); vcard_msgnum = locate_user_vcard_in_this_room(&VCMsg, &VCAtt); if (vcard_msgnum < 0L) { - syslog(9, "display_reg() exiting because locate_user_vcard_in_this_room() failed\n"); + syslog(LOG_WARNING, "display_reg() exiting because locate_user_vcard_in_this_room() failed\n"); if (during_login) { pop_destination(); } @@ -835,7 +835,7 @@ void Header_HandleAuth(StrBuf *Line, ParsedHttpHdrs *hdr) hdr->HR.got_auth = AUTH_BASIC; } else - syslog(1, "Authentication scheme not supported! [%s]\n", ChrPtr(Line)); + syslog(LOG_WARNING, "Authentication scheme not supported! [%s]\n", ChrPtr(Line)); } } diff --git a/webcit/availability.c b/webcit/availability.c index 3e8bfa2e5..17edb3393 100644 --- a/webcit/availability.c +++ b/webcit/availability.c @@ -98,7 +98,7 @@ int ical_ctdl_is_overlap( return(1); } - /* syslog(9, "Comparing t1start %d:%d t1end %d:%d t2start %d:%d t2end %d:%d \n", + /* syslog(LOG_DEBUG, "Comparing t1start %d:%d t1end %d:%d t2start %d:%d t2end %d:%d \n", t1start.hour, t1start.minute, t1end.hour, t1end.minute, t2start.hour, t2start.minute, t2end.hour, t2end.minute); */ @@ -107,11 +107,11 @@ int ical_ctdl_is_overlap( /* If event 1 ends before event 2 starts, we're in the clear. */ if (icaltime_compare(t1end, t2start) <= 0) return(0); - /* syslog(9, "first passed\n"); */ + /* syslog(LOG_DEBUG, "first passed\n"); */ /* If event 2 ends before event 1 starts, we're also ok. */ if (icaltime_compare(t2end, t1start) <= 0) return(0); - /* syslog(9, "second passed\n"); */ + /* syslog(LOG_DEBUG, "second passed\n"); */ /* Otherwise, they overlap. */ return(1); diff --git a/webcit/bbsview_renderer.c b/webcit/bbsview_renderer.c index a577bc95f..aefcccf95 100644 --- a/webcit/bbsview_renderer.c +++ b/webcit/bbsview_renderer.c @@ -180,7 +180,7 @@ int bbsview_RenderView_or_Tail(SharedMessageStatus *Stat, int go_to_the_very_end = 0; if (Stat->nummsgs > 0) { - syslog(9, "sorting %d messages\n", BBS->num_msgs); + syslog(LOG_DEBUG, "sorting %d messages\n", BBS->num_msgs); qsort(BBS->msgs, (size_t)(BBS->num_msgs), sizeof(long), bbsview_sortfunc); } diff --git a/webcit/calendar.c b/webcit/calendar.c index 2e486dab8..46ec41bd6 100644 --- a/webcit/calendar.c +++ b/webcit/calendar.c @@ -205,7 +205,7 @@ void cal_process_object(StrBuf *Target, if (the_method == ICAL_METHOD_REQUEST) { /* Check for conflicts */ - syslog(9, "Checking server calendar for conflicts...\n"); + syslog(LOG_DEBUG, "Checking server calendar for conflicts...\n"); serv_printf("ICAL conflicts|%ld|%s|", msgnum, cal_partnum); serv_getln(buf, sizeof buf); if (buf[0] == '1') { @@ -233,7 +233,7 @@ void cal_process_object(StrBuf *Target, StrBufAppendPrintf(Target, "\n"); } } - syslog(9, "...done.\n"); + syslog(LOG_DEBUG, "...done.\n"); StrBufAppendPrintf(Target, ""); @@ -601,7 +601,7 @@ void display_individual_cal(icalcomponent *event, long msgnum, char *from, int u } } icalrecur_iterator_free(ritr); - /* syslog(9, "Performed %d recurrences; final one is %s", num_recur, ctime(&final_recurrence)); */ + /* syslog(LOG_DEBUG, "Performed %d recurrences; final one is %s", num_recur, ctime(&final_recurrence)); */ } @@ -858,7 +858,7 @@ void do_freebusy(void) who[len-4] = 0; } - syslog(9, "freebusy requested for <%s>\n", who); + syslog(LOG_INFO, "freebusy requested for <%s>\n", who); serv_printf("ICAL freebusy|%s", who); serv_getln(buf, sizeof buf); diff --git a/webcit/calendar_tools.c b/webcit/calendar_tools.c index 5fffee44c..daefe82fd 100644 --- a/webcit/calendar_tools.c +++ b/webcit/calendar_tools.c @@ -243,7 +243,7 @@ icalcomponent *ical_encapsulate_subcomponent(icalcomponent *subcomp) { int zone_already_attached; if (subcomp == NULL) { - syslog(3, "ERROR: ical_encapsulate_subcomponent() called with NULL argument\n"); + syslog(LOG_WARNING, "ERROR: ical_encapsulate_subcomponent() called with NULL argument\n"); return NULL; } @@ -251,7 +251,7 @@ icalcomponent *ical_encapsulate_subcomponent(icalcomponent *subcomp) { * If we're already looking at a full VCALENDAR component, this is probably an error. */ if (icalcomponent_isa(subcomp) == ICAL_VCALENDAR_COMPONENT) { - syslog(3, "ERROR: component sent to ical_encapsulate_subcomponent() already top level\n"); + syslog(LOG_WARNING, "ERROR: component sent to ical_encapsulate_subcomponent() already top level\n"); return subcomp; } @@ -281,11 +281,11 @@ icalcomponent *ical_encapsulate_subcomponent(icalcomponent *subcomp) { for (i=0; i<5; ++i) { if (z == attached_zones[i]) { ++zone_already_attached; - syslog(9, "zone already attached!!\n"); + syslog(LOG_DEBUG, "zone already attached!!\n"); } } if ((!zone_already_attached) && (num_zones_attached < 5)) { - syslog(9, "attaching zone %d!\n", num_zones_attached); + syslog(LOG_DEBUG, "attaching zone %d!\n", num_zones_attached); attached_zones[num_zones_attached++] = z; } @@ -299,7 +299,7 @@ icalcomponent *ical_encapsulate_subcomponent(icalcomponent *subcomp) { /* Encapsulate the VEVENT component into a complete VCALENDAR */ encaps = icalcomponent_new(ICAL_VCALENDAR_COMPONENT); if (encaps == NULL) { - syslog(3, "ERROR: ical_encapsulate_subcomponent() could not allocate component\n"); + syslog(LOG_WARNING, "ERROR: ical_encapsulate_subcomponent() could not allocate component\n"); return NULL; } diff --git a/webcit/context_loop.c b/webcit/context_loop.c index 8218d1d9a..5320e56fc 100644 --- a/webcit/context_loop.c +++ b/webcit/context_loop.c @@ -73,7 +73,7 @@ void do_housekeeping(void) if ((sptr->inuse == 0) && ((the_time - (sptr->lastreq)) > (time_t) WEBCIT_TIMEOUT)) { - syslog(3, "Timeout session %d", sptr->wc_session); + syslog(LOG_DEBUG, "Timeout session %d", sptr->wc_session); sptr->killthis = 1; } @@ -100,7 +100,7 @@ void do_housekeeping(void) * Now free up and destroy the culled sessions. */ while (sessions_to_kill != NULL) { - syslog(3, "Destroying session %d", sessions_to_kill->wc_session); + syslog(LOG_DEBUG, "Destroying session %d", sessions_to_kill->wc_session); sptr = sessions_to_kill->next; session_destroy_modules(&sessions_to_kill); sessions_to_kill = sptr; @@ -618,7 +618,7 @@ void context_loop(ParsedHttpHdrs *Hdr) /* How long did this transaction take? */ gettimeofday(&tx_finish, NULL); - syslog(LOG_DEBUG, "HTTP: 200 [%ld.%06ld] %s %s", + syslog(LOG_INFO, "HTTP: 200 [%ld.%06ld] %s %s", ((tx_finish.tv_sec*1000000 + tx_finish.tv_usec) - (tx_start.tv_sec*1000000 + tx_start.tv_usec)) / 1000000, ((tx_finish.tv_sec*1000000 + tx_finish.tv_usec) - (tx_start.tv_sec*1000000 + tx_start.tv_usec)) % 1000000, ReqStrs[Hdr->HR.eReqType], diff --git a/webcit/crypto.c b/webcit/crypto.c index aa509887b..d7b460cde 100644 --- a/webcit/crypto.c +++ b/webcit/crypto.c @@ -83,7 +83,7 @@ void init_ssl(void) for (a = 0; a < CRYPTO_num_locks(); a++) { SSLCritters[a] = malloc(sizeof(pthread_mutex_t)); if (!SSLCritters[a]) { - syslog(1, + syslog(LOG_EMERG, "citserver: can't allocate memory!!\n"); /** Nothing's been initialized, just die */ ShutDownWebcit(); @@ -130,13 +130,13 @@ void init_ssl(void) if (!strcasecmp(ctdlhost, "uds")) { sprintf(buf, "%s/keys/citadel.key", ctdlport); rv = symlink(buf, CTDL_KEY_PATH); - if (!rv) syslog(1, "%s\n", strerror(errno)); + if (!rv) syslog(LOG_DEBUG, "%s\n", strerror(errno)); sprintf(buf, "%s/keys/citadel.csr", ctdlport); rv = symlink(buf, CTDL_CSR_PATH); - if (!rv) syslog(1, "%s\n", strerror(errno)); + if (!rv) syslog(LOG_DEBUG, "%s\n", strerror(errno)); sprintf(buf, "%s/keys/citadel.cer", ctdlport); rv = symlink(buf, CTDL_CER_PATH); - if (!rv) syslog(1, "%s\n", strerror(errno)); + if (!rv) syslog(LOG_DEBUG, "%s\n", strerror(errno)); } /* @@ -475,7 +475,7 @@ void endtls(void) /* I don't think this is needed, and it crashes the server anyway * * if (ctx != NULL) { - * syslog(9, "Freeing CTX at %x\n", (int)ctx ); + * syslog(LOG_DEBUG, "Freeing CTX at %x\n", (int)ctx ); * SSL_CTX_free(ctx); * } */ diff --git a/webcit/dav_propfind.c b/webcit/dav_propfind.c index 66b2063e9..1e2e5e74a 100644 --- a/webcit/dav_propfind.c +++ b/webcit/dav_propfind.c @@ -167,7 +167,7 @@ const folder *GetRESTFolder(int IgnoreFloor, HashList *Subfolders) { DeleteHashPos(&itd); - syslog(0, "5\n"); + syslog(LOG_DEBUG, "5\n"); continue; } DeleteHashPos(&itd); @@ -178,7 +178,7 @@ const folder *GetRESTFolder(int IgnoreFloor, HashList *Subfolders) { DeleteHashPos(&itd); - syslog(0, "5\n"); + syslog(LOG_DEBUG, "5\n"); continue; } DeleteHashPos(&itfl); diff --git a/webcit/dav_put.c b/webcit/dav_put.c index 1dcfe66b3..8b6935ef1 100644 --- a/webcit/dav_put.c +++ b/webcit/dav_put.c @@ -51,7 +51,7 @@ void dav_put_bigics(void) /* Report success and not much else. */ hprintf("HTTP/1.1 204 No Content\r\n"); - syslog(9, "HTTP/1.1 204 No Content\r\n"); + syslog(LOG_DEBUG, "HTTP/1.1 204 No Content\r\n"); dav_common_headers(); begin_burst(); end_burst(); @@ -118,12 +118,12 @@ void dav_put(void) * version, so we fail... */ if (StrLength(WCC->Hdr->HR.dav_ifmatch) > 0) { - syslog(9, "dav_ifmatch: %s\n", ChrPtr(WCC->Hdr->HR.dav_ifmatch)); + syslog(LOG_DEBUG, "dav_ifmatch: %s\n", ChrPtr(WCC->Hdr->HR.dav_ifmatch)); old_msgnum = locate_message_by_uid(ChrPtr(dav_uid)); - syslog(9, "old_msgnum: %ld\n", old_msgnum); + syslog(LOG_DEBUG, "old_msgnum: %ld\n", old_msgnum); if (StrTol(WCC->Hdr->HR.dav_ifmatch) != old_msgnum) { hprintf("HTTP/1.1 412 Precondition Failed\r\n"); - syslog(9, "HTTP/1.1 412 Precondition Failed (ifmatch=%ld, old_msgnum=%ld)\r\n", + syslog(LOG_INFO, "HTTP/1.1 412 Precondition Failed (ifmatch=%ld, old_msgnum=%ld)\r\n", StrTol(WCC->Hdr->HR.dav_ifmatch), old_msgnum); dav_common_headers(); @@ -174,7 +174,7 @@ void dav_put(void) new_msgnum = atol(buf); break; case 1: - syslog(9, "new_msgnum=%ld (%s)\n", new_msgnum, buf); + syslog(LOG_DEBUG, "new_msgnum=%ld (%s)\n", new_msgnum, buf); break; case 2: StrBufAppendBufPlain(dav_uid, buf, -1, 0); @@ -204,7 +204,7 @@ void dav_put(void) if (old_msgnum < 0L) { char escaped_uid[1024]; hprintf("HTTP/1.1 201 Created\r\n"); - syslog(9, "HTTP/1.1 201 Created\r\n"); + syslog(LOG_DEBUG, "HTTP/1.1 201 Created\r\n"); dav_common_headers(); hprintf("etag: \"%ld\"\r\n", new_msgnum); hprintf("Location: "); @@ -221,7 +221,7 @@ void dav_put(void) /* We modified an existing item. */ hprintf("HTTP/1.1 204 No Content\r\n"); - syslog(9, "HTTP/1.1 204 No Content\r\n"); + syslog(LOG_DEBUG, "HTTP/1.1 204 No Content\r\n"); dav_common_headers(); hprintf("Etag: \"%ld\"\r\n", new_msgnum); /* The item we replaced has probably already been deleted by diff --git a/webcit/event.c b/webcit/event.c index 6d6bb5619..13c5a3e4c 100644 --- a/webcit/event.c +++ b/webcit/event.c @@ -93,7 +93,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, get_pref_long("weekstart", &weekstart, 17); if (weekstart > 6) weekstart = 0; - syslog(9, "display_edit_individual_event(%ld) calview=%s year=%s month=%s day=%s\n", + syslog(LOG_DEBUG, "display_edit_individual_event(%ld) calview=%s year=%s month=%s day=%s\n", msgnum, bstr("calview"), bstr("year"), bstr("month"), bstr("day") ); diff --git a/webcit/gettext.c b/webcit/gettext.c index 5e5d0909b..fdf4ed1f9 100644 --- a/webcit/gettext.c +++ b/webcit/gettext.c @@ -196,7 +196,7 @@ void httplang_to_locale(StrBuf *LocaleString, wcsession *sess) nBest=0; } sess->selected_language = nBest; - syslog(9, "language found: %s", AvailLangLoaded[WC->selected_language]); + syslog(LOG_DEBUG, "language found: %s", AvailLangLoaded[WC->selected_language]); FreeStrBuf(&Buf); FreeStrBuf(&SBuf); } @@ -299,7 +299,7 @@ void initialize_locales(void) { language = getenv("WEBCIT_LANG"); if ((language) && (!IsEmptyStr(language)) && (strcmp(language, "UNLIMITED") != 0)) { - syslog(9, "Nailing locale to %s", language); + syslog(LOG_INFO, "Nailing locale to %s", language); } else language = NULL; @@ -328,10 +328,10 @@ void initialize_locales(void) { (((i > 0) && (wc_locales[0] != NULL)) ? wc_locales[0] : Empty_Locale) ); if (wc_locales[nLocalesLoaded] == NULL) { - syslog(1, "locale for %s disabled: %s", buf, strerror(errno)); + syslog(LOG_NOTICE, "locale for %s disabled: %s", buf, strerror(errno)); } else { - syslog(3, "Found locale: %s", buf); + syslog(LOG_INFO, "Found locale: %s", buf); AvailLangLoaded[nLocalesLoaded] = AvailLang[i]; nLocalesLoaded++; } @@ -350,7 +350,7 @@ void initialize_locales(void) { #endif } if ((language != NULL) && (nLocalesLoaded == 0)) { - syslog(1, "Your selected locale [%s] isn't available on your system. falling back to C", language); + syslog(LOG_WARNING, "Your selected locale [%s] isn't available on your system. falling back to C", language); #ifdef HAVE_USELOCALE wc_locales[0] = newlocale( (LC_MESSAGES_MASK|LC_TIME_MASK), @@ -367,9 +367,9 @@ void initialize_locales(void) { #ifdef ENABLE_NLS setlocale(LC_ALL, ""); - syslog(9, "Text domain: %s", textdomain("webcit")); - syslog(9, "Text domain Charset: %s", bind_textdomain_codeset("webcit", "UTF8")); - syslog(9, "Message catalog directory: %s", bindtextdomain(textdomain(NULL), LOCALEDIR"/locale")); + syslog(LOG_DEBUG, "Text domain: %s", textdomain("webcit")); + syslog(LOG_DEBUG, "Text domain Charset: %s", bind_textdomain_codeset("webcit", "UTF8")); + syslog(LOG_DEBUG, "Message catalog directory: %s", bindtextdomain(textdomain(NULL), LOCALEDIR"/locale")); #endif } diff --git a/webcit/html2html.c b/webcit/html2html.c index 965dc55d6..fe49f9005 100644 --- a/webcit/html2html.c +++ b/webcit/html2html.c @@ -296,10 +296,10 @@ void output_html(const char *supplied_charset, int treat_as_wiki, int msgnum, St && (strcasecmp(charset, "UTF-8")) && (strcasecmp(charset, "")) ) { - syslog(9, "Converting %s to UTF-8\n", charset); + syslog(LOG_DEBUG, "Converting %s to UTF-8\n", charset); ctdl_iconv_open("UTF-8", charset, &ic); if (ic == (iconv_t)(-1) ) { - syslog(5, "%s:%d iconv_open() failed: %s\n", + syslog(LOG_WARNING, "%s:%d iconv_open() failed: %s\n", __FILE__, __LINE__, strerror(errno)); } } @@ -414,9 +414,9 @@ void output_html(const char *supplied_charset, int treat_as_wiki, int msgnum, St * and then ended the message) */ if (!tag_end) { - syslog(9, "tag_end is null and ptr is:\n"); - syslog(9, "%s\n", ptr); - syslog(9, "Theoretical bytes remaining: %d\n", (int)(msgend - ptr)); + syslog(LOG_DEBUG, "tag_end is null and ptr is:\n"); + syslog(LOG_DEBUG, "%s\n", ptr); + syslog(LOG_DEBUG, "Theoretical bytes remaining: %d\n", (int)(msgend - ptr)); } src=strstr(ptr, "src=\"cid:"); @@ -641,7 +641,7 @@ void url(char *buf, size_t bufsize) start = NULL; len = strlen(buf); if (len > bufsize) { - syslog(1, "URL: content longer than buffer!"); + syslog(LOG_WARNING, "URL: content longer than buffer!"); return; } end = buf + len; @@ -677,7 +677,7 @@ void url(char *buf, size_t bufsize) UrlLen = end - start; if (UrlLen > sizeof(urlbuf)){ - syslog(1, "URL: content longer than buffer!"); + syslog(LOG_WARNING, "URL: content longer than buffer!"); return; } memcpy(urlbuf, start, UrlLen); @@ -690,7 +690,7 @@ void url(char *buf, size_t bufsize) "%ca href=%c%s%c TARGET=%c%s%c%c%s%c/A%c", LB, QU, urlbuf, QU, QU, TARGET, QU, RB, urlbuf, LB, RB); if (outpos >= sizeof(outbuf) - Offset) { - syslog(1, "URL: content longer than buffer!"); + syslog(LOG_WARNING, "URL: content longer than buffer!"); return; } @@ -698,7 +698,7 @@ void url(char *buf, size_t bufsize) if (TrailerLen > 0) memcpy(outbuf + Offset + outpos, end, TrailerLen); if (Offset + outpos + TrailerLen > bufsize) { - syslog(1, "URL: content longer than buffer!"); + syslog(LOG_WARNING, "URL: content longer than buffer!"); return; } memcpy (buf, outbuf, Offset + outpos + TrailerLen); diff --git a/webcit/ical_dezonify.c b/webcit/ical_dezonify.c index c50f75621..935ae74dc 100644 --- a/webcit/ical_dezonify.c +++ b/webcit/ical_dezonify.c @@ -24,11 +24,11 @@ icaltimezone *get_default_icaltimezone(void) { zone = icaltimezone_get_builtin_timezone(default_zone_name); } if (!zone) { - syslog(1, "Unable to load '%s' time zone. Defaulting to UTC.\n", default_zone_name); + syslog(LOG_WARNING, "Unable to load '%s' time zone. Defaulting to UTC.\n", default_zone_name); zone = icaltimezone_get_utc_timezone(); } if (!zone) { - syslog(1, "Unable to load UTC time zone!\n"); + syslog(LOG_EMERG, "Unable to load UTC time zone!\n"); } return zone; } @@ -64,19 +64,19 @@ void ical_dezonify_backend(icalcomponent *cal, /* Convert it to an icaltimezone type. */ if (tzid != NULL) { #ifdef DBG_ICAL - syslog(9, " * Stringy supplied timezone is: '%s'\n", tzid); + syslog(LOG_DEBUG, " * Stringy supplied timezone is: '%s'\n", tzid); #endif if ( (!strcasecmp(tzid, "UTC")) || (!strcasecmp(tzid, "GMT")) ) { utc_declared_as_tzid = 1; #ifdef DBG_ICAL - syslog(9, " * ...and we handle that internally.\n"); + syslog(LOG_DEBUG, " * ...and we handle that internally.\n"); #endif } else { /* try attached first */ t = icalcomponent_get_timezone(cal, tzid); #ifdef DBG_ICAL - syslog(9, " * ...and I %s have tzdata for that zone.\n", + syslog(LOG_DEBUG, " * ...and I %s have tzdata for that zone.\n", (t ? "DO" : "DO NOT") ); #endif @@ -85,7 +85,7 @@ void ical_dezonify_backend(icalcomponent *cal, t = icaltimezone_get_builtin_timezone(tzid); #ifdef DBG_ICAL if (t) { - syslog(9, " * Using system tzdata!\n"); + syslog(LOG_DEBUG, " * Using system tzdata!\n"); } #endif } @@ -113,18 +113,18 @@ void ical_dezonify_backend(icalcomponent *cal, } #ifdef DBG_ICAL - syslog(9, " * Was: %s\n", icaltime_as_ical_string(TheTime)); + syslog(LOG_DEBUG, " * Was: %s\n", icaltime_as_ical_string(TheTime)); #endif if (TheTime.is_utc) { #ifdef DBG_ICAL - syslog(9, " * This property is ALREADY UTC.\n"); + syslog(LOG_DEBUG, " * This property is ALREADY UTC.\n"); #endif } else if (utc_declared_as_tzid) { #ifdef DBG_ICAL - syslog(9, " * Replacing '%s' TZID with 'Z' suffix.\n", tzid); + syslog(LOG_DEBUG, " * Replacing '%s' TZID with 'Z' suffix.\n", tzid); #endif TheTime.is_utc = 1; } @@ -133,12 +133,12 @@ void ical_dezonify_backend(icalcomponent *cal, /* Do the conversion. */ if (t != NULL) { #ifdef DBG_ICAL - syslog(9, " * Timezone prop found. Converting to UTC.\n"); + syslog(LOG_DEBUG, " * Timezone prop found. Converting to UTC.\n"); #endif } else { #ifdef DBG_ICAL - syslog(9, " * Converting default timezone to UTC.\n"); + syslog(LOG_DEBUG, " * Converting default timezone to UTC.\n"); #endif } @@ -151,7 +151,7 @@ void ical_dezonify_backend(icalcomponent *cal, icalproperty_remove_parameter_by_kind(prop, ICAL_TZID_PARAMETER); #ifdef DBG_ICAL - syslog(9, " * Now: %s\n", icaltime_as_ical_string(TheTime)); + syslog(LOG_DEBUG, " * Now: %s\n", icaltime_as_ical_string(TheTime)); #endif /* Now add the converted property back in. */ @@ -219,7 +219,7 @@ void ical_dezonify(icalcomponent *cal) { icalcomponent *vt = NULL; #ifdef DBG_ICAL - syslog(9, "ical_dezonify() started\n"); + syslog(LOG_DEBUG, "ical_dezonify() started\n"); #endif /* Convert all times to UTC */ @@ -233,7 +233,7 @@ void ical_dezonify(icalcomponent *cal) { } #ifdef DBG_ICAL - syslog(9, "ical_dezonify() completed\n"); + syslog(LOG_DEBUG, "ical_dezonify() completed\n"); #endif } diff --git a/webcit/ical_subst.c b/webcit/ical_subst.c index 01e795829..0f64fde72 100644 --- a/webcit/ical_subst.c +++ b/webcit/ical_subst.c @@ -434,7 +434,7 @@ HashList *iterate_FindConflict(StrBuf *Target, WCTemplputParams *TP) } } FreeStrBuf(&Line); - syslog(9, "...done.\n"); + syslog(LOG_DEBUG, "...done.\n"); return Conflicts; } diff --git a/webcit/inetconf.c b/webcit/inetconf.c index bbba2eece..15cd5d8e8 100644 --- a/webcit/inetconf.c +++ b/webcit/inetconf.c @@ -73,7 +73,7 @@ void load_inetconf(void) GetHash(WCC->InetCfg, ChrPtr(CfgToken), StrLength(CfgToken), &vHash); Hash = (HashList*) vHash; if (Hash == NULL) { - syslog(1, "ERROR Loading inet config line: [%s]\n", + syslog(LOG_WARNING, "ERROR Loading inet config line: [%s]\n", ChrPtr(Buf)); FreeStrBuf(&Value); continue; diff --git a/webcit/locate_host.c b/webcit/locate_host.c index 72a73cca7..d015f53f5 100644 --- a/webcit/locate_host.c +++ b/webcit/locate_host.c @@ -27,5 +27,5 @@ void locate_host(StrBuf *tbuf, int client_socket) getpeername(client_socket, (struct sockaddr *)&clientaddr, &addrlen); getnameinfo((struct sockaddr *)&clientaddr, addrlen, clienthost, sizeof(clienthost), NULL, 0, 0); StrBufAppendBufPlain(tbuf, clienthost, -1, 0); - syslog(9, "Client is at %s\n", clienthost); + syslog(LOG_DEBUG, "Client is at %s\n", clienthost); } diff --git a/webcit/messages.c b/webcit/messages.c index dec8d6676..ebc4e41f8 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -531,7 +531,7 @@ message_summary *ReadOneMessageSummary(StrBuf *RawMessage, const char *DefaultSu StrBufCutLeft(Buf, nBuf + 1); Eval->f(Msg, Buf); } - else syslog(1, "Don't know how to handle Message Headerline [%s]", ChrPtr(Buf)); + else syslog(LOG_INFO, "Don't know how to handle Message Headerline [%s]", ChrPtr(Buf)); } return Msg; } @@ -1054,7 +1054,7 @@ void post_message(void) StrBuf_ServGetln(Buf); if (GetServerStatusMsg(Buf, NULL, 1, 2) != 2) { /* You probably don't even have a dumb Drafts folder */ - syslog(9, "%s:%d: server save to drafts error: %s\n", __FILE__, __LINE__, ChrPtr(Buf) + 4); + syslog(LOG_DEBUG, "%s:%d: server save to drafts error: %s\n", __FILE__, __LINE__, ChrPtr(Buf) + 4); AppendImportantMessage(_("Saved to Drafts failed: "), -1); display_enter(); FreeStrBuf(&Buf); @@ -1128,7 +1128,7 @@ void post_message(void) } else { - syslog(9, "%s\n", ChrPtr(CmdBuf)); + syslog(LOG_DEBUG, "%s\n", ChrPtr(CmdBuf)); serv_puts(ChrPtr(CmdBuf)); FreeStrBuf(&CmdBuf); @@ -1165,7 +1165,7 @@ void post_message(void) } dont_post = lbstr("postseq"); } else { - syslog(9, "%s:%d: server post error: %s", __FILE__, __LINE__, ChrPtr(Buf) + 4); + syslog(LOG_DEBUG, "%s:%d: server post error: %s", __FILE__, __LINE__, ChrPtr(Buf) + 4); AppendImportantMessage(ChrPtr(Buf) + 4, StrLength(Buf) - 4); display_enter(); if (saving_to_drafts) gotoroom(WCC->CurRoom.name); @@ -1220,16 +1220,16 @@ void upload_attachment(void) { void *v; wc_mime_attachment *att; - syslog(9, "upload_attachment()\n"); + syslog(LOG_DEBUG, "upload_attachment()\n"); wc_printf("upload_attachment()
\n"); if (WCC->upload_length <= 0) { - syslog(9, "ERROR no attachment was uploaded\n"); + syslog(LOG_DEBUG, "ERROR no attachment was uploaded\n"); wc_printf("ERROR no attachment was uploaded
\n"); return; } - syslog(9, "Client is uploading %d bytes\n", WCC->upload_length); + syslog(LOG_DEBUG, "Client is uploading %d bytes\n", WCC->upload_length); wc_printf("Client is uploading %d bytes
\n", WCC->upload_length); att = malloc(sizeof(wc_mime_attachment)); memset(att, 0, sizeof(wc_mime_attachment )); diff --git a/webcit/msg_renderers.c b/webcit/msg_renderers.c index 50a0f2271..dcb187912 100644 --- a/webcit/msg_renderers.c +++ b/webcit/msg_renderers.c @@ -870,7 +870,7 @@ void examine_content_type(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCh Hdr = (headereval*)vHdr; Hdr->evaluator(Msg, Value, FoundCharset); } - else syslog(1, "don't know how to handle content type sub-header[%s]\n", ChrPtr(Token)); + else syslog(LOG_WARNING, "don't know how to handle content type sub-header[%s]\n", ChrPtr(Token)); } FreeStrBuf(&Token); FreeStrBuf(&Value); @@ -1033,7 +1033,7 @@ void render_MAIL_text_plain(StrBuf *Target, WCTemplputParams *TP, StrBuf *FoundC else { ctdl_iconv_open("UTF-8", ChrPtr(cs), &ic); if (ic == (iconv_t)(-1) ) { - syslog(5, "%s:%d iconv_open(UTF-8, %s) failed: %s\n", + syslog(LOG_WARNING, "%s:%d iconv_open(UTF-8, %s) failed: %s\n", __FILE__, __LINE__, ChrPtr(Mime->Charset), strerror(errno)); } } diff --git a/webcit/paramhandling.c b/webcit/paramhandling.c index f5cc22bbc..a317ad39d 100644 --- a/webcit/paramhandling.c +++ b/webcit/paramhandling.c @@ -51,7 +51,7 @@ void ParseURLParams(StrBuf *url) } keylen = aptr - up - 1; /* -1 -> '=' */ if(keylen >= sizeof(u->url_key)) { - syslog(1, "invalid url_key from %s", ChrPtr(WCC->Hdr->HR.browser_host)); + syslog(LOG_WARNING, "invalid url_key from %s", ChrPtr(WCC->Hdr->HR.browser_host)); return; } @@ -59,7 +59,7 @@ void ParseURLParams(StrBuf *url) memcpy(u->url_key, up, keylen); u->url_key[keylen] = '\0'; if (keylen < 0) { - syslog(1, "invalid url_key from %s", ChrPtr(WCC->Hdr->HR.browser_host)); + syslog(LOG_WARNING, "invalid url_key from %s", ChrPtr(WCC->Hdr->HR.browser_host)); free(u); return; } @@ -71,7 +71,7 @@ void ParseURLParams(StrBuf *url) u->url_data = NewStrBufPlain(aptr, len); StrBufUnescape(u->url_data, 1); #ifdef DEBUG_URLSTRINGS - syslog(9, "%s = [%d] %s\n", + syslog(LOG_DEBUG, "%s = [%d] %s\n", u->url_key, StrLength(u->url_data), ChrPtr(u->url_data)); @@ -81,7 +81,7 @@ void ParseURLParams(StrBuf *url) len = bptr - aptr; u->url_data = NewStrBufPlain(aptr, len); StrBufUnescape(u->url_data, 1); - syslog(1, "REJECTED because of __ is internal only: %s = [%d] %s\n", + syslog(LOG_WARNING, "REJECTED because of __ is internal only: %s = [%d] %s\n", u->url_key, StrLength(u->url_data), ChrPtr(u->url_data)); @@ -318,7 +318,7 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp, long keylen; #ifdef DEBUG_URLSTRINGS - syslog(9, "upload_handler() name=%s, type=%s, len="SIZE_T_FMT, name, cbtype, length); + syslog(LOG_DEBUG, "upload_handler() name=%s, type=%s, len="SIZE_T_FMT, name, cbtype, length); #endif if (WCC->Hdr->urlstrings == NULL) WCC->Hdr->urlstrings = NewHash(1, NULL); @@ -335,7 +335,7 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp, Put(WCC->Hdr->urlstrings, u->url_key, keylen, u, free_url); } else { - syslog(1, "REJECTED because of __ is internal only: %s = [%d] %s\n", + syslog(LOG_INFO, "REJECTED because of __ is internal only: %s = [%d] %s\n", u->url_key, StrLength(u->url_data), ChrPtr(u->url_data)); @@ -343,7 +343,7 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp, free_url(u); } #ifdef DEBUG_URLSTRINGS - syslog(9, "Key: <%s> len: [%d] Data: <%s>", + syslog(LOG_DEBUG, "Key: <%s> len: [%d] Data: <%s>", u->url_key, StrLength(u->url_data), ChrPtr(u->url_data)); @@ -357,7 +357,7 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp, WCC->upload_filename = NewStrBufPlain(filename, -1); safestrncpy(WCC->upload_content_type, cbtype, sizeof(WC->upload_content_type)); #ifdef DEBUG_URLSTRINGS - syslog(9, "File: <%s> len: [%ld]", filename, length); + syslog(LOG_DEBUG, "File: <%s> len: [%ld]", filename, length); #endif } @@ -370,7 +370,7 @@ void PutBstr(const char *key, long keylen, StrBuf *Value) wcsession *WCC = WC; if(keylen >= sizeof(u->url_key)) { - syslog(1, "invalid url_key from %s", ChrPtr(WCC->Hdr->HR.browser_host)); + syslog(LOG_WARNING, "invalid url_key from %s", ChrPtr(WCC->Hdr->HR.browser_host)); FreeStrBuf(&Value); return; } diff --git a/webcit/roomlist.c b/webcit/roomlist.c index 869a594fa..2b282ff72 100644 --- a/webcit/roomlist.c +++ b/webcit/roomlist.c @@ -869,13 +869,13 @@ int ConditionalRoomIsRESTSubRoom(StrBuf *Target, WCTemplputParams *TP) urlp = GetCount(WCC->Directory); delta = Folder->nRoomNameParts - urlp + 1; - syslog(0, "\n->%s: %d - %ld ", + syslog(LOG_DEBUG, "\n->%s: %d - %ld ", ChrPtr(Folder->name), urlp, Folder->nRoomNameParts); /* list only the floors which are in relation to the dav_depth header */ if (WCC->Hdr->HR.dav_depth != delta) { - syslog(0, "1\n"); + syslog(LOG_DEBUG, "1\n"); return 0; } @@ -895,7 +895,7 @@ int ConditionalRoomIsRESTSubRoom(StrBuf *Target, WCTemplputParams *TP) { DeleteHashPos(&it); - syslog(0, "3\n"); + syslog(LOG_DEBUG, "3\n"); return 0; } Dir = (StrBuf*) vDir; @@ -903,7 +903,7 @@ int ConditionalRoomIsRESTSubRoom(StrBuf *Target, WCTemplputParams *TP) ChrPtr(Dir)) != 0) { DeleteHashPos(&it); - syslog(0, "4\n"); + syslog(LOG_DEBUG, "4\n"); return 0; } } @@ -917,7 +917,7 @@ int ConditionalRoomIsRESTSubRoom(StrBuf *Target, WCTemplputParams *TP) { DeleteHashPos(&it); - syslog(0, "5\n"); + syslog(LOG_DEBUG, "5\n"); return WCC->Hdr->HR.dav_depth == 1; } DeleteHashPos(&it); diff --git a/webcit/roomops.c b/webcit/roomops.c index 2c4477657..66efe3faa 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -67,7 +67,7 @@ void _DBG_QR(long QR) i = i << 1; j++; } - syslog(9, "DBG: QR-Vec [%ld] [%s]\n", QR, ChrPtr(QRVec)); + syslog(LOG_DEBUG, "DBG: QR-Vec [%ld] [%s]\n", QR, ChrPtr(QRVec)); FreeStrBuf(&QRVec); } @@ -90,7 +90,7 @@ void _DBG_QR2(long QR2) i = i << 1; j++; } - syslog(9, "DBG: QR2-Vec [%ld] [%s]\n", QR2, ChrPtr(QR2Vec)); + syslog(LOG_DEBUG, "DBG: QR2-Vec [%ld] [%s]\n", QR2, ChrPtr(QR2Vec)); FreeStrBuf(&QR2Vec); } diff --git a/webcit/roomviews.c b/webcit/roomviews.c index ac59c5b21..81829502c 100644 --- a/webcit/roomviews.c +++ b/webcit/roomviews.c @@ -93,7 +93,7 @@ int ConditionalRoomHasGroupdavContent(StrBuf *Target, WCTemplputParams *TP) { folder *Folder = (folder *)CTX(CTX_ROOMS); - syslog(0, "-> %s: %d\n", ChrPtr(Folder->name), Folder->view); + syslog(LOG_DEBUG, "-> %s: %d\n", ChrPtr(Folder->name), Folder->view); return ((Folder->view == VIEW_CALENDAR) || (Folder->view == VIEW_TASKS) || diff --git a/webcit/scripts/mk_module_init.sh b/webcit/scripts/mk_module_init.sh index ae1cd3751..19a29d163 100755 --- a/webcit/scripts/mk_module_init.sh +++ b/webcit/scripts/mk_module_init.sh @@ -157,7 +157,7 @@ HOOKNAME=`echo $HOOK |sed "s;ServerStartModule_;;"` # Add this entry point to the .c file cat <> $C_FILE #ifdef DBG_PRINNT_HOOKS_AT_START - syslog(CTDL_INFO, "Starting $HOOKNAME\n"); + syslog(LOG_DEBUG, "Starting $HOOKNAME\n"); #endif $HOOK(); EOF @@ -189,7 +189,7 @@ for HOOK in $INIT_FUNCS; do # Add this entry point to the .c file cat <> $C_FILE #ifdef DBG_PRINNT_HOOKS_AT_START - syslog(CTDL_INFO, "Initializing $HOOKNAME\n"); + syslog(LOG_DEBUG, "Initializing $HOOKNAME\n"); #endif $HOOK(); EOF @@ -220,7 +220,7 @@ for HOOK in $INIT2_FUNCS; do # Add this entry point to the .c file cat <> $C_FILE #ifdef DBG_PRINNT_HOOKS_AT_START - syslog(CTDL_INFO, "Initializing $HOOKNAME\n"); + syslog(LOG_DEBUG, "Initializing $HOOKNAME\n"); #endif $HOOK(); EOF @@ -252,7 +252,7 @@ HOOKNAME=`echo $HOOK |sed "s;ServerShutdownModule_;;"` # Add this entry point to the .c file cat <> $C_FILE #ifdef DBG_PRINNT_HOOKS_AT_START - syslog(CTDL_INFO, "Shutting down $HOOKNAME\n"); + syslog(LOG_DEBUG, "Shutting down $HOOKNAME\n"); #endif $HOOK(); EOF @@ -285,7 +285,7 @@ HOOKNAME=`echo $HOOK |sed "s;SessionNewModule_;;"` # Add this entry point to the .c file cat <> $C_FILE #ifdef DBG_PRINNT_HOOKS_AT_START - syslog(CTDL_INFO, "Initializing $HOOKNAME\n"); + syslog(LOG_DEBUG, "Initializing $HOOKNAME\n"); #endif $HOOK(sess); EOF @@ -317,7 +317,7 @@ HOOKNAME=`echo $HOOK |sed "s;SessionAttachModule_;;"` # Add this entry point to the .c file cat <> $C_FILE #ifdef DBG_PRINNT_HOOKS_AT_START - syslog(CTDL_INFO, "Attaching Session; $HOOKNAME\n"); + syslog(LOG_DEBUG, "Attaching Session; $HOOKNAME\n"); #endif $HOOK(sess); EOF @@ -349,7 +349,7 @@ HOOKNAME=`echo $HOOK |sed "s;SessionDetachModule_;;"` # Add this entry point to the .c file cat <> $C_FILE #ifdef DBG_PRINNT_HOOKS_AT_START - syslog(CTDL_INFO, "Initializing $HOOKNAME\n"); + syslog(LOG_DEBUG, "Initializing $HOOKNAME\n"); #endif $HOOK(sess); EOF @@ -382,7 +382,7 @@ HOOKNAME=`echo $HOOK |sed "s;SessionDestroyModule_;;"` # Add this entry point to the .c file cat <> $C_FILE #ifdef DBG_PRINNT_HOOKS_AT_START - syslog(CTDL_INFO, "Initializing $HOOKNAME\n"); + syslog(LOG_DEBUG, "Initializing $HOOKNAME\n"); #endif $HOOK(*sess); EOF @@ -419,7 +419,7 @@ HOOKNAME=`echo $HOOK |sed "s;HttpNewModule_;;"` # Add this entry point to the .c file cat <> $C_FILE #ifdef DBG_PRINNT_HOOKS_AT_START - syslog(CTDL_INFO, "NEW $HOOKNAME\n"); + syslog(LOG_DEBUG, "NEW $HOOKNAME\n"); #endif $HOOK(httpreq); EOF @@ -447,7 +447,7 @@ HOOKNAME=`echo $HOOK |sed "s;HttpDetachModule_;;"` # Add this entry point to the .c file cat <> $C_FILE #ifdef DBG_PRINNT_HOOKS_AT_START - syslog(CTDL_INFO, "Detaching $HOOKNAME\n"); + syslog(LOG_DEBUG, "Detaching $HOOKNAME\n"); #endif $HOOK(httpreq); EOF @@ -476,7 +476,7 @@ HOOKNAME=`echo $HOOK |sed "s;HttpDestroyModule_;;"` # Add this entry point to the .c file cat <> $C_FILE #ifdef DBG_PRINNT_HOOKS_AT_START - syslog(CTDL_INFO, "Destructing $HOOKNAME\n"); + syslog(LOG_DEBUG, "Destructing $HOOKNAME\n"); #endif $HOOK(httpreq); EOF diff --git a/webcit/serv_func.c b/webcit/serv_func.c index 6dcf79cd9..f03ff442a 100644 --- a/webcit/serv_func.c +++ b/webcit/serv_func.c @@ -64,7 +64,7 @@ ServInfo *get_serv_info(StrBuf *browser_host, StrBuf *user_agent) ); StrBuf_ServGetln(Buf); if (GetServerStatus(Buf, NULL) != 2) { - syslog(0, "get_serv_info(IDEN): unexpected answer [%s]\n", + syslog(LOG_WARNING, "get_serv_info(IDEN): unexpected answer [%s]\n", ChrPtr(Buf)); FreeStrBuf(&Buf); return NULL; @@ -78,7 +78,7 @@ ServInfo *get_serv_info(StrBuf *browser_host, StrBuf *user_agent) serv_puts("ICAL sgi|1"); StrBuf_ServGetln(Buf); if (GetServerStatus(Buf, NULL) != 2) { - syslog(0, "get_serv_info(ICAL sgi|1): unexpected answer [%s]\n", + syslog(LOG_WARNING, "get_serv_info(ICAL sgi|1): unexpected answer [%s]\n", ChrPtr(Buf)); FreeStrBuf(&Buf); return NULL; @@ -88,7 +88,7 @@ ServInfo *get_serv_info(StrBuf *browser_host, StrBuf *user_agent) serv_puts("INFO"); StrBuf_ServGetln(Buf); if (GetServerStatus(Buf, NULL) != 1) { - syslog(0, "get_serv_info(INFO sgi|1): unexpected answer [%s]\n", + syslog(LOG_WARNING, "get_serv_info(INFO sgi|1): unexpected answer [%s]\n", ChrPtr(Buf)); FreeStrBuf(&Buf); return NULL; diff --git a/webcit/siteconfig.c b/webcit/siteconfig.c index 1f513d81a..2454f00d8 100644 --- a/webcit/siteconfig.c +++ b/webcit/siteconfig.c @@ -115,7 +115,7 @@ void LoadZoneFiles(void) Put(ZoneHash, HKEY("UTC"), ZName, HFreeStrBuf); zones = icaltimezone_get_builtin_timezones(); for (z = 0; z < zones->num_elements; ++z) { - /* syslog(9, "Location: %-40s tzid: %s\n", + /* syslog(LOG_DEBUG, "Location: %-40s tzid: %s\n", icaltimezone_get_location(icalarray_element_at(zones, z)), icaltimezone_get_tzid(icalarray_element_at(zones, z)) ); */ diff --git a/webcit/static.c b/webcit/static.c index 9a91e2676..a1a6251fc 100644 --- a/webcit/static.c +++ b/webcit/static.c @@ -59,7 +59,7 @@ unsigned char OnePixelGif[37] = { HashList *StaticFilemappings[4] = {NULL, NULL, NULL, NULL}; /* { - syslog(9, "Suspicious request. Ignoring."); + syslog(LOG_DEBUG, "Suspicious request. Ignoring."); hprintf("HTTP/1.1 404 Security check failed\r\n"); hprintf("Content-Type: text/plain\r\n\r\n"); wc_printf("You have sent a malformed or invalid request.\r\n"); @@ -94,7 +94,7 @@ void output_static(const char *what) content_type = GuessMimeByFilename(what, len); fd = open(what, O_RDONLY); if (fd <= 0) { - syslog(9, "output_static('%s') [%s] -- NOT FOUND --\n", what, ChrPtr(WC->Hdr->this_page)); + syslog(LOG_INFO, "output_static('%s') [%s] -- NOT FOUND --\n", what, ChrPtr(WC->Hdr->this_page)); if (strstr(content_type, "image/") != NULL) { output_error_pic("the file you requsted is gone.", strerror(errno)); @@ -109,7 +109,7 @@ void output_static(const char *what) } } else { if (fstat(fd, &statbuf) == -1) { - syslog(9, "output_static('%s') -- FSTAT FAILED --\n", what); + syslog(LOG_INFO, "output_static('%s') -- FSTAT FAILED --\n", what); if (strstr(content_type, "image/") != NULL) { output_error_pic("Stat failed!", strerror(errno)); @@ -131,7 +131,7 @@ void output_static(const char *what) if (StrBufReadBLOB(WC->WBuf, &fd, 1, bytes, &Err) < 0) { if (fd > 0) close(fd); - syslog(9, "output_static('%s') -- FREAD FAILED (%s) --\n", what, strerror(errno)); + syslog(LOG_INFO, "output_static('%s') -- FREAD FAILED (%s) --\n", what, strerror(errno)); hprintf("HTTP/1.1 500 internal server error \r\n"); hprintf("Content-Type: text/plain\r\n"); end_burst(); @@ -260,7 +260,7 @@ int LoadStaticDir(const char *DirName, HashList *DirList, const char *RelDir) StrBufAppendBufPlain(OneWebName, filedir_entry->d_name, d_namelen, 0); Put(DirList, SKEY(OneWebName), FileName, HFreeStrBuf); - /* syslog(9, "[%s | %s]\n", ChrPtr(OneWebName), ChrPtr(FileName)); */ + /* syslog(LOG_DEBUG, "[%s | %s]\n", ChrPtr(OneWebName), ChrPtr(FileName)); */ break; default: break; @@ -307,7 +307,7 @@ void output_static_safe(HashList *DirList) output_static(ChrPtr(File)); } else { - syslog(1, "output_static_safe() file %s not found. \n", + syslog(LOG_INFO, "output_static_safe() file %s not found. \n", ChrPtr(WCC->Hdr->HR.ReqLine)); MimeType = GuessMimeByFilename(SKEY(WCC->Hdr->HR.ReqLine)); if (strstr(MimeType, "image/") != NULL) diff --git a/webcit/subst.c b/webcit/subst.c index b119ce18c..6c80802c2 100644 --- a/webcit/subst.c +++ b/webcit/subst.c @@ -243,7 +243,7 @@ void LogTemplateError (StrBuf *Target, const char *Type, int ErrorPos, WCTemplpu } if (TP->Tokens != NULL) { - syslog(1, "%s [%s] (in '%s' line %ld); %s; [%s]\n", + syslog(LOG_WARNING, "%s [%s] (in '%s' line %ld); %s; [%s]\n", Type, Err, ChrPtr(TP->Tokens->FileName), @@ -253,7 +253,7 @@ void LogTemplateError (StrBuf *Target, const char *Type, int ErrorPos, WCTemplpu } else { - syslog(1, "%s: %s;\n", + syslog(LOG_WARNING, "%s: %s;\n", Type, ChrPtr(Error)); } @@ -317,7 +317,7 @@ void LogTemplateError (StrBuf *Target, const char *Type, int ErrorPos, WCTemplpu FreeStrBuf(&Error); /* if (dbg_backtrace_template_errors) - wc_backtrace(); + wc_backtrace(LOG_DEBUG); */ } @@ -335,7 +335,7 @@ void LogError (StrBuf *Target, const char *Type, const char *Format, ...) StrBufVAppendPrintf(Error, Format, arg_ptr); va_end(arg_ptr); - syslog(1, "%s", ChrPtr(Error)); + syslog(LOG_WARNING, "%s", ChrPtr(Error)); WCC = WC; if (WCC->WFBuf == NULL) WCC->WFBuf = NewStrBuf(); @@ -349,7 +349,7 @@ void LogError (StrBuf *Target, const char *Type, const char *Format, ...) FreeStrBuf(&Error); /* if (dbg_backtrace_template_errors) - wc_backtrace(); + wc_backtrace(LOG_DEBUG); */ } @@ -590,7 +590,7 @@ long GetTemplateTokenNumber(StrBuf *Target, WCTemplputParams *TP, int N, long df LogTemplateError(Target, "TokenParameter", N, TP, "invalid token %d. this shouldn't have come till here.\n", N); - wc_backtrace(); + wc_backtrace(LOG_DEBUG); return 0; } @@ -886,7 +886,7 @@ int GetNextParameter(StrBuf *Buf, } pche = pch; if (*pch != quote) { - syslog(1, "Error (in '%s' line %ld); " + syslog(LOG_WARNING, "Error (in '%s' line %ld); " "evaluating template param [%s] in Token [%s]\n", ChrPtr(pTmpl->FileName), Tokens->Line, @@ -900,7 +900,7 @@ int GetNextParameter(StrBuf *Buf, else { StrBufPeek(Buf, pch, -1, '\0'); if (LoadTemplates > 1) { - syslog(1, + syslog(LOG_DEBUG, "DBG: got param [%s] "SIZE_T_FMT" "SIZE_T_FMT"\n", pchs, pche - pchs, strlen(pchs) ); @@ -932,7 +932,7 @@ int GetNextParameter(StrBuf *Buf, else { Parm->lvalue = 0; /* TODO whUT? - syslog(1, "Error (in '%s' line %ld); " + syslog(LOG_DEBUG, "Error (in '%s' line %ld); " "evaluating long template param [%s] in Token [%s]\n", ChrPtr(pTmpl->FileName), Tokens->Line, @@ -1400,13 +1400,13 @@ void *load_template(StrBuf *Target, WCTemplate *NewTemplate) fd = open(ChrPtr(NewTemplate->FileName), O_RDONLY); if (fd <= 0) { - syslog(1, "ERROR: could not open template '%s' - %s\n", + syslog(LOG_WARNING, "ERROR: could not open template '%s' - %s\n", ChrPtr(NewTemplate->FileName), strerror(errno)); return NULL; } if (fstat(fd, &statbuf) == -1) { - syslog(1, "ERROR: could not stat template '%s' - %s\n", + syslog(LOG_WARNING, "ERROR: could not stat template '%s' - %s\n", ChrPtr(NewTemplate->FileName), strerror(errno)); return NULL; } @@ -1414,7 +1414,7 @@ void *load_template(StrBuf *Target, WCTemplate *NewTemplate) NewTemplate->Data = NewStrBufPlain(NULL, statbuf.st_size + 1); if (StrBufReadBLOB(NewTemplate->Data, &fd, 1, statbuf.st_size, &Err) < 0) { close(fd); - syslog(1, "ERROR: reading template '%s' - %s
\n", + syslog(LOG_WARNING, "ERROR: reading template '%s' - %s
\n", ChrPtr(NewTemplate->FileName), strerror(errno)); return NULL; } @@ -1619,7 +1619,7 @@ int LoadTemplateDir(const StrBuf *DirName, HashList *big, const StrBuf *BaseKey) StrBufAppendBufPlain(Key, filedir_entry->d_name, MinorPtr - filedir_entry->d_name, 0); if (LoadTemplates >= 1) - syslog(1, "%s %s\n", ChrPtr(FileName), ChrPtr(Key)); + syslog(LOG_DEBUG, "%s %s\n", ChrPtr(FileName), ChrPtr(Key)); prepare_template(FileName, Key, big); default: break; @@ -1714,7 +1714,7 @@ int EvaluateToken(StrBuf *Target, int state, WCTemplputParams **TPP) WCTemplputParams *TP = *TPP; /* much output, since pName is not terminated... - syslog(1,"Doing token: %s\n",Token->pName); + syslog(LOG_DEBUG,"Doing token: %s\n",Token->pName); */ switch (TP->Tokens->Flags) { @@ -1819,7 +1819,7 @@ const StrBuf *ProcessTemplate(WCTemplate *Tmpl, StrBuf *Target, WCTemplputParams if (LoadTemplates != 0) { if (LoadTemplates > 1) - syslog(1, "DBG: ----- loading: [%s] ------ \n", + syslog(LOG_DEBUG, "DBG: ----- loading: [%s] ------ \n", ChrPtr(Tmpl->FileName)); pTmpl = duplicate_template(Tmpl); if(load_template(Target, pTmpl) == NULL) { @@ -1931,14 +1931,14 @@ const StrBuf *DoTemplate(const char *templatename, long len, StrBuf *Target, WCT if (len == 0) { - syslog(1, "Can't to load a template with empty name!\n"); + syslog(LOG_WARNING, "Can't to load a template with empty name!\n"); StrBufAppendPrintf(Target, "
\nCan't to load a template with empty name!\n
"); return NULL; } if (!GetHash(StaticLocal, templatename, len, &vTmpl) && !GetHash(Static, templatename, len, &vTmpl)) { - syslog(1, "didn't find Template [%s] %ld %ld\n", templatename, len , (long)strlen(templatename)); + syslog(LOG_WARNING, "didn't find Template [%s] %ld %ld\n", templatename, len , (long)strlen(templatename)); StrBufAppendPrintf(Target, "
\ndidn't find Template [%s] %ld %ld\n
", templatename, len, (long)strlen(templatename)); @@ -2266,7 +2266,7 @@ int EvaluateConditional(StrBuf *Target, int Neg, int state, WCTemplputParams **T rc = TP->Tokens->Params[1]->lvalue; if (LoadTemplates > 5) - syslog(1, "<%s> : %d %d==%d\n", + syslog(LOG_DEBUG, "<%s> : %d %d==%d\n", ChrPtr(TP->Tokens->FlatToken), rc, res, Neg); @@ -2590,7 +2590,7 @@ void RegisterSortFunc(const char *name, long len, NewSort->GroupChange = GroupChange; NewSort->ContextType = ContextType; if (ContextType == CTX_NONE) { - syslog(1, "sorting requires a context. CTX_NONE won't make it.\n"); + syslog(LOG_WARNING, "sorting requires a context. CTX_NONE won't make it.\n"); exit(1); } @@ -2639,7 +2639,7 @@ CompareFunc RetrieveSort(WCTemplputParams *TP, LogTemplateError( NULL, "Sorting", ERR_PARM1, TP, "Illegal default sort: [%s]", Default); - wc_backtrace(); + wc_backtrace(LOG_WARNING); } } SortBy = (SortStruct*)vSortBy; @@ -2884,7 +2884,7 @@ void dbg_print_longvector(long *LongVector) StrBufAppendPrintf(Buf, "%d: %ld]\n", i, LongVector[i]); } - syslog(1, "%s", ChrPtr(Buf)); + syslog(LOG_DEBUG, "%s", ChrPtr(Buf)); FreeStrBuf(&Buf); } diff --git a/webcit/sysdep.c b/webcit/sysdep.c index 0c0ac90e2..6c0efa49b 100644 --- a/webcit/sysdep.c +++ b/webcit/sysdep.c @@ -104,7 +104,7 @@ void InitialiseSemaphores(void) if (pipe(ExitPipe)) { - syslog(2, "Failed to open exit pipe: %d [%s]\n", + syslog(LOG_WARNING, "Failed to open exit pipe: %d [%s]\n", errno, strerror(errno)); @@ -195,17 +195,17 @@ void worker_entry(void) if (shutdown == 1) {/* we're the one to cleanup the mess. */ http_destroy_modules(&Hdr); - syslog(2, "I'm master shutdown: tagging sessions to be killed.\n"); + syslog(LOG_DEBUG, "I'm master shutdown: tagging sessions to be killed.\n"); shutdown_sessions(); - syslog(2, "master shutdown: waiting for others\n"); + syslog(LOG_DEBUG, "master shutdown: waiting for others\n"); sleeeeeeeeeep(1); /* wait so some others might finish... */ - syslog(2, "master shutdown: cleaning up sessions\n"); + syslog(LOG_DEBUG, "master shutdown: cleaning up sessions\n"); do_housekeeping(); - syslog(2, "master shutdown: cleaning up libical\n"); + syslog(LOG_DEBUG, "master shutdown: cleaning up libical\n"); ShutDownWebcit(); - syslog(2, "master shutdown exiting.\n"); + syslog(LOG_DEBUG, "master shutdown exiting.\n"); exit(0); } break; @@ -217,7 +217,7 @@ void worker_entry(void) /* Now do something. */ if (msock < 0) { if (ssock > 0) close (ssock); - syslog(2, "in between."); + syslog(LOG_DEBUG, "in between."); pthread_exit(NULL); } else { /* Got it? do some real work! */ @@ -239,11 +239,11 @@ void worker_entry(void) int fdflags; fdflags = fcntl(ssock, F_GETFL); if (fdflags < 0) - syslog(1, "unable to get server socket flags! %s \n", + syslog(LOG_WARNING, "unable to get server socket flags! %s \n", strerror(errno)); fdflags = fdflags | O_NONBLOCK; if (fcntl(ssock, F_SETFL, fdflags) < 0) - syslog(1, "unable to set server socket nonblocking flags! %s \n", + syslog(LOG_WARNING, "unable to set server socket nonblocking flags! %s \n", strerror(errno)); } @@ -273,7 +273,7 @@ void worker_entry(void) } while (!time_to_die); http_destroy_modules(&Hdr); - syslog(1, "Thread exiting.\n"); + syslog(LOG_DEBUG, "Thread exiting.\n"); pthread_exit(NULL); } @@ -284,7 +284,7 @@ void worker_entry(void) */ pid_t current_child; void graceful_shutdown_watcher(int signum) { - syslog(1, "Watcher thread exiting.\n"); + syslog(LOG_INFO, "Watcher thread exiting.\n"); write(ExitPipe[0], HKEY(" ")); kill(current_child, signum); if (signum != SIGHUP) @@ -301,7 +301,7 @@ void graceful_shutdown(int signum) { FILE *FD; int fd; - syslog(1, "WebCit is being shut down on signal %d.\n", signum); + syslog(LOG_INFO, "WebCit is being shut down on signal %d.\n", signum); fd = msock; msock = -1; time_to_die = 1; @@ -431,13 +431,13 @@ void spawn_another_worker_thread() * otherwise the MIME parser crashes on FreeBSD. */ if ((ret = pthread_attr_setstacksize(&attr, 1024 * 1024))) { - syslog(1, "pthread_attr_setstacksize: %s\n", strerror(ret)); + syslog(LOG_WARNING, "pthread_attr_setstacksize: %s\n", strerror(ret)); pthread_attr_destroy(&attr); } /* now create the thread */ if (pthread_create(&SessThread, &attr, (void *(*)(void *)) worker_entry, NULL) != 0) { - syslog(1, "Can't create thread: %s\n", strerror(errno)); + syslog(LOG_WARNING, "Can't create thread: %s\n", strerror(errno)); } /* free up the attributes */ @@ -487,7 +487,7 @@ webcit_calc_dirs_n_files(int relh, const char *basedir, int home, char *webcitdi ctdl_key_dir); /* we should go somewhere we can leave our coredump, if enabled... */ - syslog(9, "Changing directory to %s\n", socket_dir); + syslog(LOG_INFO, "Changing directory to %s\n", socket_dir); if (chdir(webcitdir) != 0) { perror("chdir"); } @@ -537,7 +537,7 @@ void drop_root(uid_t UID) /* * print the actual stack frame. */ -void wc_backtrace(void) +void wc_backtrace(long LogLevel) { #ifdef HAVE_BACKTRACE void *stack_frames[50]; @@ -549,9 +549,9 @@ void wc_backtrace(void) strings = backtrace_symbols(stack_frames, size); for (i = 0; i < size; i++) { if (strings != NULL) - syslog(1, "%s\n", strings[i]); + syslog(LogLevel, "%s\n", strings[i]); else - syslog(1, "%p\n", stack_frames[i]); + syslog(LogLevel, "%p\n", stack_frames[i]); } free(strings); #endif diff --git a/webcit/tasks.c b/webcit/tasks.c index a58edbb7b..d9afe93a1 100644 --- a/webcit/tasks.c +++ b/webcit/tasks.c @@ -504,7 +504,7 @@ void save_individual_task(icalcomponent *supplied_vtodo, long msgnum, char* from ); } /** Give this task a UID if it doesn't have one. */ - syslog(9, "Give this task a UID if it doesn't have one.\n"); + syslog(LOG_DEBUG, "Give this task a UID if it doesn't have one.\n"); if (icalcomponent_get_first_property(vtodo, ICAL_UID_PROPERTY) == NULL) { generate_uuid(buf); @@ -514,17 +514,17 @@ void save_individual_task(icalcomponent *supplied_vtodo, long msgnum, char* from } /* Increment the sequence ID */ - syslog(9, "Increment the sequence ID\n"); + syslog(LOG_DEBUG, "Increment the sequence ID\n"); while (prop = icalcomponent_get_first_property(vtodo, ICAL_SEQUENCE_PROPERTY), (prop != NULL) ) { i = icalproperty_get_sequence(prop); - syslog(9, "Sequence was %d\n", i); + syslog(LOG_DEBUG, "Sequence was %d\n", i); if (i > sequence) sequence = i; icalcomponent_remove_property(vtodo, prop); icalproperty_free(prop); } ++sequence; - syslog(9, "New sequence is %d. Adding...\n", sequence); + syslog(LOG_DEBUG, "New sequence is %d. Adding...\n", sequence); icalcomponent_add_property(vtodo, icalproperty_new_sequence(sequence) ); @@ -536,7 +536,7 @@ void save_individual_task(icalcomponent *supplied_vtodo, long msgnum, char* from * can't encapsulate something that may already be encapsulated * somewhere else. */ - syslog(9, "Encapsulating into a full VCALENDAR component\n"); + syslog(LOG_DEBUG, "Encapsulating into a full VCALENDAR component\n"); encaps = ical_encapsulate_subcomponent(icalcomponent_new_clone(vtodo)); /* Serialize it and save it to the message base */ diff --git a/webcit/tcp_sockets.c b/webcit/tcp_sockets.c index e163c9b57..2835344f4 100644 --- a/webcit/tcp_sockets.c +++ b/webcit/tcp_sockets.c @@ -25,7 +25,7 @@ long MaxRead = -1; /* should we do READ scattered or all at once? */ */ RETSIGTYPE timeout(int signum) { - syslog(1, "Connection timed out; unable to reach citserver\n"); + syslog(LOG_WARNING, "Connection timed out; unable to reach citserver\n"); /* no exit here, since we need to server the connection unreachable thing. exit(3); */ } @@ -44,12 +44,12 @@ int uds_connectsock(char *sockpath) s = socket(AF_UNIX, SOCK_STREAM, 0); if (s < 0) { - syslog(1, "Can't create socket [%s]: %s\n", sockpath, strerror(errno)); + syslog(LOG_WARNING, "Can't create socket [%s]: %s\n", sockpath, strerror(errno)); return(-1); } if (connect(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) { - syslog(1, "Can't connect [%s]: %s\n", sockpath, strerror(errno)); + syslog(LOG_WARNING, "Can't connect [%s]: %s\n", sockpath, strerror(errno)); close(s); return(-1); } @@ -75,7 +75,7 @@ int tcp_connectsock(char *host, char *service) if ((service == NULL) || IsEmptyStr(service)) return (-1); - syslog(9, "tcp_connectsock(%s,%s)\n", host, service); + syslog(LOG_DEBUG, "tcp_connectsock(%s,%s)\n", host, service); memset(&hints, 0x00, sizeof(hints)); hints.ai_flags = AI_NUMERICSERV; @@ -101,7 +101,7 @@ int tcp_connectsock(char *host, char *service) rc = getaddrinfo(host, service, &hints, &res); if (rc != 0) { - syslog(1, "%s: %s\n", host, gai_strerror(rc)); + syslog(LOG_DEBUG, "%s: %s\n", host, gai_strerror(rc)); freeaddrinfo(res); return(-1); } @@ -111,13 +111,13 @@ int tcp_connectsock(char *host, char *service) */ for (ai = res; ai != NULL; ai = ai->ai_next) { - if (ai->ai_family == AF_INET) syslog(9, "Trying IPv4\n"); - else if (ai->ai_family == AF_INET6) syslog(9, "Trying IPv6\n"); - else syslog(9, "This is going to fail.\n"); + if (ai->ai_family == AF_INET) syslog(LOG_DEBUG, "Trying IPv4\n"); + else if (ai->ai_family == AF_INET6) syslog(LOG_DEBUG, "Trying IPv6\n"); + else syslog(LOG_WARNING, "This is going to fail.\n"); s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); if (s < 0) { - syslog(1, "socket() failed: %s\n", strerror(errno)); + syslog(LOG_WARNING, "socket() failed: %s\n", strerror(errno)); freeaddrinfo(res); return(-1); } @@ -127,7 +127,7 @@ int tcp_connectsock(char *host, char *service) return(s); } else { - syslog(1, "connect() failed: %s\n", strerror(errno)); + syslog(LOG_WARNING, "connect() failed: %s\n", strerror(errno)); close(s); } } @@ -153,7 +153,7 @@ int serv_getln(char *strbuf, int bufsize) FlushStrBuf(WCC->MigrateReadLineBuf); strbuf[len] = '\0'; #ifdef SERV_TRACE - syslog(9, "%3d<<<%s\n", WC->serv_sock, strbuf); + syslog(LOG_DEBUG, "%3d<<<%s\n", WC->serv_sock, strbuf); #endif return len; } @@ -177,9 +177,9 @@ int StrBuf_ServGetln(StrBuf *buf) &ErrStr); if (rc < 0) { - syslog(1, "StrBuf_ServGetln(): Server connection broken: %s\n", + syslog(LOG_INFO, "StrBuf_ServGetln(): Server connection broken: %s\n", (ErrStr)?ErrStr:""); - wc_backtrace(); + wc_backtrace(LOG_INFO); if (WCC->serv_sock > 0) close(WCC->serv_sock); WCC->serv_sock = (-1); WCC->connected = 0; @@ -191,7 +191,7 @@ int StrBuf_ServGetln(StrBuf *buf) long pos = 0; if (WCC->ReadPos != NULL) pos = WCC->ReadPos - ChrPtr(WCC->ReadBuf); - syslog(9, "%3d<<<[%ld]%s\n", WC->serv_sock, pos, ChrPtr(buf)); + syslog(LOG_DEBUG, "%3d<<<[%ld]%s\n", WC->serv_sock, pos, ChrPtr(buf)); } #endif return rc; @@ -213,9 +213,9 @@ int StrBuf_ServGetBLOBBuffered(StrBuf *buf, long BlobSize) &ErrStr); if (rc < 0) { - syslog(1, "StrBuf_ServGetBLOBBuffered(): Server connection broken: %s\n", + syslog(LOG_INFO, "StrBuf_ServGetBLOBBuffered(): Server connection broken: %s\n", (ErrStr)?ErrStr:""); - wc_backtrace(); + wc_backtrace(LOG_INFO); if (WCC->serv_sock > 0) close(WCC->serv_sock); WCC->serv_sock = (-1); WCC->connected = 0; @@ -223,7 +223,7 @@ int StrBuf_ServGetBLOBBuffered(StrBuf *buf, long BlobSize) } #ifdef SERV_TRACE else - syslog(9, "%3d<<serv_sock, StrLength(buf)); + syslog(LOG_DEBUG, "%3d<<serv_sock, StrLength(buf)); #endif return rc; @@ -239,9 +239,9 @@ int StrBuf_ServGetBLOB(StrBuf *buf, long BlobSize) rc = StrBufReadBLOB(buf, &WCC->serv_sock, 1, BlobSize, &ErrStr); if (rc < 0) { - syslog(1, "StrBuf_ServGetBLOB(): Server connection broken: %s\n", + syslog(LOG_INFO, "StrBuf_ServGetBLOB(): Server connection broken: %s\n", (ErrStr)?ErrStr:""); - wc_backtrace(); + wc_backtrace(LOG_INFO); if (WCC->serv_sock > 0) close(WCC->serv_sock); WCC->serv_sock = (-1); WCC->connected = 0; @@ -249,7 +249,7 @@ int StrBuf_ServGetBLOB(StrBuf *buf, long BlobSize) } #ifdef SERV_TRACE else - syslog(9, "%3d<<serv_sock, StrLength(buf)); + syslog(LOG_DEBUG, "%3d<<serv_sock, StrLength(buf)); #endif return rc; @@ -273,12 +273,12 @@ void FlushReadBuf (void) pche = pch + len; if (WCC->ReadPos != pche) { - syslog(1, + syslog(LOG_EMERG, "ERROR: somebody didn't eat his soup! Remaing Chars: %ld [%s]\n", (long)(pche - WCC->ReadPos), pche ); - syslog(1, + syslog(LOG_EMERG, "--------------------------------------------------------------------------------\n" "Whole buf: [%s]\n" "--------------------------------------------------------------------------------\n", @@ -311,7 +311,7 @@ int serv_write(const char *buf, int nbytes) nbytes - bytes_written); if (retval < 1) { const char *ErrStr = strerror(errno); - syslog(1, "serv_write(): Server connection broken: %s\n", + syslog(LOG_INFO, "serv_write(): Server connection broken: %s\n", (ErrStr)?ErrStr:""); if (WCC->serv_sock > 0) close(WCC->serv_sock); WCC->serv_sock = (-1); @@ -332,7 +332,7 @@ int serv_write(const char *buf, int nbytes) int serv_puts(const char *string) { #ifdef SERV_TRACE - syslog(9, "%3d>>>%s\n", WC->serv_sock, string); + syslog(LOG_DEBUG, "%3d>>>%s\n", WC->serv_sock, string); #endif FlushReadBuf(); @@ -348,7 +348,7 @@ int serv_puts(const char *string) int serv_putbuf(const StrBuf *string) { #ifdef SERV_TRACE - syslog(9, "%3d>>>%s\n", WC->serv_sock, ChrPtr(string)); + syslog(LOG_DEBUG, "%3d>>>%s\n", WC->serv_sock, ChrPtr(string)); #endif FlushReadBuf(); @@ -381,7 +381,7 @@ int serv_printf(const char *format,...) buf[len] = '\0'; rc = serv_write(buf, len); #ifdef SERV_TRACE - syslog(9, ">>>%s", buf); + syslog(LOG_DEBUG, ">>>%s", buf); #endif return rc; } @@ -420,8 +420,8 @@ int serv_read_binary(StrBuf *Ret, size_t total_len, StrBuf *Buf) this_block = StrTol(Buf); rc = StrBuf_ServGetBLOBBuffered(Ret, this_block); if (rc < 0) { - syslog(1, "Server connection broken during download\n"); - wc_backtrace(); + syslog(LOG_INFO, "Server connection broken during download\n"); + wc_backtrace(LOG_INFO); if (WCC->serv_sock > 0) close(WCC->serv_sock); WCC->serv_sock = (-1); WCC->connected = 0; @@ -541,7 +541,7 @@ int webcit_tcp_server(char *ip_addr, int port_number, int queue_len) { ip_version = 4; if (inet_pton(AF_INET, ip_addr, &sin4.sin_addr) <= 0) { - syslog(1, "Error binding to [%s] : %s\n", ip_addr, strerror(errno)); + syslog(LOG_WARNING, "Error binding to [%s] : %s\n", ip_addr, strerror(errno)); return (-WC_EXIT_BIND); } } @@ -549,13 +549,13 @@ int webcit_tcp_server(char *ip_addr, int port_number, int queue_len) { ip_version = 6; if (inet_pton(AF_INET6, ip_addr, &sin6.sin6_addr) <= 0) { - syslog(1, "Error binding to [%s] : %s\n", ip_addr, strerror(errno)); + syslog(LOG_WARNING, "Error binding to [%s] : %s\n", ip_addr, strerror(errno)); return (-WC_EXIT_BIND); } } if (port_number == 0) { - syslog(1, "Cannot start: no port number specified.\n"); + syslog(LOG_WARNING, "Cannot start: no port number specified.\n"); return (-WC_EXIT_BIND); } sin6.sin6_port = htons((u_short) port_number); @@ -565,7 +565,7 @@ int webcit_tcp_server(char *ip_addr, int port_number, int queue_len) s = socket( ((ip_version == 6) ? PF_INET6 : PF_INET), SOCK_STREAM, (p->p_proto)); if (s < 0) { - syslog(1, "Can't create a listening socket: %s\n", strerror(errno)); + syslog(LOG_WARNING, "Can't create a listening socket: %s\n", strerror(errno)); return (-WC_EXIT_BIND); } /* Set some socket options that make sense. */ @@ -580,13 +580,13 @@ int webcit_tcp_server(char *ip_addr, int port_number, int queue_len) } if (b < 0) { - syslog(1, "Can't bind: %s\n", strerror(errno)); + syslog(LOG_EMERG, "Can't bind: %s\n", strerror(errno)); close(s); return (-WC_EXIT_BIND); } if (listen(s, queue_len) < 0) { - syslog(1, "Can't listen: %s\n", strerror(errno)); + syslog(LOG_EMERG, "Can't listen: %s\n", strerror(errno)); close(s); return (-WC_EXIT_BIND); } @@ -611,7 +611,7 @@ int webcit_uds_server(char *sockpath, int queue_len) i = unlink(sockpath); if ((i != 0) && (errno != ENOENT)) { - syslog(1, "webcit: can't unlink %s: %s\n", + syslog(LOG_WARNING, "webcit: can't unlink %s: %s\n", sockpath, strerror(errno)); return (-WC_EXIT_BIND); } @@ -622,18 +622,18 @@ int webcit_uds_server(char *sockpath, int queue_len) s = socket(AF_UNIX, SOCK_STREAM, 0); if (s < 0) { - syslog(1, "webcit: Can't create a unix domain socket: %s\n", strerror(errno)); + syslog(LOG_WARNING, "webcit: Can't create a unix domain socket: %s\n", strerror(errno)); return (-WC_EXIT_BIND); } if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) < 0) { - syslog(1, "webcit: Can't bind: %s\n", strerror(errno)); + syslog(LOG_WARNING, "webcit: Can't bind: %s\n", strerror(errno)); close(s); return (-WC_EXIT_BIND); } if (listen(s, actual_queue_len) < 0) { - syslog(1, "webcit: Can't listen: %s\n", strerror(errno)); + syslog(LOG_WARNING, "webcit: Can't listen: %s\n", strerror(errno)); close(s); return (-WC_EXIT_BIND); } @@ -693,7 +693,7 @@ int client_read_to(ParsedHttpHdrs *Hdr, StrBuf *Target, int bytes, int timeout) return 1; } else { - syslog(2, "client_read_ssl() failed\n"); + syslog(LOG_INFO, "client_read_ssl() failed\n"); return -1; } } @@ -711,9 +711,9 @@ int client_read_to(ParsedHttpHdrs *Hdr, StrBuf *Target, int bytes, int timeout) O_TERM, &Error); if (retval < 0) { - syslog(2, "client_read() failed: %s\n", + syslog(LOG_INFO, "client_read() failed: %s\n", Error); - wc_backtrace(); + wc_backtrace(LOG_DEBUG); return retval; } @@ -750,7 +750,7 @@ long end_burst(void) hprintf("Content-encoding: gzip\r\n"); else { syslog(LOG_ALERT, "Compression failed: %d [%s] sending uncompressed\n", errno, strerror(errno)); - wc_backtrace(); + wc_backtrace(LOG_INFO); } } @@ -784,7 +784,7 @@ long end_burst(void) FD_ZERO(&wset); FD_SET(WCC->Hdr->http_sock, &wset); if (select(WCC->Hdr->http_sock + 1, NULL, &wset, NULL, NULL) == -1) { - syslog(2, "client_write: Socket select failed (%s)\n", strerror(errno)); + syslog(LOG_DEBUG, "client_write: Socket select failed (%s)\n", strerror(errno)); return -1; } } @@ -793,8 +793,8 @@ long end_burst(void) (res = write(WCC->Hdr->http_sock, ptr, count)) == -1) { - syslog(2, "client_write: Socket write failed (%s)\n", strerror(errno)); - wc_backtrace(); + syslog(LOG_DEBUG, "client_write: Socket write failed (%s)\n", strerror(errno)); + wc_backtrace(LOG_INFO); return res; } count -= res; @@ -810,7 +810,7 @@ long end_burst(void) FD_ZERO(&wset); FD_SET(WCC->Hdr->http_sock, &wset); if (select(WCC->Hdr->http_sock + 1, NULL, &wset, NULL, NULL) == -1) { - syslog(2, "client_write: Socket select failed (%s)\n", strerror(errno)); + syslog(LOG_INFO, "client_write: Socket select failed (%s)\n", strerror(errno)); return -1; } } @@ -819,8 +819,8 @@ long end_burst(void) (res = write(WCC->Hdr->http_sock, ptr, count)) == -1) { - syslog(2, "client_write: Socket write failed (%s)\n", strerror(errno)); - wc_backtrace(); + syslog(LOG_INFO, "client_write: Socket write failed (%s)\n", strerror(errno)); + wc_backtrace(LOG_INFO); return res; } count -= res; diff --git a/webcit/useredit.c b/webcit/useredit.c index a6041d7e6..f710513cb 100644 --- a/webcit/useredit.c +++ b/webcit/useredit.c @@ -576,7 +576,7 @@ TRYAGAIN: serv_puts("000"); } else - syslog(1, "Error while creating user vcard: %s\n", ChrPtr(Buf)); + syslog(LOG_WARNING, "Error while creating user vcard: %s\n", ChrPtr(Buf)); goto TRYAGAIN; } FreeStrBuf(&Buf); diff --git a/webcit/vcard_edit.c b/webcit/vcard_edit.c index 950fae6f4..fee75f30f 100644 --- a/webcit/vcard_edit.c +++ b/webcit/vcard_edit.c @@ -599,7 +599,7 @@ void parse_vcard(StrBuf *Target, struct vCard *v, HashList *VC, int full, wc_mim StrBufDecodeBase64(Val); } - syslog(1, "%s [%s][%s]", + syslog(LOG_DEBUG, "%s [%s][%s]", firsttoken, ChrPtr(Val), v->prop[i].value); @@ -607,11 +607,11 @@ void parse_vcard(StrBuf *Target, struct vCard *v, HashList *VC, int full, wc_mim { eVC evc = (eVC) V; Put(VC, IKEY(evc), Val, HFreeStrBuf); - syslog(1, "[%ul]\n", evc); + syslog(LOG_DEBUG, "[%ul]\n", evc); Val = NULL; } else - syslog(1, "[]\n"); + syslog(LOG_DEBUG, "[]\n"); /* TODO: check for layer II else diff --git a/webcit/webcit.c b/webcit/webcit.c index d02f8084e..2ce94be12 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -467,7 +467,7 @@ void push_destination(void) { FreeStrBuf(&WCC->PushedDestination); WCC->PushedDestination = NewStrBufDup(SBSTR("url")); - syslog(9, "Push: %s", ChrPtr(WCC->PushedDestination)); + syslog(LOG_DEBUG, "Push: %s", ChrPtr(WCC->PushedDestination)); wc_printf("OK"); } @@ -505,7 +505,7 @@ void pop_destination(void) { /* * All righty then! We have a destination saved, so go there now. */ - syslog(9, "Pop: %s", ChrPtr(WCC->PushedDestination)); + syslog(LOG_DEBUG, "Pop: %s", ChrPtr(WCC->PushedDestination)); http_redirect(ChrPtr(WCC->PushedDestination)); } @@ -625,11 +625,11 @@ void session_loop(void) /* If the client sent a nonce that is incorrect, kill the request. */ if (havebstr("nonce")) { - syslog(9, "Comparing supplied nonce %s to session nonce %d", + syslog(LOG_DEBUG, "Comparing supplied nonce %s to session nonce %d", bstr("nonce"), WCC->nonce ); if (ibstr("nonce") != WCC->nonce) { - syslog(9, "Ignoring request with mismatched nonce."); + syslog(LOG_INFO, "Ignoring request with mismatched nonce."); hprintf("HTTP/1.1 404 Security check failed\r\n"); hprintf("Content-Type: text/plain\r\n"); begin_burst(); @@ -705,18 +705,18 @@ void session_loop(void) */ if (havebstr("go")) { int ret; - syslog(9, "Explicit room selection: %s", bstr("go")); + syslog(LOG_DEBUG, "Explicit room selection: %s", bstr("go")); ret = gotoroom(sbstr("go")); /* do quietly to avoid session output! */ if ((ret/100) != 2) { - syslog(1, "Unable to change to [%s]; Reason: %d", bstr("go"), ret); + syslog(LOG_DEBUG, "Unable to change to [%s]; Reason: %d", bstr("go"), ret); } } else if (havebstr("gotofirst")) { int ret; - syslog(9, "Explicit room selection: %s", bstr("gotofirst")); + syslog(LOG_DEBUG, "Explicit room selection: %s", bstr("gotofirst")); ret = gotoroom(sbstr("gotofirst")); /* do quietly to avoid session output! */ if ((ret/100) != 2) { - syslog(1, "Unable to change to [%s]; Reason: %d", bstr("gotofirst"), ret); + syslog(LOG_INFO, "Unable to change to [%s]; Reason: %d", bstr("gotofirst"), ret); } } @@ -727,13 +727,13 @@ void session_loop(void) else if ( (StrLength(WCC->CurRoom.name) == 0) && ( (StrLength(WCC->Hdr->c_roomname) > 0) )) { int ret; - syslog(9, "We are in '%s' but cookie indicates '%s', going there...", + syslog(LOG_DEBUG, "We are in '%s' but cookie indicates '%s', going there...", ChrPtr(WCC->CurRoom.name), ChrPtr(WCC->Hdr->c_roomname) ); ret = gotoroom(WCC->Hdr->c_roomname); /* do quietly to avoid session output! */ if ((ret/100) != 2) { - syslog(1, "COOKIEGOTO: Unable to change to [%s]; Reason: %d", + syslog(LOG_DEBUG, "COOKIEGOTO: Unable to change to [%s]; Reason: %d", ChrPtr(WCC->Hdr->c_roomname), ret); } } @@ -800,7 +800,7 @@ void display_default_landing_page(void) { /* default action */ if (havebstr("go")) { - syslog(9, "Explicit room selection: %s", bstr("go")); + syslog(LOG_DEBUG, "Explicit room selection: %s", bstr("go")); StrBuf *teh_room = NewStrBufPlain(bstr("go"), strlen(bstr("go"))); smart_goto(teh_room); FreeStrBuf(&teh_room); @@ -919,11 +919,11 @@ InitModule_WEBCIT snprintf(dir, SIZ, "%s/webcit.css", static_local_dir); if (!access(dir, R_OK)) { - syslog(9, "Using local Stylesheet [%s]", dir); + syslog(LOG_INFO, "Using local Stylesheet [%s]", dir); csslocal = NewStrBufPlain(HKEY("")); } else - syslog(9, "No Site-local Stylesheet [%s] installed.", dir); + syslog(LOG_INFO, "No Site-local Stylesheet [%s] installed.", dir); } diff --git a/webcit/webserver.c b/webcit/webserver.c index c2a0bd8cd..2ef9d6764 100644 --- a/webcit/webserver.c +++ b/webcit/webserver.c @@ -169,7 +169,7 @@ int main(int argc, char **argv) if (gethostname (&server_cookie[strlen(server_cookie)], 200) != 0) { - syslog(2, "gethostname: %s", strerror(errno)); + syslog(LOG_INFO, "gethostname: %s", strerror(errno)); free(server_cookie); } } @@ -247,16 +247,16 @@ int main(int argc, char **argv) FILE *fd; StrBufAppendBufPlain(I18nDump, HKEY("}\n"), 0); if (StrLength(I18nDump) < 50) { - syslog(1, "*******************************************************************\n"); - syslog(1, "* No strings found in templates! Are you sure they're there? *\n"); - syslog(1, "*******************************************************************\n"); + syslog(LOG_INFO, "*******************************************************************\n"); + syslog(LOG_INFO, "* No strings found in templates! Are you sure they're there? *\n"); + syslog(LOG_INFO, "*******************************************************************\n"); return -1; } fd = fopen(I18nDumpFile, "w"); if (fd == NULL) { - syslog(1, "***********************************************\n"); - syslog(1, "* unable to open I18N dumpfile [%s] *\n", I18nDumpFile); - syslog(1, "***********************************************\n"); + syslog(LOG_INFO, "***********************************************\n"); + syslog(LOG_INFO, "* unable to open I18N dumpfile [%s] *\n", I18nDumpFile); + syslog(LOG_INFO, "***********************************************\n"); return -1; } fwrite(ChrPtr(I18nDump), 1, StrLength(I18nDump), fd); @@ -276,7 +276,7 @@ int main(int argc, char **argv) * wcsession struct to which the thread is currently bound. */ if (pthread_key_create(&MyConKey, NULL) != 0) { - syslog(1, "Can't create TSD key: %s", strerror(errno)); + syslog(LOG_EMERG, "Can't create TSD key: %s", strerror(errno)); } InitialiseSemaphores(); @@ -288,7 +288,7 @@ int main(int argc, char **argv) */ #ifdef HAVE_OPENSSL if (pthread_key_create(&ThreadSSL, NULL) != 0) { - syslog(1, "Can't create TSD key: %s", strerror(errno)); + syslog(LOG_EMERG, "Can't create TSD key: %s", strerror(errno)); } #endif @@ -299,11 +299,11 @@ int main(int argc, char **argv) */ if (!IsEmptyStr(uds_listen_path)) { - syslog(2, "Attempting to create listener socket at %s...", uds_listen_path); + syslog(LOG_DEBUG, "Attempting to create listener socket at %s...", uds_listen_path); msock = webcit_uds_server(uds_listen_path, LISTEN_QUEUE_LENGTH); } else { - syslog(2, "Attempting to bind to port %d...", http_port); + syslog(LOG_DEBUG, "Attempting to bind to port %d...", http_port); msock = webcit_tcp_server(ip_addr, http_port, LISTEN_QUEUE_LENGTH); } if (msock < 0) @@ -312,7 +312,7 @@ int main(int argc, char **argv) return -msock; } - syslog(2, "Listening on socket %d", msock); + syslog(LOG_INFO, "Listening on socket %d", msock); signal(SIGPIPE, SIG_IGN); pthread_mutex_init(&SessionListMutex, NULL); diff --git a/webcit/webserver.h b/webcit/webserver.h index cd8634bc2..51926cbf5 100644 --- a/webcit/webserver.h +++ b/webcit/webserver.h @@ -7,7 +7,7 @@ extern char *default_landing_page; int ClientGetLine(ParsedHttpHdrs *Hdr, StrBuf *Target); int client_read_to(ParsedHttpHdrs *Hdr, StrBuf *Target, int bytes, int timeout); -void wc_backtrace(void); +void wc_backtrace(long LogLevel); void ShutDownWebcit(void); void shutdown_ssl(void); -- 2.30.2