1/* passcheck.c: The opiepasscheck() library function.
2
3%%% portions-copyright-cmetz-96
4Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
5Reserved. The Inner Net License Version 2 applies to these portions of
6the software.
7You should have received a copy of the license with this software. If
8you didn't get a copy, you may request one from <license@inner.net>.
9
10Portions of this software are Copyright 1995 by Randall Atkinson and Dan
11McDonald, All Rights Reserved. All Rights under this copyright are assigned
12to the U.S. Naval Research Laboratory (NRL). The NRL Copyright Notice and
13License Agreement applies to this software.
14
15        History:
16
17	Modified by cmetz for OPIE 2.3. OPIE_PASS_{MIN,MAX} changed to
18		OPIE_SECRET_{MIN,MAX}.
19	Modified by cmetz for OPIE 2.2. Use FUNCTION declaration et al.
20        Created at NRL for OPIE 2.2 from opiesubr.c.
21*/
22#include "opie_cfg.h"
23
24#include <stdio.h>
25#include <string.h>
26
27#include "opie.h"
28
29/*
30   Applies "good password" rules to the secret pass phrase.
31
32   We currently implement the following:
33
34   Passwords must be at least OPIE_SECRET_MIN (10) characters long.
35   Passwords must be at most OPIE_SECRET_MAX (127) characters long.
36
37   N.B.: Passing NULL pointers to this function is a bad idea.
38*/
39int opiepasscheck FUNCTION((secret), char *secret)
40{
41	int len = strlen(secret);
42
43	if (len < OPIE_SECRET_MIN)
44		return 1;
45
46	if (len > OPIE_SECRET_MAX)
47		return 1;
48
49	return 0;
50}
51