Merge branch 'Webcit_Coredump_StrBufQuotedPrintableEncode' into 'master'
authorArt Cancro <ajc@citadel.org>
Fri, 23 Jun 2023 19:26:25 +0000 (19:26 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 23 Jun 2023 19:26:25 +0000 (19:26 +0000)
Webcit coredumping when body of message is blank

See merge request citadel/citadel!2

17 files changed:
citadel/Makefile
citadel/docs/databaselayout.md
citadel/server/modules/bio/serv_bio.c
citadel/server/modules/ctdlproto/serv_user.c
citadel/server/modules/expire/serv_expire.c
citadel/server/modules/migrate/serv_migrate.c
citadel/server/modules/newuser/serv_newuser.c [deleted file]
citadel/server/modules_init.c
citadel/server/msgbase.c
citadel/server/server.h
citadel/server/user_ops.c
citadel/utils/ctdl3264.c
textclient/bootstrap
textclient/citadel.c
textclient/citadel_ipc.c
textclient/routines.c
textclient/textclient.h

index 91e951893ddda29017a55f620e04d1d9a44ff637..e9226bdd51b4b6a66b7f21325eb43815304cf539 100644 (file)
@@ -10,7 +10,7 @@
 # config.mk is generated by ./configure
 include config.mk
 
-all := citserver setup ctdlmigrate sendcommand citmail chkpw chkpwd ctdl3264
+all := citserver setup ctdlmigrate sendcommand citmail chkpw chkpwd
 all: $(all)
 
 citserver: server/*.c server/modules/*/*.c config.mk server/*.h
index 4dca3718a6b71082e4c0b5c9477ac1bd65c576f3..c3198833127c372efd5499e47bd420a514c89433 100644 (file)
@@ -26,8 +26,6 @@ this file look something like this:
         uid_t uid;                      // Associate with a unix account?
         char password[32];              // Account password (unless using external authentication)
         unsigned flags;                 // See US_ flags below
-        long timescalled;               // Total number of logins
-        long posted;                    // Number of messages posted (ever)
         CIT_UBYTE axlevel;              // Access level
         long usernum;                   // User number (never recycled)
         time_t lastcall;                // Last time the user called
index 738180893febab266d4933eba7005941341924ae..8be817ae687dbcdf7f999b1ad7aee2290347747d 100644 (file)
@@ -65,9 +65,8 @@ void cmd_rbio(char *cmdbuf) {
                return;
        }
 
-       cprintf("%d OK|%s|%ld|%d|%ld|%ld|%ld\n", LISTING_FOLLOWS,
-               ruser.fullname, ruser.usernum, ruser.axlevel,
-               (long)ruser.lastcall, ruser.timescalled, ruser.posted);
+       cprintf("%d OK|%s|%ld|%d|%ld|0|0\n", LISTING_FOLLOWS,
+               ruser.fullname, ruser.usernum, ruser.axlevel, (long)ruser.lastcall);
 
        struct CtdlMessage *msg = CtdlFetchMessage(ruser.msgnum_bio, 1);
        if (msg != NULL) {
index b1b5f8fa065f01a5295567078659b68cecf3aaa5..f5f4ef525faaad5118cc7cc430dd75845f6f3396 100644 (file)
@@ -1,6 +1,6 @@
 // Server functions which perform operations on user objects.
 //
-// Copyright (c) 1987-2022 by the citadel.org team
+// Copyright (c) 1987-2023 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.
@@ -469,13 +469,11 @@ void ListThisUser(char *username, void *data) {
                if ((CC->user.axlevel >= AxAideU)
                    || ((usbuf.flags & US_UNLISTED) == 0)
                    || ((CC->internal_pgm))) {
-                       cprintf("%s|%d|%ld|%ld|%ld|%ld||\n",
+                       cprintf("%s|%d|%ld|%ld|0|0||\n",
                                usbuf.fullname,
                                usbuf.axlevel,
                                usbuf.usernum,
-                               (long)usbuf.lastcall,
-                               usbuf.timescalled,
-                               usbuf.posted);
+                               (long)usbuf.lastcall);
                }
        }
 }
@@ -545,13 +543,11 @@ void cmd_agup(char *cmdbuf) {
                cprintf("%d No such user.\n", ERROR + NO_SUCH_USER);
                return;
        }
-       cprintf("%d %s|%s|%u|%ld|%ld|%d|%ld|%ld|%d\n",
+       cprintf("%d %s|%s|%u|0|0|%d|%ld|%ld|%d\n",
                CIT_OK,
                usbuf.fullname,
                usbuf.password,
                usbuf.flags,
-               usbuf.timescalled,
-               usbuf.posted,
                (int) usbuf.axlevel,
                usbuf.usernum,
                (long)usbuf.lastcall,
@@ -581,10 +577,6 @@ void cmd_asup(char *cmdbuf) {
                extract_token(usbuf.password, cmdbuf, 1, '|', sizeof usbuf.password);
        if (np > 2)
                usbuf.flags = extract_int(cmdbuf, 2);
-       if (np > 3)
-               usbuf.timescalled = extract_int(cmdbuf, 3);
-       if (np > 4)
-               usbuf.posted = extract_int(cmdbuf, 4);
        if (np > 5) {
                newax = extract_int(cmdbuf, 5);
                if ((newax >= AxDeleted) && (newax <= AxAideU)) {
index abcf62b121f8e57d6984da64ad377211f2d26020..096360aa4229deaed24add2d4c59c981556e849e 100644 (file)
@@ -370,9 +370,6 @@ void do_user_purge(char *username, void *data) {
        // Moved this lower down so that aides and permanent users get purged if they ask to be.
        if (!strcasecmp(us.password, "deleteme")) purge = 1;
        
-       // Fewer than zero calls is impossible, indicating a corrupted record.
-       if (us.timescalled < 0) purge = 1;
-
        // any negative user number, is also impossible.
        if (us.usernum < 0L) purge = 1;
        
index 7fd65e8747878988e6991794ef3683a2478e8046..3a58bac6379baf3915f2fe284fc1abe4b4d905e1 100644 (file)
@@ -108,8 +108,6 @@ void migr_export_users_backend(char *username, void *data) {
        cprintf("<u_uid>%ld</u_uid>\n", (long)u.uid);
        client_write(HKEY("<u_password>"));     xml_strout(u.password);         client_write(HKEY("</u_password>\n"));
        cprintf("<u_flags>%u</u_flags>\n", u.flags);
-       cprintf("<u_timescalled>%ld</u_timescalled>\n", u.timescalled);
-       cprintf("<u_posted>%ld</u_posted>\n", u.posted);
        cprintf("<u_axlevel>%d</u_axlevel>\n", u.axlevel);
        cprintf("<u_usernum>%ld</u_usernum>\n", u.usernum);
        cprintf("<u_lastcall>%ld</u_lastcall>\n", (long)u.lastcall);
@@ -547,8 +545,6 @@ int migr_userrecord(void *data, const char *el) {
        else if (!strcasecmp(el, "u_uid"))                      usbuf.uid = atol(ChrPtr(migr_chardata));
        else if (!strcasecmp(el, "u_password"))                 safestrncpy(usbuf.password, ChrPtr(migr_chardata), sizeof usbuf.password);
        else if (!strcasecmp(el, "u_flags"))                    usbuf.flags = atoi(ChrPtr(migr_chardata));
-       else if (!strcasecmp(el, "u_timescalled"))              usbuf.timescalled = atol(ChrPtr(migr_chardata));
-       else if (!strcasecmp(el, "u_posted"))                   usbuf.posted = atol(ChrPtr(migr_chardata));
        else if (!strcasecmp(el, "u_axlevel"))                  usbuf.axlevel = atoi(ChrPtr(migr_chardata));
        else if (!strcasecmp(el, "u_usernum"))                  usbuf.usernum = atol(ChrPtr(migr_chardata));
        else if (!strcasecmp(el, "u_lastcall"))                 usbuf.lastcall = atol(ChrPtr(migr_chardata));
diff --git a/citadel/server/modules/newuser/serv_newuser.c b/citadel/server/modules/newuser/serv_newuser.c
deleted file mode 100644 (file)
index a75686c..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Automatically copies the contents of a "New User Greetings" room to the
- * inbox of any new user upon account creation.
- *
- * Copyright (c) 1987-2022 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-/*
- * Name of the New User Greetings room.
- */
-#define NEWUSERGREETINGS       "New User Greetings"
-
-#include "../../sysdep.h"
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <pwd.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <time.h>
-#include <sys/wait.h>
-#include <string.h>
-#include <limits.h>
-#include "../../ctdl_module.h"
-#include "../../citadel_defs.h"
-#include "../../server.h"
-#include "../../citserver.h"
-#include "../../support.h"
-#include "../../config.h"
-#include "../../user_ops.h"
-#include "../../database.h"
-#include "../../msgbase.h"
-
-/*
- * Copy the contents of the New User Greetings> room to the user's Mail> room.
- */
-void CopyNewUserGreetings(void) {
-       struct cdbdata *cdbfr;
-       long *msglist = NULL;
-       int num_msgs = 0;
-       char mailboxname[ROOMNAMELEN];
-
-
-       /* Only do this for new users. */
-       if (CC->user.timescalled != 1) return;
-
-       /* This user's mailbox. */
-       CtdlMailboxName(mailboxname, sizeof mailboxname, &CC->user, MAILROOM);
-
-       /* Go to the source room ... bail out silently if it's not there,
-        * or if it's not private.
-        */
-       if (CtdlGetRoom(&CC->room, NEWUSERGREETINGS) != 0) return;
-       if ((CC->room.QRflags & QR_PRIVATE) == 0) return;
-
-       cdbfr = cdb_fetch(CDB_MSGLISTS, &CC->room.QRnumber, sizeof(long));
-
-       if (cdbfr != NULL) {
-               msglist = malloc(cdbfr->len);
-               memcpy(msglist, cdbfr->ptr, cdbfr->len);
-               num_msgs = cdbfr->len / sizeof(long);
-               cdb_free(cdbfr);
-       }
-
-       if (num_msgs > 0) {
-               CtdlSaveMsgPointersInRoom(mailboxname, msglist, num_msgs, 1, NULL, 0);
-       }
-
-       /* Now free the memory we used, and go away. */
-       if (msglist != NULL) free(msglist);
-}
-
-
-// Initialization function, called from modules_init.c
-char *ctdl_module_init_newuser(void) {
-       if (!threading) {
-               CtdlRegisterSessionHook(CopyNewUserGreetings, EVT_LOGIN, PRIO_LOGIN + 1);
-       }
-       
-       /* return our module name for the log */
-       return "newuser";
-}
index 17e5b699464be255605d33bd6b2a9aaf0c4e2610..a79f6d326e4b621c153a8f3edb4492290d5c30a4 100644 (file)
@@ -52,7 +52,6 @@ void initialize_modules(int is_threading) {
        syslog(LOG_DEBUG, "extensions: init %s", ctdl_module_init_listdeliver());
        syslog(LOG_DEBUG, "extensions: init %s", ctdl_module_init_listsub());
        syslog(LOG_DEBUG, "extensions: init %s", ctdl_module_init_migrate());
-       syslog(LOG_DEBUG, "extensions: init %s", ctdl_module_init_newuser());
        syslog(LOG_DEBUG, "extensions: init %s", ctdl_module_init_nntp());
        syslog(LOG_DEBUG, "extensions: init %s", ctdl_module_init_notes());
        syslog(LOG_DEBUG, "extensions: init %s", ctdl_module_init_pop3());
index 892c6941e7892f3056a388544d7dcfdf1a5d4632..e5f8b1e190813e8f672520aeb2a02ef170126fea 100644 (file)
@@ -2786,12 +2786,6 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,      /* message to save */
                }
        }
 
-       /* Bump this user's messages posted counter. */
-       syslog(LOG_DEBUG, "msgbase: updating user");
-       CtdlLockGetCurrentUser();
-       CC->user.posted = CC->user.posted + 1;
-       CtdlPutCurrentUserLock();
-
        /* Decide where bounces need to be delivered */
        if ((recps != NULL) && (recps->bounce_to == NULL)) {
                if (CC->logged_in) {
index 7e380a724a454dacfc8e8d4f07b614ce2b33b0f1..3c1f6999ffcb2761110df2f479fe187629727797 100644 (file)
@@ -143,8 +143,8 @@ struct ctdluser {                   // User record
        uid_t uid;                      // Associate with a unix account?
        char password[32];              // password
        unsigned flags;                 // See US_ flags below
-       long timescalled;               // Total number of logins
-       long posted;                    // Number of messages ever submitted
+       long unused1;
+       long unused2;
        cit_uint8_t axlevel;            // Access level
        long usernum;                   // User number (never recycled)
        time_t lastcall;                // Date/time of most recent login
index f9a7f7146b28be03395b86b96d56cbe75688544c..62e62f49297b19ccfeb97821aca5ad0ec58d5c9e 100644 (file)
@@ -566,7 +566,6 @@ void do_login(void) {
        syslog(LOG_NOTICE, "user_ops: <%s> logged in", CC->curr_user);
 
        CtdlGetUserLock(&CC->user, CC->curr_user);
-       ++(CC->user.timescalled);
        CC->previous_login = CC->user.lastcall;
        time(&CC->user.lastcall);
 
@@ -632,9 +631,8 @@ void do_login(void) {
 
 
 void logged_in_response(void) {
-       cprintf("%d %s|%d|%ld|%ld|%u|%ld|%ld\n",
+       cprintf("%d %s|%d|0|0|%u|%ld|%ld\n",
                CIT_OK, CC->user.fullname, CC->user.axlevel,
-               CC->user.timescalled, CC->user.posted,
                CC->user.flags, CC->user.usernum,
                CC->previous_login
        );
@@ -901,9 +899,6 @@ int internal_create_user(char *username, struct ctdluser *usbuf, uid_t uid) {
 
        // These are the default flags on new accounts
        usbuf->flags = US_LASTOLD | US_DISAPPEAR | US_PAGINATOR | US_FLOORS;
-
-       usbuf->timescalled = 0;
-       usbuf->posted = 0;
        usbuf->axlevel = CtdlGetConfigInt("c_initax");
        usbuf->lastcall = time(NULL);
 
index 012cfa89f086669543dc7887d3772a7b599bb987..dce5739fba4a427b27d4eb1358beec65b65f7b06 100644 (file)
@@ -188,8 +188,6 @@ void convert_users(int which_cdb, DBT *in_key, DBT *in_data, DBT *out_key, DBT *
        user64->uid                     = (uid_t)       user32->uid;
        strcpy(user64->password,                        user32->password);
        user64->flags                   = (unsigned)    user32->flags;
-       user64->timescalled             = (long)        user32->timescalled;
-       user64->posted                  = (long)        user32->posted;
        user64->axlevel                 = (cit_uint8_t) user32->axlevel;
        user64->usernum                 = (long)        user32->usernum;
        user64->lastcall                = (time_t)      user32->lastcall;
index 4224ed144f09ff608d4d4805f13e89403f05ef55..6b7f03d2618d1502768fb54a434929eae871b59c 100755 (executable)
@@ -1,4 +1,5 @@
 #!/bin/sh
 
-grep '^#define CLIENT_VERSION' textclient.h | sed 's/[^0-9]*//g' >package-version.txt
+# This isn't needed anymore and is now just a stub to keep old scripts from breaking.
+
 exit 0
index d8f19efdb8469e5a284700bfbc9e49c8d147c2a6..453f21bea86c6bb36736150adc7236a3b99853f0 100644 (file)
@@ -38,8 +38,6 @@ int uglistsize = 0;
 char is_mail = 0;              /* nonzero when we're in a mail room */
 char axlevel = AxDeleted;      /* access level */
 char is_room_aide = 0;         /* boolean flag, 1 if room admin */
-int timescalled;
-int posted;
 unsigned userflags;
 long usernum = 0L;             /* user number */
 time_t lastcall = 0L;          /* Date/time of previous login */
@@ -156,7 +154,7 @@ void userlist(CtdlIPC * ipc, char *patn) {
                return;
        }
 
-       scr_printf("User Name                                                        Last Visit\n");
+       scr_printf("User Name                                                        Last Login\n");
        scr_printf("---------------------------------------------------------------- ----------\n");
        if (listing != NULL)
                while (!IsEmptyStr(listing)) {
@@ -183,8 +181,6 @@ void userlist(CtdlIPC * ipc, char *patn) {
 void load_user_info(char *params) {
        extract_token(fullname, params, 0, '|', sizeof fullname);
        axlevel = extract_int(params, 1);
-       timescalled = extract_int(params, 2);
-       posted = extract_int(params, 3);
        userflags = extract_int(params, 4);
        usernum = extract_long(params, 5);
        lastcall = extract_long(params, 6);
@@ -826,7 +822,7 @@ void read_config(CtdlIPC * ipc) {
        int r;                  /* IPC response code */
        char _fullname[USERNAME_SIZE];
        long _usernum;
-       int _axlevel, _timescalled, _posted;
+       int _axlevel;
        time_t _lastcall;
        struct ctdluser *user = NULL;
 
@@ -840,8 +836,6 @@ void read_config(CtdlIPC * ipc) {
        _usernum = extract_long(buf, 2);
        _axlevel = extract_int(buf, 3);
        _lastcall = extract_long(buf, 4);
-       _timescalled = extract_int(buf, 5);
-       _posted = extract_int(buf, 6);
        free(resp);
        resp = NULL;
 
@@ -854,10 +848,8 @@ void read_config(CtdlIPC * ipc) {
        }
 
        /* show misc user info */
-       scr_printf("%s\nAccess level: %d (%s)\n"
-                  "User #%ld / %d Calls / %d Posts", _fullname, _axlevel, axdefs[(int) _axlevel], _usernum, _timescalled, _posted);
        if (_lastcall > 0L) {
-               scr_printf(" / Curr login: %s", asctime(localtime(&_lastcall)));
+               scr_printf("Last login: %s", asctime(localtime(&_lastcall)));
        }
        scr_printf("\n");
 
@@ -1559,10 +1551,8 @@ int main(int argc, char **argv) {
        }
 
        color(BRIGHT_WHITE);
-       scr_printf("\n%s\nAccess level: %d (%s)\n"
-                  "User #%ld / Login #%d", fullname, axlevel, axdefs[(int) axlevel], usernum, timescalled);
        if (lastcall > 0L) {
-               scr_printf(" / Last login: %s", asctime(localtime(&lastcall)));
+               scr_printf("Last login: %s", asctime(localtime(&lastcall)));
        }
        scr_printf("\n");
 
index 007f8410f254f1e79e9efd7edf2b58746175de60..26d2fa2adba91162d70ede35d6c3599177f5e61d 100644 (file)
@@ -1903,8 +1903,6 @@ int CtdlIPCAideGetUserParameters(CtdlIPC * ipc, const char *who, struct ctdluser
                extract_token(uret[0]->fullname, cret, 0, '|', sizeof uret[0]->fullname);
                extract_token(uret[0]->password, cret, 1, '|', sizeof uret[0]->password);
                uret[0]->flags = extract_int(cret, 2);
-               uret[0]->timescalled = extract_long(cret, 3);
-               uret[0]->posted = extract_long(cret, 4);
                uret[0]->axlevel = extract_int(cret, 5);
                uret[0]->usernum = extract_long(cret, 6);
                uret[0]->lastcall = extract_long(cret, 7);
@@ -1928,9 +1926,9 @@ int CtdlIPCAideSetUserParameters(CtdlIPC * ipc, const struct ctdluser *uret, cha
        if (!aaa)
                return -1;
 
-       sprintf(aaa, "ASUP %s|%s|%d|%ld|%ld|%d|%ld|%ld|%d",
-               uret->fullname, uret->password, uret->flags, uret->timescalled,
-               uret->posted, uret->axlevel, uret->usernum, uret->lastcall, uret->USuserpurge);
+       sprintf(aaa, "ASUP %s|%s|%d|0|0|%d|%ld|%ld|%d",
+               uret->fullname, uret->password, uret->flags,
+               uret->axlevel, uret->usernum, uret->lastcall, uret->USuserpurge);
        ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
        free(aaa);
        return ret;
index 1dff2b7d1003a464932e2dabf01b23443a236169..3a04cbe7c15d16bed2a3313a0e29c7d269077b04 100644 (file)
@@ -218,8 +218,6 @@ void edituser(CtdlIPC * ipc, int cmd) {
                else {
                        user->flags |= US_REGIS;
                }
-               user->timescalled = intprompt("Times called", user->timescalled, 0, INT_MAX);
-               user->posted = intprompt("Messages posted", user->posted, 0, INT_MAX);
                user->lastcall = boolprompt("Set last login to now", 0) ? time(NULL) : user->lastcall;
                user->USuserpurge = intprompt("Purge time (in days, 0 for system default", user->USuserpurge, 0, INT_MAX);
        }
index 5d92a72a598034eb0de1f10633f69097fd0c62f5..6dd5889ca99de67be5908c93b394017f24a806bf 100644 (file)
@@ -232,8 +232,6 @@ struct ctdluser {                   // User record
        uid_t uid;                      // Associate with a unix account?
        char password[32];              // password
        unsigned flags;                 // See US_ flags below
-       long timescalled;               // Total number of logins
-       long posted;                    // Number of messages ever submitted
        uint8_t axlevel;                // Access level
        long usernum;                   // User number (never recycled)
        time_t lastcall;                // Date/time of most recent login