mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-19 19:52:48 +00:00
Allow number of failed login attemps to be set
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@995 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -136,6 +136,7 @@ static char vmfmts[80];
|
|||||||
static int vmmaxmessage;
|
static int vmmaxmessage;
|
||||||
static int maxgreet;
|
static int maxgreet;
|
||||||
static int skipms;
|
static int skipms;
|
||||||
|
static int maxlogins;
|
||||||
|
|
||||||
STANDARD_LOCAL_USER;
|
STANDARD_LOCAL_USER;
|
||||||
|
|
||||||
@@ -1843,6 +1844,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
|||||||
char fmtc[256] = "";
|
char fmtc[256] = "";
|
||||||
char password[80];
|
char password[80];
|
||||||
struct vm_state vms;
|
struct vm_state vms;
|
||||||
|
int logretries = 0;
|
||||||
struct ast_vm_user *vmu = NULL, vmus;
|
struct ast_vm_user *vmu = NULL, vmus;
|
||||||
char *context=NULL;
|
char *context=NULL;
|
||||||
|
|
||||||
@@ -1897,7 +1899,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
|||||||
|
|
||||||
/* Authenticate them and get their mailbox/password */
|
/* Authenticate them and get their mailbox/password */
|
||||||
|
|
||||||
while (!valid) {
|
while (!valid && (logretries < maxlogins)) {
|
||||||
/* Prompt for, and read in the username */
|
/* Prompt for, and read in the username */
|
||||||
if (!skipuser && ast_readstring(chan, vms.username, sizeof(vms.username) - 1, 2000, 10000, "#") < 0) {
|
if (!skipuser && ast_readstring(chan, vms.username, sizeof(vms.username) - 1, 2000, 10000, "#") < 0) {
|
||||||
ast_log(LOG_WARNING, "Couldn't read username\n");
|
ast_log(LOG_WARNING, "Couldn't read username\n");
|
||||||
@@ -1941,6 +1943,13 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
|||||||
if (ast_streamfile(chan, "vm-incorrect", chan->language))
|
if (ast_streamfile(chan, "vm-incorrect", chan->language))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
logretries++;
|
||||||
|
}
|
||||||
|
if (logretries >= maxlogins) {
|
||||||
|
ast_stopstream(chan);
|
||||||
|
res = play_and_wait(chan, "vm-goodbye");
|
||||||
|
if (res > 0)
|
||||||
|
res = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (valid) {
|
if (valid) {
|
||||||
@@ -2094,7 +2103,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cmd == 't') {
|
if ((cmd == 't') || (cmd == '#')) {
|
||||||
/* Timeout */
|
/* Timeout */
|
||||||
res = 0;
|
res = 0;
|
||||||
} else {
|
} else {
|
||||||
@@ -2264,6 +2273,15 @@ static int load_users(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
maxlogins = 3;
|
||||||
|
if ((s = ast_variable_retrieve(cfg, "general", "maxlogins"))) {
|
||||||
|
if (sscanf(s, "%d", &x) == 1) {
|
||||||
|
maxlogins = x;
|
||||||
|
} else {
|
||||||
|
ast_log(LOG_WARNING, "Invalid max failed login attempts\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cat = ast_category_browse(cfg, NULL);
|
cat = ast_category_browse(cfg, NULL);
|
||||||
while(cat) {
|
while(cat) {
|
||||||
if (strcasecmp(cat, "general")) {
|
if (strcasecmp(cat, "general")) {
|
||||||
|
@@ -20,6 +20,8 @@ skipms=3000
|
|||||||
maxsilence=10
|
maxsilence=10
|
||||||
; Silence threshold (what we consider silence, the lower, the more sensitive)
|
; Silence threshold (what we consider silence, the lower, the more sensitive)
|
||||||
silencethreshold=128
|
silencethreshold=128
|
||||||
|
; Max number of failed login attempts
|
||||||
|
maxlogins=3
|
||||||
|
|
||||||
;
|
;
|
||||||
; Each mailbox is listed in the form <mailbox>=<password>,<name>,<email>,<pager_email>
|
; Each mailbox is listed in the form <mailbox>=<password>,<name>,<email>,<pager_email>
|
||||||
|
Reference in New Issue
Block a user