if (found) \
goto found; \
} while (0)
-# define CHECK_PASSWORD_VARIANT(ctx, data, template, p) \
- do { \
- code = variant_in_cdb_dictionary(ctx, data, template, p, &found); \
- if (code != 0) \
- goto fail; \
- if (found) \
- goto found; \
+# define CHECK_PASSWORD_EDIT(ctx, data, template, p) \
+ do { \
+ code = edit_in_cdb_dictionary(ctx, data, template, p, &found); \
+ if (code != 0) \
+ goto fail; \
+ if (found) \
+ goto found; \
} while (0)
* of the template is found, false otherwise. Returns a Kerberos status code.
*/
static krb5_error_code
-variant_in_cdb_dictionary(krb5_context ctx, krb5_pwqual_moddata data,
- char *template, char *permute, bool *found)
+edit_in_cdb_dictionary(krb5_context ctx, krb5_pwqual_moddata data,
+ char *template, char *permute, bool *found)
{
- int c;
+ int c, save;
krb5_error_code code;
*found = false;
+ save = *permute;
for (c = 0; c <= 127; c++)
if (isprint(c)) {
*permute = c;
code = in_cdb_dictionary(ctx, data, template, found);
- if (code != 0 || found)
+ if (code != 0 || *found)
return code;
}
+ *permute = save;
return 0;
}
/* Check all one-character permutations. */
memcpy(variant, password, length + 1);
for (p = variant; *p != '\0'; p++)
- CHECK_PASSWORD_VARIANT(ctx, data, variant, p);
+ CHECK_PASSWORD_EDIT(ctx, data, variant, p);
/* Check all one-character additions. */
for (i = 0; i <= length; i++) {
if (i < length)
memcpy(variant + i + 1, password + i, length - i);
variant[length + 1] = '\0';
- CHECK_PASSWORD_VARIANT(ctx, data, variant, variant + i);
+ CHECK_PASSWORD_EDIT(ctx, data, variant, variant + i);
}
/*
"principal": "test@EXAMPLE.ORG",
"password": "bitterbane123",
"code": 0
+ },
+ {
+ "name": "in dictionary (edit: delete 1)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "itterbane",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: delete 2)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "btterbane",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: delete 3/4)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "biterbane",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: delete 5)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "bittrbane",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: delete 6)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "bittebane",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: delete 7)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "bitterane",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: delete 8)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "bitterbne",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: delete 9)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "bitterbae",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: delete 10)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "bitterban",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: modify 1)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "Citterbane",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: modify 2)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "b7tterbane",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: modify 3)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "bi#terbane",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: modify 4)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "bit*erbane",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: modify 5)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "bittgrbane",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: modify 6)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "bitte.bane",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: modify 7)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "bitter ane",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: modify 8)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "bitterb-ne",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: modify 9)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "bitterbame",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: modify 10)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "bitterbanq",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: add 2)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "b7itterbane",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: add 3)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "bi#tterbane",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: add 4)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "bit*terbane",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: add 5)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "bittgerbane",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: add 6)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "bitte.rbane",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: add 7)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "bitter bane",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: add 8)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "bitterb-ane",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: add 9)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "bitterbamne",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
+ },
+ {
+ "name": "in dictionary (edit: add 10)",
+ "principal": "test@EXAMPLE.ORG",
+ "password": "bitterbanqe",
+ "code": "KADM5_PASS_Q_DICT",
+ "error": "password found in list of common passwords"
}
]