]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/bio/serv_bio.c
Officially declare war on LHFS
[citadel.git] / citadel / modules / bio / serv_bio.c
index 071df111331b9fc977f3ff9ba54793e14c819f2d..e6e1dd20b103112d9adaae16d9bd90b1ba77b1fc 100644 (file)
@@ -2,7 +2,7 @@
  * This module implementsserver commands related to the display and
  * manipulation of user "bio" files.
  *
- * Copyright (c) 1987-2016 by the citadel.org team
+ * Copyright (c) 1987-2021 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 as published by
@@ -51,6 +51,7 @@ void cmd_ebio(char *cmdbuf) {
        char userconfigroomname[ROOMNAMELEN];
        CtdlMailboxName(userconfigroomname, sizeof userconfigroomname, &CC->user, USERCONFIGROOM);
        long new_msgnum = quickie_message("Citadel", NULL, NULL, userconfigroomname, ChrPtr(NewProfile), FMT_RFC822, "Profile submitted with EBIO command");
+       FreeStrBuf(&NewProfile);
        CtdlGetUserLock(&CC->user, CC->curr_user);
        CC->user.msgnum_bio = new_msgnum;
        CtdlPutUserLock(&CC->user);
@@ -58,8 +59,6 @@ void cmd_ebio(char *cmdbuf) {
                syslog(LOG_DEBUG, "Deleting old message %ld from %s", old_msgnum, userconfigroomname);
                CtdlDeleteMessages(userconfigroomname, &old_msgnum, 1, "");
        }
-
-       FreeStrBuf(&NewProfile);
 }
 
 
@@ -83,7 +82,7 @@ void cmd_rbio(char *cmdbuf)
                ruser.fullname, ruser.usernum, ruser.axlevel,
                (long)ruser.lastcall, ruser.timescalled, ruser.posted);
 
-       struct CtdlMessage *msg = CtdlFetchMessage(ruser.msgnum_bio, 1, 1);
+       struct CtdlMessage *msg = CtdlFetchMessage(ruser.msgnum_bio, 1);
        if (msg != NULL) {
                CtdlOutputPreLoadedMsg(msg, MT_CITADEL, HEADERS_NONE, 0, 0, 0);
                CM_Free(msg);
@@ -147,7 +146,6 @@ void import_old_bio_files(void)
 {
        DIR *filedir = NULL;
        struct dirent *filedir_entry;
-       struct dirent *d;
        size_t d_namelen;
        struct ctdluser usbuf;
        long usernum = 0;
@@ -157,18 +155,11 @@ void import_old_bio_files(void)
 
 
        syslog(LOG_DEBUG, "Importing old style bio files into the message base");
-       d = (struct dirent *)malloc(offsetof(struct dirent, d_name) + PATH_MAX + 2);
-       if (d == NULL) {
-               return;
-       }
-
-       filedir = opendir (ctdl_bio_dir);
+       filedir = opendir("bio");
        if (filedir == NULL) {
-               free(d);
                return;
        }
-       while ((readdir_r(filedir, d, &filedir_entry) == 0) &&
-              (filedir_entry != NULL))
+       while ( (filedir_entry = readdir(filedir)) , (filedir_entry != NULL))
        {
 #ifdef _DIRENT_HAVE_D_NAMLEN
                d_namelen = filedir_entry->d_namlen;
@@ -201,7 +192,7 @@ void import_old_bio_files(void)
                    (filedir_entry->d_name[1] == '.'))
                        continue;
 
-               snprintf(path, PATH_MAX, "%s/%s", ctdl_bio_dir, filedir_entry->d_name);
+               snprintf(path, PATH_MAX, "bio/%s", filedir_entry->d_name);
                if (d_type == DT_UNKNOWN) {
                        if (lstat(path, &s) == 0) {
                                d_type = IFTODT(s.st_mode);
@@ -219,9 +210,8 @@ void import_old_bio_files(void)
                        }
                }
        }
-       free(d);
        closedir(filedir);
-       rmdir(ctdl_bio_dir);
+       rmdir("bio");
 }