remove the fallback password.

This commit is contained in:
Enno Rehling 2014-01-01 20:29:08 -08:00
parent 3660c47afb
commit 6412d3bbf8
9 changed files with 16 additions and 36 deletions

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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 */

View File

@ -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];

View File

@ -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 */

View File

@ -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);
}

@ -1 +1 @@
Subproject commit af834a24aa87cdd51b1a68381a5a55140e1b1281
Subproject commit ce14333daa6f53d11b725dc347d734e3d513f793