From 2d91668c654b83d2b200b64302c5e1529a67b3ff Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Tue, 25 Jan 2005 20:49:18 +0000 Subject: [PATCH] Implemented 'Mirror exclude' SVN revision: 1184 --- NT/elogd.vcproj | 2 +- doc/config.html | 9 ++++++++- src/elogd.c | 21 ++++++++++++++++++--- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/NT/elogd.vcproj b/NT/elogd.vcproj index 99602a84..8aa4c973 100755 --- a/NT/elogd.vcproj +++ b/NT/elogd.vcproj @@ -44,7 +44,7 @@ GenerateDebugInformation="TRUE" ProgramDatabaseFile=".\Debug/elogd.pdb" SubSystem="1" - StackReserveSize="1048576" + StackReserveSize="4000000" TargetMachine="1"/>
If one wants to try out mirroring without causing any harm, one can turn on this flag. During synchronization, entries are compared and necessary transfers are displayed, -but not executed. Default is 0. +but not executed. Default is 0.

+ +
  • Mirror exclude = 0 | 1

    + +By default, all logbooks are mirrored. Individual logbooks might be excluded from +mirroring by putting Mirror exclude = 1 in their individual logbook +section of the configuration file (Not the [global] section). +Default is 0.

    diff --git a/src/elogd.c b/src/elogd.c index d5a65993..376dd355 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -6,6 +6,9 @@ Contents: Web server program for Electronic Logbook ELOG $Log$ + Revision 1.545 2005/01/25 20:49:18 ritt + Implemented 'Mirror exclude' + Revision 1.544 2005/01/25 16:31:40 ritt Switched from GIF to PNG @@ -4165,7 +4168,7 @@ INT el_retrieve(LOGBOOK * lbs, { int i, index, size, fh; char str[NAME_LENGTH], file_name[256], *p; - char message[TEXT_SIZE + 1000], attachment_all[64 * MAX_ATTACHMENTS]; + char *message, attachment_all[64 * MAX_ATTACHMENTS]; if (message_id == 0) /* open most recent message */ @@ -4190,9 +4193,12 @@ INT el_retrieve(LOGBOOK * lbs, text, textsize, in_reply_to, reply_to, attachment, encoding, locked_by); } + message = malloc(TEXT_SIZE + 1000); + lseek(fh, lbs->el_index[index].offset, SEEK_SET); - i = read(fh, message, sizeof(message) - 1); + i = read(fh, message, TEXT_SIZE + 1000 - 1); if (i <= 0) { + free(message); close(fh); return EL_FILE_ERROR; } @@ -4201,6 +4207,7 @@ INT el_retrieve(LOGBOOK * lbs, close(fh); if (strncmp(message, "$@MID@$:", 8) != 0) { + free(message); /* file might have been edited, rebuild index */ el_build_index(lbs, TRUE); return el_retrieve(lbs, message_id, date, attr_list, attrib, n_attr, @@ -4208,8 +4215,10 @@ INT el_retrieve(LOGBOOK * lbs, } /* check for correct ID */ - if (atoi(message + 8) != message_id) + if (atoi(message + 8) != message_id) { + free(message); return EL_FILE_ERROR; + } /* decode message size */ p = strstr(message + 8, "$@MID@$:"); @@ -4285,6 +4294,7 @@ INT el_retrieve(LOGBOOK * lbs, if ((int) strlen(p) >= *textsize) { strlcpy(text, p, *textsize); show_error("Entry too long to display. Please increase TEXT_SIZE and recompile elogd."); + free(message); return EL_FILE_ERROR; } else { strlcpy(text, p, *textsize); @@ -4304,6 +4314,7 @@ INT el_retrieve(LOGBOOK * lbs, } } + free(message); return EL_SUCCESS; } @@ -13162,6 +13173,10 @@ void synchronize(LOGBOOK * lbs, int mode) && !strieq(lb_list[i].top_group, getcfg_topgroup())) continue; + /* skip if excluded */ + if (getcfg(lb_list[i].name, "Mirror exclude", str, sizeof(str)) && atoi(str) == 1) + continue; + /* if called by cron, set user name and password */ if (mode == SYNC_CRON && getcfg(lb_list[i].name, "mirror user", str, sizeof(str))) { if (get_user_line(lb_list[i].name, str, pwd, NULL, NULL, NULL) == EL_SUCCESS) {