From 7408ecea5cc097c76ed667097020e1d9a1228b0d Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Fri, 16 Sep 2022 18:44:08 +0000 Subject: [PATCH] text client: if the 'who am i' command is used to populate the host name, strip the trailing newline. Otherwise the newline gets sent as part of an IDEN command and it confuses the server protocol. --- citadel/config.mk | 2 +- textclient/citadel_ipc.c | 2 +- textclient/config.mk | 4 ++-- textclient/routines.c | 3 +++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/citadel/config.mk b/citadel/config.mk index 864c60f48..58e36c703 100644 --- a/citadel/config.mk +++ b/citadel/config.mk @@ -1,4 +1,4 @@ # config.mk is generated by configure CTDLDIR := /root/citadel/citadel -CFLAGS := -ggdb -DHAVE_OPENSSL -DBUILD_ID=\"v957-38-g71c3e52b0\" -DCTDLDIR=\"/root/citadel/citadel\" +CFLAGS := -ggdb -DHAVE_OPENSSL -DBUILD_ID=\"v957-74-g825c7f252\" -DCTDLDIR=\"/root/citadel/citadel\" LDFLAGS := -lssl -lcrypto -lz diff --git a/textclient/citadel_ipc.c b/textclient/citadel_ipc.c index e5788ad4c..a2f583c6e 100644 --- a/textclient/citadel_ipc.c +++ b/textclient/citadel_ipc.c @@ -1672,7 +1672,7 @@ int CtdlIPCIdentifySoftware(CtdlIPC * ipc, int developerid, int clientid, developerid = 8; clientid = 0; revision = CLIENT_VERSION - 600; - software_name = "Citadel (libcitadel)"; + software_name = "Citadel text client"; } if (!hostname) return -2; diff --git a/textclient/config.mk b/textclient/config.mk index da064d22e..518496338 100644 --- a/textclient/config.mk +++ b/textclient/config.mk @@ -1,5 +1,5 @@ -CFLAGS := -Wformat-truncation=0 -ggdb -DHAVE_OPENSSL -LDFLAGS := -lssl -lcrypto -lz +CFLAGS := -Wformat-truncation=0 -ggdb +LDFLAGS := PREFIX := /usr/local BINDIR := /usr/local/bin CTDLDIR := /usr/local/citadel diff --git a/textclient/routines.c b/textclient/routines.c index 56b4fd337..6ef297866 100644 --- a/textclient/routines.c +++ b/textclient/routines.c @@ -490,6 +490,9 @@ void locate_host(CtdlIPC * ipc, char *hbuf) { return; } fgets(hbuf, SIZ, who); + if (hbuf[strlen(hbuf) - 1] == '\n') { + hbuf[strlen(hbuf) - 1] = 0; + } pclose(who); stripallbut(hbuf, '(', ')'); } -- 2.39.2