122347Spst/* passcheck.c: The opiepasscheck() library function. 222347Spst 329964Sache%%% portions-copyright-cmetz-96 492906SmarkmPortions of this software are Copyright 1996-1999 by Craig Metz, All Rights 522347SpstReserved. The Inner Net License Version 2 applies to these portions of 622347Spstthe software. 722347SpstYou should have received a copy of the license with this software. If 822347Spstyou didn't get a copy, you may request one from <license@inner.net>. 922347Spst 1022347SpstPortions of this software are Copyright 1995 by Randall Atkinson and Dan 1122347SpstMcDonald, All Rights Reserved. All Rights under this copyright are assigned 1222347Spstto the U.S. Naval Research Laboratory (NRL). The NRL Copyright Notice and 1322347SpstLicense Agreement applies to this software. 1422347Spst 1522347Spst History: 1622347Spst 1722347Spst Modified by cmetz for OPIE 2.3. OPIE_PASS_{MIN,MAX} changed to 1822347Spst OPIE_SECRET_{MIN,MAX}. 1922347Spst Modified by cmetz for OPIE 2.2. Use FUNCTION declaration et al. 2022347Spst Created at NRL for OPIE 2.2 from opiesubr.c. 2122347Spst*/ 2222347Spst#include "opie_cfg.h" 2322347Spst 2422347Spst#include <stdio.h> 2522347Spst#include <string.h> 2622347Spst 2722347Spst#include "opie.h" 2822347Spst 2922347Spst/* 3022347Spst Applies "good password" rules to the secret pass phrase. 3122347Spst 3222347Spst We currently implement the following: 3322347Spst 3422347Spst Passwords must be at least OPIE_SECRET_MIN (10) characters long. 3522347Spst Passwords must be at most OPIE_SECRET_MAX (127) characters long. 3622347Spst 3722347Spst N.B.: Passing NULL pointers to this function is a bad idea. 3822347Spst*/ 3922347Spstint opiepasscheck FUNCTION((secret), char *secret) 4022347Spst{ 4122347Spst int len = strlen(secret); 4222347Spst 4322347Spst if (len < OPIE_SECRET_MIN) 4422347Spst return 1; 4522347Spst 4622347Spst if (len > OPIE_SECRET_MAX) 4722347Spst return 1; 4822347Spst 4922347Spst return 0; 5022347Spst} 51