summaryrefslogtreecommitdiffstats
path: root/patches/ppp-2.4.5/0030-no_crypt_hack.patch
blob: 69b5b66a25d8d7c4a0e432b9bcdda52647e0b763 (plain)
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
From: Marco d'Itri <md@linux.it>
Date: Wed, 25 Jan 2012 19:14:27 +0100
Subject: [PATCH] no_crypt_hack

The udeb package does not have crypt(3).
This patch makes authentication always fail, since it is not needed anyway
for dialout.
---
 pppd/Makefile.linux |    4 ++++
 pppd/auth.c         |    2 ++
 pppd/session.c      |    2 ++
 3 files changed, 8 insertions(+)

diff --git a/pppd/Makefile.linux b/pppd/Makefile.linux
index 44cf309..c001679 100644
--- a/pppd/Makefile.linux
+++ b/pppd/Makefile.linux
@@ -116,10 +116,14 @@ COMPILE_FLAGS += -DHAS_SHADOW
 #LIBS     += -lshadow $(LIBS)
 endif
 
+ifdef NO_CRYPT_HACK
+COMPILE_FLAGS += -DNO_CRYPT_HACK
+else
 ifneq ($(wildcard /usr/include/crypt.h),)
 COMPILE_FLAGS += -DHAVE_CRYPT_H=1
 LIBS	+= -lcrypt
 endif
+endif
 
 ifdef NEEDDES
 ifndef USE_CRYPT
diff --git a/pppd/auth.c b/pppd/auth.c
index 031c030..36e1549 100644
--- a/pppd/auth.c
+++ b/pppd/auth.c
@@ -1442,8 +1442,10 @@ check_passwd(unit, auser, userlen, apasswd, passwdlen, msg)
 	    }
 	    if (secret[0] != 0 && !login_secret) {
 		/* password given in pap-secrets - must match */
+#ifndef NO_CRYPT_HACK
 		if ((cryptpap || strcmp(passwd, secret) != 0)
 		    && strcmp(crypt(passwd, secret), secret) != 0)
+#endif
 		    ret = UPAP_AUTHNAK;
 	    }
 	}
diff --git a/pppd/session.c b/pppd/session.c
index 32901a2..108331f 100644
--- a/pppd/session.c
+++ b/pppd/session.c
@@ -348,8 +348,10 @@ session_start(flags, user, passwd, ttyName, msg)
 	/*
 	 * If no passwd, don't let them login if we're authenticating.
 	 */
+#ifndef NO_CRYPT_HACK
         if (pw->pw_passwd == NULL || strlen(pw->pw_passwd) < 2
             || strcmp(crypt(passwd, pw->pw_passwd), pw->pw_passwd) != 0)
+#endif
             return SESSION_FAILED;
     }