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",
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 */