Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Enno Rehling 2018-12-01 21:24:24 +01:00
commit e58b3acfd7
3 changed files with 13 additions and 2 deletions

View File

@ -9,6 +9,11 @@ if len(sys.argv)<4:
filename=sys.argv[1] filename=sys.argv[1]
myfaction=sys.argv[2] myfaction=sys.argv[2]
mypasswd=sys.argv[3] mypasswd=sys.argv[3]
quiet=len(sys.argv)<=4
def log(str):
if not quiet:
print(str)
if mypasswd[0] == '"': if mypasswd[0] == '"':
mypasswd = mypasswd.strip('"') mypasswd = mypasswd.strip('"')
@ -16,10 +21,17 @@ if mypasswd[0] == '"':
pw_data = EPasswd() pw_data = EPasswd()
try: try:
pw_data.load_database(filename) pw_data.load_database(filename)
log("loaded from db " + filename)
except: except:
pw_data.load_file(filename) pw_data.load_file(filename)
log("loaded from file " + filename)
if pw_data.fac_exists(myfaction): if pw_data.fac_exists(myfaction):
if pw_data.check(myfaction, mypasswd): if pw_data.check(myfaction, mypasswd):
log("password match: " + myfaction)
sys.exit(0) sys.exit(0)
log("password mismatch: " + myfaction)
else:
log("faction missing: " + myfaction)
sys.exit(-1) sys.exit(-1)

View File

@ -69,7 +69,7 @@ class EPasswd:
def check(self, id, passwd): def check(self, id, passwd):
pw = self.get_passwd(id) pw = self.get_passwd(id)
if pw[0:4]=='$2a$' or pw[0:4]=='$2y$': if pw[0:4]=='$2a$' or pw[0:4]=='$2y$':
return bcrypt.checkpw(passwd, pw) return bcrypt.checkpw(passwd.encode('utf8'), pw.encode('utf8'))
return pw == passwd return pw == passwd
def get_passwd(self, id): def get_passwd(self, id):

View File

@ -2238,7 +2238,6 @@ static void eval_trail(struct opstack **stack, const void *userdata)
handle_end = aregs->nregions; handle_end = aregs->nregions;
for (i = begin; i < handle_end; ++i) { for (i = begin; i < handle_end; ++i) {
region *r = aregs->regions[i]; region *r = aregs->regions[i];
sbs_strcat(&sbs, ", ");
print_trail(report, r, lang, &sbs); print_trail(report, r, lang, &sbs);