struct MetaData has an unused member "mimetype" that doesn't
authorArt Cancro <ajc@citadel.org>
Fri, 24 Aug 2018 14:27:14 +0000 (10:27 -0400)
committerArt Cancro <ajc@citadel.org>
Fri, 24 Aug 2018 14:27:14 +0000 (10:27 -0400)
appear to be used anywhere (other than import/export, which
doesn't count).  Removed this element from import/export and
renamed the member to "unused_field_1" in preparation for
removing it.

citadel/modules/migrate/serv_migrate.c
citadel/msgbase.c
citadel/server.h

index aba5cdb231c025c4838b28e46c2f2535c75d5e88..96ff75057f20e218285c7f1820416f6d82539961 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This module dumps and/or loads the Citadel database in XML format.
  *
- * Copyright (c) 1987-2017 by the citadel.org team
+ * Copyright (c) 1987-2018 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.
@@ -330,7 +330,6 @@ void migr_export_message(long msgnum) {
        cprintf("<msg_meta_refcount>%d</msg_meta_refcount>\n", smi.meta_refcount);
        cprintf("<msg_meta_rfc822_length>%ld</msg_meta_rfc822_length>\n", smi.meta_rfc822_length);
        client_write(HKEY("<msg_meta_content_type>")); xml_strout(smi.meta_content_type); client_write(HKEY("</msg_meta_content_type>\n"));
-       client_write(HKEY("<msg_mimetype>")); xml_strout(smi.mimetype); client_write(HKEY("</msg_mimetype>\n"));
 
        client_write(HKEY("<msg_text>"));
        CtdlSerializeMessage(&smr, msg);
@@ -795,7 +794,6 @@ void migr_xml_end(void *data, const char *el)
        else if (!strcasecmp(el, "msg_meta_refcount"))          smi.meta_refcount = atoi(ChrPtr(migr_chardata));
        else if (!strcasecmp(el, "msg_meta_rfc822_length"))     smi.meta_rfc822_length = atoi(ChrPtr(migr_chardata));
        else if (!strcasecmp(el, "msg_meta_content_type"))      safestrncpy(smi.meta_content_type, ChrPtr(migr_chardata), sizeof smi.meta_content_type);
-       else if (!strcasecmp(el, "msg_mimetype"))               safestrncpy(smi.mimetype, ChrPtr(migr_chardata), sizeof smi.mimetype);
 
        else if (!strcasecmp(el, "msg_text"))
        {
@@ -820,14 +818,14 @@ void migr_xml_end(void *data, const char *el)
                }
 
                syslog(LOG_INFO,
-                      "%s message #%ld, size=%d, refcount=%d, bodylength=%ld, content-type: %s / %s",
+                      "%s message #%ld, size=%d, refcount=%d, bodylength=%ld, content-type: %s",
                       (rc!= 0)?"failed to import ":"Imported ",
                       import_msgnum,
                       StrLength(migr_MsgData),
                       smi.meta_refcount,
                       smi.meta_rfc822_length,
-                      smi.meta_content_type,
-                      smi.mimetype);
+                      smi.meta_content_type
+               );
                memset(&smi, 0, sizeof(smi));
        }
 
@@ -982,12 +980,12 @@ int migr_restore_message_metadata(long msgnum, int refcount)
 
 
        syslog(LOG_INFO,
-              "Setting message #%ld meta data to: refcount=%d, bodylength=%ld, content-type: %s / %s",
+              "Setting message #%ld meta data to: refcount=%d, bodylength=%ld, content-type: %s",
               smi.meta_msgnum,
               smi.meta_refcount,
               smi.meta_rfc822_length,
-              smi.meta_content_type,
-              smi.mimetype);
+              smi.meta_content_type
+       );
 
        PutMetaData(&smi);
 
