From 43edf552b83666922ebfd007bcc1449554e7aaad Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Sat, 14 Sep 2013 19:33:19 +0200 Subject: [PATCH] Apiize CtdlIsPublicClient() --- citadel/citserver.c | 3 +-- citadel/citserver.h | 1 + citadel/modules/ctdlproto/serv_session.c | 23 ++++++++++++----------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/citadel/citserver.c b/citadel/citserver.c index e7374205d..3f3739e27 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -60,7 +60,6 @@ #include "support.h" #include "locate_host.h" #include "room_ops.h" -#include "file_ops.h" #include "control.h" #include "euidindex.h" #include "context.h" @@ -273,7 +272,7 @@ char CtdlCheckExpress(void) { * (for example, to show the location of the user rather than the location * of the client). */ -int is_public_client(void) +int CtdlIsPublicClient(void) { char buf[1024]; char addrbuf[1024]; diff --git a/citadel/citserver.h b/citadel/citserver.h index 37028a749..3e616b19f 100644 --- a/citadel/citserver.h +++ b/citadel/citserver.h @@ -53,5 +53,6 @@ void help_subst (char *strbuf, char *source, char *dest); extern int panic_fd; char CtdlCheckExpress(void); +int CtdlIsPublicClient(void); extern time_t server_startup_time; extern int openid_level_supported; diff --git a/citadel/modules/ctdlproto/serv_session.c b/citadel/modules/ctdlproto/serv_session.c index 8fbda5ca7..c829fca07 100644 --- a/citadel/modules/ctdlproto/serv_session.c +++ b/citadel/modules/ctdlproto/serv_session.c @@ -49,7 +49,7 @@ #include "sysdep_decls.h" #include "support.h" #include "room_ops.h" -#include "file_ops.h" +#include "svn_revision.h" #include "control.h" #include "msgbase.h" #include "config.h" @@ -167,6 +167,7 @@ void cmd_more(char *argbuf) { */ void cmd_iden(char *argbuf) { + CitContext *CCC = MyContext(); int dev_code; int cli_code; int rev_level; @@ -187,17 +188,17 @@ void cmd_iden(char *argbuf) from_host[sizeof from_host - 1] = 0; if (num_parms(argbuf)>=5) extract_token(from_host, argbuf, 4, '|', sizeof from_host); - CC->cs_clientdev = dev_code; - CC->cs_clienttyp = cli_code; - CC->cs_clientver = rev_level; - safestrncpy(CC->cs_clientname, desc, sizeof CC->cs_clientname); - CC->cs_clientname[31] = 0; + CCC->cs_clientdev = dev_code; + CCC->cs_clienttyp = cli_code; + CCC->cs_clientver = rev_level; + safestrncpy(CCC->cs_clientname, desc, sizeof CCC->cs_clientname); + CCC->cs_clientname[31] = 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; + if ( (CCC->is_local_socket) || (CtdlIsPublicClient()) ) { + safestrncpy(CCC->cs_host, from_host, sizeof CCC->cs_host); + CCC->cs_host[sizeof CCC->cs_host - 1] = 0; + CCC->cs_addr[0] = 0; } syslog(LOG_NOTICE, "Client %d/%d/%01d.%02d (%s) from %s\n", @@ -206,7 +207,7 @@ void cmd_iden(char *argbuf) (rev_level / 100), (rev_level % 100), desc, - CC->cs_host + CCC->cs_host ); cprintf("%d Ok\n",CIT_OK); } -- 2.30.2