Path: blob/main/crypto/krb5/src/lib/kadm5/srv/pwqual_empty.c
39566 views
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */1/* lib/kadm5/srv/pwqual_empty.c */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 may7* require a specific license from the United States Government.8* It is the responsibility of any person or organization contemplating9* export to obtain such a license before exporting.10*11* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and12* distribute this software and its documentation for any purpose and13* without fee is hereby granted, provided that the above copyright14* notice appear in all copies and that both that copyright notice and15* this permission notice appear in supporting documentation, and that16* the name of M.I.T. not be used in advertising or publicity pertaining17* to distribution of the software without specific, written prior18* permission. Furthermore if you modify this software you must label19* your software as modified software and not distribute it in such a20* fashion that it might be confused with the original M.I.T. software.21* M.I.T. makes no representations about the suitability of22* this software for any purpose. It is provided "as is" without express23* or implied warranty.24*/2526/* Password quality module to reject empty passwords */2728#include "k5-int.h"29#include <krb5/pwqual_plugin.h>30#include "server_internal.h"3132static krb5_error_code33empty_check(krb5_context context, krb5_pwqual_moddata data,34const char *password, const char *policy_name,35krb5_principal princ, const char **languages)36{37/* Unlike other built-in modules, this one operates even for principals38* with no password policy. */39if (*password == '\0') {40k5_setmsg(context, KADM5_PASS_Q_TOOSHORT,41_("Empty passwords are not allowed"));42return KADM5_PASS_Q_TOOSHORT;43}44return 0;45}4647krb5_error_code48pwqual_empty_initvt(krb5_context context, int maj_ver, int min_ver,49krb5_plugin_vtable vtable)50{51krb5_pwqual_vtable vt;5253if (maj_ver != 1)54return KRB5_PLUGIN_VER_NOTSUPP;55vt = (krb5_pwqual_vtable)vtable;56vt->name = "empty";57vt->check = empty_check;58return 0;59}606162