2''' Sample externpasscheck script for use with voicemail.conf 
    4Copyright (C) 2010, Digium, Inc. 
    5Russell Bryant <russell@digium.com> 
    7The externpasscheck option in voicemail.conf allows an external script to 
    8validate passwords when a user is changing it.  The script can enforce password 
    9strength rules.  This script is an example of doing so and implements a check 
   10on password length, a password with too many identical consecutive numbers, or 
   11a password made up of sequential digits. 
   24    (
"(?P<digit>\d)(?P=digit){%d}" % (REQUIRED_LENGTH - 1),
 
   25        "%d consecutive numbers that are the same" % REQUIRED_LENGTH)
 
   45mailbox, context, old_pw, new_pw = sys.argv[1:5]
 
   48if len(new_pw) < REQUIRED_LENGTH:
 
   49    print(
"INVALID: Password is too short (%d) - must be at least %d" % \
 
   50            (
len(new_pw), REQUIRED_LENGTH))
 
   53for regex, error 
in REGEX_BLACKLIST:
 
   54    if re.search(regex, new_pw):
 
   55        print(
"INVALID: %s" % error)
 
   58for pw 
in PW_BLACKLIST:
 
   59    if new_pw.find(pw) != -1:
 
   60        print(
"INVALID: %s is forbidden in a password" % pw)
 
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)