/* Password quality plugin vtable for major version 1. */
typedef struct krb5_pwqual_vtable_st {
+ const char *name; /* Mandatory: name of module. */
krb5_pwqual_open_fn open;
krb5_pwqual_check_fn check;
krb5_pwqual_close_fn close;
void
k5_pwqual_free_handles(krb5_context context, pwqual_handle *handles);
+/* Return the name of a password quality plugin module. */
+const char *
+k5_pwqual_name(krb5_context context, pwqual_handle handle);
+
/* Check a password using a password quality plugin module. */
krb5_error_code
k5_pwqual_check(krb5_context context, pwqual_handle handle,
free(handles);
}
+const char *
+k5_pwqual_name(krb5_context context, pwqual_handle handle)
+{
+ return handle->vt.name;
+}
+
krb5_error_code
k5_pwqual_check(krb5_context context, pwqual_handle handle,
const char *password, const char *policy_name,
if (maj_ver != 1)
return KRB5_PLUGIN_VER_NOTSUPP;
vt = (krb5_pwqual_vtable)vtable;
+ vt->name = "dict";
vt->open = dict_open;
vt->check = dict_check;
vt->close = dict_close;
if (maj_ver != 1)
return KRB5_PLUGIN_VER_NOTSUPP;
vt = (krb5_pwqual_vtable)vtable;
+ vt->name = "empty";
vt->check = empty_check;
return 0;
}
if (maj_ver != 1)
return KRB5_PLUGIN_VER_NOTSUPP;
vt = (krb5_pwqual_vtable)vtable;
+ vt->name = "hesiod";
vt->check = hesiod_check;
return 0;
}
if (maj_ver != 1)
return KRB5_PLUGIN_VER_NOTSUPP;
vt = (krb5_pwqual_vtable)vtable;
+ vt->name = "princ";
vt->check = princ_check;
return 0;
}
#include <kdb.h>
#include <ctype.h>
#include <pwd.h>
+#include <syslog.h>
#include "server_internal.h"
+#include <adm_proto.h>
kadm5_ret_t
adb_policy_init(kadm5_server_handle_t handle)
}
for (h = handle->qual_handles; *h != NULL; h++) {
ret = k5_pwqual_check(handle->context, *h, password, polname, princ);
- if (ret != 0)
+ if (ret != 0) {
+ const char *e = krb5_get_error_message(handle->context, ret);
+ const char *modname = k5_pwqual_name(handle->context, *h);
+ char *princname;
+ if (krb5_unparse_name(handle->context, princ, &princname) != 0)
+ princname = NULL;
+ krb5_klog_syslog(LOG_ERR, "password quality module %s rejected "
+ "password for %s: %s", modname,
+ princname ? princname : "(can't unparse)", e);
+ krb5_free_error_message(handle->context, e);
+ free(princname);
return ret;
+ }
}
return 0;
}