safestrncpy(con->cs_addr, "", sizeof con->cs_addr);
con->cs_UDSclientUID = -1;
con->cs_host[sizeof con->cs_host - 1] = 0;
- if (!CC->is_local_socket) {
+ if (!CC->is_local_client) {
locate_host(con->cs_host, sizeof con->cs_host,
con->cs_addr, sizeof con->cs_addr,
con->client_socket
con->nologin = 1;
}
- if (!CC->is_local_socket) {
- syslog(LOG_INFO, "context: session (%s) started from %s (%s)", con->ServiceName, con->cs_host, con->cs_addr);
- }
- else {
- syslog(LOG_INFO, "context: session (%s) started via local socket with uid=%d", con->ServiceName, con->cs_UDSclientUID);
- }
+ syslog(LOG_INFO, "context: session (%s) started from %s (%s) uid=%d",
+ con->ServiceName, con->cs_host, con->cs_addr, con->cs_UDSclientUID
+ );
/* Run any session startup routines registered by loadable modules */
PerformSessionHooks(EVT_START);
StrBuf *sMigrateBuf; /* Our block buffered read buffer */
int client_socket;
- int is_local_socket; /* set to 1 if client is on unix domain sock */
+ int is_local_client; /* set to 1 if client is running on the same host */
/* Redirect this session's output to a memory buffer? */
StrBuf *redirect_buffer; /* the buffer */
StrBuf *StatusMessage;
CC->cs_clientname[31] = 0;
/* For local sockets, allow the client to supply the user's origin address */
- if (CC->is_local_socket) {
+ if ((CC->is_local_client) || (!IsEmptyStr(CC->cs_addr) && (!strcmp(CC->cs_addr, "127.0.0.1")) || (!strcmp(CC->cs_addr, "::1")))) {
safestrncpy(CC->cs_host, from_host, sizeof CC->cs_host);
CC->cs_host[sizeof CC->cs_host - 1] = 0;
CC->cs_addr[0] = 0;
* Here's where we (hopefully) have most parts of the Citadel server that
* might need tweaking when run on different operating system variants.
*
- * Copyright (c) 1987-2017 by the citadel.org team
+ * Copyright (c) 1987-2019 by the citadel.org team
*
* This program is open source software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 3.
{
/* Gotcha! */
syslog(LOG_ERR,
- "sysdep: killing session CC[%d] bad FD: [%d:%d] User[%s] Host[%s:%s]",
- ptr->cs_pid,
- ptr->client_socket,
- ptr->is_local_socket,
- ptr->curr_user,
- ptr->cs_host,ptr->cs_addr
+ "sysdep: killing session CC[%d] bad FD: [%d] User[%s] Host[%s:%s]",
+ ptr->cs_pid,
+ ptr->client_socket,
+ ptr->curr_user,
+ ptr->cs_host,
+ ptr->cs_addr
);
ptr->kill_me = 1;
ptr->client_socket = -1;
con->h_greeting_function = serviceptr->h_greeting_function;
con->ServiceName = serviceptr->ServiceName;
- /* Determine whether it's a local socket */
+ /* Connections on a local client are always from the same host */
if (serviceptr->sockpath != NULL) {
- con->is_local_socket = 1;
+ con->is_local_client = 1;
}
/* Set the SO_REUSEADDR socket option */