openafs-string-header-cleanup-20071030
[openafs.git] / src / kauth / kpwvalid.c
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #include <afsconfig.h>
11 #include <afs/param.h>
12
13 RCSID
14     ("$Header$");
15
16 #include <stdio.h>
17 #include <string.h>
18 #ifdef AFS_NT40_ENV
19 #include <WINNT/afsevent.h>
20 #endif
21 #include <afs/afsutil.h>
22
23 #include "AFS_component_version_number.c"
24
25   /* returns 0 if the password is long enough, otherwise non-zero  */
26 main(int argc, char *argv[])
27 {
28     char oldpassword[512];
29     char password[512];
30     int rc;
31
32     if (fgets(oldpassword, 512, stdin))
33         while (fgets(password, 512, stdin)) {
34             if (strlen(password) > 8) { /* password includes a newline */
35                 rc = 0;
36                 fputs("0\n", stdout);
37                 fflush(stdout);
38             } else {
39                 rc = 1;
40                 fputs("Passwords must contain at least 8 characters.\n",
41                       stderr);
42                 fputs("1\n", stdout);
43                 fflush(stdout);
44             }
45         }
46 }