Removed logging subsystem from webcit. It's all syslog now.
authorArt Cancro <ajc@citadel.org>
Mon, 17 Jan 2011 17:00:36 +0000 (12:00 -0500)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 4 Sep 2011 14:00:56 +0000 (14:00 +0000)
39 files changed:
webcit/auth.c
webcit/availability.c
webcit/bbsview_renderer.c
webcit/calendar.c
webcit/calendar_tools.c
webcit/context_loop.c
webcit/crypto.c
webcit/event.c
webcit/gettext.c
webcit/groupdav_propfind.c
webcit/groupdav_put.c
webcit/html2html.c
webcit/ical_dezonify.c
webcit/inetconf.c
webcit/locate_host.c
webcit/messages.c
webcit/mk_module_init.sh
webcit/msg_renderers.c
webcit/paramhandling.c
webcit/preferences.c
webcit/roomlist.c
webcit/roomops.c
webcit/roomviews.c
webcit/serv_func.c
webcit/setup.c
webcit/siteconfig.c
webcit/static.c
webcit/subst.c
webcit/sysdep.c
webcit/tasks.c
webcit/tcp_sockets.c
webcit/tests/test_main.c
webcit/tests/test_tools.c
webcit/useredit.c
webcit/vcard_edit.c
webcit/webcit.c
webcit/webcit.h
webcit/webserver.c
webcit/webserver.h

index 40d12c9..74ab667 100644 (file)
@@ -529,7 +529,7 @@ void do_welcome(void)
        if (StrLength(Buf) == 0) {
                StrBufAppendBufPlain(Buf, "dotgoto?room=_BASEROOM_", -1, 0);
        }
-       lprintf(9, "Redirecting to user's start page: %s\n", ChrPtr(Buf));
+       syslog(9, "Redirecting to user's start page: %s\n", ChrPtr(Buf));
        http_redirect(ChrPtr(Buf));
 }
 
@@ -758,7 +758,7 @@ void display_reg(int during_login)
        Buf = NewStrBuf();
        memset(&Room, 0, sizeof(folder));
        if (goto_config_room(Buf, &Room) != 0) {
-               lprintf(9, "display_reg() exiting because goto_config_room() failed\n");
+               syslog(9, "display_reg() exiting because goto_config_room() failed\n");
                if (during_login) {
                        do_welcome();
                }
@@ -774,7 +774,7 @@ void display_reg(int during_login)
        FreeStrBuf(&Buf);
        vcard_msgnum = locate_user_vcard_in_this_room(&VCMsg, &VCAtt);
        if (vcard_msgnum < 0L) {
-               lprintf(9, "display_reg() exiting because locate_user_vcard_in_this_room() failed\n");
+               syslog(9, "display_reg() exiting because locate_user_vcard_in_this_room() failed\n");
                if (during_login) {
                        do_welcome();
                }
@@ -957,7 +957,7 @@ void Header_HandleAuth(StrBuf *Line, ParsedHttpHdrs *hdr)
                        hdr->HR.got_auth = AUTH_BASIC;
                }
                else 
-                       lprintf(1, "Authentication scheme not supported! [%s]\n", ChrPtr(Line));
+                       syslog(1, "Authentication scheme not supported! [%s]\n", ChrPtr(Line));
        }
 }
 
@@ -972,7 +972,7 @@ void CheckAuthBasic(ParsedHttpHdrs *hdr)
        StrBufAppendBuf(hdr->HR.plainauth, hdr->HR.user_agent, 0);
        hdr->HR.SessionKey = hashlittle(SKEY(hdr->HR.plainauth), 89479832);
 /*
-       lprintf(1, "CheckAuthBasic: calculated sessionkey %ld\n", 
+       syslog(1, "CheckAuthBasic: calculated sessionkey %ld\n", 
                hdr->HR.SessionKey);
 */
 }
index 67aa46f..0273526 100644 (file)
@@ -104,7 +104,7 @@ int ical_ctdl_is_overlap(
                return(1);
        }
 
-       /* lprintf (9, "Comparing t1start %d:%d t1end %d:%d t2start %d:%d t2end %d:%d \n",
+       /* syslog(9, "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);
        */
@@ -113,11 +113,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);
-       /* lprintf(9, "first passed\n"); */
+       /* syslog(9, "first passed\n"); */
 
        /* If event 2 ends before event 1 starts, we're also ok. */
        if (icaltime_compare(t2end, t1start) <= 0) return(0);
-       /* lprintf(9, "second passed\n"); */
+       /* syslog(9, "second passed\n"); */
 
        /* Otherwise, they overlap. */
        return(1);
