\r
#define APR_SALT_SIZE 8\r
\r
-/* copied from liblutil/passwd.c */\r
-static int pw_string64(\r
- const struct berval *sc,\r
- const struct berval *hash,\r
- struct berval *b64,\r
- const struct berval *salt )\r
-{\r
- int rc;\r
- struct berval string;\r
- size_t b64len;\r
-\r
- if( salt ) {\r
- /* need to base64 combined string */\r
- string.bv_len = hash->bv_len + salt->bv_len;\r
- string.bv_val = ber_memalloc( string.bv_len + 1 );\r
-\r
- if( string.bv_val == NULL ) {\r
- return LUTIL_PASSWD_ERR;\r
- }\r
-\r
- AC_MEMCPY( string.bv_val, hash->bv_val,\r
- hash->bv_len );\r
- AC_MEMCPY( &string.bv_val[hash->bv_len], salt->bv_val,\r
- salt->bv_len );\r
- string.bv_val[string.bv_len] = '\0';\r
-\r
- } else {\r
- string = *hash;\r
- }\r
-\r
- b64len = LUTIL_BASE64_ENCODE_LEN( string.bv_len ) + 1;\r
- b64->bv_len = b64len + sc->bv_len;\r
- b64->bv_val = ber_memalloc( b64->bv_len + 1 );\r
-\r
- if( b64->bv_val == NULL ) {\r
- if( salt ) ber_memfree( string.bv_val );\r
- return LUTIL_PASSWD_ERR;\r
- }\r
-\r
- AC_MEMCPY(b64->bv_val, sc->bv_val, sc->bv_len);\r
-\r
- rc = lutil_b64_ntop(\r
- (unsigned char *) string.bv_val, string.bv_len,\r
- &b64->bv_val[sc->bv_len], b64len );\r
-\r
- if( salt ) ber_memfree( string.bv_val );\r
- \r
- if( rc < 0 ) {\r
- return LUTIL_PASSWD_ERR;\r
- }\r
-\r
- /* recompute length */\r
- b64->bv_len = sc->bv_len + rc;\r
- assert( strlen(b64->bv_val) == b64->bv_len );\r
- return LUTIL_PASSWD_OK;\r
-}\r
-\r
/* The algorithm implemented in this function was created by Poul-Henning\r
* Kamp and released under the following license:\r
* ----------------------------------------------------------------------------\r
if (text)\r
*text = NULL;\r
\r
- return pw_string64(scheme, &digest, hash, &salt);\r
+ return lutil_passwd_string64(scheme, &digest, hash, &salt);\r
}\r
\r
int init_module(int argc, char *argv[]) {\r
return lutil_passwd_add((struct berval *) &scheme, chk_apr1, hash_apr1);\r
-}
\ No newline at end of file
+}\r