annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/krb5/pwqual_plugin.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
jpayne@69 2 /*
jpayne@69 3 * Copyright (C) 2010 by the Massachusetts Institute of Technology.
jpayne@69 4 * All rights reserved.
jpayne@69 5 *
jpayne@69 6 * Export of this software from the United States of America may
jpayne@69 7 * require a specific license from the United States Government.
jpayne@69 8 * It is the responsibility of any person or organization contemplating
jpayne@69 9 * export to obtain such a license before exporting.
jpayne@69 10 *
jpayne@69 11 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
jpayne@69 12 * distribute this software and its documentation for any purpose and
jpayne@69 13 * without fee is hereby granted, provided that the above copyright
jpayne@69 14 * notice appear in all copies and that both that copyright notice and
jpayne@69 15 * this permission notice appear in supporting documentation, and that
jpayne@69 16 * the name of M.I.T. not be used in advertising or publicity pertaining
jpayne@69 17 * to distribution of the software without specific, written prior
jpayne@69 18 * permission. Furthermore if you modify this software you must label
jpayne@69 19 * your software as modified software and not distribute it in such a
jpayne@69 20 * fashion that it might be confused with the original M.I.T. software.
jpayne@69 21 * M.I.T. makes no representations about the suitability of
jpayne@69 22 * this software for any purpose. It is provided "as is" without express
jpayne@69 23 * or implied warranty.
jpayne@69 24 */
jpayne@69 25
jpayne@69 26 /*
jpayne@69 27 * Declarations for password quality plugin module implementors.
jpayne@69 28 *
jpayne@69 29 * The password quality pluggable interface currently has only one supported
jpayne@69 30 * major version, which is 1. Major version 1 has a current minor version
jpayne@69 31 * number of 1.
jpayne@69 32 *
jpayne@69 33 * Password quality plugin modules should define a function named
jpayne@69 34 * pwqual_<modulename>_initvt, matching the signature:
jpayne@69 35 *
jpayne@69 36 * krb5_error_code
jpayne@69 37 * pwqual_modname_initvt(krb5_context context, int maj_ver, int min_ver,
jpayne@69 38 * krb5_plugin_vtable vtable);
jpayne@69 39 *
jpayne@69 40 * The initvt function should:
jpayne@69 41 *
jpayne@69 42 * - Check that the supplied maj_ver number is supported by the module, or
jpayne@69 43 * return KRB5_PLUGIN_VER_NOTSUPP if it is not.
jpayne@69 44 *
jpayne@69 45 * - Cast the vtable pointer as appropriate for maj_ver:
jpayne@69 46 * maj_ver == 1: Cast to krb5_pwqual_vtable
jpayne@69 47 *
jpayne@69 48 * - Initialize the methods of the vtable, stopping as appropriate for the
jpayne@69 49 * supplied min_ver. Optional methods may be left uninitialized.
jpayne@69 50 *
jpayne@69 51 * Memory for the vtable is allocated by the caller, not by the module.
jpayne@69 52 */
jpayne@69 53
jpayne@69 54 #ifndef KRB5_PWQUAL_PLUGIN_H
jpayne@69 55 #define KRB5_PWQUAL_PLUGIN_H
jpayne@69 56
jpayne@69 57 #include <krb5/krb5.h>
jpayne@69 58 #include <krb5/plugin.h>
jpayne@69 59 #include <kadm5/admin.h>
jpayne@69 60
jpayne@69 61 /* An abstract type for password quality module data. */
jpayne@69 62 typedef struct krb5_pwqual_moddata_st *krb5_pwqual_moddata;
jpayne@69 63
jpayne@69 64 /*** Method type declarations ***/
jpayne@69 65
jpayne@69 66 /* Optional: Initialize module data. dictfile is the realm's configured
jpayne@69 67 * dictionary filename. */
jpayne@69 68 typedef krb5_error_code
jpayne@69 69 (*krb5_pwqual_open_fn)(krb5_context context, const char *dict_file,
jpayne@69 70 krb5_pwqual_moddata *data);
jpayne@69 71
jpayne@69 72 /*
jpayne@69 73 * Mandatory: Check a password for the principal princ, which has an associated
jpayne@69 74 * password policy named policy_name (or no associated policy if policy_name is
jpayne@69 75 * NULL). The parameter languages, if not NULL, contains a null-terminated
jpayne@69 76 * list of client-specified language tags as defined in RFC 5646. The method
jpayne@69 77 * should return one of the following errors if the password fails quality
jpayne@69 78 * standards:
jpayne@69 79 *
jpayne@69 80 * - KADM5_PASS_Q_TOOSHORT: password should be longer
jpayne@69 81 * - KADM5_PASS_Q_CLASS: password must have more character classes
jpayne@69 82 * - KADM5_PASS_Q_DICT: password contains dictionary words
jpayne@69 83 * - KADM5_PASS_Q_GENERIC: unspecified quality failure
jpayne@69 84 *
jpayne@69 85 * The module should also set an extended error message with
jpayne@69 86 * krb5_set_error_message(). The message may be localized according to one of
jpayne@69 87 * the language tags in languages.
jpayne@69 88 */
jpayne@69 89 typedef krb5_error_code
jpayne@69 90 (*krb5_pwqual_check_fn)(krb5_context context, krb5_pwqual_moddata data,
jpayne@69 91 const char *password, const char *policy_name,
jpayne@69 92 krb5_principal princ, const char **languages);
jpayne@69 93
jpayne@69 94 /* Optional: Release resources used by module data. */
jpayne@69 95 typedef void
jpayne@69 96 (*krb5_pwqual_close_fn)(krb5_context context, krb5_pwqual_moddata data);
jpayne@69 97
jpayne@69 98 /*** vtable declarations **/
jpayne@69 99
jpayne@69 100 /* Password quality plugin vtable for major version 1. */
jpayne@69 101 typedef struct krb5_pwqual_vtable_st {
jpayne@69 102 const char *name; /* Mandatory: name of module. */
jpayne@69 103 krb5_pwqual_open_fn open;
jpayne@69 104 krb5_pwqual_check_fn check;
jpayne@69 105 krb5_pwqual_close_fn close;
jpayne@69 106 /* Minor version 1 ends here. */
jpayne@69 107 } *krb5_pwqual_vtable;
jpayne@69 108
jpayne@69 109 #endif /* KRB5_PWQUAL_PLUGIN_H */