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