serv_puts(buf);
serv_getln(buf, sizeof buf);
if (buf[0] == '2') {
- lprintf(CTDL_DEBUG, "OpenID server contacted; redirecting to %s\n", &buf[4]);
+ syslog(CTDL_DEBUG, "OpenID server contacted; redirecting to %s\n", &buf[4]);
http_redirect(&buf[4]);
return;
}
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));
}
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();
}
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();
}
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));
}
}
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);
*/
}
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);
*/
/* 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);
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);
}
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') {
StrBufAppendPrintf(Target, "</dd>\n");
}
}
- lprintf(9, "...done.\n");
+ syslog(9, "...done.\n");
StrBufAppendPrintf(Target, "</dl>");
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)))
); */
++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));
}
}
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)); */
}
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);
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;
}
* 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;
}
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;
}
/* 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;
}
* 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;
(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
);
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:
}
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;
}
{
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;
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;
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],
/* 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],
}
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();
}
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],
}
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);
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();
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;
}
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");
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);
}
* 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
/* 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. */
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);
}
}
else {
- lprintf(3, "Unable to read private key.\n");
+ syslog(3, "Unable to read private key.\n");
}
}
* 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.
/* 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. */
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);
}
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()));
}
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);
}
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);
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);
}
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);
* }
*/
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()));
}
}
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;
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));
sleeeeeeeeeep(1);
continue;
}
- lprintf(9, "SSL_read got error %ld\n", errval);
+ syslog(9, "SSL_read got error %ld\n", errval);
endtls();
return (-1);
}
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")
);
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);
}
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;
(((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++;
}
#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),
#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
}
{
DeleteHashPos(&itd);
- lprintf(0, "5\n");
+ syslog(0, "5\n");
continue;
}
DeleteHashPos(&itd);
{
DeleteHashPos(&itd);
- lprintf(0, "5\n");
+ syslog(0, "5\n");
continue;
}
DeleteHashPos(&itfl);
/* 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();
* 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();
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);
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: ");
/* 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
&& (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));
}
}
* 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:");
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;
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);
"%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;
}
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);
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;
}
/* 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
t = icaltimezone_get_builtin_timezone(tzid);
#ifdef DBG_ICAL
if (t) {
- lprintf(9, " * Using system tzdata!\n");
+ syslog(9, " * Using system tzdata!\n");
}
#endif
}
}
#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;
}
/* 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
}
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. */
icalcomponent *vt = NULL;
#ifdef DBG_ICAL
- lprintf(9, "ical_dezonify() started\n");
+ syslog(9, "ical_dezonify() started\n");
#endif
/* Convert all times to UTC */
}
#ifdef DBG_ICAL
- lprintf(9, "ical_dezonify() completed\n");
+ syslog(9, "ical_dezonify() completed\n");
#endif
}
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;
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);
}
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;
}
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();
}
else
{
- lprintf(9, "%s\n", ChrPtr(CmdBuf));
+ syslog(9, "%s\n", ChrPtr(CmdBuf));
serv_puts(ChrPtr(CmdBuf));
FreeStrBuf(&CmdBuf);
} 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();
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 ));
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
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);
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));
}
}
if (havebstr("attach_button")) {
- lprintf(CTDL_DEBUG, "Attempting to attach %s\n", bstr("openid_url"));
+ syslog(CTDL_DEBUG, "Attempting to attach %s\n", bstr("openid_url"));
snprintf(buf, sizeof buf,
"OIDS %s|%s/finalize_openid_login|%s",
serv_puts(buf);
serv_getln(buf, sizeof buf);
if (buf[0] == '2') {
- lprintf(CTDL_DEBUG, "OpenID server contacted; redirecting to %s\n", &buf[4]);
+ syslog(CTDL_DEBUG, "OpenID server contacted; redirecting to %s\n", &buf[4]);
http_redirect(&buf[4]);
return;
}
else {
- lprintf(CTDL_DEBUG, "OpenID attach failed: %s\n", &buf[4]);
+ syslog(CTDL_DEBUG, "OpenID attach failed: %s\n", &buf[4]);
}
}
}
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;
}
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;
}
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));
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));
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);
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));
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));
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
}
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;
}
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));
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);
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;
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)
{
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;
}
{
DeleteHashPos(&it);
- lprintf(0, "3\n");
+ syslog(0, "3\n");
return 0;
}
Dir = (StrBuf*) vDir;
ChrPtr(Dir)) != 0)
{
DeleteHashPos(&it);
- lprintf(0, "4\n");
+ syslog(0, "4\n");
return 0;
}
}
{
DeleteHashPos(&it);
- lprintf(0, "5\n");
+ syslog(0, "5\n");
return WCC->Hdr->HR.dav_depth == 1;
}
DeleteHashPos(&it);
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);
}
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);
}
{
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) ||
);
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;
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;
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;
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,
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))
); */
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");
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();
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();
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();
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;
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();
}
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),
}
else
{
- lprintf(1, "%s: %s;\n",
+ syslog(1, "%s: %s;\n",
Type,
ChrPtr(Error));
}
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();
}
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,
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;
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,
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;
}
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;
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;
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) {
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) {
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));
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;
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);
}
StrBufAppendPrintf(Buf, "%d: %ld]\n", i, LongVector[i]);
}
- lprintf(1, ChrPtr(Buf));
+ syslog(1, ChrPtr(Buf));
FreeStrBuf(&Buf);
}
*/
void begin_critical_section(int which_one)
{
- /* lprintf(CTDL_DEBUG, "begin_critical_section(%d)\n", which_one); */
pthread_mutex_lock(&Critters[which_one]);
}
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;
/* 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! */
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));
}
} 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.
*/
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);
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;
* 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 */
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");
}
#endif // HAVE_GETPWUID_R
if (pwp == NULL)
- lprintf(CTDL_CRIT, "WARNING: getpwuid(%ld): %s\n"
+ syslog(CTDL_CRIT, "WARNING: getpwuid(%ld): %s\n"
"Group IDs will be incorrect.\n", UID,
strerror(errno));
else {
initgroups(pw.pw_name, pw.pw_gid);
if (setgid(pw.pw_gid))
- lprintf(CTDL_CRIT, "setgid(%ld): %s\n", (long)pw.pw_gid,
+ syslog(CTDL_CRIT, "setgid(%ld): %s\n", (long)pw.pw_gid,
strerror(errno));
}
- lprintf(CTDL_INFO, "Changing uid to %ld\n", (long)UID);
+ syslog(CTDL_INFO, "Changing uid to %ld\n", (long)UID);
if (setuid(UID) != 0) {
- lprintf(CTDL_CRIT, "setuid() failed: %s\n", strerror(errno));
+ syslog(CTDL_CRIT, "setuid() failed: %s\n", strerror(errno));
}
#if defined (HAVE_SYS_PRCTL_H) && defined (PR_SET_DUMPABLE)
prctl(PR_SET_DUMPABLE, 1);
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
);
}
/** 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);
}
/* 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)
);
* 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 */
*/
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); */
}
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);
}
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;
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);
}
*/
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);
}
return(s);
}
else {
- lprintf(1, "connect() failed: %s\n", strerror(errno));
+ syslog(1, "connect() failed: %s\n", strerror(errno));
close(s);
}
}
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;
}
&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);
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;
&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);
}
#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;
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);
}
#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;
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",
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);
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();
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();
buf[len] = '\0';
serv_write(buf, len);
#ifdef SERV_TRACE
- lprintf(9, ">>>%s", buf);
+ syslog(9, ">>>%s", buf);
#endif
}
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;
{
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);
}
}
{
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);
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. */
}
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);
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);
}
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);
}
return 1;
}
else {
- lprintf(2, "client_read_ssl() failed\n");
+ syslog(2, "client_read_ssl() failed\n");
return -1;
}
}
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;
if (CompressBuffer(WCC->WBuf) > 0)
hprintf("Content-encoding: gzip\r\n");
else {
- lprintf(CTDL_ALERT, "Compression failed: %d [%s] sending uncompressed\n", errno, strerror(errno));
+ syslog(CTDL_ALERT, "Compression failed: %d [%s] sending uncompressed\n", errno, strerror(errno));
wc_backtrace();
}
}
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;
}
}
(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;
}
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;
}
}
(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;
}
if (gethostname
(&server_cookie[strlen(server_cookie)],
200) != 0) {
- lprintf(2, "gethostname: %s\n",
+ syslog(2, "gethostname: %s\n",
strerror(errno));
free(server_cookie);
}
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"
);
* 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 ();
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!");
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);
StrBufDecodeBase64(Val);
}
- lprintf(1, "%s [%s][%s]",
+ syslog(1, "%s [%s][%s]",
firsttoken,
ChrPtr(Val),
v->prop[i].value);
{
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
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"
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");
}
return;
}
- lprintf(9, "Pop: %s\n", ChrPtr(WCC->PushedDestination));
+ syslog(9, "Pop: %s\n", ChrPtr(WCC->PushedDestination));
http_redirect(ChrPtr(WCC->PushedDestination));
}
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;
/* 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();
*/
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);
}
}
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);
}
}
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);
}
#include <stdarg.h>
#include <pthread.h>
#include <signal.h>
+#include <syslog.h>
#include <sys/utsname.h>
#include <libcitadel.h>
if (gethostname
(&server_cookie[strlen(server_cookie)],
200) != 0) {
- lprintf(2, "gethostname: %s\n",
+ syslog(2, "gethostname: %s\n",
strerror(errno));
free(server_cookie);
}
return 1;
}
+ /* Start the logger */
+ openlog("webcit",
+ ( running_as_daemon ? (LOG_PID) : (LOG_PID | LOG_PERROR) ),
+ LOG_NEWS
+ );
+
if (optind < argc) {
ctdlhost = argv[optind];
if (++optind < argc)
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 */
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);
* 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 ();
*/
#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
*/
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)
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);
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);