Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
David Barchiesi
OpenLDAP
Commits
3ae49ffc
Commit
3ae49ffc
authored
14 years ago
by
Howard Chu
Committed by
Quanah Gibson-Mount
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Replace pw_string64 with lutil_passwd_string64
parent
66f9f50d
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/passwd/sha2/slapd-sha2.c
+3
-60
3 additions, 60 deletions
contrib/slapd-modules/passwd/sha2/slapd-sha2.c
with
3 additions
and
60 deletions
contrib/slapd-modules/passwd/sha2/slapd-sha2.c
+
3
−
60
View file @
3ae49ffc
...
...
@@ -32,63 +32,6 @@
#include
<stdio.h>
#endif
/* pw_string64 function taken from libraries/liblutil/passwd.c */
static
int
pw_string64
(
const
struct
berval
*
sc
,
const
struct
berval
*
hash
,
struct
berval
*
b64
,
const
struct
berval
*
salt
)
{
int
rc
;
struct
berval
string
;
size_t
b64len
;
if
(
salt
)
{
/* need to base64 combined string */
string
.
bv_len
=
hash
->
bv_len
+
salt
->
bv_len
;
string
.
bv_val
=
ber_memalloc
(
string
.
bv_len
+
1
);
if
(
string
.
bv_val
==
NULL
)
{
return
LUTIL_PASSWD_ERR
;
}
AC_MEMCPY
(
string
.
bv_val
,
hash
->
bv_val
,
hash
->
bv_len
);
AC_MEMCPY
(
&
string
.
bv_val
[
hash
->
bv_len
],
salt
->
bv_val
,
salt
->
bv_len
);
string
.
bv_val
[
string
.
bv_len
]
=
'\0'
;
}
else
{
string
=
*
hash
;
}
b64len
=
LUTIL_BASE64_ENCODE_LEN
(
string
.
bv_len
)
+
1
;
b64
->
bv_len
=
b64len
+
sc
->
bv_len
;
b64
->
bv_val
=
ber_memalloc
(
b64
->
bv_len
+
1
);
if
(
b64
->
bv_val
==
NULL
)
{
if
(
salt
)
ber_memfree
(
string
.
bv_val
);
return
LUTIL_PASSWD_ERR
;
}
AC_MEMCPY
(
b64
->
bv_val
,
sc
->
bv_val
,
sc
->
bv_len
);
rc
=
lutil_b64_ntop
(
(
unsigned
char
*
)
string
.
bv_val
,
string
.
bv_len
,
&
b64
->
bv_val
[
sc
->
bv_len
],
b64len
);
if
(
salt
)
ber_memfree
(
string
.
bv_val
);
if
(
rc
<
0
)
{
return
LUTIL_PASSWD_ERR
;
}
/* recompute length */
b64
->
bv_len
=
sc
->
bv_len
+
rc
;
assert
(
strlen
(
b64
->
bv_val
)
==
b64
->
bv_len
);
return
LUTIL_PASSWD_OK
;
}
char
*
sha256_hex_hash
(
const
char
*
passwd
)
{
SHA256_CTX
ct
;
...
...
@@ -170,7 +113,7 @@ static int hash_sha256(
digest
.
bv_val
=
(
char
*
)
hash256
;
digest
.
bv_len
=
sizeof
(
hash256
);
return
pw
_string64
(
scheme
,
&
digest
,
hash
,
NULL
);
return
lutil_passwd
_string64
(
scheme
,
&
digest
,
hash
,
NULL
);
}
static
int
hash_sha384
(
...
...
@@ -193,7 +136,7 @@ static int hash_sha384(
digest
.
bv_val
=
(
char
*
)
hash384
;
digest
.
bv_len
=
sizeof
(
hash384
);
return
pw
_string64
(
scheme
,
&
digest
,
hash
,
NULL
);
return
lutil_passwd
_string64
(
scheme
,
&
digest
,
hash
,
NULL
);
}
static
int
hash_sha512
(
...
...
@@ -213,7 +156,7 @@ static int hash_sha512(
digest
.
bv_val
=
(
char
*
)
hash512
;
digest
.
bv_len
=
sizeof
(
hash512
);
return
pw
_string64
(
scheme
,
&
digest
,
hash
,
NULL
);
return
lutil_passwd
_string64
(
scheme
,
&
digest
,
hash
,
NULL
);
}
static
int
chk_sha256
(
...
...
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