Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Wiki
Bugzilla
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
openldap
OpenLDAP
Commits
2ee11b37
Commit
2ee11b37
authored
19 years ago
by
Howard Chu
Browse files
Options
Downloads
Patches
Plain Diff
cleanup whitespace, use upper case hex for nt/lm
parent
6b784de0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
contrib/slapd-modules/smbk5pwd/smbk5pwd.c
+35
-35
35 additions, 35 deletions
contrib/slapd-modules/smbk5pwd/smbk5pwd.c
with
35 additions
and
35 deletions
contrib/slapd-modules/smbk5pwd/smbk5pwd.c
+
35
−
35
View file @
2ee11b37
...
...
@@ -66,24 +66,24 @@ static void smbk5pwd_destroy() {
#endif
#ifdef DO_SAMBA
static
const
char
hex
[]
=
"0123456789
abcdef
"
;
static
const
char
hex
[]
=
"0123456789
ABCDEF
"
;
/* From liblutil/passwd.c... */
static
void
lmPasswd_to_key
(
const
unsigned
char
*
lmPasswd
,
des_cblock
*
key
)
const
unsigned
char
*
lmPasswd
,
des_cblock
*
key
)
{
/* make room for parity bits */
((
char
*
)
key
)[
0
]
=
lmPasswd
[
0
];
((
char
*
)
key
)[
1
]
=
((
lmPasswd
[
0
]
&
0x01
)
<<
7
)
|
(
lmPasswd
[
1
]
>>
1
);
((
char
*
)
key
)[
2
]
=
((
lmPasswd
[
1
]
&
0x03
)
<<
6
)
|
(
lmPasswd
[
2
]
>>
2
);
((
char
*
)
key
)[
3
]
=
((
lmPasswd
[
2
]
&
0x07
)
<<
5
)
|
(
lmPasswd
[
3
]
>>
3
);
((
char
*
)
key
)[
4
]
=
((
lmPasswd
[
3
]
&
0x0F
)
<<
4
)
|
(
lmPasswd
[
4
]
>>
4
);
((
char
*
)
key
)[
5
]
=
((
lmPasswd
[
4
]
&
0x1F
)
<<
3
)
|
(
lmPasswd
[
5
]
>>
5
);
((
char
*
)
key
)[
6
]
=
((
lmPasswd
[
5
]
&
0x3F
)
<<
2
)
|
(
lmPasswd
[
6
]
>>
6
);
((
char
*
)
key
)[
7
]
=
((
lmPasswd
[
6
]
&
0x7F
)
<<
1
);
des_set_odd_parity
(
key
);
/* make room for parity bits */
((
char
*
)
key
)[
0
]
=
lmPasswd
[
0
];
((
char
*
)
key
)[
1
]
=
((
lmPasswd
[
0
]
&
0x01
)
<<
7
)
|
(
lmPasswd
[
1
]
>>
1
);
((
char
*
)
key
)[
2
]
=
((
lmPasswd
[
1
]
&
0x03
)
<<
6
)
|
(
lmPasswd
[
2
]
>>
2
);
((
char
*
)
key
)[
3
]
=
((
lmPasswd
[
2
]
&
0x07
)
<<
5
)
|
(
lmPasswd
[
3
]
>>
3
);
((
char
*
)
key
)[
4
]
=
((
lmPasswd
[
3
]
&
0x0F
)
<<
4
)
|
(
lmPasswd
[
4
]
>>
4
);
((
char
*
)
key
)[
5
]
=
((
lmPasswd
[
4
]
&
0x1F
)
<<
3
)
|
(
lmPasswd
[
5
]
>>
5
);
((
char
*
)
key
)[
6
]
=
((
lmPasswd
[
5
]
&
0x3F
)
<<
2
)
|
(
lmPasswd
[
6
]
>>
6
);
((
char
*
)
key
)[
7
]
=
((
lmPasswd
[
6
]
&
0x7F
)
<<
1
);
des_set_odd_parity
(
key
);
}
#define MAX_PWLEN 256
...
...
@@ -115,23 +115,23 @@ static void lmhash(
struct
berval
*
hash
)
{
char
UcasePassword
[
15
];
des_cblock
key
;
des_key_schedule
schedule
;
des_cblock
StdText
=
"KGS!@#$%"
;
char
UcasePassword
[
15
];
des_cblock
key
;
des_key_schedule
schedule
;
des_cblock
StdText
=
"KGS!@#$%"
;
des_cblock
hbuf
[
2
];
strncpy
(
UcasePassword
,
passwd
->
bv_val
,
14
);
UcasePassword
[
14
]
=
'\0'
;
ldap_pvt_str2upper
(
UcasePassword
);
strncpy
(
UcasePassword
,
passwd
->
bv_val
,
14
);
UcasePassword
[
14
]
=
'\0'
;
ldap_pvt_str2upper
(
UcasePassword
);
lmPasswd_to_key
(
UcasePassword
,
&
key
);
des_set_key_unchecked
(
&
key
,
schedule
);
des_ecb_encrypt
(
&
StdText
,
&
hbuf
[
0
],
schedule
,
DES_ENCRYPT
);
lmPasswd_to_key
(
UcasePassword
,
&
key
);
des_set_key_unchecked
(
&
key
,
schedule
);
des_ecb_encrypt
(
&
StdText
,
&
hbuf
[
0
],
schedule
,
DES_ENCRYPT
);
lmPasswd_to_key
(
&
UcasePassword
[
7
],
&
key
);
des_set_key_unchecked
(
&
key
,
schedule
);
des_ecb_encrypt
(
&
StdText
,
&
hbuf
[
1
],
schedule
,
DES_ENCRYPT
);
lmPasswd_to_key
(
&
UcasePassword
[
7
],
&
key
);
des_set_key_unchecked
(
&
key
,
schedule
);
des_ecb_encrypt
(
&
StdText
,
&
hbuf
[
1
],
schedule
,
DES_ENCRYPT
);
hexify
(
(
char
*
)
hbuf
,
hash
);
}
...
...
@@ -141,20 +141,20 @@ static void nthash(
struct
berval
*
hash
)
{
/* Windows currently only allows 14 character passwords, but
* may support up to 256 in the future. We assume this means
/* Windows currently only allows 14 character passwords, but
* may support up to 256 in the future. We assume this means
* 256 UCS2 characters, not 256 bytes...
*/
*/
char
hbuf
[
HASHLEN
];
int
i
;
MD4_CTX
ctx
;
int
i
;
MD4_CTX
ctx
;
if
(
passwd
->
bv_len
>
MAX_PWLEN
*
2
)
passwd
->
bv_len
=
MAX_PWLEN
*
2
;
MD4_Init
(
&
ctx
);
MD4_Update
(
&
ctx
,
passwd
->
bv_val
,
passwd
->
bv_len
);
MD4_Final
(
hbuf
,
&
ctx
);
MD4_Init
(
&
ctx
);
MD4_Update
(
&
ctx
,
passwd
->
bv_val
,
passwd
->
bv_len
);
MD4_Final
(
hbuf
,
&
ctx
);
hexify
(
hbuf
,
hash
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment