From 708a4113e7eb4965230821890d750fb44a166aac Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 21 Oct 2021 16:06:13 -0400 Subject: [PATCH] Poking around in the text client to determine whether we can remove dependency on libcitadel. --- textclient/citadel.c | 2 +- textclient/citadel_ipc.c | 16 ++++++++-------- textclient/client_chat.c | 2 +- textclient/messages.c | 12 ++++++------ textclient/rooms.c | 10 +++++----- textclient/routines2.c | 20 ++++++++++---------- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/textclient/citadel.c b/textclient/citadel.c index bb165dd8e..d60dfc1e7 100644 --- a/textclient/citadel.c +++ b/textclient/citadel.c @@ -374,7 +374,7 @@ void dotgoto(CtdlIPC * ipc, char *towhere, int display_name, int fromungoto) scr_printf("%s\n", aaa); return; } - safestrncpy(room_name, room->RRname, ROOMNAMELEN); + strncpy(room_name, room->RRname, ROOMNAMELEN); room_flags = room->RRflags; room_flags2 = room->RRflags2; from_floor = curr_floor; diff --git a/textclient/citadel_ipc.c b/textclient/citadel_ipc.c index dc8976444..ac8c593c4 100644 --- a/textclient/citadel_ipc.c +++ b/textclient/citadel_ipc.c @@ -633,21 +633,21 @@ int CtdlIPCGetSingleMessage(CtdlIPC * ipc, long msgnum, int headers, int as_mime if (!strncasecmp(aaa, "nhdr=yes", 8)) mret[0]->nhdr = 1; else if (!strncasecmp(aaa, "from=", 5)) - safestrncpy(mret[0]->author, &aaa[5], SIZ); + strncpy(mret[0]->author, &aaa[5], SIZ); else if (!strncasecmp(aaa, "type=", 5)) mret[0]->type = atoi(&aaa[5]); else if (!strncasecmp(aaa, "msgn=", 5)) - safestrncpy(mret[0]->msgid, &aaa[5], SIZ); + strncpy(mret[0]->msgid, &aaa[5], SIZ); else if (!strncasecmp(aaa, "subj=", 5)) - safestrncpy(mret[0]->subject, &aaa[5], SIZ); + strncpy(mret[0]->subject, &aaa[5], SIZ); else if (!strncasecmp(aaa, "rfca=", 5)) - safestrncpy(mret[0]->email, &aaa[5], SIZ); + strncpy(mret[0]->email, &aaa[5], SIZ); else if (!strncasecmp(aaa, "room=", 5)) - safestrncpy(mret[0]->room, &aaa[5], SIZ); + strncpy(mret[0]->room, &aaa[5], SIZ); else if (!strncasecmp(aaa, "rcpt=", 5)) - safestrncpy(mret[0]->recipient, &aaa[5], SIZ); + strncpy(mret[0]->recipient, &aaa[5], SIZ); else if (!strncasecmp(aaa, "wefw=", 5)) - safestrncpy(mret[0]->references, &aaa[5], SIZ); + strncpy(mret[0]->references, &aaa[5], SIZ); else if (!strncasecmp(aaa, "time=", 5)) mret[0]->time = atol(&aaa[5]); else if (!strncasecmp(aaa, "locl", 4)) @@ -2880,7 +2880,7 @@ static int uds_connectsock(int *isLocal, char *sockpath) memset(&addr, 0, sizeof(addr)); addr.sun_family = AF_UNIX; - safestrncpy(addr.sun_path, sockpath, sizeof addr.sun_path); + strncpy(addr.sun_path, sockpath, sizeof addr.sun_path); s = socket(AF_UNIX, SOCK_STREAM, 0); if (s < 0) { diff --git a/textclient/client_chat.c b/textclient/client_chat.c index 1339d0e61..55ccb9b4d 100644 --- a/textclient/client_chat.c +++ b/textclient/client_chat.c @@ -153,7 +153,7 @@ void chatmode(CtdlIPC *ipc) { } else { size_t i = MIN(sizeof buf - 1, strlen(c_user) + 2); memset(buf, ' ', i); - safestrncpy(&buf[i], c_text, sizeof buf - i); + strncpy(&buf[i], c_text, sizeof buf - i); } while (strlen(buf) < 79) { strcat(buf, " "); diff --git a/textclient/messages.c b/textclient/messages.c index 3fc717300..22a178e8a 100644 --- a/textclient/messages.c +++ b/textclient/messages.c @@ -562,28 +562,28 @@ int read_message(CtdlIPC *ipc, snprintf(reply_to, sizeof reply_to, "%s <%s>", message->author, message->email); } else { - safestrncpy(reply_to, message->email, sizeof reply_to); + strncpy(reply_to, message->email, sizeof reply_to); } } /* But if we can't do that, set it to a Citadel address. */ if (!strcmp(reply_to, NO_REPLY_TO)) { - safestrncpy(reply_to, message->author, sizeof(reply_to)); + strncpy(reply_to, message->author, sizeof(reply_to)); } if (message->msgid != NULL) { - safestrncpy(reply_inreplyto, message->msgid, sizeof reply_inreplyto); + strncpy(reply_inreplyto, message->msgid, sizeof reply_inreplyto); } if (message->references != NULL) { if (!IsEmptyStr(message->references)) { - safestrncpy(reply_references, message->references, sizeof reply_references); + strncpy(reply_references, message->references, sizeof reply_references); } } if (message->subject != NULL) { - safestrncpy(reply_subject, message->subject, sizeof reply_subject); + strncpy(reply_subject, message->subject, sizeof reply_subject); if (!IsEmptyStr(message->subject)) { if (dest) { fprintf(dest, "Subject: %s\n", message->subject); @@ -640,7 +640,7 @@ int read_message(CtdlIPC *ipc, while ((searchptr != NULL) && (num_urls < MAXURLS)) { searchptr = strstr(searchptr, urlprefixes[p]); if (searchptr != NULL) { - safestrncpy(urls[num_urls], searchptr, sizeof(urls[num_urls])); + strncpy(urls[num_urls], searchptr, sizeof(urls[num_urls])); for (i = 0; i < strlen(urls[num_urls]); i++) { ch = urls[num_urls][i]; if (ch == '>' || ch == '\"' || ch == ')' || ch == ' ' || ch == '\n') { diff --git a/textclient/rooms.c b/textclient/rooms.c index 5c65cea82..8bef2ddfa 100644 --- a/textclient/rooms.c +++ b/textclient/rooms.c @@ -415,7 +415,7 @@ int select_floor(CtdlIPC * ipc, int rfloor) do { newfloor = (-1); - safestrncpy(floorstr, floorlist[rfloor], sizeof floorstr); + strncpy(floorstr, floorlist[rfloor], sizeof floorstr); strprompt("Which floor", floorstr, 255); for (a = 0; a < 128; ++a) { if (!strcasecmp(floorstr, &floorlist[a][0])) @@ -473,7 +473,7 @@ void editthisroom(CtdlIPC * ipc) /* Fetch the name of the current room admin */ r = CtdlIPCGetRoomAide(ipc, buf); if (r / 100 == 2) { - safestrncpy(room_admin_name, buf, sizeof room_admin_name); + strncpy(room_admin_name, buf, sizeof room_admin_name); } else { strcpy(room_admin_name, ""); } @@ -656,7 +656,7 @@ void dotungoto(CtdlIPC * ipc, char *towhere) if (r / 100 != 2) { scr_printf("%s\n", buf); } - safestrncpy(buf, uglist[found], sizeof(buf)); + strncpy(buf, uglist[found], sizeof(buf)); /* we queue ungoto information here, because we're not really ungotoing, we're really going to a random spot in some arbitrary room list. */ @@ -683,7 +683,7 @@ void ungoto(CtdlIPC * ipc) if (r / 100 != 2) { scr_printf("%s\n", buf); } - safestrncpy(buf, uglist[uglistsize - 1], sizeof(buf)); + strncpy(buf, uglist[uglistsize - 1], sizeof(buf)); uglistsize--; free(uglist[uglistsize]); /* Don't queue ungoto info or we end up in a loop */ @@ -1054,7 +1054,7 @@ void readinfo(CtdlIPC * ipc) /* Name of currernt room admin */ r = CtdlIPCGetRoomAide(ipc, buf); if (r / 100 == 2) - safestrncpy(room_admin_name, buf, sizeof room_admin_name); + strncpy(room_admin_name, buf, sizeof room_admin_name); else strcpy(room_admin_name, ""); diff --git a/textclient/routines2.c b/textclient/routines2.c index bca697cd2..77fbe133c 100644 --- a/textclient/routines2.c +++ b/textclient/routines2.c @@ -75,21 +75,21 @@ void entregis(CtdlIPC * ipc) { remove_token(reg, 0, '\n'); if (a == 2) - safestrncpy(tmpname, buf, sizeof tmpname); + strncpy(tmpname, buf, sizeof tmpname); else if (a == 3) - safestrncpy(tmpaddr, buf, sizeof tmpaddr); + strncpy(tmpaddr, buf, sizeof tmpaddr); else if (a == 4) - safestrncpy(tmpcity, buf, sizeof tmpcity); + strncpy(tmpcity, buf, sizeof tmpcity); else if (a == 5) - safestrncpy(tmpstate, buf, sizeof tmpstate); + strncpy(tmpstate, buf, sizeof tmpstate); else if (a == 6) - safestrncpy(tmpzip, buf, sizeof tmpzip); + strncpy(tmpzip, buf, sizeof tmpzip); else if (a == 7) - safestrncpy(tmpphone, buf, sizeof tmpphone); + strncpy(tmpphone, buf, sizeof tmpphone); else if (a == 9) - safestrncpy(tmpemail, buf, sizeof tmpemail); + strncpy(tmpemail, buf, sizeof tmpemail); else if (a == 10) - safestrncpy(tmpcountry, buf, sizeof tmpcountry); + strncpy(tmpcountry, buf, sizeof tmpcountry); ++a; } } @@ -103,7 +103,7 @@ void entregis(CtdlIPC * ipc) { do { ok = 1; - safestrncpy(holdemail, tmpemail, sizeof holdemail); + strncpy(holdemail, tmpemail, sizeof holdemail); strprompt("Email address", tmpemail, 31); r = CtdlIPCDirectoryLookup(ipc, tmpemail, buf); if (r / 100 == 2) { @@ -116,7 +116,7 @@ void entregis(CtdlIPC * ipc) { scr_printf("\nYou can't use %s as your address.\n", tmpemail); scr_printf("It is already in use by %s @ %s.\n", diruser, dirnode); ok = 0; - safestrncpy(tmpemail, holdemail, sizeof tmpemail); + strncpy(tmpemail, holdemail, sizeof tmpemail); } } } while (ok == 0); -- 2.39.2