forked from github/server
Merge remote-tracking branch 'upstream/develop' into develop
This commit is contained in:
commit
3193c74fe2
3 changed files with 13 additions and 2 deletions
|
@ -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)
|
||||||
|
|
|
@ -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):
|
||||||
|
|
|
@ -2239,7 +2239,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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue