forked from github/server
parteipasswörter mit overrride für übergabe
This commit is contained in:
parent
b1aadd3b92
commit
7e60d07eed
|
@ -1144,7 +1144,7 @@ quit(void)
|
||||||
for (u = r->units; u; u = u->next)
|
for (u = r->units; u; u = u->next)
|
||||||
for (S = u->orders; S; S = S->next)
|
for (S = u->orders; S; S = S->next)
|
||||||
if (igetkeyword(S->s, u->faction->locale) == K_QUIT) {
|
if (igetkeyword(S->s, u->faction->locale) == K_QUIT) {
|
||||||
if (strcasecmp(getstrtoken(), u->faction->passw) == 0) {
|
if (checkpasswd(u->faction, getstrtoken())) {
|
||||||
destroyfaction(u->faction);
|
destroyfaction(u->faction);
|
||||||
} else {
|
} else {
|
||||||
cmistake(u, S->s, 86, MSG_EVENT);
|
cmistake(u, S->s, 86, MSG_EVENT);
|
||||||
|
@ -1185,7 +1185,7 @@ quit(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcasecmp(s_pass, u->faction->passw)) {
|
if (!checkpasswd(u->faction, s_pass)) {
|
||||||
cmistake(u, S->s, 86, MSG_EVENT);
|
cmistake(u, S->s, 86, MSG_EVENT);
|
||||||
printf(" Warnung: NEUSTART mit falschem Passwort für Partei %s: %s\n",
|
printf(" Warnung: NEUSTART mit falschem Passwort für Partei %s: %s\n",
|
||||||
factionid(u->faction), S->s);
|
factionid(u->faction), S->s);
|
||||||
|
@ -1206,9 +1206,24 @@ quit(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
fprintf(sqlstream,
|
if (fval(f, FFL_OVERRIDE)) {
|
||||||
"UPDATE subscriptions SET lastturn=%d WHERE game=%d AND faction='%s';",
|
free(f->override);
|
||||||
f->lastorders, GAME_ID, itoa36(f->no));
|
f->override = strdup(itoa36(rand()));
|
||||||
|
}
|
||||||
|
if (turn!=f->lastorders) {
|
||||||
|
char info[256];
|
||||||
|
sprintf(info, "%d Einheiten, %d Personen, %d Silber",
|
||||||
|
f->nunits, f->number, f->money);
|
||||||
|
fprintf(sqlstream,
|
||||||
|
"UPDATE subscriptions SET lastturn=%d, password='%s', info='%s' "
|
||||||
|
"WHERE game=%d AND faction='%s';",
|
||||||
|
f->lastorders, f->override, info, GAME_ID, itoa36(f->no));
|
||||||
|
} else {
|
||||||
|
fprintf(sqlstream,
|
||||||
|
"UPDATE subscriptions SET lastturn=%d, password='%s' "
|
||||||
|
"WHERE game=%d AND faction='%s';",
|
||||||
|
f->lastorders, f->override, GAME_ID, itoa36(f->no));
|
||||||
|
}
|
||||||
|
|
||||||
if (turn - f->lastorders >= (NMRTIMEOUT - 1)) {
|
if (turn - f->lastorders >= (NMRTIMEOUT - 1)) {
|
||||||
inactivefaction(f);
|
inactivefaction(f);
|
||||||
|
@ -2069,8 +2084,8 @@ set_passw(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
set_string(&u->faction->passw, pbuf);
|
set_string(&u->faction->passw, pbuf);
|
||||||
add_message(&u->faction->msgs, new_message(u->faction,
|
ADDMSG(&u->faction->msgs, msg_message("changepasswd",
|
||||||
"changepasswd%s:value", gc_add(strdup(u->faction->passw))));
|
"value", gc_add(strdup(u->faction->passw))));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -3467,7 +3467,8 @@ report_summary(summary * s, summary * o, boolean full)
|
||||||
out_faction(F, f);
|
out_faction(F, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (full && NMRTIMEOUT) {
|
#if NMRTIMEOUT
|
||||||
|
if (full) {
|
||||||
fprintf(F, "\n\nFactions with NMRs:\n");
|
fprintf(F, "\n\nFactions with NMRs:\n");
|
||||||
for (i = NMRTIMEOUT; i > 0; --i) {
|
for (i = NMRTIMEOUT; i > 0; --i) {
|
||||||
for(f=factions; f; f=f->next) {
|
for(f=factions; f; f=f->next) {
|
||||||
|
@ -3483,6 +3484,7 @@ report_summary(summary * s, summary * o, boolean full)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
fclose(F);
|
fclose(F);
|
||||||
|
|
||||||
|
|
|
@ -470,6 +470,7 @@ stripfaction (faction * f)
|
||||||
free(f->email);
|
free(f->email);
|
||||||
free(f->banner);
|
free(f->banner);
|
||||||
free(f->passw);
|
free(f->passw);
|
||||||
|
free(f->override);
|
||||||
free(f->name);
|
free(f->name);
|
||||||
#ifndef FAST_REGION
|
#ifndef FAST_REGION
|
||||||
vset_destroy(&f->regions);
|
vset_destroy(&f->regions);
|
||||||
|
|
|
@ -153,13 +153,10 @@ struct xml_stack;
|
||||||
#define INTERIM_VERSION 309
|
#define INTERIM_VERSION 309
|
||||||
#define NEWSKILL_VERSION 309
|
#define NEWSKILL_VERSION 309
|
||||||
#define WATCHERS_VERSION 310
|
#define WATCHERS_VERSION 310
|
||||||
|
#define OVERRIDE_VERSION 311
|
||||||
|
|
||||||
#if SKILLPOINTS
|
|
||||||
# define RELEASE_VERSION INTERIM_VERSION
|
|
||||||
#else
|
|
||||||
# define RELEASE_VERSION WATCHERS_VERSION
|
|
||||||
#endif
|
|
||||||
#define UGROUPS_VERSION 400 /* nicht aktivieren, nicht fertig */
|
#define UGROUPS_VERSION 400 /* nicht aktivieren, nicht fertig */
|
||||||
|
#define RELEASE_VERSION OVERRIDE_VERSION
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#if RELEASE_VERSION >= UGROUPS_VERSION
|
#if RELEASE_VERSION >= UGROUPS_VERSION
|
||||||
|
@ -882,18 +879,19 @@ extern int max_unique_id;
|
||||||
#define MAX_UNIT_NR (36*36*36*36-1)
|
#define MAX_UNIT_NR (36*36*36*36-1)
|
||||||
#define MAX_CONTAINER_NR (36*36*36*36-1)
|
#define MAX_CONTAINER_NR (36*36*36*36-1)
|
||||||
|
|
||||||
#define FL_NOAIDF (1<<21) /* Hilfsflag Kampf */
|
#define FL_NOAIDF (1<<21) /* Hilfsflag Kampf */
|
||||||
#define FL_NOAID (1<<22) /* Einheit hat Noaid-Status */
|
#define FL_NOAID (1<<22) /* Einheit hat Noaid-Status */
|
||||||
|
|
||||||
#define FL_MARK (1<<23) /* für markierende algorithmen, die das hinterher auch wieder
|
#define FL_MARK (1<<23) /* für markierende algorithmen, die das hinterher auch wieder
|
||||||
löschen müssen! (Ist dafür nicht eigentlich FL_DH gedacht?) */
|
löschen müssen! (Ist dafür nicht eigentlich FL_DH gedacht?) */
|
||||||
#define FL_NOIDLEOUT (1<<24) /* Partei stirbt nicht an NMRs */
|
#define FL_NOIDLEOUT (1<<24) /* Partei stirbt nicht an NMRs */
|
||||||
#define FL_TAKEALL (1<<25) /* Einheit nimmt alle Gegenstände an */
|
#define FL_TAKEALL (1<<25) /* Einheit nimmt alle Gegenstände an */
|
||||||
#define FL_UNNAMED (1<<26) /* Partei/Einheit/Gebäude/Schiff ist unbenannt */
|
#define FL_UNNAMED (1<<26) /* Partei/Einheit/Gebäude/Schiff ist unbenannt */
|
||||||
#define FL_RESTARTED (1<<27) /* Partei hat schon einen Neustart gemacht */
|
|
||||||
/* no longer used, may contain old data! */
|
#define FFL_OVERRIDE (1<<27) /* Override-Passwort wurde benutzt */
|
||||||
|
|
||||||
/* Flags, die gespeichert werden sollen: */
|
/* Flags, die gespeichert werden sollen: */
|
||||||
#define FL_SAVEMASK (FL_NOAID | FL_RESTARTED | FL_OWNER | FL_PARTEITARNUNG | FL_LOCKED | FL_HUNGER | FL_NOIDLEOUT | FL_TAKEALL | FL_UNNAMED)
|
#define UFL_SAVEMASK (FL_NOAID | FL_OWNER | FL_PARTEITARNUNG | FL_LOCKED | FL_HUNGER | FL_NOIDLEOUT | FL_TAKEALL | FL_UNNAMED)
|
||||||
|
|
||||||
#define fval(u, i) ((u)->flags & (i))
|
#define fval(u, i) ((u)->flags & (i))
|
||||||
#define fset(u, i) ((u)->flags |= (i))
|
#define fset(u, i) ((u)->flags |= (i))
|
||||||
|
|
|
@ -93,6 +93,8 @@ addplayer(region *r, char *email, const struct race * frace, locale *loc)
|
||||||
|
|
||||||
for (i = 0; i < 6; i++) buf[i] = (char) (97 + rand() % 26); buf[i] = 0;
|
for (i = 0; i < 6; i++) buf[i] = (char) (97 + rand() % 26); buf[i] = 0;
|
||||||
set_string(&f->passw, buf);
|
set_string(&f->passw, buf);
|
||||||
|
for (i = 0; i < 6; i++) buf[i] = (char) (97 + rand() % 26); buf[i] = 0;
|
||||||
|
set_string(&f->override, buf);
|
||||||
|
|
||||||
f->lastorders = turn;
|
f->lastorders = turn;
|
||||||
f->alive = 1;
|
f->alive = 1;
|
||||||
|
@ -130,3 +132,13 @@ addplayer(region *r, char *email, const struct race * frace, locale *loc)
|
||||||
return u;
|
return u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean
|
||||||
|
checkpasswd(faction * f, const char * passwd)
|
||||||
|
{
|
||||||
|
if (strcasecmp(f->passw, passwd)==0) return true;
|
||||||
|
if (strcasecmp(f->override, passwd)==0) {
|
||||||
|
fset(f, FFL_OVERRIDE);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -29,6 +29,7 @@ typedef struct faction {
|
||||||
char *banner;
|
char *banner;
|
||||||
char *email;
|
char *email;
|
||||||
char *passw;
|
char *passw;
|
||||||
|
char *override;
|
||||||
struct locale * locale;
|
struct locale * locale;
|
||||||
int lastorders; /* enno: short? */
|
int lastorders; /* enno: short? */
|
||||||
int age; /* enno: short? */
|
int age; /* enno: short? */
|
||||||
|
@ -77,5 +78,6 @@ extern const struct unit * random_unit_in_faction(const struct faction *f);
|
||||||
extern const char * factionname(const struct faction * f);
|
extern const char * factionname(const struct faction * f);
|
||||||
extern void * resolve_faction(void * data);
|
extern void * resolve_faction(void * data);
|
||||||
extern struct unit * addplayer(struct region *r, char *email, const struct race * frace, struct locale *loc);
|
extern struct unit * addplayer(struct region *r, char *email, const struct race * frace, struct locale *loc);
|
||||||
|
extern boolean checkpasswd(faction * f, const char * passwd);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -444,9 +444,9 @@ readfaction(void)
|
||||||
|
|
||||||
f = findfaction(i36);
|
f = findfaction(i36);
|
||||||
|
|
||||||
if (f==NULL || strcasecmp(f->passw, pass)) {
|
if (f==NULL || !checkpasswd(f, pass)) {
|
||||||
faction * f2 = findfaction(i10);
|
faction * f2 = findfaction(i10);
|
||||||
if (f2!=NULL && !strcasecmp(f2->passw, pass)) {
|
if (f2!=NULL && !checkpasswd(f2, pass)) {
|
||||||
f = f2;
|
f = f2;
|
||||||
addstrlist(&f->mistakes, "Die Befehle wurden nicht als base36 eingeschickt!");
|
addstrlist(&f->mistakes, "Die Befehle wurden nicht als base36 eingeschickt!");
|
||||||
}
|
}
|
||||||
|
@ -463,7 +463,7 @@ readfaction(void)
|
||||||
freestrlist(f->mistakes);
|
freestrlist(f->mistakes);
|
||||||
f->mistakes = 0;
|
f->mistakes = 0;
|
||||||
|
|
||||||
if (strcasecmp(f->passw, pass)) {
|
if (!checkpasswd(f, pass)) {
|
||||||
addstrlist(&f->mistakes, "Das Passwort wurde falsch eingegeben");
|
addstrlist(&f->mistakes, "Das Passwort wurde falsch eingegeben");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -915,6 +915,12 @@ readgame(boolean backup)
|
||||||
rds(F, &f->banner);
|
rds(F, &f->banner);
|
||||||
rds(F, &f->email);
|
rds(F, &f->email);
|
||||||
rds(F, &f->passw);
|
rds(F, &f->passw);
|
||||||
|
if (global.data_version >= OVERRIDE_VERSION) {
|
||||||
|
rds(F, &f->override);
|
||||||
|
} else {
|
||||||
|
f->override = strdup(itoa36(rand()));
|
||||||
|
}
|
||||||
|
|
||||||
if (global.data_version < LOCALE_VERSION) {
|
if (global.data_version < LOCALE_VERSION) {
|
||||||
f->locale = find_locale("de");
|
f->locale = find_locale("de");
|
||||||
} else {
|
} else {
|
||||||
|
@ -948,6 +954,7 @@ readgame(boolean backup)
|
||||||
f->flags = ri(F);
|
f->flags = ri(F);
|
||||||
else
|
else
|
||||||
f->flags = 0;
|
f->flags = 0;
|
||||||
|
freset(f, FFL_OVERRIDE);
|
||||||
|
|
||||||
if (global.data_version>=FATTRIBS_VERSION)
|
if (global.data_version>=FATTRIBS_VERSION)
|
||||||
a_read(F, &f->attribs);
|
a_read(F, &f->attribs);
|
||||||
|
@ -1858,6 +1865,9 @@ writegame(char *path, char quiet)
|
||||||
ws(F, f->banner);
|
ws(F, f->banner);
|
||||||
ws(F, f->email);
|
ws(F, f->email);
|
||||||
ws(F, f->passw);
|
ws(F, f->passw);
|
||||||
|
#if RELEASE_VERSION>=OVERRIDE_VERSION
|
||||||
|
ws(F, f->override);
|
||||||
|
#endif
|
||||||
#if RELEASE_VERSION>=LOCALE_VERSION
|
#if RELEASE_VERSION>=LOCALE_VERSION
|
||||||
ws(F, locale_name(f->locale));
|
ws(F, locale_name(f->locale));
|
||||||
#endif
|
#endif
|
||||||
|
@ -2043,7 +2053,7 @@ writegame(char *path, char quiet)
|
||||||
else
|
else
|
||||||
wi(F, 0);
|
wi(F, 0);
|
||||||
wi(F, u->status);
|
wi(F, u->status);
|
||||||
wi(F, u->flags & FL_SAVEMASK);
|
wi(F, u->flags & UFL_SAVEMASK);
|
||||||
#if RELEASE_VERSION < GUARDFIX_VERSION
|
#if RELEASE_VERSION < GUARDFIX_VERSION
|
||||||
wi(F, getguard(u));
|
wi(F, getguard(u));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -332,15 +332,14 @@ tower_init(void)
|
||||||
static void
|
static void
|
||||||
guardian_faction(plane * pl, int id)
|
guardian_faction(plane * pl, int id)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
|
||||||
region * r;
|
region * r;
|
||||||
faction * f = findfaction(id);
|
faction * f = findfaction(id);
|
||||||
|
|
||||||
if (!f) {
|
if (!f) {
|
||||||
f = calloc(1, sizeof(faction));
|
f = calloc(1, sizeof(faction));
|
||||||
f->banner = strdup("Sie dienen dem großen Wyrm");
|
f->banner = strdup("Sie dienen dem großen Wyrm");
|
||||||
f->passw = strdup(" ");
|
f->passw = strdup(itoa36(rand()));
|
||||||
for (i = 0; i < 4; i++) f->passw[i] = (char) (97 + rand() % 26);
|
f->override = strdup(itoa36(rand()));
|
||||||
f->email = strdup("igjarjuk@eressea-pbem.de");
|
f->email = strdup("igjarjuk@eressea-pbem.de");
|
||||||
f->name = strdup("Igjarjuks Kundschafter");
|
f->name = strdup("Igjarjuks Kundschafter");
|
||||||
f->race = new_race[RC_ILLUSION];
|
f->race = new_race[RC_ILLUSION];
|
||||||
|
|
|
@ -618,6 +618,8 @@ gm_addquest(const char * email, const char * name, int radius, unsigned int flag
|
||||||
a_add(&f->attribs, make_key(atoi36("quest")));
|
a_add(&f->attribs, make_key(atoi36("quest")));
|
||||||
f->banner = strdup("Questenpartei");
|
f->banner = strdup("Questenpartei");
|
||||||
f->passw = strdup(itoa36(rand()));
|
f->passw = strdup(itoa36(rand()));
|
||||||
|
f->override = strdup(itoa36(rand()));
|
||||||
|
f->override = strdup(itoa36(rand()));
|
||||||
f->email = strdup(email);
|
f->email = strdup(email);
|
||||||
f->name = strdup("Questenpartei");
|
f->name = strdup("Questenpartei");
|
||||||
f->race = new_race[RC_TEMPLATE];
|
f->race = new_race[RC_TEMPLATE];
|
||||||
|
|
|
@ -1389,6 +1389,7 @@ makemonsters(void)
|
||||||
f->unique_id = ++max_unique_id;
|
f->unique_id = ++max_unique_id;
|
||||||
f->name=strdup("Monster");
|
f->name=strdup("Monster");
|
||||||
f->passw=strdup("abc123");
|
f->passw=strdup("abc123");
|
||||||
|
f->override = strdup(itoa36(rand()));
|
||||||
fhash(f);
|
fhash(f);
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue