Import Upstream version 1.8.5
[hcoop/debian/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 #include <roken.h>
14
15 #ifdef AFS_NT40_ENV
16 #include <WINNT/afsevent.h>
17 #endif
18 #include <afs/afsutil.h>
19
20 #include "AFS_component_version_number.c"
21
22 /* returns 0 if the password is long enough, otherwise non-zero */
23 int
24 main(int argc, char *argv[])
25 {
26 char oldpassword[512];
27 char password[512];
28 int rc = 1;
29
30 if (fgets(oldpassword, 512, stdin))
31 while (fgets(password, 512, stdin)) {
32 if (strlen(password) > 8) { /* password includes a newline */
33 rc = 0;
34 fputs("0\n", stdout);
35 fflush(stdout);
36 } else {
37 rc = 1;
38 fputs("Passwords must contain at least 8 characters.\n",
39 stderr);
40 fputs("1\n", stdout);
41 fflush(stdout);
42 }
43 }
44 return rc;
45 }