Changeset: fe79407a9d06 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fe79407a9d06 Modified Files: tools/merovingian/ChangeLog.Feb2013 tools/merovingian/daemon/merovingian.c Branch: Feb2013 Log Message:
monetdbd: drop ancient upgrade code Mar2011 and Aug2011 are very long ago, people should have upgraded by now. diffs (201 lines): diff --git a/tools/merovingian/ChangeLog.Feb2013 b/tools/merovingian/ChangeLog.Feb2013 --- a/tools/merovingian/ChangeLog.Feb2013 +++ b/tools/merovingian/ChangeLog.Feb2013 @@ -1,6 +1,9 @@ # ChangeLog file for sql/src/backends/monet5/merovingian # This file is updated with mchangelog +* Sat Dec 1 2012 Fabian Groffen <fab...@monetdb.org> +- Upgrade support for dbfarms from Mar2011 and Aug2011 was dropped + * Fri Nov 30 2012 Fabian Groffen <fab...@monetdb.org> - monetdb status now uses a more condensed output, to cater for the uris being shown, and prints how long a database is stopped, or how long diff --git a/tools/merovingian/daemon/merovingian.c b/tools/merovingian/daemon/merovingian.c --- a/tools/merovingian/daemon/merovingian.c +++ b/tools/merovingian/daemon/merovingian.c @@ -384,159 +384,6 @@ newErr(const char *fmt, ...) return(ret); } -/** - * Explicitly pulled out functionality that is just implemented to - * obtain an automatic upgrade path. - * - * Starting from the Apr2011 release, the .merovingian_pass file is no - * longer used. Instead, the phrase is inside the - * .merovingian_properties file that is used since that release also. - * If the file exists, read its contents, and set it as value for the - * key "passphrase" in the given confkeyval. Afterwards, delete the old - * .merovingian_pass file. - * - * Returns 0 if a .merovingian_pass file existed, contained a valid key, - * was set in ckv, and the .merovingian_pass file was removed. - */ -static char -autoUpgradePassphraseMar2011Apr2011(confkeyval *ckv) -{ - struct stat statbuf; - FILE *secretf; - size_t len; - char buf[128]; - - if (stat(".merovingian_pass", &statbuf) == -1) - return(1); - - if ((secretf = fopen(".merovingian_pass", "r")) == NULL) - return(1); - - len = fread(buf, 1, sizeof(buf) - 1, secretf); - fclose(secretf); - buf[len] = '\0'; - len = strlen(buf); /* secret can contain null-bytes */ - /* strip trailing newlines */ - for (; len > 0 && buf[len - 1] == '\n'; len--) - buf[len - 1] = '\0'; - if (len == 0) - return(1); - - ckv = findConfKey(ckv, "passphrase"); - setConfVal(ckv, buf); - - if (!unlink(".merovingian_pass")) - return(1); - - return(0); -} - -/** - * Explicitly pulled out functionality that is just implemented to - * obtain an automatic upgrade path. - * - * Starting from the Dec2011 release, the discoveryport setting has - * disappeared. Instead, a boolean discovery is available to enable or - * disable the service. It always uses the same port as the connections - * are on. - * - * This function sets discovery to true if discoveryport is set to a - * non-zero positive value in port range, false otherwise. - * - * Returns 0 if discoveryport is not set (and upgrade probably already - * took place). - */ -static char -autoUpgradeDiscoveryPortAug2011Dec2011(confkeyval *mckv) -{ - confkeyval *kv; - confkeyval ckv[] = { - {"discoveryport", NULL, 0, INT}, - { NULL, NULL, 0, INVALID} - }; - - readProps(ckv, "."); - - kv = findConfKey(ckv, "discoveryport"); - if (kv->val == NULL) { - freeConfFile(ckv); - return 0; - } - - if (kv->ival <= 0 || kv->ival > 65535) { - kv = findConfKey(mckv, "discovery"); - setConfVal(kv, "false"); - } - - freeConfFile(ckv); - return 1; -} - -/** - * Explicitly pulled out functionality that is just implemented to - * obtain an automatic upgrade path. - * - * Starting from the Dec2011 release, the controlport setting has - * disappeared. Instead, a boolean control is available to enable or - * disable the (remote) service. It always uses the same port as the - * connections are on, since starting from this release the same handler - * is used. - * - * This function sets control to true if controlport is set to a - * non-zero positive value in port range and passphrase is also - * non-empty, false otherwise. A migration of the passphrase is made to - * the default password backend hash. - * - * Returns 0 if controlport is not set (and upgrade probably already - * took place). - */ -static char -autoUpgradeControlPortAug2011Dec2011(confkeyval *mckv) -{ - char *pwhash; - char hstr[256]; - confkeyval *kv; - confkeyval ckv[] = { - {"controlport", NULL, 0, INT}, - {"passphrase", NULL, 0, STR}, - { NULL, NULL, 0, INVALID} - }; - - readProps(ckv, "."); - - kv = findConfKey(ckv, "controlport"); - if (kv->val == NULL) { - freeConfFile(ckv); - return 0; - } - - if (kv->ival <= 0 || kv->ival > 65535) { - kv = findConfKey(mckv, "passphrase"); - setConfVal(kv, NULL); - freeConfFile(ckv); - return 0; - } - - kv = findConfKey(ckv, "passphrase"); - if (kv->val == NULL || kv->val[0] == '\0') { - freeConfFile(ckv); - return 0; - } - - /* migrate the passphrase to the configured backend hash */ - pwhash = mcrypt_BackendSum(kv->val, strlen(kv->val)); - assert(pwhash != NULL); /* only messed with configs hit this */ - snprintf(hstr, sizeof(hstr), "{%s}%s", MONETDB5_PASSWDHASH, pwhash); - free(pwhash); - kv = findConfKey(mckv, "passphrase"); - setConfVal(kv, hstr); - - kv = findConfKey(mckv, "control"); - setConfVal(kv, "true"); - - freeConfFile(ckv); - return 1; -} int main(int argc, char *argv[]) @@ -816,24 +663,6 @@ main(int argc, char *argv[]) readProps(ckv, "."); _mero_props = ckv; - /* upgrades to conf-file in place */ - kv = findConfKey(_mero_props, "passphrase"); - if (kv->val == NULL || strlen(kv->val) == 0) { - if (!autoUpgradePassphraseMar2011Apr2011(_mero_props)) { - char phrase[128]; - Mfprintf(stderr, "control passphrase unset or has zero-length, " - "generating one\n"); - generateSalt(phrase, sizeof(phrase)); - setConfVal(kv, phrase); - } - writeProps(_mero_props, "."); - } - - if (autoUpgradeDiscoveryPortAug2011Dec2011(_mero_props) != 0 || - autoUpgradeControlPortAug2011Dec2011(_mero_props) != 0) - writeProps(_mero_props, "."); - /* end upgrades to conf-file in place */ - pidfilename = getConfVal(_mero_props, "pidfile"); p = getConfVal(_mero_props, "forward"); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list