|
|
|
@ -119,8 +119,15 @@ static int auth_exec(struct ast_channel *chan, void *data)
|
|
|
|
for (retries = 0; retries < 3; retries++) {
|
|
|
|
for (retries = 0; retries < 3; retries++) {
|
|
|
|
if ((res = ast_app_getdata(chan, prompt, passwd, maxdigits, 0)) < 0)
|
|
|
|
if ((res = ast_app_getdata(chan, prompt, passwd, maxdigits, 0)) < 0)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
res = 0;
|
|
|
|
res = 0;
|
|
|
|
if (arglist.password[0] == '/') {
|
|
|
|
|
|
|
|
|
|
|
|
if (arglist.password[0] != '/') {
|
|
|
|
|
|
|
|
/* Compare against a fixed password */
|
|
|
|
|
|
|
|
if (!strcmp(passwd, arglist.password))
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (ast_test_flag(&flags,OPT_DATABASE)) {
|
|
|
|
if (ast_test_flag(&flags,OPT_DATABASE)) {
|
|
|
|
char tmp[256];
|
|
|
|
char tmp[256];
|
|
|
|
/* Compare against a database key */
|
|
|
|
/* Compare against a database key */
|
|
|
|
@ -146,10 +153,9 @@ static int auth_exec(struct ast_channel *chan, void *data)
|
|
|
|
buf[strlen(buf) - 1] = '\0';
|
|
|
|
buf[strlen(buf) - 1] = '\0';
|
|
|
|
if (ast_test_flag(&flags,OPT_MULTIPLE)) {
|
|
|
|
if (ast_test_flag(&flags,OPT_MULTIPLE)) {
|
|
|
|
md5secret = strchr(buf, ':');
|
|
|
|
md5secret = strchr(buf, ':');
|
|
|
|
if (md5secret == NULL)
|
|
|
|
if (!md5secret)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
*md5secret = '\0';
|
|
|
|
*md5secret++ = '\0';
|
|
|
|
md5secret++;
|
|
|
|
|
|
|
|
ast_md5_hash(md5passwd, passwd);
|
|
|
|
ast_md5_hash(md5passwd, passwd);
|
|
|
|
if (!strcmp(md5passwd, md5secret)) {
|
|
|
|
if (!strcmp(md5passwd, md5secret)) {
|
|
|
|
if (ast_test_flag(&flags,OPT_ACCOUNT))
|
|
|
|
if (ast_test_flag(&flags,OPT_ACCOUNT))
|
|
|
|
@ -165,7 +171,9 @@ static int auth_exec(struct ast_channel *chan, void *data)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fclose(f);
|
|
|
|
fclose(f);
|
|
|
|
|
|
|
|
|
|
|
|
if (!ast_strlen_zero(buf)) {
|
|
|
|
if (!ast_strlen_zero(buf)) {
|
|
|
|
if (ast_test_flag(&flags,OPT_MULTIPLE)) {
|
|
|
|
if (ast_test_flag(&flags,OPT_MULTIPLE)) {
|
|
|
|
if (md5secret && !strcmp(md5passwd, md5secret))
|
|
|
|
if (md5secret && !strcmp(md5passwd, md5secret))
|
|
|
|
@ -176,13 +184,9 @@ static int auth_exec(struct ast_channel *chan, void *data)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
|
|
|
|
/* Compare against a fixed password */
|
|
|
|
|
|
|
|
if (!strcmp(passwd, arglist.password))
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
prompt = "auth-incorrect";
|
|
|
|
prompt = "auth-incorrect";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((retries < 3) && !res) {
|
|
|
|
if ((retries < 3) && !res) {
|
|
|
|
if (ast_test_flag(&flags,OPT_ACCOUNT) && !ast_test_flag(&flags,OPT_MULTIPLE))
|
|
|
|
if (ast_test_flag(&flags,OPT_ACCOUNT) && !ast_test_flag(&flags,OPT_MULTIPLE))
|
|
|
|
ast_cdr_setaccount(chan, passwd);
|
|
|
|
ast_cdr_setaccount(chan, passwd);
|
|
|
|
|