/[smeserver]/rpms/ppp/sme7/ppp-2.4.4-HashorBin.patch
ViewVC logotype

Contents of /rpms/ppp/sme7/ppp-2.4.4-HashorBin.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Tue Jun 12 17:08:31 2007 UTC (17 years, 5 months ago) by slords
Branch: MAIN
CVS Tags: ppp-2_4_4-1_3_el4_sme, HEAD
Error occurred while calculating annotation data.
Import on branch sme7 of package ppp-2.4.4-1.3.el4.sme.src.rpm

1 diff -ru ppp-2.4.4.orig/pppd/chap_ms.c ppp-2.4.4+ldap/pppd/chap_ms.c
2 --- ppp-2.4.4.orig/pppd/chap_ms.c 2006-05-21 07:56:40.000000000 -0400
3 +++ ppp-2.4.4+ldap/pppd/chap_ms.c 2006-11-17 16:47:11.000000000 -0500
4 @@ -529,17 +529,73 @@
5
6 }
7
8 +/* From libsmb - From SAMBA */
9 +/*
10 + * Routine to get the 32 hex characters and turn them
11 + * into a 16 byte array.
12 + */
13 +int gethexpwd(unsigned char *p, unsigned char *pwd)
14 +{
15 +
16 + int i;
17 + unsigned char lonybble, hinybble;
18 + char *hexchars = "0123456789ABCDEF";
19 + char *p1, *p2;
20 +
21 + for (i = 0; i < 32; i += 2)
22 + {
23 +
24 + hinybble = toupper(p[i]);
25 + lonybble = toupper(p[i + 1]);
26 +
27 + p1 = strchr(hexchars, hinybble);
28 + p2 = strchr(hexchars, lonybble);
29 +
30 + if (!p1 || !p2)
31 + {
32 +
33 + return (0);
34 +
35 + }
36 +
37 + hinybble = (p1 - hexchars);
38 + lonybble = (p2 - hexchars);
39 +
40 + pwd[i / 2] = (hinybble << 4) | lonybble;
41 +
42 + }
43 +
44 + return (1);
45 +
46 +}
47 +
48 +/*
49 + * Hash the Unicode version of the secret (== password).
50 + * Or get the binary representation of the secret
51 + * if it already looks like a hash
52 + */
53 +void
54 +HashorBin(char secret[], int secret_len, u_char PasswordHash[])
55 +{
56 + u_char unicodePassword[MAX_NT_PASSWORD * 2];
57 + if (secret_len != 32)
58 + {
59 + ascii2unicode(secret, secret_len, unicodePassword);
60 + NTPasswordHash(unicodePassword, secret_len * 2, PasswordHash);
61 + }
62 + else
63 + {
64 + gethexpwd(secret, PasswordHash);
65 + }
66 +}
67 +
68 static void
69 ChapMS_NT(u_char *rchallenge, char *secret, int secret_len,
70 u_char NTResponse[24])
71 {
72 - u_char unicodePassword[MAX_NT_PASSWORD * 2];
73 u_char PasswordHash[MD4_SIGNATURE_SIZE];
74
75 - /* Hash the Unicode version of the secret (== password). */
76 - ascii2unicode(secret, secret_len, unicodePassword);
77 - NTPasswordHash(unicodePassword, secret_len * 2, PasswordHash);
78 -
79 + HashorBin(secret, secret_len, PasswordHash);
80 ChallengeResponse(rchallenge, PasswordHash, NTResponse);
81 }
82
83 @@ -547,16 +603,12 @@
84 ChapMS2_NT(u_char *rchallenge, u_char PeerChallenge[16], char *username,
85 char *secret, int secret_len, u_char NTResponse[24])
86 {
87 - u_char unicodePassword[MAX_NT_PASSWORD * 2];
88 u_char PasswordHash[MD4_SIGNATURE_SIZE];
89 u_char Challenge[8];
90
91 ChallengeHash(PeerChallenge, rchallenge, username, Challenge);
92
93 - /* Hash the Unicode version of the secret (== password). */
94 - ascii2unicode(secret, secret_len, unicodePassword);
95 - NTPasswordHash(unicodePassword, secret_len * 2, PasswordHash);
96 -
97 + HashorBin(secret, secret_len, PasswordHash);
98 ChallengeResponse(Challenge, PasswordHash, NTResponse);
99 }
100
101 @@ -637,13 +689,10 @@
102 u_char *rchallenge, char *username,
103 u_char authResponse[MS_AUTH_RESPONSE_LENGTH+1])
104 {
105 - u_char unicodePassword[MAX_NT_PASSWORD * 2];
106 u_char PasswordHash[MD4_SIGNATURE_SIZE];
107 u_char PasswordHashHash[MD4_SIGNATURE_SIZE];
108
109 - /* Hash (x2) the Unicode version of the secret (== password). */
110 - ascii2unicode(secret, secret_len, unicodePassword);
111 - NTPasswordHash(unicodePassword, secret_len * 2, PasswordHash);
112 + HashorBin(secret, secret_len, PasswordHash);
113 NTPasswordHash(PasswordHash, sizeof(PasswordHash),
114 PasswordHashHash);
115
116 @@ -682,13 +731,10 @@
117 static void
118 Set_Start_Key(u_char *rchallenge, char *secret, int secret_len)
119 {
120 - u_char unicodePassword[MAX_NT_PASSWORD * 2];
121 u_char PasswordHash[MD4_SIGNATURE_SIZE];
122 u_char PasswordHashHash[MD4_SIGNATURE_SIZE];
123
124 - /* Hash (x2) the Unicode version of the secret (== password). */
125 - ascii2unicode(secret, secret_len, unicodePassword);
126 - NTPasswordHash(unicodePassword, secret_len * 2, PasswordHash);
127 + HashorBin(secret, secret_len, PasswordHash);
128 NTPasswordHash(PasswordHash, sizeof(PasswordHash), PasswordHashHash);
129
130 mppe_set_keys(rchallenge, PasswordHashHash);
131 @@ -797,12 +843,10 @@
132 static void
133 SetMasterKeys(char *secret, int secret_len, u_char NTResponse[24], int IsServer)
134 {
135 - u_char unicodePassword[MAX_NT_PASSWORD * 2];
136 u_char PasswordHash[MD4_SIGNATURE_SIZE];
137 u_char PasswordHashHash[MD4_SIGNATURE_SIZE];
138 - /* Hash (x2) the Unicode version of the secret (== password). */
139 - ascii2unicode(secret, secret_len, unicodePassword);
140 - NTPasswordHash(unicodePassword, secret_len * 2, PasswordHash);
141 +
142 + HashorBin(secret, secret_len, PasswordHash);
143 NTPasswordHash(PasswordHash, sizeof(PasswordHash), PasswordHashHash);
144 mppe_set_keys2(PasswordHashHash, NTResponse, IsServer);
145 }

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed