*
* Main source module for the Citadel server
*
- * Copyright (c) 1987-2009 by the citadel.org team
+ * Copyright (c) 1987-2010 by the citadel.org team
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "sysdep.h"
#include <sys/types.h>
#include <sys/stat.h>
-
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#include "locate_host.h"
#include "room_ops.h"
#include "file_ops.h"
-#include "policy.h"
#include "control.h"
#include "euidindex.h"
#include "context.h"
#include "ctdl_module.h"
-
char *unique_session_numbers;
int ScheduledShutdown = 0;
time_t server_startup_time;
if (restart_server != 0)
exit(1);
- if ((running_as_daemon != 0) && (exitcode == 0))
+ if ((running_as_daemon != 0) && ((exitcode == 0) ))
exitcode = CTDLEXIT_SHUTDOWN;
exit(exitcode);
}
else {
cprintf("0\n"); /* OpenID is disabled when using non-native auth */
}
+
+ cprintf("%d\n", config.c_guest_logins);
cprintf("000\n");
}
int rev_level;
char desc[128];
char from_host[128];
- struct in_addr addr;
- int do_lookup = 0;
if (num_parms(argbuf)<4) {
cprintf("%d usage error\n", ERROR + ILLEGAL_VALUE);
safestrncpy(CC->cs_clientname, desc, sizeof CC->cs_clientname);
CC->cs_clientname[31] = 0;
- if (!IsEmptyStr(from_host)) {
- if (CC->is_local_socket) do_lookup = 1;
- else if (is_public_client()) do_lookup = 1;
- }
-
- if (do_lookup) {
- CtdlLogPrintf(CTDL_DEBUG, "Looking up hostname '%s'\n", from_host);
- if ((addr.s_addr = inet_addr(from_host)) != -1) {
- locate_host(CC->cs_host, sizeof CC->cs_host,
- CC->cs_addr, sizeof CC->cs_addr,
- &addr);
- }
- else {
- safestrncpy(CC->cs_host, from_host, sizeof CC->cs_host);
- CC->cs_host[sizeof CC->cs_host - 1] = 0;
- }
+ /* For local sockets and public clients, trust the hostname supplied by the client */
+ if ( (CC->is_local_socket) || (is_public_client()) ) {
+ safestrncpy(CC->cs_host, from_host, sizeof CC->cs_host);
+ CC->cs_host[sizeof CC->cs_host - 1] = 0;
+ CC->cs_addr[0] = 0;
}
CtdlLogPrintf(CTDL_NOTICE, "Client %d/%d/%01d.%02d (%s) from %s\n",
return(-1);
}
- if (CC->user.axlevel >= 6) return(0);
+ if (CC->user.axlevel >= AxAideU) return(0);
if (required_level >= ac_aide) {
cprintf("%d This command requires Aide access.\n",
ERROR + HIGHER_ACCESS_REQUIRED);
con->cs_host[sizeof con->cs_host - 1] = 0;
len = sizeof sin;
if (!CC->is_local_socket) {
- if (!getpeername(con->client_socket, (struct sockaddr *) &sin, &len)) {
- locate_host(con->cs_host, sizeof con->cs_host,
- con->cs_addr, sizeof con->cs_addr,
- &sin.sin_addr
- );
- }
+ locate_host(con->cs_host, sizeof con->cs_host,
+ con->cs_addr, sizeof con->cs_addr,
+ con->client_socket
+ );
}
else {
- strcpy(con->cs_host, "");
+ con->cs_host[0] = 0;
+ con->cs_addr[0] = 0;
#ifdef HAVE_STRUCT_UCRED
{
/* as http://www.wsinnovations.com/softeng/articles/uds.html told us... */
}
if (!CC->is_local_socket) {
- CtdlLogPrintf(CTDL_NOTICE, "Session started from %s [%s].\n", con->cs_host, con->cs_addr);
+ CtdlLogPrintf(CTDL_NOTICE, "Session (%s) started from %s (%s).\n", con->ServiceName, con->cs_host, con->cs_addr);
}
else {
- CtdlLogPrintf(CTDL_NOTICE, "Session started via local socket.\n");
+ CtdlLogPrintf(CTDL_NOTICE, "Session (%s) started via local socket UID:%d.\n", con->ServiceName, con->cs_UDSclientUID);
}
/* Run any session startup routines registered by loadable modules */
}
/* Log the server command, but don't show passwords... */
- if ( (strncasecmp(cmdbuf, "PASS", 4))
- && (strncasecmp(cmdbuf, "SETP", 4)) ) {
+ if ( (strncasecmp(cmdbuf, "PASS", 4)) && (strncasecmp(cmdbuf, "SETP", 4)) ) {
CtdlLogPrintf(CTDL_INFO, "%s\n", cmdbuf);
}
else {
- CtdlLogPrintf(CTDL_INFO, "<password command sent>\n");
+ CtdlLogPrintf(CTDL_INFO, "<password command hidden from log>\n");
}
buffer_output();