struct timeval tv;
struct tm tim;
time_t unixtime;
+ struct CitContext *CCC = CC;
gettimeofday(&tv, NULL);
/* Promote to time_t; types differ on some OSes (like darwin) */
unixtime = tv.tv_sec;
localtime_r(&unixtime, &tim);
- if (CC->cs_pid != 0) {
+ if ((CCC != NULL) && (CCC->cs_pid != 0)) {
sprintf(buf,
"%04d/%02d/%02d %2d:%02d:%02d.%06ld [%3d] ",
tim.tm_year + 1900, tim.tm_mon + 1,
tim.tm_mday, tim.tm_hour, tim.tm_min,
tim.tm_sec, (long)tv.tv_usec,
- CC->cs_pid);
+ CCC->cs_pid);
} else {
sprintf(buf,
"%04d/%02d/%02d %2d:%02d:%02d.%06ld ",
int s;
int i;
int actual_queue_len;
+#ifdef HAVE_STRUCT_UCRED
+ int passcred = 1;
+#endif
actual_queue_len = queue_len;
if (actual_queue_len < 5) actual_queue_len = 5;
return(-1);
}
+#ifdef HAVE_STRUCT_UCRED
+ setsockopt(s, SOL_SOCKET, SO_PASSCRED, &passcred, sizeof(passcred));
+#endif
+
chmod(sockpath, S_ISGID|S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH);
return(s);
}
context->user.usernum = get_new_user_number();
CtdlLogPrintf(CTDL_DEBUG, "Upgrading system user \"%s\" from user number 0 to user number %d\n", context->user.fullname, context->user.usernum);
/* add user to the database */
- putuser(&(context->user));
+ CtdlPutUser(&(context->user));
cdb_store(CDB_USERSBYNUMBER, &(context->user.usernum), sizeof(long), context->user.fullname, strlen(context->user.fullname)+1);
}
}
void buffer_output(void) {
#ifdef HAVE_TCP_BUFFERING
- if (!CC->redirect_ssl) {
+#ifdef HAVE_OPENSSL
+ if (!CC->redirect_ssl)
+#endif
setsockopt(CC->client_socket, IPPROTO_TCP, TCP_CORK, &on, 4);
- }
#endif
}
void unbuffer_output(void) {
#ifdef HAVE_TCP_BUFFERING
- if (!CC->redirect_ssl) {
+#ifdef HAVE_OPENSSL
+ if (!CC->redirect_ssl)
+#endif
setsockopt(CC->client_socket, IPPROTO_TCP, TCP_CORK, &off, 4);
- }
#endif
}
CtdlDestroySessionHooks();
CtdlDestroyServiceHook();
CtdlDestroyRoomHooks();
- CtdlDestroyDirectoryServiceFuncs();
#ifdef HAVE_BACKTRACE
eCrash_Uninit();
#endif
" The Citadel server process (citserver) terminated unexpectedly."
"\n \n"
" This could be the result of a bug in the server program, or some external "
- "factor. You can obtain more information about this by enabling core dumps. "
- "For more information, please see: "
- "http://citadel.org/doku.php/faq:mastering_your_os:gdb#how.do.i.make.my.system.produce.core-files"
+ "factor.\n \n"
+ " You can obtain more information about this by enabling core dumps.\n \n"
+ " For more information, please see:\n \n"
+ " http://citadel.org/doku.php/faq:mastering_your_os:gdb#how.do.i.make.my.system.produce.core-files"
"\n \n"
" If you have already done this, the core dump is likely to be found at %score.%d\n"
,
ctdl_run_dir, ForkedPid);
- aide_message(ChrPtr(CrashMail), "Citadel server process terminated unexpectedly");
+ CtdlAideMessage(ChrPtr(CrashMail), "Citadel server process terminated unexpectedly");
FreeStrBuf(&CrashMail);
}
}
* Bind a thread to a context. (It's inline merely to speed things up.)
*/
INLINE void become_session(struct CitContext *which_con) {
+ if (which_con)
+ ctdl_thread_internal_change_state(CT, CTDL_THREAD_RUNNING);
+
citthread_setspecific(MyConKey, (void *)which_con );
}