Package: cpu / 1.4.3-12

05_allowbadpass.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
From: Guido Trotter <ultrotter@debian.org>
Subject: Allow specyfing bad passwords

diff -urNad --exclude=CVS --exclude=.svn ./src/include/main/cpu.h /tmp/dpep-work.ipaiOK/cpu-1.4.3/src/include/main/cpu.h
--- ./src/include/main/cpu.h	2003-12-31 03:24:20.000000000 +0000
+++ /tmp/dpep-work.ipaiOK/cpu-1.4.3/src/include/main/cpu.h	2005-07-15 10:52:51.000000000 +0000
@@ -130,7 +130,8 @@
     {"tls", 2, 0, 'x'}, \
     {"exec", 2, 0, 'X'}, \
     {"yes", 2, 0, 'y'}, \
-    {"uri", 2, 0, 'Z'}
+    {"uri", 2, 0, 'Z'}, \
+    {"allow-badpass", 2, 0, 'q'}
 
 #ifdef  __cplusplus
 }
diff -urNad --exclude=CVS --exclude=.svn ./src/include/util/parseconfig.h /tmp/dpep-work.ipaiOK/cpu-1.4.3/src/include/util/parseconfig.h
--- ./src/include/util/parseconfig.h	2003-02-10 20:09:15.000000000 +0000
+++ /tmp/dpep-work.ipaiOK/cpu-1.4.3/src/include/util/parseconfig.h	2005-07-15 10:52:51.000000000 +0000
@@ -40,5 +40,6 @@
 int    cfg_get_signed_int(char *sec, char *ent);
 float  cfg_get_float(char *sec, char *ent);
 long   cfg_get_long(char *sec, char *ent);
+void   cfg_set_option(const char* sec, const char* name, const char* val);
 
 #endif
diff -urNad --exclude=CVS --exclude=.svn ./src/main/cpu.c /tmp/dpep-work.ipaiOK/cpu-1.4.3/src/main/cpu.c
--- ./src/main/cpu.c	2003-10-22 21:17:15.000000000 +0000
+++ /tmp/dpep-work.ipaiOK/cpu-1.4.3/src/main/cpu.c	2005-07-15 10:52:51.000000000 +0000
@@ -34,6 +34,7 @@
 #endif
 
 char * method = NULL;
+static bool badpass = false;
 
 int
 main(int argc, char *argv[])
@@ -76,6 +77,10 @@
       fprintf(stderr, "There was an error parsing the configuration file. Exiting.\n");
       exit(EXIT_FAILURE);
     }
+
+  if (badpass)
+    cfg_set_option("GLOBAL", "ALLOW_BADPASS", "1");
+
   optind = 0;
   if ( method == NULL )
     {
@@ -150,6 +155,9 @@
 	  case 'V':
 	    version_flag = 1;
 	    break;
+	  case 'q':
+	    badpass = true;
+	    break;
 	  default:
 	    break;
 	}
diff -urNad --exclude=CVS --exclude=.svn ./src/util/hash.c /tmp/dpep-work.ipaiOK/cpu-1.4.3/src/util/hash.c
--- ./src/util/hash.c	2003-10-22 21:29:19.000000000 +0000
+++ /tmp/dpep-work.ipaiOK/cpu-1.4.3/src/util/hash.c	2005-07-15 10:52:51.000000000 +0000
@@ -154,7 +154,11 @@
     if ( password[0] != '*' )
       while ( (msg = (char*)FascistCheck(newpass, dict)) != NULL )
       {
-	fprintf(stdout, "%s is a bad password: %s\n", newpass, msg);
+	fprintf(stdout, "Bad password: %s\n", msg);
+	if (cfg_get_int("GLOBAL", "ALLOW_BADPASS")) {
+		fprintf(stdout, "But allowing anyway since allow-badpass is enabled\n");
+		break;
+	}
 	newpass = NULL;
 	msg = NULL;
 	while ( (newpass = CPU_getpass("Enter a new password: ")) == NULL )
diff -urNad --exclude=CVS --exclude=.svn ./src/util/parseconfig.c /tmp/dpep-work.ipaiOK/cpu-1.4.3/src/util/parseconfig.c
--- ./src/util/parseconfig.c	2003-02-10 20:09:16.000000000 +0000
+++ /tmp/dpep-work.ipaiOK/cpu-1.4.3/src/util/parseconfig.c	2005-07-15 10:52:51.000000000 +0000
@@ -297,4 +297,13 @@
     return atof(val);
 }
 
+void
+cfg_set_option(const char* sec, const char* name, const char* val)
+{
+	struct CFG_ENTRIES* e;
+
+	e=cfg_find_section(c, sec);
+	cfg_set_entry(e, name, val);
+
+}
 /* end of parseconfig.c */