From 6412d3bbf80bf300f11a684b282df7b98a3cb418 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 1 Jan 2014 20:29:08 -0800 Subject: [PATCH] remove the fallback password. --- core/src/gamecode/laws.c | 24 ++++++++---------------- core/src/kernel/faction.c | 4 ---- core/src/kernel/faction.h | 2 -- core/src/kernel/save.c | 8 ++------ core/src/kernel/version.h | 5 +++-- core/src/modules/arena.c | 1 - core/src/modules/autoseed.c | 5 ++--- core/src/modules/gmcmd.c | 1 - storage | 2 +- 9 files changed, 16 insertions(+), 36 deletions(-) diff --git a/core/src/gamecode/laws.c b/core/src/gamecode/laws.c index daa7a6334..c2e89b3c4 100755 --- a/core/src/gamecode/laws.c +++ b/core/src/gamecode/laws.c @@ -1446,26 +1446,20 @@ static void remove_idle_players(void) destroyfaction(f); continue; } - if (fval(f, FFL_OVERRIDE)) { - free(f->override); - f->override = _strdup(itoa36(rng_int())); - freset(f, FFL_OVERRIDE); - } if (turn != f->lastorders) { char info[256]; sprintf(info, "%d Einheiten, %d Personen, %d Silber", f->no_units, f->num_total, f->money); if (f->subscription) { sql_print( - ("UPDATE subscriptions SET lastturn=%d, password='%s', info='%s' WHERE id=%u;\n", - f->lastorders, f->override, info, f->subscription)); + ("UPDATE subscriptions SET lastturn=%d, info='%s' WHERE id=%u;\n", + f->lastorders, info, f->subscription)); } } else { if (f->subscription) { sql_print( - ("UPDATE subscriptions SET status='ACTIVE', lastturn=%d, firstturn=greatest(firstturn,%d), password='%s' WHERE id=%u;\n", - f->lastorders, f->lastorders - f->age, f->override, - f->subscription)); + ("UPDATE subscriptions SET status='ACTIVE', lastturn=%d, firstturn=greatest(firstturn,%d) WHERE id=%u;\n", + f->lastorders, f->lastorders - f->age, f->subscription)); } } @@ -2408,7 +2402,6 @@ int password_cmd(unit * u, struct order *ord) } else { u->faction->passw = _strdup(pwbuf); } - fset(u->faction, FFL_OVERRIDE); ADDMSG(&u->faction->msgs, msg_message("changepasswd", "value", u->faction->passw)); return 0; @@ -4675,8 +4668,8 @@ int writepasswd(void) log_info("writing passwords..."); for (f = factions; f; f = f->next) { - fprintf(F, "%s:%s:%s:%s:%u\n", - factionid(f), f->email, f->passw, f->override, f->subscription); + fprintf(F, "%s:%s:%s:%u\n", + factionid(f), f->email, f->passw, f->subscription); } fclose(F); return 0; @@ -4711,9 +4704,8 @@ void update_subscriptions(void) sprintf(zText, "subscriptions.%u", turn); F = fopen(zText, "w"); for (f = factions; f != NULL; f = f->next) { - fprintf(F, "%s:%u:%s:%s:%s:%u:\n", - itoa36(f->no), f->subscription, f->email, f->override, - dbrace(f->race), f->lastorders); + fprintf(F, "%s:%u:%s:%s:%u:\n", + itoa36(f->no), f->subscription, f->email, dbrace(f->race), f->lastorders); } fclose(F); } diff --git a/core/src/kernel/faction.c b/core/src/kernel/faction.c index 340eb5d5e..456cc3133 100755 --- a/core/src/kernel/faction.c +++ b/core/src/kernel/faction.c @@ -88,7 +88,6 @@ void free_faction(faction * f) free(f->email); free(f->banner); free(f->passw); - free(f->override); free(f->name); while (f->attribs) { @@ -204,7 +203,6 @@ faction *addfaction(const char *email, const char *password, log_error("Invalid email address for faction %s: %s\n", itoa36(f->no), email); } - f->override = _strdup(itoa36(rng_int())); faction_setpassword(f, password); f->alliance_joindate = turn; @@ -264,8 +262,6 @@ bool checkpasswd(const faction * f, const char *passwd, bool shortp) { if (unicode_utf8_strcasecmp(f->passw, passwd) == 0) return true; - if (unicode_utf8_strcasecmp(f->override, passwd) == 0) - return true; return false; } diff --git a/core/src/kernel/faction.h b/core/src/kernel/faction.h index cc7239e82..2de1f6486 100644 --- a/core/src/kernel/faction.h +++ b/core/src/kernel/faction.h @@ -44,7 +44,6 @@ extern "C" { * (FFL_SELECT muss man vorher initialisieren, * FL_MARK hinterher löschen) */ #define FFL_NOIDLEOUT (1<<24) /* Partei stirbt nicht an NMRs */ -#define FFL_OVERRIDE (1<<27) /* Override-Passwort wurde benutzt */ #define FFL_DBENTRY (1<<28) /* Partei ist in Datenbank eingetragen */ #define FFL_NOTIMEOUT (1<<29) /* ignore MaxAge() */ #define FFL_GM (1<<30) /* eine Partei mit Sonderrechten */ @@ -71,7 +70,6 @@ extern "C" { char *banner; char *email; char *passw; - char *override; int max_spelllevel; struct spellbook *spellbook; const struct locale *locale; diff --git a/core/src/kernel/save.c b/core/src/kernel/save.c index 8e2a1fb2c..923e7c89d 100644 --- a/core/src/kernel/save.c +++ b/core/src/kernel/save.c @@ -1247,11 +1247,8 @@ faction *readfaction(struct gamedata * data) READ_STR(data->store, name, sizeof(name)); f->passw = _strdup(name); - if (data->version >= OVERRIDE_VERSION) { - READ_STR(data->store, name, sizeof(name)); - f->override = _strdup(name); - } else { - f->override = _strdup(itoa36(rng_int())); + if (data->version < NOOVERRIDE_VERSION && data->version >= OVERRIDE_VERSION) { + READ_STR(data->store, 0, 0); } READ_STR(data->store, name, sizeof(name)); @@ -1362,7 +1359,6 @@ void writefaction(struct gamedata *data, const faction * f) WRITE_STR(data->store, (const char *)f->banner); WRITE_STR(data->store, f->email); WRITE_TOK(data->store, (const char *)f->passw); - WRITE_TOK(data->store, (const char *)f->override); WRITE_TOK(data->store, locale_name(f->locale)); WRITE_INT(data->store, f->lastorders); WRITE_INT(data->store, f->age); diff --git a/core/src/kernel/version.h b/core/src/kernel/version.h index 00d5d539c..c591834df 100644 --- a/core/src/kernel/version.h +++ b/core/src/kernel/version.h @@ -69,8 +69,9 @@ #define FIX_WATCHERS_VERSION 338 /* fixed storage of watchers */ #define UNIQUE_SPELLS_VERSION 339 /* turn 775, spell names are now unique globally, not just per school */ #define SPELLBOOK_VERSION 340 /* turn 775, full spellbooks are stored for factions */ +#define NOOVERRIDE_VERSION 341 /* turn 775, full spellbooks are stored for factions */ -#define MIN_VERSION CURSETYPE_VERSION /* minimal datafile we support */ -#define RELEASE_VERSION SPELLBOOK_VERSION /* current datafile */ +#define MIN_VERSION CURSETYPE_VERSION /* minimal datafile we support */ +#define RELEASE_VERSION NOOVERRIDE_VERSION /* current datafile */ #define STREAM_VERSION 2 /* internal encoding of binary files */ diff --git a/core/src/modules/arena.c b/core/src/modules/arena.c index eaf574fca..07334f961 100644 --- a/core/src/modules/arena.c +++ b/core/src/modules/arena.c @@ -341,7 +341,6 @@ static void guardian_faction(plane * pl, int id) f = calloc(1, sizeof(faction)); f->banner = _strdup("Sie dienen dem großen Wyrm"); f->passw = _strdup(itoa36(rng_int())); - f->override = _strdup(itoa36(rng_int())); set_email(&f->email, "igjarjuk@eressea.de"); f->name = _strdup("Igjarjuks Kundschafter"); f->race = new_race[RC_ILLUSION]; diff --git a/core/src/modules/autoseed.c b/core/src/modules/autoseed.c index e5838d150..92b94ae3e 100644 --- a/core/src/modules/autoseed.c +++ b/core/src/modules/autoseed.c @@ -689,9 +689,8 @@ int autoseed(newfaction ** players, int nsize, int max_agediff) f->email, regionname(r, NULL)); if (f->subscription) { sql_print( - ("UPDATE subscriptions SET status='ACTIVE', faction='%s', firstturn=%d, lastturn=%d, password='%s' WHERE id=%u;\n", - factionid(f), f->lastorders, f->lastorders, f->override, - f->subscription)); + ("UPDATE subscriptions SET status='ACTIVE', faction='%s', firstturn=%d, lastturn=%d WHERE id=%u;\n", + factionid(f), f->lastorders, f->lastorders, f->subscription)); } /* remove duplicate email addresses */ diff --git a/core/src/modules/gmcmd.c b/core/src/modules/gmcmd.c index d83a84aaa..581ad27ee 100644 --- a/core/src/modules/gmcmd.c +++ b/core/src/modules/gmcmd.c @@ -666,7 +666,6 @@ faction *gm_addfaction(const char *email, plane * p, region * r) f->banner = _strdup("quest faction"); f->name = _strdup("quest faction"); f->passw = _strdup(itoa36(rng_int())); - f->override = _strdup(itoa36(rng_int())); if (set_email(&f->email, email) != 0) { log_error("Invalid email address for faction %s: %s\n", itoa36(f->no), email); } diff --git a/storage b/storage index af834a24a..ce14333da 160000 --- a/storage +++ b/storage @@ -1 +1 @@ -Subproject commit af834a24aa87cdd51b1a68381a5a55140e1b1281 +Subproject commit ce14333daa6f53d11b725dc347d734e3d513f793