</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>Too long monotonic character sequence</term>
+ <listitem>
+ <para>
+ Optional check for too long monotonic character sequence.
+ </para>
+ </listitem>
+ </varlistentry>
<varlistentry>
<term>Contains user name</term>
<listitem>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>
+ <option>maxsequence=<replaceable>N</replaceable></option>
+ </term>
+ <listitem>
+ <para>
+ Reject passwords which contain monotonic character sequences
+ longer than N. The default is 0 which means that this check
+ is disabled. Examples of such sequence are '12345' or 'fedcb'.
+ Note that most such passwords will not pass the simplicity
+ check unless the sequence is only a minor part of the password.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term>
<option>maxclassrepeat=<replaceable>N</replaceable></option>
int oth_credit;
int min_class;
int max_repeat;
+ int max_sequence;
int max_class_repeat;
int reject_user;
int gecos_check;
opt->max_repeat = strtol(*argv+10,&ep,10);
if (!ep)
opt->max_repeat = 0;
+ } else if (!strncmp(*argv,"maxsequence=",12)) {
+ opt->max_sequence = strtol(*argv+12,&ep,10);
+ if (!ep)
+ opt->max_sequence = 0;
} else if (!strncmp(*argv,"maxclassrepeat=",15)) {
opt->max_class_repeat = strtol(*argv+15,&ep,10);
if (!ep)
return 0;
}
+static int sequence(struct cracklib_options *opt, const char *new)
+{
+ char c;
+ int i;
+ int sequp = 1;
+ int seqdown = 1;
+
+ if (opt->max_sequence == 0)
+ return 0;
+
+ if (new[0] == '\0')
+ return 0;
+
+ for (i = 1; new[i]; i++) {
+ c = new[i-1];
+ if (new[i] == c+1) {
+ ++sequp;
+ if (sequp > opt->max_sequence)
+ return 1;
+ seqdown = 1;
+ } else if (new[i] == c-1) {
+ ++seqdown;
+ if (seqdown > opt->max_sequence)
+ return 1;
+ sequp = 1;
+ } else {
+ sequp = 1;
+ seqdown = 1;
+ }
+ }
+ return 0;
+}
+
static int wordcheck(const char *new, char *word)
{
char *f, *b;
if (!msg && consecutive(opt, new))
msg = _("contains too many same characters consecutively");
+ if (!msg && sequence(opt, new))
+ msg = _("contains too long of a monotonic character sequence");
+
if (!msg && (usercheck(opt, newmono, usermono) || gecoscheck(pamh, opt, newmono, user)))
msg = _("contains the user name in some form");