From: Art Cancro Date: Tue, 17 Nov 2009 04:27:39 +0000 (+0000) Subject: * Currently working through a bug that's preventing wiki history pages from being... X-Git-Tag: v7.86~612 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=7a4d3aeb0b3a8210edc8f627e0914e2aa4c93131 * Currently working through a bug that's preventing wiki history pages from being replicated over the network. --- diff --git a/citadel/modules/network/serv_network.c b/citadel/modules/network/serv_network.c index 0f1d37183..c20712142 100644 --- a/citadel/modules/network/serv_network.c +++ b/citadel/modules/network/serv_network.c @@ -217,14 +217,14 @@ int network_usetable(struct CtdlMessage *msg) { cdbut = cdb_fetch(CDB_USETABLE, msgid, strlen(msgid)); if (cdbut != NULL) { cdb_free(cdbut); + CtdlLogPrintf(CTDL_DEBUG, "network_usetable() : we already have %s\n", msgid); return(1); } /* If we got to this point, it's unique: add it. */ strcpy(ut.ut_msgid, msgid); ut.ut_timestamp = time(NULL); - cdb_store(CDB_USETABLE, msgid, strlen(msgid), - &ut, sizeof(struct UseTable) ); + cdb_store(CDB_USETABLE, msgid, strlen(msgid), &ut, sizeof(struct UseTable) ); return(0); } @@ -1484,6 +1484,8 @@ void network_process_buffer(char *buffer, long size) { unsigned char firstbyte; unsigned char lastbyte; + CtdlLogPrintf(CTDL_DEBUG, "network_process_buffer() processing %ld bytes\n", size); + /* Validate just a little bit. First byte should be FF and * last byte should be 00. */ firstbyte = buffer[0]; lastbyte = buffer[size-1]; @@ -1582,17 +1584,14 @@ void network_process_buffer(char *buffer, long size) { /* Learn network topology from the path */ if ((msg->cm_fields['N'] != NULL) && (msg->cm_fields['P'] != NULL)) { - network_learn_topology(msg->cm_fields['N'], - msg->cm_fields['P']); + network_learn_topology(msg->cm_fields['N'], msg->cm_fields['P']); } /* Is the sending node giving us a very persuasive suggestion about * which room this message should be saved in? If so, go with that. */ if (msg->cm_fields['C'] != NULL) { - safestrncpy(target_room, - msg->cm_fields['C'], - sizeof target_room); + safestrncpy(target_room, msg->cm_fields['C'], sizeof target_room); } /* Otherwise, does it have a recipient? If so, validate it... */ @@ -1604,6 +1603,7 @@ void network_process_buffer(char *buffer, long size) { "Please check the address and try sending the message again.\n"); msg = NULL; free_recipients(recp); + CtdlLogPrintf(CTDL_DEBUG, "Bouncing message due to invalid recipient address.\n"); return; } strcpy(target_room, ""); /* no target room if mail */ @@ -1613,9 +1613,7 @@ void network_process_buffer(char *buffer, long size) { * it has the O field (Originating room) set. */ else if (msg->cm_fields['O'] != NULL) { - safestrncpy(target_room, - msg->cm_fields['O'], - sizeof target_room); + safestrncpy(target_room, msg->cm_fields['O'], sizeof target_room); } /* Strip out fields that are only relevant during transit */ diff --git a/citadel/modules/wiki/serv_wiki.c b/citadel/modules/wiki/serv_wiki.c index b9e3ad454..2904c653b 100644 --- a/citadel/modules/wiki/serv_wiki.c +++ b/citadel/modules/wiki/serv_wiki.c @@ -234,7 +234,14 @@ int wiki_upload_beforesave(struct CtdlMessage *msg) { /* Update the history message (regardless of whether it's new or existing) */ - /* First, figure out the boundary string. We do this even when we generated the + /* Remove the Message-ID from the old version of the history message. This will cause a brand + * new one to be generated, avoiding an uninitentional hit of the loop zapper when we replicate. + */ + if (history_msg->cm_fields['I'] != NULL) { + free(history_msg->cm_fields['I']); + } + + /* Figure out the boundary string. We do this even when we generated the * boundary string in the above code, just to be safe and consistent. */ strcpy(boundary, "");