index 7ed776e..3aef4d2 100644 (file)
@@ -181,7 +181,7 @@ int bbsview_RenderView_or_Tail(SharedMessageStatus *Stat,
        int end_index = 0;
 
        if (Stat->nummsgs > 0) {
-               lprintf(9, "sorting %d messages\n", BBS->num_msgs);
+               syslog(9, "sorting %d messages\n", BBS->num_msgs);
                qsort(BBS->msgs, (size_t)(BBS->num_msgs), sizeof(long), bbsview_sortfunc);
        }
 
index d483207..fe81b95 100644 (file)
@@ -210,7 +210,7 @@ void cal_process_object(StrBuf *Target,
        if (the_method == ICAL_METHOD_REQUEST) {
 
                /* Check for conflicts */
-               lprintf(9, "Checking server calendar for conflicts...\n");
+               syslog(9, "Checking server calendar for conflicts...\n");
                serv_printf("ICAL conflicts|%ld|%s|", msgnum, cal_partnum);
                serv_getln(buf, sizeof buf);
                if (buf[0] == '1') {
@@ -238,7 +238,7 @@ void cal_process_object(StrBuf *Target,
                                StrBufAppendPrintf(Target, "</dd>\n");
                        }
                }
-               lprintf(9, "...done.\n");
+               syslog(9, "...done.\n");
 
                StrBufAppendPrintf(Target, "</dl>");
 
@@ -444,7 +444,7 @@ void display_individual_cal(icalcomponent *cal, long msgnum, char *from, int unr
        Cal->cal = icalcomponent_new_clone(cal);
 
        /* Dezonify and decapsulate at the very last moment */
-       /* lprintf(9, "INITIAL: %s\n", icaltime_as_ical_string(icalproperty_get_dtstart(
+       /* syslog(9, "INITIAL: %s\n", icaltime_as_ical_string(icalproperty_get_dtstart(
                icalcomponent_get_first_property(icalcomponent_get_first_component(
                Cal->cal, ICAL_VEVENT_COMPONENT), ICAL_DTSTART_PROPERTY)))
        ); */
@@ -519,7 +519,7 @@ void display_individual_cal(icalcomponent *cal, long msgnum, char *from, int unr
                ++num_recur;
                if (num_recur > 1) {            /* Skip the first one.  We already did it at the root. */
                        icalcomponent *cptr;
-                       /* lprintf(9, "REPEATS: %s\n", icaltime_as_ical_string(next)); */
+                       /* syslog(9, "REPEATS: %s\n", icaltime_as_ical_string(next)); */
 
                        /* Note: anything we do here, we also have to do above for the root event. */
                        Cal = (disp_cal*) malloc(sizeof(disp_cal));
@@ -590,7 +590,7 @@ void display_individual_cal(icalcomponent *cal, long msgnum, char *from, int unr
                }
        }
        icalrecur_iterator_free(ritr);
-       /* lprintf(9, "Performed %d recurrences; final one is %s", num_recur, ctime(&final_recurrence)); */
+       /* syslog(9, "Performed %d recurrences; final one is %s", num_recur, ctime(&final_recurrence)); */
 
 }
 
@@ -849,7 +849,7 @@ void do_freebusy(void)
                who[len-4] = 0;
        }
 
-       lprintf(9, "freebusy requested for <%s>\n", who);
+       syslog(9, "freebusy requested for <%s>\n", who);
        serv_printf("ICAL freebusy|%s", who);
        serv_getln(buf, sizeof buf);
 
index a9b77d6..4a8b916 100644 (file)
@@ -250,7 +250,7 @@ icalcomponent *ical_encapsulate_subcomponent(icalcomponent *subcomp) {
        int zone_already_attached;
 
        if (subcomp == NULL) {
-               lprintf(3, "ERROR: ical_encapsulate_subcomponent() called with NULL argument\n");
+               syslog(3, "ERROR: ical_encapsulate_subcomponent() called with NULL argument\n");
                return NULL;
        }
 
@@ -258,7 +258,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) {
-               lprintf(3, "ERROR: component sent to ical_encapsulate_subcomponent() already top level\n");
+               syslog(3, "ERROR: component sent to ical_encapsulate_subcomponent() already top level\n");
                return subcomp;
        }
 
@@ -288,11 +288,11 @@ icalcomponent *ical_encapsulate_subcomponent(icalcomponent *subcomp) {
                                for (i=0; i<5; ++i) {
                                        if (z == attached_zones[i]) {
                                                ++zone_already_attached;
-                                               lprintf(9, "zone already attached!!\n");
+                                               syslog(9, "zone already attached!!\n");
                                        }
                                }
                                if ((!zone_already_attached) && (num_zones_attached < 5)) {
-                                       lprintf(9, "attaching zone %d!\n", num_zones_attached);
+                                       syslog(9, "attaching zone %d!\n", num_zones_attached);
                                        attached_zones[num_zones_attached++] = z;
                                }
 
@@ -306,7 +306,7 @@ icalcomponent *ical_encapsulate_subcomponent(icalcomponent *subcomp) {
        /* Encapsulate the VEVENT component into a complete VCALENDAR */
        encaps = icalcomponent_new(ICAL_VCALENDAR_COMPONENT);
        if (encaps == NULL) {
-               lprintf(3, "ERROR: ical_encapsulate_subcomponent() could not allocate component\n");
+               syslog(3, "ERROR: ical_encapsulate_subcomponent() could not allocate component\n");
                return NULL;
        }
 
index 0979181..3d60c55 100644 (file)
@@ -96,7 +96,7 @@ void do_housekeeping(void)
         * Now free up and destroy the culled sessions.
         */
        while (sessions_to_kill != NULL) {
-               lprintf(3, "Destroying session %d\n", sessions_to_kill->wc_session);
+               syslog(3, "Destroying session %d\n", sessions_to_kill->wc_session);
                pthread_mutex_lock(&sessions_to_kill->SessionMutex);
                pthread_mutex_unlock(&sessions_to_kill->SessionMutex);
                sptr = sessions_to_kill->next;
@@ -118,7 +118,7 @@ void check_thread_pool_size(void)
                (num_threads_executing >= num_threads_existing)
                && (num_threads_existing < MAX_WORKER_THREADS)
        ) {
-               lprintf(3, "%d of %d threads are executing.  Adding another worker thread.\n",
+               syslog(3, "%d of %d threads are executing.  Adding another worker thread.\n",
                        num_threads_executing,
                        num_threads_existing
                );
@@ -179,7 +179,7 @@ wcsession *FindSession(wcsession **wclist, ParsedHttpHdrs *Hdr, pthread_mutex_t
                                TheSession = sptr;
                        }
                        if (TheSession == NULL)
-                               lprintf(1, "found sessionkey [%ld], but credentials for [%s|%s] didn't match\n",
+                               syslog(1, "found sessionkey [%ld], but credentials for [%s|%s] didn't match\n",
                                        Hdr->HR.SessionKey,ChrPtr(Hdr->c_username), ChrPtr(sptr->wc_username));
                        break;
                case AUTH_COOKIE:
@@ -195,7 +195,7 @@ wcsession *FindSession(wcsession **wclist, ParsedHttpHdrs *Hdr, pthread_mutex_t
        }
        CtdlLogResult(pthread_mutex_unlock(ListMutex));
        if (TheSession == NULL)
-               lprintf(1, "didn't find sessionkey [%ld] for user [%s]\n",
+               syslog(1, "didn't find sessionkey [%ld] for user [%s]\n",
                        Hdr->HR.SessionKey,ChrPtr(Hdr->c_username));
        return TheSession;
 }
@@ -204,7 +204,7 @@ wcsession *CreateSession(int Lockable, int Static, wcsession **wclist, ParsedHtt
 {
        wcsession *TheSession;
        if (!Static)
-               lprintf(3, "Creating a new session\n");
+               syslog(3, "Creating a new session\n");
        TheSession = (wcsession *) malloc(sizeof(wcsession));
        memset(TheSession, 0, sizeof(wcsession));
        TheSession->Hdr = Hdr;
@@ -391,7 +391,7 @@ int ReadHTTPRequest (ParsedHttpHdrs *Hdr)
                        memset(pHdr, 0, sizeof(OneHttpHeader));
                        pHdr->Val = Line;
                        Put(Hdr->HTTPHeaders, HKEY("GET /"), pHdr, DestroyHttpHeaderHandler);
-                       lprintf(9, "%s\n", ChrPtr(Line));
+                       syslog(9, "%s\n", ChrPtr(Line));
                        isbogus = ReadHttpSubject(Hdr, Line, HeaderName);
                        if (isbogus) break;
                        continue;
@@ -501,7 +501,7 @@ void context_loop(ParsedHttpHdrs *Hdr)
 
                do_404();
 
-               lprintf(9, "HTTP: 404 [%ld.%06ld] %s %s \n",
+               syslog(9, "HTTP: 404 [%ld.%06ld] %s %s \n",
                        ((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],
@@ -522,7 +522,7 @@ void context_loop(ParsedHttpHdrs *Hdr)
                /* How long did this transaction take? */
                gettimeofday(&tx_finish, NULL);
                
-               lprintf(9, "HTTP: 200 [%ld.%06ld] %s %s \n",
+               syslog(9, "HTTP: 200 [%ld.%06ld] %s %s \n",
                        ((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],
@@ -558,7 +558,7 @@ void context_loop(ParsedHttpHdrs *Hdr)
                }
                
                if (StrLength(Hdr->c_language) > 0) {
-                       lprintf(9, "Session cookie requests language '%s'\n", ChrPtr(Hdr->c_language));
+                       syslog(9, "Session cookie requests language '%s'\n", ChrPtr(Hdr->c_language));
                        set_selected_language(ChrPtr(Hdr->c_language));
                        go_selected_language();
                }
@@ -586,7 +586,7 @@ void context_loop(ParsedHttpHdrs *Hdr)
        gettimeofday(&tx_finish, NULL);
        
 
-       lprintf(9, "HTTP: 200 [%ld.%06ld] %s %s \n",
+       syslog(9, "HTTP: 200 [%ld.%06ld] %s %s \n",
                ((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],
index 66bfc9b..9dd6211 100644 (file)
@@ -74,12 +74,12 @@ void init_ssl(void)
        }
 
        if (!RAND_status()) {
-               lprintf(3, "PRNG not adequately seeded, won't do SSL/TLS\n");
+               syslog(3, "PRNG not adequately seeded, won't do SSL/TLS\n");
                return;
        }
        SSLCritters = malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t *));
        if (!SSLCritters) {
-               lprintf(1, "citserver: can't allocate memory!!\n");
+               syslog(1, "citserver: can't allocate memory!!\n");
                /* Nothing's been initialized, just die */
                ShutDownWebcit();
                exit(WC_EXIT_SSL);
@@ -89,7 +89,7 @@ void init_ssl(void)
                for (a = 0; a < CRYPTO_num_locks(); a++) {
                        SSLCritters[a] = malloc(sizeof(pthread_mutex_t));
                        if (!SSLCritters[a]) {
-                               lprintf(1,
+                               syslog(1,
                                        "citserver: can't allocate memory!!\n");
                                /** Nothing's been initialized, just die */
                                ShutDownWebcit();
@@ -106,13 +106,13 @@ void init_ssl(void)
        SSL_load_error_strings();
        ssl_method = SSLv23_server_method();
        if (!(ssl_ctx = SSL_CTX_new(ssl_method))) {
-               lprintf(3, "SSL_CTX_new failed: %s\n", ERR_reason_error_string(ERR_get_error()));
+               syslog(3, "SSL_CTX_new failed: %s\n", ERR_reason_error_string(ERR_get_error()));
                return;
        }
 
-       lprintf(9, "Requesting cipher list: %s\n", ssl_cipher_list);
+       syslog(9, "Requesting cipher list: %s\n", ssl_cipher_list);
        if (!(SSL_CTX_set_cipher_list(ssl_ctx, ssl_cipher_list))) {
-               lprintf(3, "SSL_CTX_set_cipher_list failed: %s\n", ERR_reason_error_string(ERR_get_error()));
+               syslog(3, "SSL_CTX_set_cipher_list failed: %s\n", ERR_reason_error_string(ERR_get_error()));
                return;
        }
 
@@ -136,27 +136,27 @@ void init_ssl(void)
        if (!strcasecmp(ctdlhost, "uds")) {
                sprintf(buf, "%s/keys/citadel.key", ctdlport);
                rv = symlink(buf, CTDL_KEY_PATH);
-               if (!rv) lprintf(1, "%s\n", strerror(errno));
+               if (!rv) syslog(1, "%s\n", strerror(errno));
                sprintf(buf, "%s/keys/citadel.csr", ctdlport);
                rv = symlink(buf, CTDL_CSR_PATH);
-               if (!rv) lprintf(1, "%s\n", strerror(errno));
+               if (!rv) syslog(1, "%s\n", strerror(errno));
                sprintf(buf, "%s/keys/citadel.cer", ctdlport);
                rv = symlink(buf, CTDL_CER_PATH);
-               if (!rv) lprintf(1, "%s\n", strerror(errno));
+               if (!rv) syslog(1, "%s\n", strerror(errno));
        }
 
        /*
         * If we still don't have a private key, generate one.
         */
        if (access(CTDL_KEY_PATH, R_OK) != 0) {
-               lprintf(5, "Generating RSA key pair.\n");
+               syslog(5, "Generating RSA key pair.\n");
                rsa = RSA_generate_key(1024,    /* modulus size */
                                        65537,  /* exponent */
                                        NULL,   /* no callback */
                                        NULL    /* no callback */
                );
                if (rsa == NULL) {
-                       lprintf(3, "Key generation failed: %s\n", ERR_reason_error_string(ERR_get_error()));
+                       syslog(3, "Key generation failed: %s\n", ERR_reason_error_string(ERR_get_error()));
                }
                if (rsa != NULL) {
                        fp = fopen(CTDL_KEY_PATH, "w");
@@ -170,14 +170,14 @@ void init_ssl(void)
                                                        NULL,   /* no callbk */
                                                        NULL    /* no callbk */
                                ) != 1) {
-                                       lprintf(3, "Cannot write key: %s\n",
+                                       syslog(3, "Cannot write key: %s\n",
                                                ERR_reason_error_string(ERR_get_error()));
                                        unlink(CTDL_KEY_PATH);
                                }
                                fclose(fp);
                        }
                        else {
-                               lprintf(3, "Cannot write key: %s\n", CTDL_KEY_PATH);
+                               syslog(3, "Cannot write key: %s\n", CTDL_KEY_PATH);
                                ShutDownWebcit();
                                exit(0);
                        }
@@ -191,7 +191,7 @@ void init_ssl(void)
         * the CSR in this step so that the next step may commence.
         */
        if ( (access(CTDL_CER_PATH, R_OK) != 0) && (access(CTDL_CSR_PATH, R_OK) != 0) ) {
-               lprintf(5, "Generating a certificate signing request.\n");
+               syslog(5, "Generating a certificate signing request.\n");
 
                /*
                 * Read our key from the file.  No, we don't just keep this
@@ -272,7 +272,7 @@ void init_ssl(void)
 
                                        /* Sign the CSR */
                                        if (!X509_REQ_sign(req, pk, EVP_md5())) {
-                                               lprintf(3, "X509_REQ_sign(): error\n");
+                                               syslog(3, "X509_REQ_sign(): error\n");
                                        }
                                        else {
                                                /* Write it to disk. */ 
@@ -283,7 +283,7 @@ void init_ssl(void)
                                                        fclose(fp);
                                                }
                                                else {
-                                                       lprintf(3, "Cannot write key: %s\n", CTDL_CSR_PATH);
+                                                       syslog(3, "Cannot write key: %s\n", CTDL_CSR_PATH);
                                                        ShutDownWebcit();
                                                        exit(0);
                                                }
@@ -297,7 +297,7 @@ void init_ssl(void)
                }
 
                else {
-                       lprintf(3, "Unable to read private key.\n");
+                       syslog(3, "Unable to read private key.\n");
                }
        }
 
@@ -307,7 +307,7 @@ void init_ssl(void)
         * Generate a self-signed certificate if we don't have one.
         */
        if (access(CTDL_CER_PATH, R_OK) != 0) {
-               lprintf(5, "Generating a self-signed certificate.\n");
+               syslog(5, "Generating a self-signed certificate.\n");
 
                /* Same deal as before: always read the key from disk because
                 * it may or may not have just been generated.
@@ -348,7 +348,7 @@ void init_ssl(void)
                                        
                                        /* Sign the cert */
                                        if (!X509_sign(cer, pk, EVP_md5())) {
-                                               lprintf(3, "X509_sign(): error\n");
+                                               syslog(3, "X509_sign(): error\n");
                                        }
                                        else {
                                                /* Write it to disk. */ 
@@ -359,7 +359,7 @@ void init_ssl(void)
                                                        fclose(fp);
                                                }
                                                else {
-                                                       lprintf(3, "Cannot write key: %s\n", CTDL_CER_PATH);
+                                                       syslog(3, "Cannot write key: %s\n", CTDL_CER_PATH);
                                                        ShutDownWebcit();
                                                        exit(0);
                                                }
@@ -380,7 +380,7 @@ void init_ssl(void)
        SSL_CTX_use_certificate_chain_file(ssl_ctx, CTDL_CER_PATH);
        SSL_CTX_use_PrivateKey_file(ssl_ctx, CTDL_KEY_PATH, SSL_FILETYPE_PEM);
        if ( !SSL_CTX_check_private_key(ssl_ctx) ) {
-               lprintf(3, "Cannot install certificate: %s\n",
+               syslog(3, "Cannot install certificate: %s\n",
                                ERR_reason_error_string(ERR_get_error()));
        }
        
@@ -400,11 +400,11 @@ int starttls(int sock) {
                return(1);
        }
        if (!(newssl = SSL_new(ssl_ctx))) {
-               lprintf(3, "SSL_new failed: %s\n", ERR_reason_error_string(ERR_get_error()));
+               syslog(3, "SSL_new failed: %s\n", ERR_reason_error_string(ERR_get_error()));
                return(2);
        }
        if (!(SSL_set_fd(newssl, sock))) {
-               lprintf(3, "SSL_set_fd failed: %s\n", ERR_reason_error_string(ERR_get_error()));
+               syslog(3, "SSL_set_fd failed: %s\n", ERR_reason_error_string(ERR_get_error()));
                SSL_free(newssl);
                return(3);
        }
@@ -421,10 +421,10 @@ int starttls(int sock) {
                errval = SSL_get_error(newssl, retval);
                ssl_error_reason = ERR_reason_error_string(ERR_get_error());
                if (ssl_error_reason == NULL) {
-                       lprintf(3, "SSL_accept failed: errval=%i, retval=%i %s\n", errval, retval, strerror(errval));
+                       syslog(3, "SSL_accept failed: errval=%i, retval=%i %s\n", errval, retval, strerror(errval));
                }
                else {
-                       lprintf(3, "SSL_accept failed: %s\n", ssl_error_reason);
+                       syslog(3, "SSL_accept failed: %s\n", ssl_error_reason);
                }
                sleeeeeeeeeep(1);
                retval = SSL_accept(newssl);
@@ -436,27 +436,27 @@ int starttls(int sock) {
                errval = SSL_get_error(newssl, retval);
                ssl_error_reason = ERR_reason_error_string(ERR_get_error());
                if (ssl_error_reason == NULL) {
-                       lprintf(3, "SSL_accept failed: errval=%i, retval=%i (%s)\n", errval, retval, strerror(errval));
+                       syslog(3, "SSL_accept failed: errval=%i, retval=%i (%s)\n", errval, retval, strerror(errval));
                }
                else {
-                       lprintf(3, "SSL_accept failed: %s\n", ssl_error_reason);
+                       syslog(3, "SSL_accept failed: %s\n", ssl_error_reason);
                }
                SSL_free(newssl);
                newssl = NULL;
                return(4);
        }
        else {
-               lprintf(15, "SSL_accept success\n");
+               syslog(15, "SSL_accept success\n");
        }
        r = BIO_set_close(newssl->rbio, BIO_NOCLOSE);
        bits = SSL_CIPHER_get_bits(SSL_get_current_cipher(newssl), &alg_bits);
-       lprintf(15, "SSL/TLS using %s on %s (%d of %d bits)\n",
+       syslog(15, "SSL/TLS using %s on %s (%d of %d bits)\n",
                SSL_CIPHER_get_name(SSL_get_current_cipher(newssl)),
                SSL_CIPHER_get_version(SSL_get_current_cipher(newssl)),
                bits, alg_bits);
 
        pthread_setspecific(ThreadSSL, newssl);
-       lprintf(15, "SSL started\n");
+       syslog(15, "SSL started\n");
        return(0);
 }
 
@@ -474,14 +474,14 @@ void endtls(void)
 
        if (THREADSSL == NULL) return;
 
-       lprintf(15, "Ending SSL/TLS\n");
+       syslog(15, "Ending SSL/TLS\n");
        SSL_shutdown(THREADSSL);
        ctx = SSL_get_SSL_CTX(THREADSSL);
 
        /* I don't think this is needed, and it crashes the server anyway
         *
         *      if (ctx != NULL) {
-        *              lprintf(9, "Freeing CTX at %x\n", (int)ctx );
+        *              syslog(9, "Freeing CTX at %x\n", (int)ctx );
         *              SSL_CTX_free(ctx);
         *      }
         */
@@ -523,7 +523,7 @@ void client_write_ssl(const StrBuf *Buf)
        while (nremain > 0) {
                if (SSL_want_write(THREADSSL)) {
                        if ((SSL_read(THREADSSL, junk, 0)) < 1) {
-                               lprintf(9, "SSL_read in client_write: %s\n",
+                               syslog(9, "SSL_read in client_write: %s\n",
                                                ERR_reason_error_string(ERR_get_error()));
                        }
                }
@@ -536,9 +536,9 @@ void client_write_ssl(const StrBuf *Buf)
                                sleeeeeeeeeep(1);
                                continue;
                        }
-                       lprintf(9, "SSL_write got error %ld, ret %d\n", errval, retval);
+                       syslog(9, "SSL_write got error %ld, ret %d\n", errval, retval);
                        if (retval == -1) {
-                               lprintf(9, "errno is %d\n", errno);
+                               syslog(9, "errno is %d\n", errno);
                        }
                        endtls();
                        return;
@@ -563,7 +563,7 @@ int client_read_sslbuffer(StrBuf *buf, int timeout)
        while (1) {
                if (SSL_want_read(pssl)) {
                        if ((SSL_write(pssl, junk, 0)) < 1) {
-                               lprintf(9, "SSL_write in client_read\n");
+                               syslog(9, "SSL_write in client_read\n");
                        }
                }
                rlen = SSL_read(pssl, sbuf, sizeof(sbuf));
@@ -575,7 +575,7 @@ int client_read_sslbuffer(StrBuf *buf, int timeout)
                                sleeeeeeeeeep(1);
                                continue;
                        }
-                       lprintf(9, "SSL_read got error %ld\n", errval);
+                       syslog(9, "SSL_read got error %ld\n", errval);
                        endtls();
                        return (-1);
                }
index a5f996f..5d44e3f 100644 (file)
@@ -95,7 +95,7 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum,
        get_pref_long("weekstart", &weekstart, 17);
        if (weekstart > 6) weekstart = 0;
 
-       lprintf(9, "display_edit_individual_event(%ld) calview=%s year=%s month=%s day=%s\n",
+       syslog(9, "display_edit_individual_event(%ld) calview=%s year=%s month=%s day=%s\n",
                msgnum, bstr("calview"), bstr("year"), bstr("month"), bstr("day")
        );
 
index d365391..145b7b5 100644 (file)
@@ -191,7 +191,7 @@ void httplang_to_locale(StrBuf *LocaleString, wcsession *sess)
                nBest=0;
        }
        sess->selected_language = nBest;
-       lprintf(9, "language found: %s\n", AvailLangLoaded[WC->selected_language]);
+       syslog(9, "language found: %s\n", AvailLangLoaded[WC->selected_language]);
        FreeStrBuf(&Buf);
        FreeStrBuf(&SBuf);
 }
@@ -295,7 +295,7 @@ void initialize_locales(void) {
 
        language = getenv("WEBCIT_LANG");
        if ((language) && (!IsEmptyStr(language)) && (strcmp(language, "UNLIMITED") != 0)) {
-               lprintf(9, "Nailing locale to %s\n", language);
+               syslog(9, "Nailing locale to %s\n", language);
        }
        else language = NULL;
 
@@ -327,13 +327,13 @@ void initialize_locales(void) {
                        (((i > 0) && (wc_locales[0] != NULL)) ? wc_locales[0] : Empty_Locale)
                );
                if (wc_locales[nLocalesLoaded] == NULL) {
-                       lprintf(1, "locale for "LOCALEDIR"locale/%s: %s; disabled\n",
+                       syslog(1, "locale for "LOCALEDIR"locale/%s: %s; disabled\n",
                                buf,
                                strerror(errno)
                        );
                }
                else {
-                       lprintf(3, "Found locale: %s\n", buf);
+                       syslog(3, "Found locale: %s\n", buf);
                        AvailLangLoaded[nLocalesLoaded] = AvailLang[i];
                        nLocalesLoaded++;
                }
@@ -352,7 +352,7 @@ void initialize_locales(void) {
 #endif
        }
        if ((language != NULL) && (nLocalesLoaded == 0)) {
-               lprintf(1, "Your selected locale [%s] isn't available on your system. falling back to C\n", language);
+               syslog(1, "Your selected locale [%s] isn't available on your system. falling back to C\n", language);
 #ifdef HAVE_USELOCALE
                wc_locales[0] = newlocale(
                        (LC_MESSAGES_MASK|LC_TIME_MASK),
@@ -369,9 +369,9 @@ void initialize_locales(void) {
 #ifdef ENABLE_NLS
        locale = setlocale(LC_ALL, "");
 
-       lprintf(9, "Message catalog directory: %s\n", bindtextdomain("webcit", LOCALEDIR"/locale"));
-       lprintf(9, "Text domain: %s\n", textdomain("webcit"));
-       lprintf(9, "Text domain Charset: %s\n", bind_textdomain_codeset("webcit","UTF8"));
+       syslog(9, "Message catalog directory: %s\n", bindtextdomain("webcit", LOCALEDIR"/locale"));
+       syslog(9, "Text domain: %s\n", textdomain("webcit"));
+       syslog(9, "Text domain Charset: %s\n", bind_textdomain_codeset("webcit","UTF8"));
 
 #endif
 }
index ceb78fd..01dbe4f 100644 (file)
@@ -155,7 +155,7 @@ const folder *GetRESTFolder(int IgnoreFloor, HashList *Subfolders)
                        {
                                DeleteHashPos(&itd);
                                
-                               lprintf(0, "5\n");
+                               syslog(0, "5\n");
                                continue;
                        }
                        DeleteHashPos(&itd);
@@ -166,7 +166,7 @@ const folder *GetRESTFolder(int IgnoreFloor, HashList *Subfolders)
                        {
                                DeleteHashPos(&itd);
                                
-                               lprintf(0, "5\n");
+                               syslog(0, "5\n");
                                continue;
                        }
                        DeleteHashPos(&itfl);
index 2f4503b..17ca579 100644 (file)
@@ -57,7 +57,7 @@ void groupdav_put_bigics(void)
 
        /* Report success and not much else. */
        hprintf("HTTP/1.1 204 No Content\r\n");
-       lprintf(9, "HTTP/1.1 204 No Content\r\n");
+       syslog(9, "HTTP/1.1 204 No Content\r\n");
        groupdav_common_headers();
        begin_burst();
        end_burst();
@@ -124,12 +124,12 @@ void groupdav_put(void)
         * version, so we fail...
         */
        if (StrLength(WCC->Hdr->HR.dav_ifmatch) > 0) {
-               lprintf(9, "dav_ifmatch: %s\n", WCC->Hdr->HR.dav_ifmatch);
+               syslog(9, "dav_ifmatch: %s\n", WCC->Hdr->HR.dav_ifmatch);
                old_msgnum = locate_message_by_uid(ChrPtr(dav_uid));
-               lprintf(9, "old_msgnum:  %ld\n", old_msgnum);
+               syslog(9, "old_msgnum:  %ld\n", old_msgnum);
                if (StrTol(WCC->Hdr->HR.dav_ifmatch) != old_msgnum) {
                        hprintf("HTTP/1.1 412 Precondition Failed\r\n");
-                       lprintf(9, "HTTP/1.1 412 Precondition Failed (ifmatch=%ld, old_msgnum=%ld)\r\n",
+                       syslog(9, "HTTP/1.1 412 Precondition Failed (ifmatch=%ld, old_msgnum=%ld)\r\n",
                                StrTol(WCC->Hdr->HR.dav_ifmatch), old_msgnum);
                        groupdav_common_headers();
                        
@@ -180,7 +180,7 @@ void groupdav_put(void)
                        new_msgnum = atol(buf);
                        break;
                case 1: 
-                       lprintf(9, "new_msgnum=%ld (%s)\n", new_msgnum, buf);
+                       syslog(9, "new_msgnum=%ld (%s)\n", new_msgnum, buf);
                        break;
                case 2: 
                        StrBufAppendBufPlain(dav_uid, buf, -1, 0);
@@ -210,7 +210,7 @@ void groupdav_put(void)
        if (old_msgnum < 0L) {
                char escaped_uid[1024];
                hprintf("HTTP/1.1 201 Created\r\n");
-               lprintf(9, "HTTP/1.1 201 Created\r\n");
+               syslog(9, "HTTP/1.1 201 Created\r\n");
                groupdav_common_headers();
                hprintf("etag: \"%ld\"\r\n", new_msgnum);
                hprintf("Location: ");
@@ -227,7 +227,7 @@ void groupdav_put(void)
 
        /* We modified an existing item. */
        hprintf("HTTP/1.1 204 No Content\r\n");
-       lprintf(9, "HTTP/1.1 204 No Content\r\n");
+       syslog(9, "HTTP/1.1 204 No Content\r\n");
        groupdav_common_headers();
        hprintf("Etag: \"%ld\"\r\n", new_msgnum);
        /* The item we replaced has probably already been deleted by
index 33eeedf..c2a0bf6 100644 (file)
@@ -301,10 +301,10 @@ void output_html(const char *supplied_charset, int treat_as_wiki, int msgnum, St
                        && (strcasecmp(charset, "UTF-8"))
                        && (strcasecmp(charset, ""))
           ) {
-               lprintf(9, "Converting %s to UTF-8\n", charset);
+               syslog(9, "Converting %s to UTF-8\n", charset);
                ctdl_iconv_open("UTF-8", charset, &ic);
                if (ic == (iconv_t)(-1) ) {
-                       lprintf(5, "%s:%d iconv_open() failed: %s\n",
+                       syslog(5, "%s:%d iconv_open() failed: %s\n",
                                        __FILE__, __LINE__, strerror(errno));
                }
        }
@@ -412,9 +412,9 @@ void output_html(const char *supplied_charset, int treat_as_wiki, int msgnum, St
                         * and then ended the message)
                         */
                        if (!tag_end) {
-                               lprintf(9, "tag_end is null and ptr is:\n");
-                               lprintf(9, "%s\n", ptr);
-                               lprintf(9, "Theoretical bytes remaining: %d\n", msgend - ptr);
+                               syslog(9, "tag_end is null and ptr is:\n");
+                               syslog(9, "%s\n", ptr);
+                               syslog(9, "Theoretical bytes remaining: %d\n", msgend - ptr);
                        }
 
                        src=strstr(ptr, "src=\"cid:");
@@ -639,7 +639,7 @@ void url(char *buf, size_t bufsize)
        start = NULL;
        len = strlen(buf);
        if (len > bufsize) {
-               lprintf(1, "URL: content longer than buffer!");
+               syslog(1, "URL: content longer than buffer!");
                return;
        }
        end = buf + len;
@@ -675,7 +675,7 @@ void url(char *buf, size_t bufsize)
        
        UrlLen = end - start;
        if (UrlLen > sizeof(urlbuf)){
-               lprintf(1, "URL: content longer than buffer!");
+               syslog(1, "URL: content longer than buffer!");
                return;
        }
        memcpy(urlbuf, start, UrlLen);
@@ -688,7 +688,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) {
-               lprintf(1, "URL: content longer than buffer!");
+               syslog(1, "URL: content longer than buffer!");
                return;
        }
 
@@ -696,7 +696,7 @@ void url(char *buf, size_t bufsize)
        if (TrailerLen > 0)
                memcpy(outbuf + Offset + outpos, end, TrailerLen);
        if (Offset + outpos + TrailerLen > bufsize) {
-               lprintf(1, "URL: content longer than buffer!");
+               syslog(1, "URL: content longer than buffer!");
                return;
        }
        memcpy (buf, outbuf, Offset + outpos + TrailerLen);
index c890129..c50f756 100644 (file)
@@ -24,11 +24,11 @@ icaltimezone *get_default_icaltimezone(void) {
                 zone = icaltimezone_get_builtin_timezone(default_zone_name);
         }
         if (!zone) {
-               lprintf(1, "Unable to load '%s' time zone.  Defaulting to UTC.\n", default_zone_name);
+               syslog(1, "Unable to load '%s' time zone.  Defaulting to UTC.\n", default_zone_name);
                 zone = icaltimezone_get_utc_timezone();
        }
        if (!zone) {
-               lprintf(1, "Unable to load UTC time zone!\n");
+               syslog(1, "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
-                       lprintf(9, "                * Stringy supplied timezone is: '%s'\n", tzid);
+                       syslog(9, "                * Stringy supplied timezone is: '%s'\n", tzid);
 #endif
                        if ( (!strcasecmp(tzid, "UTC")) || (!strcasecmp(tzid, "GMT")) ) {
                                utc_declared_as_tzid = 1;
 #ifdef DBG_ICAL
-                               lprintf(9, "                * ...and we handle that internally.\n");
+                               syslog(9, "                * ...and we handle that internally.\n");
 #endif
                        }
                        else {
                                /* try attached first */
                                t = icalcomponent_get_timezone(cal, tzid);
 #ifdef DBG_ICAL
-                               lprintf(9, "                * ...and I %s have tzdata for that zone.\n",
+                               syslog(9, "                * ...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) {
-                                               lprintf(9, "                * Using system tzdata!\n");
+                                               syslog(9, "                * Using system tzdata!\n");
                                        }
 #endif
                                }
@@ -113,18 +113,18 @@ void ical_dezonify_backend(icalcomponent *cal,
        }
 
 #ifdef DBG_ICAL
-       lprintf(9, "                * Was: %s\n", icaltime_as_ical_string(TheTime));
+       syslog(9, "                * Was: %s\n", icaltime_as_ical_string(TheTime));
 #endif
 
        if (TheTime.is_utc) {
 #ifdef DBG_ICAL
-               lprintf(9, "                * This property is ALREADY UTC.\n");
+               syslog(9, "                * This property is ALREADY UTC.\n");
 #endif
        }
 
        else if (utc_declared_as_tzid) {
 #ifdef DBG_ICAL
-               lprintf(9, "                * Replacing '%s' TZID with 'Z' suffix.\n", tzid);
+               syslog(9, "                * 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
-                       lprintf(9, "                * Timezone prop found.  Converting to UTC.\n");
+                       syslog(9, "                * Timezone prop found.  Converting to UTC.\n");
 #endif
                }
                else {
 #ifdef DBG_ICAL
-                       lprintf(9, "                * Converting default timezone to UTC.\n");
+                       syslog(9, "                * 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
-       lprintf(9, "                * Now: %s\n", icaltime_as_ical_string(TheTime));
+       syslog(9, "                * 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
-       lprintf(9, "ical_dezonify() started\n");
+       syslog(9, "ical_dezonify() started\n");
 #endif
 
        /* Convert all times to UTC */
@@ -233,7 +233,7 @@ void ical_dezonify(icalcomponent *cal) {
        }
 
 #ifdef DBG_ICAL
-       lprintf(9, "ical_dezonify() completed\n");
+       syslog(9, "ical_dezonify() completed\n");
 #endif
 }
 
index 51fcc94..ab28475 100644 (file)
@@ -70,7 +70,7 @@ void load_inetconf(void)
                        GetHash(WCC->InetCfg, ChrPtr(CfgToken), StrLength(CfgToken), &vHash);
                        Hash = (HashList*) vHash;
                        if (Hash == NULL) {
-                               lprintf(1, "ERROR Loading inet config line: [%s]\n", 
+                               syslog(1, "ERROR Loading inet config line: [%s]\n", 
                                        ChrPtr(Buf));
                                FreeStrBuf(&Value);
                                continue;
index f0ca6c1..0c173b5 100644 (file)
@@ -33,5 +33,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);
-       lprintf(9, "Client is at %s\n", clienthost);
+       syslog(9, "Client is at %s\n", clienthost);
 }
index 951dcc4..d099de8 100644 (file)
@@ -547,7 +547,7 @@ message_summary *ReadOneMessageSummary(StrBuf *RawMessage, const char *DefaultSu
                        StrBufCutLeft(Buf, nBuf + 1);
                        Eval->f(Msg, Buf);
                }
-               else lprintf(1, "Don't know how to handle Message Headerline [%s]", ChrPtr(Buf));
+               else syslog(1, "Don't know how to handle Message Headerline [%s]", ChrPtr(Buf));
        }
        return Msg;
 }
@@ -1050,7 +1050,7 @@ void post_message(void)
                        if (GetServerStatus(Buf, NULL) != 2) {
                                /* You probably don't even have a dumb Drafts folder */
                                StrBufCutLeft(Buf, 4);
-                               lprintf(9, "%s:%d: server save to drafts error: %s\n", __FILE__, __LINE__, ChrPtr(Buf));
+                               syslog(9, "%s:%d: server save to drafts error: %s\n", __FILE__, __LINE__, ChrPtr(Buf));
                                StrBufAppendBufPlain(WCC->ImportantMsg, _("Saved to Drafts failed: "), -1, 0);
                                StrBufAppendBuf(WCC->ImportantMsg, Buf, 0);
                                display_enter();
@@ -1123,7 +1123,7 @@ void post_message(void)
                }
                else 
                {
-                       lprintf(9, "%s\n", ChrPtr(CmdBuf));
+                       syslog(9, "%s\n", ChrPtr(CmdBuf));
                        serv_puts(ChrPtr(CmdBuf));
                        FreeStrBuf(&CmdBuf);
 
@@ -1161,7 +1161,7 @@ void post_message(void)
                        } else {
                                StrBufCutLeft(Buf, 4);
 
-                               lprintf(9, "%s:%d: server post error: %s\n", __FILE__, __LINE__, ChrPtr(Buf));
+                               syslog(9, "%s:%d: server post error: %s\n", __FILE__, __LINE__, ChrPtr(Buf));
                                StrBufAppendBuf(WCC->ImportantMsg, Buf, 0);
                                if (save_to_drafts) gotoroom(WCC->CurRoom.name);
                                display_enter();
@@ -1214,16 +1214,16 @@ void upload_attachment(void) {
        void *v;
        wc_mime_attachment *att;
 
-       lprintf(9, "upload_attachment()\n");
+       syslog(9, "upload_attachment()\n");
        wc_printf("upload_attachment()<br>\n");
 
        if (WCC->upload_length <= 0) {
-               lprintf(9, "ERROR no attachment was uploaded\n");
+               syslog(9, "ERROR no attachment was uploaded\n");
                wc_printf("ERROR no attachment was uploaded<br>\n");
                return;
        }
 
-       lprintf(9, "Client is uploading %d bytes\n", WCC->upload_length);
+       syslog(9, "Client is uploading %d bytes\n", WCC->upload_length);
        wc_printf("Client is uploading %d bytes<br>\n", WCC->upload_length);
        att = malloc(sizeof(wc_mime_attachment));
        memset(att, 0, sizeof(wc_mime_attachment ));
index 257177d..95325dc 100755 (executable)
@@ -155,7 +155,7 @@ HOOKNAME=`echo $HOOK |sed "s;ServerStartModule_;;"`
 # Add this entry point to the .c file
 cat <<EOF >> $C_FILE
 #ifdef DBG_PRINNT_HOOKS_AT_START
-       lprintf (CTDL_INFO, "Starting $HOOKNAME\n");
+       syslog(CTDL_INFO, "Starting $HOOKNAME\n");
 #endif
        $HOOK();
 EOF
@@ -187,7 +187,7 @@ for HOOK in $INIT_FUNCS; do
 # Add this entry point to the .c file
     cat <<EOF >> $C_FILE
 #ifdef DBG_PRINNT_HOOKS_AT_START
-       lprintf (CTDL_INFO, "Initializing $HOOKNAME\n");
+       syslog(CTDL_INFO, "Initializing $HOOKNAME\n");
 #endif
        $HOOK();
 EOF
@@ -220,7 +220,7 @@ HOOKNAME=`echo $HOOK |sed "s;ServerShutdownModule_;;"`
 # Add this entry point to the .c file
 cat <<EOF >> $C_FILE
 #ifdef DBG_PRINNT_HOOKS_AT_START
-       lprintf (CTDL_INFO, "Shutting down $HOOKNAME\n");
+       syslog(CTDL_INFO, "Shutting down $HOOKNAME\n");
 #endif
        $HOOK();
 EOF
@@ -253,7 +253,7 @@ HOOKNAME=`echo $HOOK |sed "s;SessionNewModule_;;"`
 # Add this entry point to the .c file
 cat <<EOF >> $C_FILE
 #ifdef DBG_PRINNT_HOOKS_AT_START
-       lprintf (CTDL_INFO, "Initializing $HOOKNAME\n");
+       syslog(CTDL_INFO, "Initializing $HOOKNAME\n");
 #endif
        $HOOK(sess);
 EOF
@@ -285,7 +285,7 @@ HOOKNAME=`echo $HOOK |sed "s;SessionAttachModule_;;"`
 # Add this entry point to the .c file
 cat <<EOF >> $C_FILE
 #ifdef DBG_PRINNT_HOOKS_AT_START
-       lprintf (CTDL_INFO, "Attaching Session; $HOOKNAME\n");
+       syslog(CTDL_INFO, "Attaching Session; $HOOKNAME\n");
 #endif
        $HOOK(sess);
 EOF
@@ -317,7 +317,7 @@ HOOKNAME=`echo $HOOK |sed "s;SessionDetachModule_;;"`
 # Add this entry point to the .c file
 cat <<EOF >> $C_FILE
 #ifdef DBG_PRINNT_HOOKS_AT_START
-       lprintf (CTDL_INFO, "Initializing $HOOKNAME\n");
+       syslog(CTDL_INFO, "Initializing $HOOKNAME\n");
 #endif
        $HOOK(sess);
 EOF
@@ -350,7 +350,7 @@ HOOKNAME=`echo $HOOK |sed "s;SessionDestroyModule_;;"`
 # Add this entry point to the .c file
 cat <<EOF >> $C_FILE
 #ifdef DBG_PRINNT_HOOKS_AT_START
-       lprintf (CTDL_INFO, "Initializing $HOOKNAME\n");
+       syslog(CTDL_INFO, "Initializing $HOOKNAME\n");
 #endif
        $HOOK(*sess);
 EOF
@@ -387,7 +387,7 @@ HOOKNAME=`echo $HOOK |sed "s;HttpNewModule_;;"`
 # Add this entry point to the .c file
 cat <<EOF >> $C_FILE
 #ifdef DBG_PRINNT_HOOKS_AT_START
-       lprintf (CTDL_INFO, "NEW $HOOKNAME\n");
+       syslog(CTDL_INFO, "NEW $HOOKNAME\n");
 #endif
        $HOOK(httpreq);
 EOF
@@ -415,7 +415,7 @@ HOOKNAME=`echo $HOOK |sed "s;HttpDetachModule_;;"`
 # Add this entry point to the .c file
 cat <<EOF >> $C_FILE
 #ifdef DBG_PRINNT_HOOKS_AT_START
-       lprintf (CTDL_INFO, "Detaching $HOOKNAME\n");
+       syslog(CTDL_INFO, "Detaching $HOOKNAME\n");
 #endif
        $HOOK(httpreq);
 EOF
@@ -444,7 +444,7 @@ HOOKNAME=`echo $HOOK |sed "s;HttpDestroyModule_;;"`
 # Add this entry point to the .c file
 cat <<EOF >> $C_FILE
 #ifdef DBG_PRINNT_HOOKS_AT_START
-       lprintf (CTDL_INFO, "Destructing $HOOKNAME\n");
+       syslog(CTDL_INFO, "Destructing $HOOKNAME\n");
 #endif
        $HOOK(httpreq);
 EOF
index 8793150..60f569a 100644 (file)
@@ -853,7 +853,7 @@ void examine_content_type(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCh
                                Hdr = (headereval*)vHdr;
                                Hdr->evaluator(Msg, Value, FoundCharset);
                        }
-                       else lprintf(1, "don't know how to handle content type sub-header[%s]\n", ChrPtr(Token));
+                       else syslog(1, "don't know how to handle content type sub-header[%s]\n", ChrPtr(Token));
                }
                FreeStrBuf(&Token);
                FreeStrBuf(&Value);
@@ -999,7 +999,7 @@ void render_MAIL_text_plain(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *F
                else {
                        ctdl_iconv_open("UTF-8", ChrPtr(cs), &ic);
                        if (ic == (iconv_t)(-1) ) {
-                               lprintf(5, "%s:%d iconv_open(UTF-8, %s) failed: %s\n",
+                               syslog(5, "%s:%d iconv_open(UTF-8, %s) failed: %s\n",
                                        __FILE__, __LINE__, ChrPtr(Mime->Charset), strerror(errno));
                        }
                }
index 3d12c37..912aa6f 100644 (file)
@@ -41,7 +41,7 @@ void ParseURLParams(StrBuf *url)
                }
                keylen = aptr - up - 1; /* -1 -> '=' */
                if(keylen > sizeof(u->url_key)) {
-                       lprintf(1, "URLkey to long! [%s]", up);
+                       syslog(1, "URLkey to long! [%s]", up);
                        continue;
                }
 
@@ -49,7 +49,7 @@ void ParseURLParams(StrBuf *url)
                memcpy(u->url_key, up, keylen);
                u->url_key[keylen] = '\0';
                if (keylen < 0) {
-                       lprintf(1, "URLkey to long! [%s]", up);
+                       syslog(1, "URLkey to long! [%s]", up);
                        free(u);
                        continue;
                }
@@ -61,7 +61,7 @@ void ParseURLParams(StrBuf *url)
                        u->url_data = NewStrBufPlain(aptr, len);
                        StrBufUnescape(u->url_data, 1);
 #ifdef DEBUG_URLSTRINGS
-                       lprintf(9, "%s = [%ld]  %s\n", 
+                       syslog(9, "%s = [%ld]  %s\n", 
                                u->url_key, 
                                StrLength(u->url_data), 
                                ChrPtr(u->url_data)); 
@@ -71,7 +71,7 @@ void ParseURLParams(StrBuf *url)
                        len = bptr - aptr;
                        u->url_data = NewStrBufPlain(aptr, len);
                        StrBufUnescape(u->url_data, 1);
-                       lprintf(1, "REJECTED because of __ is internal only: %s = [%ld]  %s\n", 
+                       syslog(1, "REJECTED because of __ is internal only: %s = [%ld]  %s\n", 
                                u->url_key, 
                                StrLength(u->url_data), 
                                ChrPtr(u->url_data)); 
@@ -308,7 +308,7 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp,
        long keylen;
 
 #ifdef DEBUG_URLSTRINGS
-       lprintf(9, "\033[31mupload_handler() name=%s, type=%s, len=%d\033[0m\n", name, cbtype, length);
+       syslog(9, "\033[31mupload_handler() name=%s, type=%s, len=%d\033[0m\n", name, cbtype, length);
 #endif
        if (WCC->Hdr->urlstrings == NULL)
                WCC->Hdr->urlstrings = NewHash(1, NULL);
@@ -325,7 +325,7 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp,
                        Put(WCC->Hdr->urlstrings, u->url_key, keylen, u, free_url);
                }
                else {
-                       lprintf(1, "REJECTED because of __ is internal only: %s = [%ld]  %s\n", 
+                       syslog(1, "REJECTED because of __ is internal only: %s = [%ld]  %s\n", 
                                u->url_key, 
                                StrLength(u->url_data), 
                                ChrPtr(u->url_data)); 
@@ -333,7 +333,7 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp,
                        free_url(u);
                }
 #ifdef DEBUG_URLSTRINGS
-               lprintf(9, "Key: <%s> len: [%ld] Data: <%s>\n", 
+               syslog(9, "Key: <%s> len: [%ld] Data: <%s>\n", 
                        u->url_key, 
                        StrLength(u->url_data), 
                        ChrPtr(u->url_data));
@@ -347,7 +347,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
-               lprintf(9, "File: <%s> len: [%ld]\n", filename, length);
+               syslog(9, "File: <%s> len: [%ld]\n", filename, length);
 #endif
                
        }
@@ -361,7 +361,7 @@ void PutBstr(const char *key, long keylen, StrBuf *Value)
        urlcontent *u;
 
        if(keylen > sizeof(u->url_key)) {
-               lprintf(1, "URLkey to long! [%s]", key);
+               syslog(1, "URLkey to long! [%s]", key);
                FreeStrBuf(&Value);
                return;
        }
index b2606b9..a492f5d 100644 (file)
@@ -108,7 +108,7 @@ void GetPrefTypes(HashList *List)
                        Pref->Type = PrefType;
                        Pref->eFlatPrefType = Pref->Type->eType;
 
-                       lprintf(1, "Loading [%s]with type [%ld] [\"%s\"]\n",
+                       syslog(1, "Loading [%s]with type [%ld] [\"%s\"]\n",
                                ChrPtr(Pref->Key),
                                Pref->Type->eType,
                                ChrPtr(Pref->Val));
@@ -136,7 +136,7 @@ void GetPrefTypes(HashList *List)
 
                        if (PrefType->OnLoad != NULL){
 
-                               lprintf(1, "Loading with: -> %s(\"%s\", %ld)\n",
+                               syslog(1, "Loading with: -> %s(\"%s\", %ld)\n",
                                        ChrPtr(PrefType->OnLoadName),
                                        ChrPtr(Pref->Val),
                                        Pref->lval);
@@ -182,7 +182,7 @@ void ParsePref(HashList **List, StrBuf *ReadBuf)
                        else 
                        {
                                StrBufTrim(ReadBuf);
-                               lprintf(1, "ignoring spurious preference line: [%s]\n", 
+                               syslog(1, "ignoring spurious preference line: [%s]\n", 
                                        ChrPtr(ReadBuf));
                                DestroyPreference(Data);
                                LastData = NULL;
@@ -536,7 +536,7 @@ void set_preference_backend(const char *key, size_t keylen,
                Pref->Type = PrefType;
                Pref->eFlatPrefType = PrefType->eType;
                if (Pref->Type->eType != lPrefType)
-                       lprintf(1, "warning: saving preference with wrong type [%s] %ld != %ld \n",
+                       syslog(1, "warning: saving preference with wrong type [%s] %ld != %ld \n",
                                key, Pref->Type->eType, lPrefType);
                switch (Pref->Type->eType)
                {
index f30d0d8..bb59c95 100644 (file)
@@ -607,11 +607,11 @@ int ConditionalRoomIsRESTSubRoom(StrBuf *Target, WCTemplputParams *TP)
        urlp = GetCount(WCC->Directory);
        delta = Folder->nRoomNameParts - urlp + 1;
 
-       lprintf(0, "\n->%s: %ld - %ld ", ChrPtr(Folder->name), urlp, 
+       syslog(0, "\n->%s: %ld - %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) {
-               lprintf(0, "1\n");
+               syslog(0, "1\n");
                return 0;
        }
 
@@ -631,7 +631,7 @@ int ConditionalRoomIsRESTSubRoom(StrBuf *Target, WCTemplputParams *TP)
                        {
                                DeleteHashPos(&it);
 
-                               lprintf(0, "3\n");
+                               syslog(0, "3\n");
                                return 0;
                        }
                        Dir = (StrBuf*) vDir;
@@ -639,7 +639,7 @@ int ConditionalRoomIsRESTSubRoom(StrBuf *Target, WCTemplputParams *TP)
                                   ChrPtr(Dir)) != 0)
                        {
                                DeleteHashPos(&it);
-                               lprintf(0, "4\n");
+                               syslog(0, "4\n");
                                return 0;
                        }
                }
@@ -653,7 +653,7 @@ int ConditionalRoomIsRESTSubRoom(StrBuf *Target, WCTemplputParams *TP)
                {
                        DeleteHashPos(&it);
                        
-                       lprintf(0, "5\n");
+                       syslog(0, "5\n");
                        return WCC->Hdr->HR.dav_depth == 1;
                }
                DeleteHashPos(&it);
index 982c713..27b9751 100644 (file)
@@ -58,7 +58,7 @@ void _DBG_QR(long QR)
                i = i << 1;
                j++;
        }
-       lprintf(9, "DBG: QR-Vec [%ld] [%s]\n", QR, ChrPtr(QRVec));
+       syslog(9, "DBG: QR-Vec [%ld] [%s]\n", QR, ChrPtr(QRVec));
        FreeStrBuf(&QRVec);
 }
 
@@ -81,7 +81,7 @@ void _DBG_QR2(long QR2)
                i = i << 1;
                j++;
        }
-       lprintf(9, "DBG: QR2-Vec [%ld] [%s]\n", QR2, ChrPtr(QR2Vec));
+       syslog(9, "DBG: QR2-Vec [%ld] [%s]\n", QR2, ChrPtr(QR2Vec));
        FreeStrBuf(&QR2Vec);
 }
 
index 6d2544b..af93ae9 100644 (file)
@@ -93,7 +93,7 @@ int ConditionalRoomHasGroupdavContent(StrBuf *Target, WCTemplputParams *TP)
 {
        folder *Folder = (folder *)CTX;
 
-       lprintf(0, "-> %s: %ld\n", ChrPtr(Folder->name), Folder->view);
+       syslog(0, "-> %s: %ld\n", ChrPtr(Folder->name), Folder->view);
 
        return ((Folder->view == VIEW_CALENDAR) || 
                (Folder->view == VIEW_TASKS) || 
index 6a53a36..6e9b300 100644 (file)
@@ -63,7 +63,7 @@ ServInfo *get_serv_info(StrBuf *browser_host, StrBuf *user_agent)
        );
        StrBuf_ServGetln(Buf);
        if (GetServerStatus(Buf, NULL) != 2) {
-               lprintf(0, "get_serv_info(IDEN): unexpected answer [%s]\n",
+               syslog(0, "get_serv_info(IDEN): unexpected answer [%s]\n",
                        ChrPtr(Buf));
                FreeStrBuf(&Buf);
                return NULL;
@@ -77,7 +77,7 @@ ServInfo *get_serv_info(StrBuf *browser_host, StrBuf *user_agent)
        serv_puts("ICAL sgi|1");
        StrBuf_ServGetln(Buf);
        if (GetServerStatus(Buf, NULL) != 2) {
-               lprintf(0, "get_serv_info(ICAL sgi|1): unexpected answer [%s]\n",
+               syslog(0, "get_serv_info(ICAL sgi|1): unexpected answer [%s]\n",
                        ChrPtr(Buf));
                FreeStrBuf(&Buf);
                return NULL;
@@ -87,7 +87,7 @@ ServInfo *get_serv_info(StrBuf *browser_host, StrBuf *user_agent)
        serv_puts("INFO");
        StrBuf_ServGetln(Buf);
        if (GetServerStatus(Buf, NULL) != 1) {
-               lprintf(0, "get_serv_info(INFO sgi|1): unexpected answer [%s]\n",
+               syslog(0, "get_serv_info(INFO sgi|1): unexpected answer [%s]\n",
                        ChrPtr(Buf));
                FreeStrBuf(&Buf);
                return NULL;
index 8e4e733..c5927f0 100644 (file)
@@ -18,8 +18,8 @@ char setup_directory[SIZ];
 int using_web_installer = 0;
 char suggested_url[SIZ];
 
-/* some copies... */
-int lprintf(int loglevel, const char *format, ...){return 0;}
+/* some copies... 
+int syslog(int loglevel, const char *format, ...){return 0;} */
 void wc_printf(const char *format,...){}
 
 void RegisterNS(const char *NSName, long len, 
index 041bcb1..f0e8b49 100644 (file)
@@ -109,7 +109,7 @@ void LoadZoneFiles(void)
        Put(ZoneHash, HKEY("UTC"), ZName, HFreeStrBuf);
        zones = icaltimezone_get_builtin_timezones();
        for (z = 0; z < zones->num_elements; ++z) {
-               /* lprintf(9, "Location: %-40s tzid: %s\n",
+               /* syslog(9, "Location: %-40s tzid: %s\n",
                        icaltimezone_get_location(icalarray_element_at(zones, z)),
                        icaltimezone_get_tzid(icalarray_element_at(zones, z))
                ); */
index f03c7aa..971def8 100644 (file)
@@ -21,7 +21,7 @@
 HashList *StaticFilemappings[4] = {NULL, NULL, NULL, NULL};
 /*
                {
-                       lprintf(9, "Suspicious request. Ignoring.");
+                       syslog(9, "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");
@@ -43,7 +43,7 @@ void output_static(const char *what)
 
        fd = open(what, O_RDONLY);
        if (fd <= 0) {
-               lprintf(9, "output_static('%s') [%s]  -- NOT FOUND --\n", what, ChrPtr(WC->Hdr->this_page));
+               syslog(9, "output_static('%s') [%s]  -- NOT FOUND --\n", what, ChrPtr(WC->Hdr->this_page));
                hprintf("HTTP/1.1 404 %s\r\n", strerror(errno));
                hprintf("Content-Type: text/plain\r\n");
                begin_burst();
@@ -54,7 +54,7 @@ void output_static(const char *what)
                content_type = GuessMimeByFilename(what, len);
 
                if (fstat(fd, &statbuf) == -1) {
-                       lprintf(9, "output_static('%s')  -- FSTAT FAILED --\n", what);
+                       syslog(9, "output_static('%s')  -- FSTAT FAILED --\n", what);
                        hprintf("HTTP/1.1 404 %s\r\n", strerror(errno));
                        hprintf("Content-Type: text/plain\r\n");
                        begin_burst();
@@ -70,7 +70,7 @@ void output_static(const char *what)
                if (StrBufReadBLOB(WC->WBuf, &fd, 1, bytes, &Err) < 0)
                {
                        if (fd > 0) close(fd);
-                       lprintf(9, "output_static('%s')  -- FREAD FAILED (%s) --\n", what, strerror(errno));
+                       syslog(9, "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();
@@ -198,7 +198,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);
-                       /* lprintf(9, "[%s | %s]\n", ChrPtr(OneWebName), ChrPtr(FileName)); */
+                       /* syslog(9, "[%s | %s]\n", ChrPtr(OneWebName), ChrPtr(FileName)); */
                        break;
                default:
                        break;
@@ -246,7 +246,7 @@ void output_static_safe(HashList *DirList)
                output_static(ChrPtr(vFile));
        }
        else {
-               lprintf(1, "output_static_safe() file %s not found. \n", 
+               syslog(1, "output_static_safe() file %s not found. \n", 
                        ChrPtr(WCC->Hdr->HR.ReqLine));
 ///TODO: detect image & output blank image
                do_404();
index 3fa878a..dce5de8 100644 (file)
@@ -157,7 +157,7 @@ void LogTemplateError (StrBuf *Target, const char *Type, int ErrorPos, WCTemplpu
        }
        if (TP->Tokens != NULL) 
        {
-               lprintf(1, "%s [%s]  (in '%s' line %ld); %s; [%s]\n", 
+               syslog(1, "%s [%s]  (in '%s' line %ld); %s; [%s]\n", 
                        Type, 
                        Err, 
                        ChrPtr(TP->Tokens->FileName),
@@ -167,7 +167,7 @@ void LogTemplateError (StrBuf *Target, const char *Type, int ErrorPos, WCTemplpu
        }
        else 
        {
-               lprintf(1, "%s: %s;\n", 
+               syslog(1, "%s: %s;\n", 
                        Type, 
                        ChrPtr(Error));
        }
@@ -256,7 +256,7 @@ void LogError (StrBuf *Target, const char *Type, const char *Format, ...)
        StrBufVAppendPrintf(Error, Format, arg_ptr);
        va_end(arg_ptr);
 
-       lprintf(1, ChrPtr(Error));
+       syslog(1, ChrPtr(Error));
 
        WCC = WC;
        if (WCC->WFBuf == NULL) WCC->WFBuf = NewStrBuf();
@@ -765,7 +765,7 @@ int GetNextParameter(StrBuf *Buf,
                }
                pche = pch;
                if (*pch != quote) {
-                       lprintf(1, "Error (in '%s' line %ld); "
+                       syslog(1, "Error (in '%s' line %ld); "
                                "evaluating template param [%s] in Token [%s]\n",
                                ChrPtr(pTmpl->FileName),
                                Tokens->Line,
@@ -779,7 +779,7 @@ int GetNextParameter(StrBuf *Buf,
                else {
                        StrBufPeek(Buf, pch, -1, '\0');         
                        if (LoadTemplates > 1) {                        
-                               lprintf(1, "DBG: got param [%s] %ld %ld\n", 
+                               syslog(1, "DBG: got param [%s] %ld %ld\n", 
                                        pchs, pche - pchs, strlen(pchs));
                        }
                        Parm->Start = pchs;
@@ -809,7 +809,7 @@ int GetNextParameter(StrBuf *Buf,
                else {
                        Parm->lvalue = 0;
 /* TODO whUT?
-                       lprintf(1, "Error (in '%s' line %ld); "
+                       syslog(1, "Error (in '%s' line %ld); "
                                "evaluating long template param [%s] in Token [%s]\n",
                                ChrPtr(pTmpl->FileName),
                                Tokens->Line,
@@ -1209,13 +1209,13 @@ void *load_template(WCTemplate *NewTemplate)
 
        fd = open(ChrPtr(NewTemplate->FileName), O_RDONLY);
        if (fd <= 0) {
-               lprintf(1, "ERROR: could not open template '%s' - %s\n",
+               syslog(1, "ERROR: could not open template '%s' - %s\n",
                        ChrPtr(NewTemplate->FileName), strerror(errno));
                return NULL;
        }
 
        if (fstat(fd, &statbuf) == -1) {
-               lprintf(1, "ERROR: could not stat template '%s' - %s\n",
+               syslog(1, "ERROR: could not stat template '%s' - %s\n",
                        ChrPtr(NewTemplate->FileName), strerror(errno));
                return NULL;
        }
@@ -1223,7 +1223,7 @@ void *load_template(WCTemplate *NewTemplate)
        NewTemplate->Data = NewStrBufPlain(NULL, statbuf.st_size + 1);
        if (StrBufReadBLOB(NewTemplate->Data, &fd, 1, statbuf.st_size, &Err) < 0) {
                close(fd);
-               lprintf(1, "ERROR: reading template '%s' - %s<br>\n",
+               syslog(1, "ERROR: reading template '%s' - %s<br>\n",
                        ChrPtr(NewTemplate->FileName), strerror(errno));
                //FreeWCTemplate(NewTemplate);/////tODO
                return NULL;
@@ -1414,7 +1414,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)
-                               lprintf(1, "%s %s\n", ChrPtr(FileName), ChrPtr(Key));
+                               syslog(1, "%s %s\n", ChrPtr(FileName), ChrPtr(Key));
                        prepare_template(FileName, Key, big);
                default:
                        break;
@@ -1508,7 +1508,7 @@ int EvaluateToken(StrBuf *Target, int state, WCTemplputParams *TP)
        void *vVar;
        
 /* much output, since pName is not terminated...
-       lprintf(1,"Doing token: %s\n",Token->pName);
+       syslog(1,"Doing token: %s\n",Token->pName);
 */
 
        switch (TP->Tokens->Flags) {
@@ -1592,7 +1592,7 @@ const StrBuf *ProcessTemplate(WCTemplate *Tmpl, StrBuf *Target, WCTemplputParams
 
        if (LoadTemplates != 0) {                       
                if (LoadTemplates > 1)
-                       lprintf(1, "DBG: ----- loading:  [%s] ------ \n", 
+                       syslog(1, "DBG: ----- loading:  [%s] ------ \n", 
                                ChrPtr(Tmpl->FileName));
                pTmpl = duplicate_template(Tmpl);
                if(load_template(pTmpl) == NULL) {
@@ -1676,14 +1676,14 @@ const StrBuf *DoTemplate(const char *templatename, long len, StrBuf *Target, WCT
 
        if (len == 0)
        {
-               lprintf (1, "Can't to load a template with empty name!\n");
+               syslog(1, "Can't to load a template with empty name!\n");
                StrBufAppendPrintf(Target, "<pre>\nCan't to load a template with empty name!\n</pre>");
                return NULL;
        }
 
        if (!GetHash(StaticLocal, templatename, len, &vTmpl) &&
            !GetHash(Static, templatename, len, &vTmpl)) {
-               lprintf (1, "didn't find Template [%s] %ld %ld\n", templatename, len , (long)strlen(templatename));
+               syslog(1, "didn't find Template [%s] %ld %ld\n", templatename, len , (long)strlen(templatename));
                StrBufAppendPrintf(Target, "<pre>\ndidn't find Template [%s] %ld %ld\n</pre>", 
                                   templatename, len, 
                                   (long)strlen(templatename));
@@ -2001,7 +2001,7 @@ int EvaluateConditional(StrBuf *Target, int Neg, int state, WCTemplputParams *TP
        if (res == Neg)
                rc = TP->Tokens->Params[1]->lvalue;
        if (LoadTemplates > 5) 
-               lprintf(1, "<%s> : %d %d==%d\n", 
+               syslog(1, "<%s> : %d %d==%d\n", 
                        ChrPtr(TP->Tokens->FlatToken), 
                        rc, res, Neg);
        return rc;
@@ -2333,7 +2333,7 @@ void RegisterSortFunc(const char *name, long len,
        NewSort->GroupChange = GroupChange;
        NewSort->ContextType = ContextType;
        if (ContextType == CTX_NONE) {
-               lprintf(1, "sorting requires a context. CTX_NONE won't make it.\n");
+               syslog(1, "sorting requires a context. CTX_NONE won't make it.\n");
                exit(1);
        }
                
@@ -2629,7 +2629,7 @@ void dbg_print_longvector(long *LongVector)
                        StrBufAppendPrintf(Buf, "%d: %ld]\n", i, LongVector[i]);
 
        }
-       lprintf(1, ChrPtr(Buf));
+       syslog(1, ChrPtr(Buf));
        FreeStrBuf(&Buf);
 }
 
index 3630125..101c364 100644 (file)
@@ -115,7 +115,6 @@ void InitialiseSemaphores(void)
  */
 void begin_critical_section(int which_one)
 {
-       /* lprintf(CTDL_DEBUG, "begin_critical_section(%d)\n", which_one); */
        pthread_mutex_lock(&Critters[which_one]);
 }
 
@@ -185,17 +184,17 @@ void worker_entry(void)
                        if (shutdown == 1)
                        {/* we're the one to cleanup the mess. */
                                http_destroy_modules(&Hdr);
-                               lprintf(2, "I'm master shutdown: tagging sessions to be killed.\n");
+                               syslog(2, "I'm master shutdown: tagging sessions to be killed.\n");
                                shutdown_sessions();
-                               lprintf(2, "master shutdown: waiting for others\n");
+                               syslog(2, "master shutdown: waiting for others\n");
                                sleeeeeeeeeep(1); /* wait so some others might finish... */
-                               lprintf(2, "master shutdown: cleaning up sessions\n");
+                               syslog(2, "master shutdown: cleaning up sessions\n");
                                do_housekeeping();
-                               lprintf(2, "master shutdown: cleaning up libical\n");
+                               syslog(2, "master shutdown: cleaning up libical\n");
 
                                ShutDownWebcit();
 
-                               lprintf(2, "master shutdown exiting.\n");                               
+                               syslog(2, "master shutdown exiting.\n");                                
                                exit(0);
                        }
                        break;
@@ -207,7 +206,7 @@ void worker_entry(void)
                /* Now do something. */
                if (msock < 0) {
                        if (ssock > 0) close (ssock);
-                       lprintf(2, "in between.");
+                       syslog(2, "in between.");
                        pthread_exit(NULL);
                } else {
                        /* Got it? do some real work! */
@@ -229,11 +228,11 @@ void worker_entry(void)
                                int fdflags; 
                                fdflags = fcntl(ssock, F_GETFL);
                                if (fdflags < 0)
-                                       lprintf(1, "unable to get server socket flags! %s \n",
+                                       syslog(1, "unable to get server socket flags! %s \n",
                                                strerror(errno));
                                fdflags = fdflags | O_NONBLOCK;
                                if (fcntl(ssock, F_SETFL, fdflags) < 0)
-                                       lprintf(1, "unable to set server socket nonblocking flags! %s \n",
+                                       syslog(1, "unable to set server socket nonblocking flags! %s \n",
                                                strerror(errno));
                        }
 
@@ -263,30 +262,10 @@ void worker_entry(void)
        } while (!time_to_die);
 
        http_destroy_modules(&Hdr);
-       lprintf (1, "Thread exiting.\n");
+       syslog(1, "Thread exiting.\n");
        pthread_exit(NULL);
 }
 
-/*
- * print log messages 
- * logs to stderr if loglevel is lower than the verbosity set at startup
- *
- * loglevel    level of the message
- * format      the printf like format string
- * ...         the strings to put into format
- */
-int lprintf(int loglevel, const char *format, ...)
-{
-       va_list ap;
-
-       if (loglevel <= verbosity) {
-               va_start(ap, format);
-               vfprintf(stderr, format, ap);
-               va_end(ap);
-               fflush(stderr);
-       }
-       return 1;
-}
 
 /*
  * Shut us down the regular way.
@@ -294,7 +273,7 @@ int lprintf(int loglevel, const char *format, ...)
  */
 pid_t current_child;
 void graceful_shutdown_watcher(int signum) {
-       lprintf (1, "Watcher thread exiting.\n");
+       syslog(1, "Watcher thread exiting.\n");
        kill(current_child, signum);
        if (signum != SIGHUP)
                exit(0);
@@ -310,7 +289,7 @@ void graceful_shutdown(int signum) {
        FILE *FD;
        int fd;
 
-       lprintf (1, "WebCit is being shut down on signal %d.\n", signum);
+       syslog(1, "WebCit is being shut down on signal %d.\n", signum);
        fd = msock;
        msock = -1;
        time_to_die = 1;
@@ -441,13 +420,13 @@ void spawn_another_worker_thread()
         * otherwise the MIME parser crashes on FreeBSD.
         */
        if ((ret = pthread_attr_setstacksize(&attr, 1024 * 1024))) {
-               lprintf(1, "pthread_attr_setstacksize: %s\n", strerror(ret));
+               syslog(1, "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) {
-               lprintf(1, "Can't create thread: %s\n", strerror(errno));
+               syslog(1, "Can't create thread: %s\n", strerror(errno));
        }
 
        /* free up the attributes */
@@ -497,7 +476,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... */
-       lprintf(9, "Changing directory to %s\n", socket_dir);
+       syslog(9, "Changing directory to %s\n", socket_dir);
        if (chdir(webcitdir) != 0) {
                perror("chdir");
        }
@@ -559,9 +538,9 @@ void wc_backtrace(void)
        strings = backtrace_symbols(stack_frames, size);
        for (i = 0; i < size; i++) {
                if (strings != NULL)
-                       lprintf(1, "%s\n", strings[i]);
+                       syslog(1, "%s\n", strings[i]);
                else
-                       lprintf(1, "%p\n", stack_frames[i]);
+                       syslog(1, "%p\n", stack_frames[i]);
        }
        free(strings);
 #endif
index d4b5b27..293cd03 100644 (file)
@@ -501,7 +501,7 @@ void save_individual_task(icalcomponent *supplied_vtodo, long msgnum, char* from
                                );
                }
                /** Give this task a UID if it doesn't have one. */
-               lprintf(9, "Give this task a UID if it doesn't have one.\n");
+               syslog(9, "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);
@@ -511,17 +511,17 @@ void save_individual_task(icalcomponent *supplied_vtodo, long msgnum, char* from
                }
 
                /* Increment the sequence ID */
-               lprintf(9, "Increment the sequence ID\n");
+               syslog(9, "Increment the sequence ID\n");
                while (prop = icalcomponent_get_first_property(vtodo,
                                                               ICAL_SEQUENCE_PROPERTY), (prop != NULL) ) {
                        i = icalproperty_get_sequence(prop);
-                       lprintf(9, "Sequence was %d\n", i);
+                       syslog(9, "Sequence was %d\n", i);
                        if (i > sequence) sequence = i;
                        icalcomponent_remove_property(vtodo, prop);
                        icalproperty_free(prop);
                }
                ++sequence;
-               lprintf(9, "New sequence is %d.  Adding...\n", sequence);
+               syslog(9, "New sequence is %d.  Adding...\n", sequence);
                icalcomponent_add_property(vtodo,
                                           icalproperty_new_sequence(sequence)
                        );
@@ -533,7 +533,7 @@ void save_individual_task(icalcomponent *supplied_vtodo, long msgnum, char* from
                 * can't encapsulate something that may already be encapsulated
                 * somewhere else.
                 */
-               lprintf(9, "Encapsulating into a full VCALENDAR component\n");
+               syslog(9, "Encapsulating into a full VCALENDAR component\n");
                encaps = ical_encapsulate_subcomponent(icalcomponent_new_clone(vtodo));
 
                /* Serialize it and save it to the message base */
index 4401783..767c20a 100644 (file)
@@ -33,7 +33,7 @@ long MaxRead = -1; /* should we do READ scattered or all at once? */
  */
 RETSIGTYPE timeout(int signum)
 {
-       lprintf(1, "Connection timed out; unable to reach citserver\n");
+       syslog(1, "Connection timed out; unable to reach citserver\n");
        /* no exit here, since we need to server the connection unreachable thing. exit(3); */
 }
 
@@ -52,12 +52,12 @@ int uds_connectsock(char *sockpath)
 
        s = socket(AF_UNIX, SOCK_STREAM, 0);
        if (s < 0) {
-               lprintf(1, "Can't create socket[%s]: %s\n", sockpath, strerror(errno));
+               syslog(1, "Can't create socket[%s]: %s\n", sockpath, strerror(errno));
                return(-1);
        }
 
        if (connect(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
-               lprintf(1, "Can't connect [%s]: %s\n", sockpath, strerror(errno));
+               syslog(1, "Can't connect [%s]: %s\n", sockpath, strerror(errno));
                close(s);
                return(-1);
        }
@@ -83,7 +83,7 @@ int tcp_connectsock(char *host, char *service)
        if ((service == NULL) || IsEmptyStr(service))
                return (-1);
 
-       lprintf(9, "tcp_connectsock(%s,%s)\n", host, service);
+       syslog(9, "tcp_connectsock(%s,%s)\n", host, service);
 
        memset(&hints, 0x00, sizeof(hints));
        hints.ai_flags = AI_NUMERICSERV;
@@ -109,7 +109,7 @@ int tcp_connectsock(char *host, char *service)
 
        rc = getaddrinfo(host, service, &hints, &res);
        if (rc != 0) {
-               lprintf(1, "%s: %s\n", host, gai_strerror(rc));
+               syslog(1, "%s: %s\n", host, gai_strerror(rc));
                freeaddrinfo(res);
                return(-1);
        }
@@ -119,13 +119,13 @@ int tcp_connectsock(char *host, char *service)
         */
        for (ai = res; ai != NULL; ai = ai->ai_next) {
 
-               if (ai->ai_family == AF_INET) lprintf(9, "Trying IPv4\n");
-               else if (ai->ai_family == AF_INET6) lprintf(9, "Trying IPv6\n");
-               else lprintf(9, "This is going to fail.\n");
+               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");
 
                s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
                if (s < 0) {
-                       lprintf(1, "socket() failed: %s\n", strerror(errno));
+                       syslog(1, "socket() failed: %s\n", strerror(errno));
                        freeaddrinfo(res);
                        return(-1);
                }
@@ -135,7 +135,7 @@ int tcp_connectsock(char *host, char *service)
                        return(s);
                }
                else {
-                       lprintf(1, "connect() failed: %s\n", strerror(errno));
+                       syslog(1, "connect() failed: %s\n", strerror(errno));
                        close(s);
                }
        }
@@ -161,7 +161,7 @@ int serv_getln(char *strbuf, int bufsize)
        FlushStrBuf(WCC->MigrateReadLineBuf);
        strbuf[len] = '\0';
 #ifdef SERV_TRACE
-       lprintf(9, "%3d<<<%s\n", WC->serv_sock, strbuf);
+       syslog(9, "%3d<<<%s\n", WC->serv_sock, strbuf);
 #endif
        return len;
 }
@@ -182,7 +182,7 @@ int StrBuf_ServGetln(StrBuf *buf)
                                               &ErrStr);
        if (rc < 0)
        {
-               lprintf(1, "Server connection broken: %s\n",
+               syslog(1, "Server connection broken: %s\n",
                        (ErrStr)?ErrStr:"");
                wc_backtrace();
                WCC->serv_sock = (-1);
@@ -195,7 +195,7 @@ int StrBuf_ServGetln(StrBuf *buf)
                long pos = 0;
                if (WCC->ReadPos != NULL)
                        pos = WCC->ReadPos - ChrPtr(WCC->ReadBuf);
-               lprintf(9, "%3d<<<[%ld]%s\n", WC->serv_sock, pos, ChrPtr(buf));
+               syslog(9, "%3d<<<[%ld]%s\n", WC->serv_sock, pos, ChrPtr(buf));
        }
 #endif
        return rc;
@@ -217,7 +217,7 @@ int StrBuf_ServGetBLOBBuffered(StrBuf *buf, long BlobSize)
                                    &ErrStr);
        if (rc < 0)
        {
-               lprintf(1, "Server connection broken: %s\n",
+               syslog(1, "Server connection broken: %s\n",
                        (ErrStr)?ErrStr:"");
                wc_backtrace();
                WCC->serv_sock = (-1);
@@ -226,7 +226,7 @@ int StrBuf_ServGetBLOBBuffered(StrBuf *buf, long BlobSize)
        }
 #ifdef SERV_TRACE
         else
-                lprintf(9, "%3d<<<BLOB: %ld bytes\n", WC->serv_sock, StrLength(buf));
+                syslog(9, "%3d<<<BLOB: %ld bytes\n", WC->serv_sock, StrLength(buf));
 #endif
 
        return rc;
@@ -242,7 +242,7 @@ int StrBuf_ServGetBLOB(StrBuf *buf, long BlobSize)
        rc = StrBufReadBLOB(buf, &WCC->serv_sock, 1, BlobSize, &ErrStr);
        if (rc < 0)
        {
-               lprintf(1, "Server connection broken: %s\n",
+               syslog(1, "Server connection broken: %s\n",
                        (ErrStr)?ErrStr:"");
                wc_backtrace();
                WCC->serv_sock = (-1);
@@ -251,7 +251,7 @@ int StrBuf_ServGetBLOB(StrBuf *buf, long BlobSize)
        }
 #ifdef SERV_TRACE
         else
-                lprintf(9, "%3d<<<BLOB: %ld bytes\n", WC->serv_sock, StrLength(buf));
+                syslog(9, "%3d<<<BLOB: %ld bytes\n", WC->serv_sock, StrLength(buf));
 #endif
 
        return rc;
@@ -275,9 +275,9 @@ void FlushReadBuf (void)
                pche = pch + len;
                if (WCC->ReadPos != pche)
                {
-                       lprintf(1, "ERROR: somebody didn't eat his soup! Remaing Chars: %d [%s]\n", 
+                       syslog(1, "ERROR: somebody didn't eat his soup! Remaing Chars: %d [%s]\n", 
                                pche - WCC->ReadPos, pche);
-                       lprintf(1, 
+                       syslog(1, 
                                "--------------------------------------------------------------------------------\n"
                                "Whole buf: [%s]\n"
                                "--------------------------------------------------------------------------------\n", 
@@ -310,7 +310,7 @@ void serv_write(const char *buf, int nbytes)
                               nbytes - bytes_written);
                if (retval < 1) {
                        const char *ErrStr = strerror(errno);
-                       lprintf(1, "Server connection broken: %s\n",
+                       syslog(1, "Server connection broken: %s\n",
                                (ErrStr)?ErrStr:"");
                        close(WCC->serv_sock);
                        WCC->serv_sock = (-1);
@@ -330,7 +330,7 @@ void serv_write(const char *buf, int nbytes)
 void serv_puts(const char *string)
 {
 #ifdef SERV_TRACE
-       lprintf(9, "%3d>>>%s\n", WC->serv_sock, string);
+       syslog(9, "%3d>>>%s\n", WC->serv_sock, string);
 #endif
        FlushReadBuf();
 
@@ -345,7 +345,7 @@ void serv_puts(const char *string)
 void serv_putbuf(const StrBuf *string)
 {
 #ifdef SERV_TRACE
-       lprintf(9, "%3d>>>%s\n", WC->serv_sock, ChrPtr(string));
+       syslog(9, "%3d>>>%s\n", WC->serv_sock, ChrPtr(string));
 #endif
        FlushReadBuf();
 
@@ -376,7 +376,7 @@ void serv_printf(const char *format,...)
        buf[len] = '\0';
        serv_write(buf, len);
 #ifdef SERV_TRACE
-       lprintf(9, ">>>%s", buf);
+       syslog(9, ">>>%s", buf);
 #endif
 }
 
@@ -409,7 +409,7 @@ 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) {
-                               lprintf(1, "Server connection broken during download\n");
+                               syslog(1, "Server connection broken during download\n");
                                wc_backtrace();
                                WCC->serv_sock = (-1);
                                WCC->connected = 0;
@@ -526,7 +526,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) {
-                       lprintf(1, "Error binding to [%s] : %s\n", ip_addr, strerror(errno));
+                       syslog(1, "Error binding to [%s] : %s\n", ip_addr, strerror(errno));
                        return (-WC_EXIT_BIND);
                }
        }
@@ -534,13 +534,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) {
-                       lprintf(1, "Error binding to [%s] : %s\n", ip_addr, strerror(errno));
+                       syslog(1, "Error binding to [%s] : %s\n", ip_addr, strerror(errno));
                        return (-WC_EXIT_BIND);
                }
        }
 
        if (port_number == 0) {
-               lprintf(1, "Cannot start: no port number specified.\n");
+               syslog(1, "Cannot start: no port number specified.\n");
                return (-WC_EXIT_BIND);
        }
        sin6.sin6_port = htons((u_short) port_number);
@@ -550,7 +550,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) {
-               lprintf(1, "Can't create a listening socket: %s\n", strerror(errno));
+               syslog(1, "Can't create a listening socket: %s\n", strerror(errno));
                return (-WC_EXIT_BIND);
        }
        /* Set some socket options that make sense. */
@@ -565,12 +565,12 @@ int webcit_tcp_server(char *ip_addr, int port_number, int queue_len)
        }
 
        if (b < 0) {
-               lprintf(1, "Can't bind: %s\n", strerror(errno));
+               syslog(1, "Can't bind: %s\n", strerror(errno));
                return (-WC_EXIT_BIND);
        }
 
        if (listen(s, queue_len) < 0) {
-               lprintf(1, "Can't listen: %s\n", strerror(errno));
+               syslog(1, "Can't listen: %s\n", strerror(errno));
                return (-WC_EXIT_BIND);
        }
        return (s);
@@ -594,7 +594,7 @@ int webcit_uds_server(char *sockpath, int queue_len)
 
        i = unlink(sockpath);
        if ((i != 0) && (errno != ENOENT)) {
-               lprintf(1, "webcit: can't unlink %s: %s\n",
+               syslog(1, "webcit: can't unlink %s: %s\n",
                        sockpath, strerror(errno));
                return (-WC_EXIT_BIND);
        }
@@ -605,18 +605,18 @@ int webcit_uds_server(char *sockpath, int queue_len)
 
        s = socket(AF_UNIX, SOCK_STREAM, 0);
        if (s < 0) {
-               lprintf(1, "webcit: Can't create a unix domain socket: %s\n", strerror(errno));
+               syslog(1, "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) {
-               lprintf(1, "webcit: Can't bind: %s\n",
+               syslog(1, "webcit: Can't bind: %s\n",
                        strerror(errno));
                return (-WC_EXIT_BIND);
        }
 
        if (listen(s, actual_queue_len) < 0) {
-               lprintf(1, "webcit: Can't listen: %s\n",
+               syslog(1, "webcit: Can't listen: %s\n",
                        strerror(errno));
                return (-WC_EXIT_BIND);
        }
@@ -677,7 +677,7 @@ int client_read_to(ParsedHttpHdrs *Hdr, StrBuf *Target, int bytes, int timeout)
                                return 1;
                        }
                        else {
-                               lprintf(2, "client_read_ssl() failed\n");
+                               syslog(2, "client_read_ssl() failed\n");
                                return -1;
                        }
                }
@@ -695,7 +695,7 @@ int client_read_to(ParsedHttpHdrs *Hdr, StrBuf *Target, int bytes, int timeout)
                                        O_TERM,
                                        &Error);
        if (retval < 0) {
-               lprintf(2, "client_read() failed: %s\n",
+               syslog(2, "client_read() failed: %s\n",
                        Error);
                wc_backtrace();
                return retval;
@@ -780,7 +780,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) {
-                                lprintf(2, "client_write: Socket select failed (%s)\n", strerror(errno));
+                                syslog(2, "client_write: Socket select failed (%s)\n", strerror(errno));
                                 return -1;
                         }
                 }
@@ -789,7 +789,7 @@ long end_burst(void)
                    (res = write(WCC->Hdr->http_sock, 
                                 ptr,
                                 count)) == -1) {
-                        lprintf(2, "client_write: Socket write failed (%s)\n", strerror(errno));
+                        syslog(2, "client_write: Socket write failed (%s)\n", strerror(errno));
                        wc_backtrace();
                         return res;
                 }
@@ -813,7 +813,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) {
-                                lprintf(2, "client_write: Socket select failed (%s)\n", strerror(errno));
+                                syslog(2, "client_write: Socket select failed (%s)\n", strerror(errno));
                                 return -1;
                         }
                 }
@@ -822,7 +822,7 @@ long end_burst(void)
                    (res = write(WCC->Hdr->http_sock, 
                                 ptr,
                                 count)) == -1) {
-                        lprintf(2, "client_write: Socket write failed (%s)\n", strerror(errno));
+                        syslog(2, "client_write: Socket write failed (%s)\n", strerror(errno));
                        wc_backtrace();
                         return res;
                 }
index 6d4eabc..115bbda 100644 (file)
@@ -160,7 +160,7 @@ int main(int argc, char **argv)
                                if (gethostname
                                    (&server_cookie[strlen(server_cookie)],
                                     200) != 0) {
-                                       lprintf(2, "gethostname: %s\n",
+                                       syslog(2, "gethostname: %s\n",
                                                strerror(errno));
                                        free(server_cookie);
                                }
@@ -191,8 +191,8 @@ int main(int argc, char **argv)
        LoadIconDir(static_icon_dir);
 
        /* Tell 'em who's in da house */
-       lprintf(1, PACKAGE_STRING "\n");
-       lprintf(1, "Copyright (C) 1996-2009 by the Citadel development team.\n"
+       syslog(1, PACKAGE_STRING "\n");
+       syslog(1, "Copyright (C) 1996-2009 by the Citadel development team.\n"
                "This software is distributed under the terms of the "
                "GNU General Public License.\n\n"
        );
@@ -215,7 +215,7 @@ int main(int argc, char **argv)
         * wcsession struct to which the thread is currently bound.
         */
        if (pthread_key_create(&MyConKey, NULL) != 0) {
-               lprintf(1, "Can't create TSD key: %s\n", strerror(errno));
+               syslog(1, "Can't create TSD key: %s\n", strerror(errno));
        }
        InitialiseSemaphores ();
 
index 39b8243..9a96547 100644 (file)
@@ -85,7 +85,7 @@ void SetUpRequest(const char *UrlPath)
        memset(pHdr, 0, sizeof(OneHttpHeader));
        pHdr->Val = Line;
        Put(Hdr.HTTPHeaders, HKEY("GET /"), pHdr, DestroyHttpHeaderHandler);
-       lprintf(9, "%s\n", ChrPtr(Line));
+       syslog(9, "%s\n", ChrPtr(Line));
 
        if (ReadHttpSubject(&Hdr, Line, HeaderName))
                CU_FAIL("Failed to parse Request line / me is bogus!");
index 7ef2166..51db279 100644 (file)
@@ -480,7 +480,7 @@ TRYAGAIN:
                        serv_puts("000");
                }
                else 
-                       lprintf(1, "Error while creating user vcard: %s\n", ChrPtr(Buf));
+                       syslog(1, "Error while creating user vcard: %s\n", ChrPtr(Buf));
                goto TRYAGAIN;
        }
        FreeStrBuf(&Buf);
index c2741ce..44dde3f 100644 (file)
@@ -593,7 +593,7 @@ void parse_vcard(StrBuf *Target, struct vCard *v, HashList *VC, int full, wc_mim
                        StrBufDecodeBase64(Val);
 
                }
-               lprintf(1, "%s [%s][%s]",
+               syslog(1, "%s [%s][%s]",
                        firsttoken,
                        ChrPtr(Val),
                        v->prop[i].value);
@@ -601,11 +601,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);
-                       lprintf(1, "[%ld]\n", evc);
+                       syslog(1, "[%ld]\n", evc);
                        Val = NULL;
                }
                else
-                       lprintf(1, "[]\n");
+                       syslog(1, "[]\n");
 /*
 TODO: check for layer II
                else 
index 9762311..943b185 100644 (file)
@@ -269,7 +269,7 @@ void http_redirect(const char *whichpage) {
 void http_transmit_thing(const char *content_type, int is_static)
 {
 
-       lprintf(9, "http_transmit_thing(%s)%s\n", content_type, ((is_static > 0) ? " (static)" : ""));
+       syslog(9, "http_transmit_thing(%s)%s\n", content_type, ((is_static > 0) ? " (static)" : ""));
        output_headers(0, 0, 0, 0, 0, is_static);
 
        hprintf("Content-type: %s\r\n"
@@ -501,7 +501,7 @@ void push_destination(void) {
 
        FreeStrBuf(&WCC->PushedDestination);
        WCC->PushedDestination = NewStrBufDup(SBSTR("url"));
-       lprintf(9, "Push: %s\n", ChrPtr(WCC->PushedDestination));
+       syslog(9, "Push: %s\n", ChrPtr(WCC->PushedDestination));
        wc_printf("OK");
 }
 
@@ -516,7 +516,7 @@ void pop_destination(void) {
                return;
        }
 
-       lprintf(9, "Pop: %s\n", ChrPtr(WCC->PushedDestination));
+       syslog(9, "Pop: %s\n", ChrPtr(WCC->PushedDestination));
        http_redirect(ChrPtr(WCC->PushedDestination));
 }
 
@@ -582,7 +582,7 @@ void ParseREST_URL(void)
        HashList *Floors;
        void *vFloor;
 
-       lprintf(1, "parsing rest URL: %s\n", ChrPtr(WCC->Hdr->HR.ReqLine));
+       syslog(1, "parsing rest URL: %s\n", ChrPtr(WCC->Hdr->HR.ReqLine));
 
        WCC->Directory = NewHash(1, Flathash);
        WCC->CurrentFloor = NULL;
@@ -681,10 +681,10 @@ void session_loop(void)
 
        /* If the client sent a nonce that is incorrect, kill the request. */
        if (havebstr("nonce")) {
-               lprintf(9, "Comparing supplied nonce %s to session nonce %ld\n", 
+               syslog(9, "Comparing supplied nonce %s to session nonce %ld\n", 
                        bstr("nonce"), WCC->nonce);
                if (ibstr("nonce") != WCC->nonce) {
-                       lprintf(9, "Ignoring request with mismatched nonce.\n");
+                       syslog(9, "Ignoring request with mismatched nonce.\n");
                        hprintf("HTTP/1.1 404 Security check failed\r\n");
                        hprintf("Content-Type: text/plain\r\n");
                        begin_burst();
@@ -755,18 +755,18 @@ void session_loop(void)
         */
        if (havebstr("go")) {
                int ret;
-               lprintf(9, "Explicit room selection: %s\n", bstr("go"));
+               syslog(9, "Explicit room selection: %s\n", bstr("go"));
                ret = gotoroom(sbstr("go"));    /* do quietly to avoid session output! */
                if ((ret/100) != 2) {
-                       lprintf(1, "Unable to change to [%s]; Reason: %d\n", bstr("go"), ret);
+                       syslog(1, "Unable to change to [%s]; Reason: %d\n", bstr("go"), ret);
                }
        }
        else if (havebstr("gotofirst")) {
                int ret;
-               lprintf(9, "Explicit room selection: %s\n", bstr("gotofirst"));
+               syslog(9, "Explicit room selection: %s\n", bstr("gotofirst"));
                ret = gotoroom(sbstr("gotofirst"));     /* do quietly to avoid session output! */
                if ((ret/100) != 2) {
-                       lprintf(1, "Unable to change to [%s]; Reason: %d\n", bstr("gotofirst"), ret);
+                       syslog(1, "Unable to change to [%s]; Reason: %d\n", bstr("gotofirst"), ret);
                }
        }
 
@@ -777,13 +777,13 @@ void session_loop(void)
        else if ( (StrLength(WCC->CurRoom.name) == 0) && ( (StrLength(WCC->Hdr->c_roomname) > 0) )) {
                int ret;
 
-               lprintf(9, "We are in '%s' but cookie indicates '%s', going there...\n",
+               syslog(9, "We are in '%s' but cookie indicates '%s', going there...\n",
                        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) {
-                       lprintf(1, "COOKIEGOTO: Unable to change to [%s]; Reason: %d\n",
+                       syslog(1, "COOKIEGOTO: Unable to change to [%s]; Reason: %d\n",
                                ChrPtr(WCC->Hdr->c_roomname), ret);
                }
        }
@@ -952,11 +952,11 @@ InitModule_WEBCIT
        
        snprintf(dir, SIZ, "%s/webcit.css", static_local_dir);
        if (!access(dir, R_OK)) {
-               lprintf(9, "Using local Stylesheet [%s]\n", dir);
+               syslog(9, "Using local Stylesheet [%s]\n", dir);
                csslocal = NewStrBufPlain(HKEY("<link href=\"static.local/webcit.css\" rel=\"stylesheet\" type=\"text/css\" />"));
        }
        else
-               lprintf(9, "No Site-local Stylesheet [%s] installed. \n", dir);
+               syslog(9, "No Site-local Stylesheet [%s] installed. \n", dir);
 
 }
 
index 5417fe0..53c0157 100644 (file)
@@ -50,6 +50,7 @@
 #include <stdarg.h>
 #include <pthread.h>
 #include <signal.h>
+#include <syslog.h>
 #include <sys/utsname.h>
 #include <libcitadel.h>
 
index 73f956c..e2670d2 100644 (file)
@@ -182,7 +182,7 @@ int main(int argc, char **argv)
                                if (gethostname
                                    (&server_cookie[strlen(server_cookie)],
                                     200) != 0) {
-                                       lprintf(2, "gethostname: %s\n",
+                                       syslog(2, "gethostname: %s\n",
                                                strerror(errno));
                                        free(server_cookie);
                                }
@@ -240,22 +240,22 @@ int main(int argc, char **argv)
        LoadIconDir(static_icon_dir);
 
        /* Tell 'em who's in da house */
-       lprintf(1, PACKAGE_STRING "\n");
-       lprintf(1, "Copyright (C) 1996-2011 by the citadel.org team\n");
-       lprintf(1, "\n");
-       lprintf(1, "This program is open source  software: you can redistribute it and/or\n");
-       lprintf(1, "modify it under the terms of the GNU General Public License as published\n");
-       lprintf(1, "by the Free Software Foundation, either version 3 of the License, or\n");
-       lprintf(1, "(at your option) any later version.\n");
-       lprintf(1, "\n");
-       lprintf(1, "This program is distributed in the hope that it will be useful,\n");
-       lprintf(1, "but WITHOUT ANY WARRANTY; without even the implied warranty of\n");
-       lprintf(1, "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n");
-       lprintf(1, "GNU General Public License for more details.\n");
-       lprintf(1, "\n");
-       lprintf(1, "You should have received a copy of the GNU General Public License\n");
-       lprintf(1, "along with this program.  If not, see <http://www.gnu.org/licenses/>.\n");
-       lprintf(1, "\n");
+       syslog(1, PACKAGE_STRING "\n");
+       syslog(1, "Copyright (C) 1996-2011 by the citadel.org team\n");
+       syslog(1, "\n");
+       syslog(1, "This program is open source  software: you can redistribute it and/or\n");
+       syslog(1, "modify it under the terms of the GNU General Public License as published\n");
+       syslog(1, "by the Free Software Foundation, either version 3 of the License, or\n");
+       syslog(1, "(at your option) any later version.\n");
+       syslog(1, "\n");
+       syslog(1, "This program is distributed in the hope that it will be useful,\n");
+       syslog(1, "but WITHOUT ANY WARRANTY; without even the implied warranty of\n");
+       syslog(1, "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n");
+       syslog(1, "GNU General Public License for more details.\n");
+       syslog(1, "\n");
+       syslog(1, "You should have received a copy of the GNU General Public License\n");
+       syslog(1, "along with this program.  If not, see <http://www.gnu.org/licenses/>.\n");
+       syslog(1, "\n");
 
 
        /* initialize various subsystems */
@@ -266,16 +266,16 @@ int main(int argc, char **argv)
                FILE *fd;
                StrBufAppendBufPlain(I18nDump, HKEY("}\n"), 0);
                if (StrLength(I18nDump) < 50) {
-                       lprintf(1, "********************************************************************************\n");
-                       lprintf(1, "*        No strings found in templates!  Are you sure they're there?           *\n");
-                       lprintf(1, "********************************************************************************\n");
+                       syslog(1, "********************************************************************************\n");
+                       syslog(1, "*        No strings found in templates!  Are you sure they're there?           *\n");
+                       syslog(1, "********************************************************************************\n");
                        return -1;
                }
                fd = fopen(I18nDumpFile, "w");
                if (fd == NULL) {
-                       lprintf(1, "********************************************************************************\n");
-                       lprintf(1, "*                  unable to open I18N dumpfile [%s]         *\n", I18nDumpFile);
-                       lprintf(1, "********************************************************************************\n");
+                       syslog(1, "********************************************************************************\n");
+                       syslog(1, "*                  unable to open I18N dumpfile [%s]         *\n", I18nDumpFile);
+                       syslog(1, "********************************************************************************\n");
                        return -1;
                }
                rv = fwrite(ChrPtr(I18nDump), 1, StrLength(I18nDump), fd);
@@ -296,7 +296,7 @@ int main(int argc, char **argv)
         * wcsession struct to which the thread is currently bound.
         */
        if (pthread_key_create(&MyConKey, NULL) != 0) {
-               lprintf(1, "Can't create TSD key: %s\n", strerror(errno));
+               syslog(1, "Can't create TSD key: %s\n", strerror(errno));
        }
        InitialiseSemaphores ();
 
@@ -308,7 +308,7 @@ int main(int argc, char **argv)
         */
 #ifdef HAVE_OPENSSL
        if (pthread_key_create(&ThreadSSL, NULL) != 0) {
-               lprintf(1, "Can't create TSD key: %s\n", strerror(errno));
+               syslog(1, "Can't create TSD key: %s\n", strerror(errno));
        }
 #endif
 
@@ -319,11 +319,11 @@ int main(int argc, char **argv)
         */
 
        if (!IsEmptyStr(uds_listen_path)) {
-               lprintf(2, "Attempting to create listener socket at %s...\n", uds_listen_path);
+               syslog(2, "Attempting to create listener socket at %s...\n", uds_listen_path);
                msock = webcit_uds_server(uds_listen_path, LISTEN_QUEUE_LENGTH);
        }
        else {
-               lprintf(2, "Attempting to bind to port %d...\n", http_port);
+               syslog(2, "Attempting to bind to port %d...\n", http_port);
                msock = webcit_tcp_server(ip_addr, http_port, LISTEN_QUEUE_LENGTH);
        }
        if (msock < 0)
@@ -332,7 +332,7 @@ int main(int argc, char **argv)
                return -msock;
        }
 
-       lprintf(2, "Listening on socket %d\n", msock);
+       syslog(2, "Listening on socket %d\n", msock);
        signal(SIGPIPE, SIG_IGN);
 
        pthread_mutex_init(&SessionListMutex, NULL);
index d91cd9a..a087877 100644 (file)
@@ -5,7 +5,6 @@ extern char socket_dir[PATH_MAX];
 
 int ClientGetLine(ParsedHttpHdrs *Hdr, StrBuf *Target);
 int client_read_to(ParsedHttpHdrs *Hdr, StrBuf *Target, int bytes, int timeout);
-int lprintf(int loglevel, const char *format, ...);
 void wc_backtrace(void);
 void ShutDownWebcit(void);
 void shutdown_ssl(void);