index 30f9a6888b9c084a681e257656731a7b6ef4bbc0..339650a8f14e7a189679f884da1ce0c2e09016d4 100644 (file)
@@ -55,23 +55,23 @@ char *msgkeys[91] = {
        NULL, 
        "from", /* A -> eAuthor       */
        NULL,   /* B -> eBig_message  */
-       NULL,   /* C -> eRemoteRoom   */
-       NULL,   /* D -> eDestination  */
+       NULL,   /* C -> eRemoteRoom   FIXME no more ignet */
+       NULL,   /* D -> eDestination  FIXME no more ignet */
        "exti", /* E -> eXclusivID    */
        "rfca", /* F -> erFc822Addr   */
        NULL,   /* G */
-       "hnod", /* H -> eHumanNode    */
+       "hnod", /* H -> eHumanNode    FIXME no more ignet */
        "msgn", /* I -> emessageId    */
        "jrnl", /* J -> eJournal      */
        "rep2", /* K -> eReplyTo      */
        "list", /* L -> eListID       */
        "text", /* M -> eMesageText   */
-       "node", /* N -> eNodeName     */
+       "node", /* N -> eNodeName     FIXME no more ignet */
        "room", /* O -> eOriginalRoom */
        "path", /* P -> eMessagePath  */
        NULL,   /* Q */
        "rcpt", /* R -> eRecipient    */
-       "spec", /* S -> eSpecialField */
+       "spec", /* S -> eSpecialField FIXME we might not be using this anymore */
        "time", /* T -> eTimestamp    */
        "subj", /* U -> eMsgSubject   */
        "nvto", /* V -> eenVelopeTo   */
@@ -147,22 +147,25 @@ eMsgField FieldOrder[]  = {
 
 static const long NDiskFields = sizeof(FieldOrder) / sizeof(eMsgField);
 
+
 int CM_IsEmpty(struct CtdlMessage *Msg, eMsgField which)
 {
-       return !((Msg->cm_fields[which] != NULL) &&
-                (Msg->cm_fields[which][0] != '\0'));
+       return !((Msg->cm_fields[which] != NULL) && (Msg->cm_fields[which][0] != '\0'));
 }
 
+
 void CM_SetField(struct CtdlMessage *Msg, eMsgField which, const char *buf, long length)
 {
-       if (Msg->cm_fields[which] != NULL)
+       if (Msg->cm_fields[which] != NULL) {
                free (Msg->cm_fields[which]);
+       }
        Msg->cm_fields[which] = malloc(length + 1);
        memcpy(Msg->cm_fields[which], buf, length);
        Msg->cm_fields[which][length] = '\0';
        Msg->cm_lengths[which] = length;
 }
 
+
 void CM_SetFieldLONG(struct CtdlMessage *Msg, eMsgField which, long lvalue)
 {
        char buf[128];
@@ -170,6 +173,8 @@ void CM_SetFieldLONG(struct CtdlMessage *Msg, eMsgField which, long lvalue)
        len = snprintf(buf, sizeof(buf), "%ld", lvalue);
        CM_SetField(Msg, which, buf, len);
 }
+
+
 void CM_CutFieldAt(struct CtdlMessage *Msg, eMsgField WhichToCut, long maxlen)
 {
        if (Msg->cm_fields[WhichToCut] == NULL)
@@ -182,6 +187,7 @@ void CM_CutFieldAt(struct CtdlMessage *Msg, eMsgField WhichToCut, long maxlen)
        }
 }
 
+
 void CM_FlushField(struct CtdlMessage *Msg, eMsgField which)
 {
        if (Msg->cm_fields[which] != NULL)
@@ -189,35 +195,37 @@ void CM_FlushField(struct CtdlMessage *Msg, eMsgField which)
        Msg->cm_fields[which] = NULL;
        Msg->cm_lengths[which] = 0;
 }
+
+
 void CM_Flush(struct CtdlMessage *Msg)
 {
        int i;
 
-       if (CM_IsValidMsg(Msg) == 0) 
+       if (CM_IsValidMsg(Msg) == 0) {
                return;
+       }
 
-       for (i = 0; i < 256; ++i)
-       {
+       for (i = 0; i < 256; ++i) {
                CM_FlushField(Msg, i);
        }
 }
 
+
 void CM_CopyField(struct CtdlMessage *Msg, eMsgField WhichToPutTo, eMsgField WhichtToCopy)
 {
        long len;
-       if (Msg->cm_fields[WhichToPutTo] != NULL)
+       if (Msg->cm_fields[WhichToPutTo] != NULL) {
                free (Msg->cm_fields[WhichToPutTo]);
+       }
 
-       if (Msg->cm_fields[WhichtToCopy] != NULL)
-       {
+       if (Msg->cm_fields[WhichtToCopy] != NULL) {
                len = Msg->cm_lengths[WhichtToCopy];
                Msg->cm_fields[WhichToPutTo] = malloc(len + 1);
                memcpy(Msg->cm_fields[WhichToPutTo], Msg->cm_fields[WhichtToCopy], len);
                Msg->cm_fields[WhichToPutTo][len] = '\0';
                Msg->cm_lengths[WhichToPutTo] = len;
        }
-       else
-       {
+       else {
                Msg->cm_fields[WhichToPutTo] = NULL;
                Msg->cm_lengths[WhichToPutTo] = 0;
        }
@@ -249,48 +257,53 @@ void CM_PrependToField(struct CtdlMessage *Msg, eMsgField which, const char *buf
        }
 }
 
+
 void CM_SetAsField(struct CtdlMessage *Msg, eMsgField which, char **buf, long length)
 {
-       if (Msg->cm_fields[which] != NULL)
+       if (Msg->cm_fields[which] != NULL) {
                free (Msg->cm_fields[which]);
+       }
 
        Msg->cm_fields[which] = *buf;
        *buf = NULL;
        Msg->cm_lengths[which] = length;
 }
 
+
 void CM_SetAsFieldSB(struct CtdlMessage *Msg, eMsgField which, StrBuf **buf)
 {
-       if (Msg->cm_fields[which] != NULL)
+       if (Msg->cm_fields[which] != NULL) {
                free (Msg->cm_fields[which]);
+       }
 
        Msg->cm_lengths[which] = StrLength(*buf);
        Msg->cm_fields[which] = SmashStrBuf(buf);
 }
 
+
 void CM_GetAsField(struct CtdlMessage *Msg, eMsgField which, char **ret, long *retlen)
 {
-       if (Msg->cm_fields[which] != NULL)
-       {
+       if (Msg->cm_fields[which] != NULL) {
                *retlen = Msg->cm_lengths[which];
                *ret = Msg->cm_fields[which];
                Msg->cm_fields[which] = NULL;
                Msg->cm_lengths[which] = 0;
        }
-       else
-       {
+       else {
                *ret = NULL;
                *retlen = 0;
        }
 }
 
+
 /*
  * Returns 1 if the supplied pointer points to a valid Citadel message.
  * If the pointer is NULL or the magic number check fails, returns 0.
  */
 int CM_IsValidMsg(struct CtdlMessage *msg) {
-       if (msg == NULL)
+       if (msg == NULL) {
                return 0;
+       }
        if ((msg->cm_magic) != CTDLMESSAGE_MAGIC) {
                syslog(LOG_WARNING, "msgbase: CM_IsValidMsg() self-check failed");
                return 0;
@@ -298,6 +311,7 @@ int CM_IsValidMsg(struct CtdlMessage *msg) {
        return 1;
 }
 
+
 void CM_FreeContents(struct CtdlMessage *msg)
 {
        int i;
@@ -310,13 +324,14 @@ void CM_FreeContents(struct CtdlMessage *msg)
 
        msg->cm_magic = 0;      /* just in case */
 }
+
+
 /*
  * 'Destructor' for struct CtdlMessage
  */
 void CM_Free(struct CtdlMessage *msg)
 {
-       if (CM_IsValidMsg(msg) == 0) 
-       {
+       if (CM_IsValidMsg(msg) == 0) {
                if (msg != NULL) free (msg);
                return;
        }
@@ -324,40 +339,42 @@ void CM_Free(struct CtdlMessage *msg)
        free(msg);
 }
 
+
 int CM_DupField(eMsgField i, struct CtdlMessage *OrgMsg, struct CtdlMessage *NewMsg)
 {
        long len;
        len = OrgMsg->cm_lengths[i];
        NewMsg->cm_fields[i] = malloc(len + 1);
-       if (NewMsg->cm_fields[i] == NULL)
+       if (NewMsg->cm_fields[i] == NULL) {
                return 0;
+       }
        memcpy(NewMsg->cm_fields[i], OrgMsg->cm_fields[i], len);
        NewMsg->cm_fields[i][len] = '\0';
        NewMsg->cm_lengths[i] = len;
        return 1;
 }
 
+
 struct CtdlMessage * CM_Duplicate(struct CtdlMessage *OrgMsg)
 {
        int i;
        struct CtdlMessage *NewMsg;
 
-       if (CM_IsValidMsg(OrgMsg) == 0) 
+       if (CM_IsValidMsg(OrgMsg) == 0) {
                return NULL;
+       }
        NewMsg = (struct CtdlMessage *)malloc(sizeof(struct CtdlMessage));
-       if (NewMsg == NULL)
+       if (NewMsg == NULL) {
                return NULL;
+       }
 
        memcpy(NewMsg, OrgMsg, sizeof(struct CtdlMessage));
 
        memset(&NewMsg->cm_fields, 0, sizeof(char*) * 256);
        
-       for (i = 0; i < 256; ++i)
-       {
-               if (OrgMsg->cm_fields[i] != NULL)
-               {
-                       if (!CM_DupField(i, OrgMsg, NewMsg))
-                       {
+       for (i = 0; i < 256; ++i) {
+               if (OrgMsg->cm_fields[i] != NULL) {
+                       if (!CM_DupField(i, OrgMsg, NewMsg)) {
                                CM_Free(NewMsg);
                                return NULL;
                        }
@@ -368,9 +385,6 @@ struct CtdlMessage * CM_Duplicate(struct CtdlMessage *OrgMsg)
 }
 
 
-
-
-
 /* Determine if a given message matches the fields in a message template.
  * Return 0 for a successful match.
  */
@@ -3500,8 +3514,6 @@ int CtdlDeleteMessages(const char *room_name,             /* which room */
 }
 
 
-
-
 /*
  * GetMetaData()  -  Get the supplementary record for a message
  */
@@ -3522,7 +3534,7 @@ void GetMetaData(struct MetaData *smibuf, long msgnum)
        if (cdbsmi == NULL) {
                return;         /* record not found; go with defaults */
        }
-       memcpy(smibuf, cdbsmi->ptr,
+       memcpy(smibuf, cdbsmi->ptr,                                     // FIXME can we do this without a memcpy?
               ((cdbsmi->len > sizeof(struct MetaData)) ?
                sizeof(struct MetaData) : cdbsmi->len));
        cdb_free(cdbsmi);
index 837e8b252291d3f8be433412f49095fca9dca155..85f6c1cfcec353004632b52ef8bc4361a2d5ef62 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * Main declarations file for the Citadel server
  *
- * Copyright (c) 1987-2017 by the citadel.org team
+ * Copyright (c) 1987-2018 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.
@@ -65,22 +65,22 @@ typedef struct __recptypes {
 #define RECPTYPES_MAGIC 0xfeeb
 
 
-#define CTDLEXIT_SHUTDOWN      0       /* Normal shutdown; do NOT auto-restart */
+#define CTDLEXIT_SHUTDOWN      0       // Normal shutdown; do NOT auto-restart
 
 /*
  * Exit codes 101 through 109 are used for conditions in which
  * we deliberately do NOT want the service to automatically
  * restart.
  */
-#define CTDLEXIT_CONFIG                101     /* Could not read citadel.config */
-#define CTDLEXIT_CONTROL       102     /* Could not acquire lock */
-#define CTDLEXIT_HOME          103     /* Citadel home directory not found */
-#define CTDLEXIT_OOD           104     /* Out Of Date config - rerun setup */
-#define CTDLEXIT_DB            105     /* Unable to initialize database */
-#define CTDLEXIT_LIBCITADEL    106     /* Incorrect version of libcitadel */
-#define CTDL_EXIT_UNSUP_AUTH   107     /* Unsupported auth mode configured */
-#define CTDLEXIT_UNUSER                108     /* Could not determine uid to run as */
-#define CTDLEXIT_CRYPTO                109     /* Problem initializing SSL or TLS */
+#define CTDLEXIT_CONFIG                101     // Could not read system configuration
+#define CTDLEXIT_CONTROL       102     // Could not acquire lock
+#define CTDLEXIT_HOME          103     // Citadel home directory not found
+#define CTDLEXIT_OOD           104     // Out Of Date config - rerun setup
+#define CTDLEXIT_DB            105     // Unable to initialize database
+#define CTDLEXIT_LIBCITADEL    106     // Incorrect version of libcitadel
+#define CTDL_EXIT_UNSUP_AUTH   107     // Unsupported auth mode configured
+#define CTDLEXIT_UNUSER                108     // Could not determine uid to run as
+#define CTDLEXIT_CRYPTO                109     // Problem initializing SSL or TLS
 
 /*
  * Reasons why a session would be terminated (set CC->kill_me to these values)
@@ -286,7 +286,7 @@ struct MetaData {
        int meta_refcount;              /* Number of rooms pointing to this msg */
        char meta_content_type[64];     /* Cached MIME content-type */
        long meta_rfc822_length;        /* Cache of RFC822-translated msg length */
-       char mimetype[64];              /* if we were able to guess the mimetype for the data */ 
+       char unused_field_1[64];        /* FIXME this isn't used anywhere , why do we have it ?!? */
 };
 
 /* Calls to AdjRefCount() are queued and deferred, so the user doesn't