mcst-linux-kernel/patches-2024.06.26/cpu-1.4.3/0003-allowbadpass.patch

92 lines
3.1 KiB
Diff

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 */