From 9f051da5f95c2bfff60b179a9a403276a7f96b43 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 26 Dec 2017 15:01:48 -0500 Subject: [PATCH] serv_upgrade.c now has pre- and post- startup sections. The import of email addresses from vcards to the user configuration records has to take place after serv_inetcfg is initialized. Also versioned everything at 914 for new release. --- citadel/citadel.h | 4 +-- citadel/configure.ac | 2 +- citadel/debian/changelog | 6 ++++ citadel/internet_addressing.c | 2 ++ citadel/modules/inetcfg/serv_inetcfg.c | 1 + citadel/modules/upgrade/serv_upgrade.c | 48 +++++++++++++++++++------- citadel/modules/vcard/serv_vcard.c | 43 ++++++----------------- libcitadel/configure.in | 4 +-- libcitadel/debian/changelog | 6 ++++ libcitadel/lib/libcitadel.h | 2 +- webcit/configure.ac | 2 +- webcit/debian/changelog | 4 +-- webcit/webcit.h | 6 ++-- 13 files changed, 73 insertions(+), 57 deletions(-) diff --git a/citadel/citadel.h b/citadel/citadel.h index 4c6775d8f..843f050a6 100644 --- a/citadel/citadel.h +++ b/citadel/citadel.h @@ -45,10 +45,10 @@ extern "C" { * usually more strict because you're not really supposed to dump/load and * upgrade at the same time. */ -#define REV_LEVEL 913 // This version +#define REV_LEVEL 914 // This version #define REV_MIN 591 // Oldest compatible database #define EXPORT_REV_MIN 760 // Oldest compatible export files -#define LIBCITADEL_MIN 903 // Minimum required version of libcitadel +#define LIBCITADEL_MIN 914 // Minimum required version of libcitadel #define SERVER_TYPE 0 // zero for stock Citadel; other developers please // obtain SERVER_TYPE codes for your implementations diff --git a/citadel/configure.ac b/citadel/configure.ac index 94ba60de5..7faa9e52b 100644 --- a/citadel/configure.ac +++ b/citadel/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.52) -AC_INIT([Citadel], [912], [http://www.citadel.org/]) +AC_INIT([Citadel], [914], [http://www.citadel.org/]) AC_REVISION([$Revision: 5108 $]) AC_CONFIG_SRCDIR([citserver.c]) AC_CONFIG_HEADER(sysdep.h) diff --git a/citadel/debian/changelog b/citadel/debian/changelog index 9d8b4a8ba..eb42548bf 100644 --- a/citadel/debian/changelog +++ b/citadel/debian/changelog @@ -1,3 +1,9 @@ +citadel (9.14-1) stable; urgency=low + + * new release + + -- Wilfried Goesgens Wed, 26 Dec 2017 12:56:30 -0400 + citadel (9.01-1) stable; urgency=low * new release diff --git a/citadel/internet_addressing.c b/citadel/internet_addressing.c index a9c1b6481..5a27eec51 100644 --- a/citadel/internet_addressing.c +++ b/citadel/internet_addressing.c @@ -285,6 +285,7 @@ int CtdlHostAlias(char *fqdn) { char host[256], type[256]; int found = 0; + syslog(LOG_DEBUG, "EVQ: CtdlHostAlias(%s)", fqdn); if (fqdn == NULL) return(hostalias_nomatch); if (IsEmptyStr(fqdn)) return(hostalias_nomatch); if (!strcasecmp(fqdn, "localhost")) return(hostalias_localhost); @@ -293,6 +294,7 @@ int CtdlHostAlias(char *fqdn) { if (inetcfg == NULL) return(hostalias_nomatch); config_lines = num_tokens(inetcfg, '\n'); + syslog(LOG_DEBUG, "EVQ: inetcfg config_lines is %d", config_lines); for (i=0; iroom, SYSCONFIGROOM) != 0) { return; } diff --git a/citadel/modules/upgrade/serv_upgrade.c b/citadel/modules/upgrade/serv_upgrade.c index 0e68f3b16..bc471dc1a 100644 --- a/citadel/modules/upgrade/serv_upgrade.c +++ b/citadel/modules/upgrade/serv_upgrade.c @@ -142,10 +142,6 @@ void reindex_uids_backend(struct ctdluser *usbuf, void *data) { } CtdlPutUserLock(&us); if ((us.uid > 0) && (us.uid != NATIVE_AUTH_UID)) { // if non-native auth , index by uid - - syslog(LOG_DEBUG, "\033[31m attaching %d to %s \033[0m", us.uid , us.fullname); - - StrBuf *claimed_id = NewStrBuf(); StrBufPrintf(claimed_id, "uid:%d", us.uid); attach_extauth(&us, claimed_id); @@ -159,6 +155,7 @@ void reindex_uids_backend(struct ctdluser *usbuf, void *data) { } } + /* * Build extauth index of all users with uid-based join (system auth, LDAP auth) * Also changes all users with a uid of CTDLUID to NATIVE_AUTH_UID (-1) @@ -171,7 +168,6 @@ void reindex_uids(void) { } - /* * These accounts may have been created by code that ran between mid 2008 and early 2011. * If present they are no longer in use and may be deleted. @@ -528,14 +524,14 @@ void move_inet_addrs_from_vcards_to_user_records(void) * Based on the server version number reported by the existing database, * run in-place data format upgrades until everything is up to date. */ -void check_server_upgrades(void) { +void pre_startup_upgrades(void) { oldver = CtdlGetConfigInt("MM_hosted_upgrade_level"); syslog(LOG_INFO, "Existing database version on disk is %d", oldver); update_config(); if (oldver < REV_LEVEL) { - syslog(LOG_WARNING, "Server hosted updates need to be processed at this time. Please wait..."); + syslog(LOG_WARNING, "Running pre-startup database upgrades."); } else { return; @@ -572,10 +568,6 @@ void check_server_upgrades(void) { ingest_old_roominfo_and_roompic_files(); } - if ((oldver > 000) && (oldver < 912)) { - move_inet_addrs_from_vcards_to_user_records(); - } - CtdlSetConfigInt("MM_hosted_upgrade_level", REV_LEVEL); /* @@ -596,10 +588,42 @@ void check_server_upgrades(void) { } +/* + * Based on the server version number reported by the existing database, + * run in-place data format upgrades until everything is up to date. + */ +void post_startup_upgrades(void) { + + syslog(LOG_INFO, "Existing database version on disk is %d", oldver); + + if (oldver < REV_LEVEL) { + syslog(LOG_WARNING, "Running post-startup database upgrades."); + } + else { + return; + } + + if ((oldver > 000) && (oldver < 912)) { + move_inet_addrs_from_vcards_to_user_records(); + } +} + + CTDL_MODULE_UPGRADE(upgrade) { - check_server_upgrades(); + pre_startup_upgrades(); /* return our module id for the Log */ return "upgrade"; } + +CTDL_MODULE_INIT(upgrade) +{ + if(!threading) + { + post_startup_upgrades(); + } + + /* return our module name for the log */ + return "upgrade"; +} diff --git a/citadel/modules/vcard/serv_vcard.c b/citadel/modules/vcard/serv_vcard.c index f3624bdc4..fe77e6ba0 100644 --- a/citadel/modules/vcard/serv_vcard.c +++ b/citadel/modules/vcard/serv_vcard.c @@ -99,8 +99,7 @@ void vcard_extract_internet_addresses(struct CtdlMessage *msg, int (*callback)(c if (CM_IsEmpty(msg, eAuthor)) return; if (CM_IsEmpty(msg, eNodeName)) return; - snprintf(citadel_address, sizeof citadel_address, "%s @ %s", - msg->cm_fields[eAuthor], msg->cm_fields[eNodeName]); + snprintf(citadel_address, sizeof citadel_address, "%s @ %s", msg->cm_fields[eAuthor], msg->cm_fields[eNodeName]); v = vcard_load(msg->cm_fields[eMesageText]); if (v == NULL) return; @@ -142,8 +141,8 @@ void vcard_extract_internet_addresses(struct CtdlMessage *msg, int (*callback)(c void extract_inet_email_addrs(char *emailaddrbuf, size_t emailaddrbuf_len, char *secemailaddrbuf, size_t secemailaddrbuf_len, struct vCard *v, - int local_addrs_only) -{ + int local_addrs_only +) { struct CitContext *CCC = CC; /* put this on the stack, just for speed */ char *s, *k, *addr; int instance = 0; @@ -159,6 +158,9 @@ void extract_inet_email_addrs(char *emailaddrbuf, size_t emailaddrbuf_len, striplt(addr); if (!IsEmptyStr(addr)) { IsDirectoryAddress = IsDirectory(addr, 1); + + syslog(LOG_DEBUG, "EVQ: addr=<%s> IsDirectoryAddress=<%d> local_addrs_only=<%d>", addr, IsDirectoryAddress, local_addrs_only); + if ( IsDirectoryAddress || !local_addrs_only) { ++saved_instance; @@ -801,7 +803,6 @@ void vcard_newuser(struct ctdluser *usbuf) { syslog(LOG_DEBUG, "\033[31m FIXME BORK BORK BORK try lookup by uid , or maybe dn?\033[0m"); - found_user = CtdlTryUserLDAP(usbuf->fullname, ldap_dn, sizeof ldap_dn, ldap_cn, sizeof ldap_cn, &usbuf->uid); if (found_user == 0) { if (Ctdl_LDAP_to_vCard(ldap_dn, v)) { @@ -1413,7 +1414,6 @@ CTDL_MODULE_INIT(vcard) CtdlRegisterSessionHook(vcard_session_login_hook, EVT_LOGIN, PRIO_LOGIN + 70); CtdlRegisterMessageHook(vcard_upload_beforesave, EVT_BEFORESAVE); CtdlRegisterMessageHook(vcard_upload_aftersave, EVT_AFTERSAVE); - CtdlRegisterDeleteHook(vcard_delete_remove); CtdlRegisterProtoHook(cmd_regi, "REGI", "Enter registration info"); CtdlRegisterProtoHook(cmd_greg, "GREG", "Get registration info"); CtdlRegisterProtoHook(cmd_qdir, "QDIR", "Query Directory"); @@ -1422,7 +1422,10 @@ CTDL_MODULE_INIT(vcard) CtdlRegisterProtoHook(cmd_dvca, "DVCA", "Dump VCard Addresses"); CtdlRegisterUserHook(vcard_newuser, EVT_NEWUSER); CtdlRegisterUserHook(vcard_purge, EVT_PURGEUSER); - CtdlRegisterNetprocHook(vcard_extract_from_network); + + CtdlRegisterDeleteHook(vcard_delete_remove); // FIXME this is obsolete, right? + CtdlRegisterNetprocHook(vcard_extract_from_network); // FIXME this is obsolete, right? + CtdlRegisterSessionHook(store_harvested_addresses, EVT_TIMER, PRIO_CLEANUP + 470); CtdlRegisterFixedOutputHook("text/x-vcard", vcard_fixed_output); CtdlRegisterFixedOutputHook("text/vcard", vcard_fixed_output); @@ -1435,32 +1438,6 @@ CTDL_MODULE_INIT(vcard) qr.QRep.expire_mode = EXPIRE_MANUAL; qr.QRdefaultview = VIEW_ADDRESSBOOK; /* 2 = address book view */ CtdlPutRoomLock(&qr); - - /* - * Also make sure it has a netconfig file, so the networker runs - * on this room even if we don't share it with any other nodes. - * This allows the CANCEL messages (i.e. "Purge this vCard") to be - * purged. - * - * FIXME this no longer works - * - */ - //assoc_file_name(filename, sizeof filename, &qr, ctdl_netcfg_dir); - //fp = fopen(filename, "a"); - //if (fp != NULL) { - //fclose(fp); - //rv = chown(filename, CTDLUID, (-1)); - //if (rv == -1) { - //syslog(LOG_ERR, "vcard: failed to adjust ownership of %s: %m", filename); - //} - //rv = chmod(filename, 0600); - //if (rv == -1) { - //syslog(LOG_ERR, "vcard: failed to adjust ownership of %s: %m", filename); - //} - //} - //else { - //syslog(LOG_ERR, "vcard: cannot create %s: %m", filename); - //} } /* for postfix tcpdict */ diff --git a/libcitadel/configure.in b/libcitadel/configure.in index 21c0636d0..625498d8b 100755 --- a/libcitadel/configure.in +++ b/libcitadel/configure.in @@ -5,7 +5,7 @@ dnl dnl Ensure that libcitadel is configured with autoconf 2.52 or newer AC_PREREQ(2.52) -AC_INIT(libcitadel, 904, http://uncensored.citadel.org) +AC_INIT(libcitadel, 914, http://uncensored.citadel.org) AC_CONFIG_SRCDIR(Makefile.in) AC_CONFIG_AUX_DIR(conftools) @@ -20,7 +20,7 @@ dnl Set LIBAGE to 0. dnl LIBCURRENT=4 -LIBREVISION=904 +LIBREVISION=914 LIBAGE=0 sinclude(conftools/libtool.m4) diff --git a/libcitadel/debian/changelog b/libcitadel/debian/changelog index b26175f6a..186ea22f2 100644 --- a/libcitadel/debian/changelog +++ b/libcitadel/debian/changelog @@ -1,3 +1,9 @@ +libcitadel (9.14-1) stable; urgency=low + + * new release + + -- Wilfried Goesgens Wed, 26 Dec 2017 12:56:30 -0400 + libcitadel (9.01-1) stable; urgency=low * new release diff --git a/libcitadel/lib/libcitadel.h b/libcitadel/lib/libcitadel.h index 4757d0925..ad7058a0b 100644 --- a/libcitadel/lib/libcitadel.h +++ b/libcitadel/lib/libcitadel.h @@ -28,7 +28,7 @@ #include #include -#define LIBCITADEL_VERSION_NUMBER 904 +#define LIBCITADEL_VERSION_NUMBER 914 /* * Here's a bunch of stupid magic to make the MIME parser portable. diff --git a/webcit/configure.ac b/webcit/configure.ac index bda5ae80f..4d6c981ba 100644 --- a/webcit/configure.ac +++ b/webcit/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. dnl $Id$ -AC_INIT([WebCit], [912], [http://www.citadel.org/]) +AC_INIT([WebCit], [914], [http://www.citadel.org/]) AC_SUBST(PROG_SUBDIRS) diff --git a/webcit/debian/changelog b/webcit/debian/changelog index d48253326..cc75463b4 100644 --- a/webcit/debian/changelog +++ b/webcit/debian/changelog @@ -1,8 +1,8 @@ -webcit (9.01-1) stable; urgency=low +webcit (9.14-1) stable; urgency=low * new release - -- Wilfried Goesgens Wed, 01 Apr 2015 12:56:30 -0400 + -- Wilfried Goesgens Wed, 26 Dec 2017 12:56:30 -0400 webcit (8.29-1) stable; urgency=low diff --git a/webcit/webcit.h b/webcit/webcit.h index 11cdc6f78..54410d05b 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -127,9 +127,9 @@ extern char *ssl_cipher_list; #define PORT_NUM 2000 /* port number to listen on */ #define DEVELOPER_ID 0 #define CLIENT_ID 4 -#define CLIENT_VERSION 912 /* This version of WebCit */ -#define MINIMUM_CIT_VERSION 912 /* Minimum required version of Citadel server */ -#define LIBCITADEL_MIN 903 /* Minimum required version of libcitadel */ +#define CLIENT_VERSION 914 /* This version of WebCit */ +#define MINIMUM_CIT_VERSION 914 /* Minimum required version of Citadel server */ +#define LIBCITADEL_MIN 914 /* Minimum required version of libcitadel */ #define DEFAULT_HOST "localhost" /* Default Citadel server */ #define DEFAULT_PORT "504" #define TARGET "webcit01" /* Window target for inline URL's */ -- 2.30.2