static int vmmaxmessage;
static int maxgreet;
static int skipms;
+static int maxlogins;
STANDARD_LOCAL_USER;
char fmtc[256] = "";
char password[80];
struct vm_state vms;
+ int logretries = 0;
struct ast_vm_user *vmu = NULL, vmus;
char *context=NULL;
/* Authenticate them and get their mailbox/password */
- while (!valid) {
+ while (!valid && (logretries < maxlogins)) {
/* Prompt for, and read in the username */
if (!skipuser && ast_readstring(chan, vms.username, sizeof(vms.username) - 1, 2000, 10000, "#") < 0) {
ast_log(LOG_WARNING, "Couldn't read username\n");
if (ast_streamfile(chan, "vm-incorrect", chan->language))
break;
}
+ logretries++;
+ }
+ if (logretries >= maxlogins) {
+ ast_stopstream(chan);
+ res = play_and_wait(chan, "vm-goodbye");
+ if (res > 0)
+ res = 0;
}
if (valid) {
break;
}
}
- if (cmd == 't') {
+ if ((cmd == 't') || (cmd == '#')) {
/* Timeout */
res = 0;
} else {
}
}
+ 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);
while(cat) {
if (strcasecmp(cat, "general")) {
maxsilence=10
; Silence threshold (what we consider silence, the lower, the more sensitive)
silencethreshold=128
+; Max number of failed login attempts
+maxlogins=3
;
; Each mailbox is listed in the form <mailbox>=<password>,<name>,<email>,<pager_email>