jpayne@69: /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ jpayne@69: /* jpayne@69: * Copyright (C) 2010 by the Massachusetts Institute of Technology. jpayne@69: * All rights reserved. jpayne@69: * jpayne@69: * Export of this software from the United States of America may jpayne@69: * require a specific license from the United States Government. jpayne@69: * It is the responsibility of any person or organization contemplating jpayne@69: * export to obtain such a license before exporting. jpayne@69: * jpayne@69: * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and jpayne@69: * distribute this software and its documentation for any purpose and jpayne@69: * without fee is hereby granted, provided that the above copyright jpayne@69: * notice appear in all copies and that both that copyright notice and jpayne@69: * this permission notice appear in supporting documentation, and that jpayne@69: * the name of M.I.T. not be used in advertising or publicity pertaining jpayne@69: * to distribution of the software without specific, written prior jpayne@69: * permission. Furthermore if you modify this software you must label jpayne@69: * your software as modified software and not distribute it in such a jpayne@69: * fashion that it might be confused with the original M.I.T. software. jpayne@69: * M.I.T. makes no representations about the suitability of jpayne@69: * this software for any purpose. It is provided "as is" without express jpayne@69: * or implied warranty. jpayne@69: */ jpayne@69: jpayne@69: /* jpayne@69: * Declarations for password quality plugin module implementors. jpayne@69: * jpayne@69: * The password quality pluggable interface currently has only one supported jpayne@69: * major version, which is 1. Major version 1 has a current minor version jpayne@69: * number of 1. jpayne@69: * jpayne@69: * Password quality plugin modules should define a function named jpayne@69: * pwqual__initvt, matching the signature: jpayne@69: * jpayne@69: * krb5_error_code jpayne@69: * pwqual_modname_initvt(krb5_context context, int maj_ver, int min_ver, jpayne@69: * krb5_plugin_vtable vtable); jpayne@69: * jpayne@69: * The initvt function should: jpayne@69: * jpayne@69: * - Check that the supplied maj_ver number is supported by the module, or jpayne@69: * return KRB5_PLUGIN_VER_NOTSUPP if it is not. jpayne@69: * jpayne@69: * - Cast the vtable pointer as appropriate for maj_ver: jpayne@69: * maj_ver == 1: Cast to krb5_pwqual_vtable jpayne@69: * jpayne@69: * - Initialize the methods of the vtable, stopping as appropriate for the jpayne@69: * supplied min_ver. Optional methods may be left uninitialized. jpayne@69: * jpayne@69: * Memory for the vtable is allocated by the caller, not by the module. jpayne@69: */ jpayne@69: jpayne@69: #ifndef KRB5_PWQUAL_PLUGIN_H jpayne@69: #define KRB5_PWQUAL_PLUGIN_H jpayne@69: jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: jpayne@69: /* An abstract type for password quality module data. */ jpayne@69: typedef struct krb5_pwqual_moddata_st *krb5_pwqual_moddata; jpayne@69: jpayne@69: /*** Method type declarations ***/ jpayne@69: jpayne@69: /* Optional: Initialize module data. dictfile is the realm's configured jpayne@69: * dictionary filename. */ jpayne@69: typedef krb5_error_code jpayne@69: (*krb5_pwqual_open_fn)(krb5_context context, const char *dict_file, jpayne@69: krb5_pwqual_moddata *data); jpayne@69: jpayne@69: /* jpayne@69: * Mandatory: Check a password for the principal princ, which has an associated jpayne@69: * password policy named policy_name (or no associated policy if policy_name is jpayne@69: * NULL). The parameter languages, if not NULL, contains a null-terminated jpayne@69: * list of client-specified language tags as defined in RFC 5646. The method jpayne@69: * should return one of the following errors if the password fails quality jpayne@69: * standards: jpayne@69: * jpayne@69: * - KADM5_PASS_Q_TOOSHORT: password should be longer jpayne@69: * - KADM5_PASS_Q_CLASS: password must have more character classes jpayne@69: * - KADM5_PASS_Q_DICT: password contains dictionary words jpayne@69: * - KADM5_PASS_Q_GENERIC: unspecified quality failure jpayne@69: * jpayne@69: * The module should also set an extended error message with jpayne@69: * krb5_set_error_message(). The message may be localized according to one of jpayne@69: * the language tags in languages. jpayne@69: */ jpayne@69: typedef krb5_error_code jpayne@69: (*krb5_pwqual_check_fn)(krb5_context context, krb5_pwqual_moddata data, jpayne@69: const char *password, const char *policy_name, jpayne@69: krb5_principal princ, const char **languages); jpayne@69: jpayne@69: /* Optional: Release resources used by module data. */ jpayne@69: typedef void jpayne@69: (*krb5_pwqual_close_fn)(krb5_context context, krb5_pwqual_moddata data); jpayne@69: jpayne@69: /*** vtable declarations **/ jpayne@69: jpayne@69: /* Password quality plugin vtable for major version 1. */ jpayne@69: typedef struct krb5_pwqual_vtable_st { jpayne@69: const char *name; /* Mandatory: name of module. */ jpayne@69: krb5_pwqual_open_fn open; jpayne@69: krb5_pwqual_check_fn check; jpayne@69: krb5_pwqual_close_fn close; jpayne@69: /* Minor version 1 ends here. */ jpayne@69: } *krb5_pwqual_vtable; jpayne@69: jpayne@69: #endif /* KRB5_PWQUAL_PLUGIN_H */