Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nadezhda Ivanova
OpenLDAP
Commits
9ed2b33e
Commit
9ed2b33e
authored
May 02, 2001
by
Kurt Zeilenga
Browse files
optional SHA1
parent
17b52c97
Changes
3
Hide whitespace changes
Inline
Side-by-side
libraries/liblutil/authpasswd.c
View file @
9ed2b33e
...
...
@@ -67,11 +67,13 @@ static int chk_md5(
const
struct
berval
*
salt
,
const
struct
berval
*
cred
);
#ifdef LUTIL_SHA1_BYTES
static
int
chk_sha1
(
const
struct
pw_scheme
*
scheme
,
const
struct
berval
*
passwd
,
const
struct
berval
*
salt
,
const
struct
berval
*
cred
);
#endif
static
int
chk_crypt
(
const
struct
pw_scheme
*
scheme
,
...
...
@@ -95,7 +97,7 @@ static int chk_ext_unix(
const
struct
berval
*
passwd
,
const
struct
berval
*
cred
);
#ifdef LUTIL_SHA1_BYTES
/* password hash routines */
static
int
*
hash_sha1
(
const
struct
pw_scheme
*
scheme
,
...
...
@@ -103,6 +105,7 @@ static int *hash_sha1(
const
struct
berval
*
salt
,
struct
berval
**
passwd_out
,
struct
berval
**
salt_out
);
#endif
static
int
*
hash_md5
(
const
struct
pw_scheme
*
scheme
,
...
...
@@ -128,7 +131,9 @@ struct pw_scheme {
static
const
struct
pw_scheme
pw_schemes
[]
=
{
#ifdef LUTIL_SHA1_BYTES
{
{
sizeof
(
"SHA1"
)
-
1
,
"SHA1"
},
chk_sha1
,
0
/* hash_sha1 */
,
4
},
#endif
{
{
sizeof
(
"MD5"
)
-
1
,
"MD5"
},
chk_md5
,
0
/* hash_md5 */
,
4
},
#ifdef SLAPD_CRYPT
...
...
@@ -364,6 +369,7 @@ static struct berval * base64(
/* PASSWORD CHECK ROUTINES */
#ifdef LUTIL_SHA1_BYTES
static
int
chk_sha1
(
const
struct
pw_scheme
*
sc
,
const
struct
berval
*
passwd
,
...
...
@@ -431,6 +437,7 @@ done:
ber_memfree
(
orig_salt
);
return
rc
;
}
#endif
static
int
chk_md5
(
const
struct
pw_scheme
*
sc
,
...
...
@@ -791,6 +798,7 @@ static int chk_unix(
#ifdef SLAPD_GENERATE
#ifdef LUTIL_SHA1_BYTES
static
struct
berval
*
hash_ssha1
(
const
struct
pw_scheme
*
scheme
,
const
struct
berval
*
passwd
)
...
...
@@ -837,6 +845,7 @@ static struct berval *hash_sha1(
return
pw_string64
(
scheme
,
&
digest
,
NULL
);
}
#endif
static
struct
berval
*
hash_smd5
(
const
struct
pw_scheme
*
scheme
,
...
...
libraries/liblutil/passwd.c
View file @
9ed2b33e
...
...
@@ -93,6 +93,7 @@ static int chk_smd5(
const
struct
berval
*
passwd
,
const
struct
berval
*
cred
);
#ifdef LUTIL_SHA1_BYTES
static
int
chk_ssha1
(
const
struct
pw_scheme
*
scheme
,
const
struct
berval
*
passwd
,
...
...
@@ -102,6 +103,7 @@ static int chk_sha1(
const
struct
pw_scheme
*
scheme
,
const
struct
berval
*
passwd
,
const
struct
berval
*
cred
);
#endif
#ifdef SLAPD_LMHASH
static
int
chk_lanman
(
...
...
@@ -139,6 +141,7 @@ static int chk_unix(
#endif
#ifdef LUTIL_SHA1_BYTES
/* password hash routines */
static
struct
berval
*
hash_sha1
(
const
struct
pw_scheme
*
scheme
,
...
...
@@ -147,6 +150,7 @@ static struct berval *hash_sha1(
static
struct
berval
*
hash_ssha1
(
const
struct
pw_scheme
*
scheme
,
const
struct
berval
*
passwd
);
#endif
static
struct
berval
*
hash_smd5
(
const
struct
pw_scheme
*
scheme
,
...
...
@@ -171,8 +175,10 @@ static struct berval *hash_crypt(
static
const
struct
pw_scheme
pw_schemes
[]
=
{
#ifdef LUTIL_SHA1_BYTES
{
{
sizeof
(
"{SSHA}"
)
-
1
,
"{SSHA}"
},
chk_ssha1
,
hash_ssha1
},
{
{
sizeof
(
"{SHA}"
)
-
1
,
"{SHA}"
},
chk_sha1
,
hash_sha1
},
#endif
{
{
sizeof
(
"{SMD5}"
)
-
1
,
"{SMD5}"
},
chk_smd5
,
hash_smd5
},
{
{
sizeof
(
"{MD5}"
)
-
1
,
"{MD5}"
},
chk_md5
,
hash_md5
},
...
...
@@ -448,6 +454,7 @@ static struct berval * pw_string64(
/* PASSWORD CHECK ROUTINES */
#ifdef LUTIL_SHA1_BYTES
static
int
chk_ssha1
(
const
struct
pw_scheme
*
sc
,
const
struct
berval
*
passwd
,
...
...
@@ -520,6 +527,7 @@ static int chk_sha1(
ber_memfree
(
orig_pass
);
return
rc
?
1
:
0
;
}
#endif
static
int
chk_smd5
(
const
struct
pw_scheme
*
sc
,
...
...
@@ -952,6 +960,7 @@ static int chk_unix(
/* PASSWORD GENERATION ROUTINES */
#ifdef LUTIL_SHA1_BYTES
static
struct
berval
*
hash_ssha1
(
const
struct
pw_scheme
*
scheme
,
const
struct
berval
*
passwd
)
...
...
@@ -998,6 +1007,7 @@ static struct berval *hash_sha1(
return
pw_string64
(
scheme
,
&
digest
,
NULL
);
}
#endif
static
struct
berval
*
hash_smd5
(
const
struct
pw_scheme
*
scheme
,
...
...
libraries/liblutil/sha1.c
View file @
9ed2b33e
...
...
@@ -25,6 +25,7 @@
*/
#include
"portable.h"
#include
<ac/bytes.h>
#include
<ac/string.h>
/* include socket.h to get sys/types.h and/or winsock2.h */
...
...
@@ -34,6 +35,8 @@
#include
"lutil_sha1.h"
#ifdef LUTIL_SHA1_BYTES
/* undefining this will cause pointer alignment errors */
#define SHA1HANDSOFF
/* Copies data before messing with it. */
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
...
...
@@ -275,3 +278,5 @@ lutil_SHA1Data( const unsigned char *data, size_t len, char *buf )
lutil_SHA1Update
(
&
ctx
,
data
,
len
);
return
(
lutil_SHA1End
(
&
ctx
,
buf
));
}
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment