diff options
-rw-r--r-- | kerberosIV/kadm/Makefile | 4 | ||||
-rw-r--r-- | kerberosIV/kadm/check_password.c | 61 | ||||
-rw-r--r-- | kerberosIV/kadm/kadm_err.et | 11 |
3 files changed, 71 insertions, 5 deletions
diff --git a/kerberosIV/kadm/Makefile b/kerberosIV/kadm/Makefile index 6f7f3779ba6..1ef16f76440 100644 --- a/kerberosIV/kadm/Makefile +++ b/kerberosIV/kadm/Makefile @@ -1,9 +1,9 @@ -# $OpenBSD: Makefile,v 1.7 1997/02/11 04:40:36 tholo Exp $ +# $OpenBSD: Makefile,v 1.8 1998/05/15 06:22:16 art Exp $ .include <bsd.obj.mk> LIB= kadm -SRCS= kadm_err.c kadm_cli_wrap.c kadm_stream.c kadm_supp.c +SRCS= kadm_err.c kadm_cli_wrap.c kadm_stream.c kadm_supp.c check_password.c CFLAGS+=-I. -I${.CURDIR} .if exists(${.CURDIR}/../krb/${__objdir}) CFLAGS+=-I${.CURDIR}/../krb/${__objdir} diff --git a/kerberosIV/kadm/check_password.c b/kerberosIV/kadm/check_password.c new file mode 100644 index 00000000000..39903eb8301 --- /dev/null +++ b/kerberosIV/kadm/check_password.c @@ -0,0 +1,61 @@ +/* $OpenBSD: check_password.c,v 1.1 1998/05/15 06:22:17 art Exp $ */ +/* $KTH: check_password.c,v 1.1 1998/01/16 23:10:18 joda Exp $ */ +/* + * Copyright (c) 1998 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Kungliga Tekniska + * Högskolan and its contributors. + * + * 4. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "kadm_locl.h" + +/* This is a client side password check. Should perhaps be merged with + kadmind version that lives in pw_check.c */ + +int +kadm_check_pw (const char *password) +{ + const char *t; + if (strlen(password) == 0) + return KADM_PASS_Q_NULL; + if (strlen(password) < MIN_KPW_LEN) + return KADM_PASS_Q_TOOSHORT; + + /* Don't allow all lower case passwords regardless of length */ + for (t = password; *t && islower(*t); t++) + ; + if (*t == '\0') + return KADM_PASS_Q_CLASS; + return 0; +} diff --git a/kerberosIV/kadm/kadm_err.et b/kerberosIV/kadm/kadm_err.et index f4fe0685cbe..22e9b5c0e7a 100644 --- a/kerberosIV/kadm/kadm_err.et +++ b/kerberosIV/kadm/kadm_err.et @@ -1,5 +1,5 @@ -# $OpenBSD: kadm_err.et,v 1.4 1998/02/18 11:53:44 art Exp $ -# $KTH: kadm_err.et,v 1.4 1996/06/12 08:01:34 bg Exp $ +# $OpenBSD: kadm_err.et,v 1.5 1998/05/15 06:22:17 art Exp $ +# $KTH: kadm_err.et,v 1.5 1998/01/16 23:11:27 joda Exp $ #- # Copyright (C) 1988 by the Massachusetts Institute of Technology @@ -24,7 +24,7 @@ # KADM_SUCCESS, as all success codes should be, is zero -ec KADM_RCSID, "$Header: /cvs/OpenBSD/src/kerberosIV/kadm/Attic/kadm_err.et,v 1.4 1998/02/18 11:53:44 art Exp $" +ec KADM_RCSID, "$OpenBSD: kadm_err.et,v 1.5 1998/05/15 06:22:17 art Exp $" # /* Building and unbuilding the packet errors */ ec KADM_NO_REALM, "Cannot fetch local realm" ec KADM_NO_CRED, "Unable to fetch credentials" @@ -68,4 +68,9 @@ ec KADM_PW_MISMATCH, "Cleartext password and DES key did not match" ec KADM_NOT_SERV_PRINC, "Invalid principal for change srvtab request" ec KADM_IMMUTABLE, "Attempt to delete immutable principal" +# password quality basically stolen from OV libkadm5 +ec KADM_PASS_Q_NULL, "Null passwords are not allowed" +ec KADM_PASS_Q_TOOSHORT,"Password is too short" +ec KADM_PASS_Q_CLASS, "Too few character classes in password" +ec KADM_PASS_Q_DICT, "Password is in the password dictionary" end |