Skip to content
Snippets Groups Projects
Commit c8408d3c authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

ITS#2906: report invalid userPassword schemes, clarify documentation

parent 14da72a9
No related branches found
No related tags found
No related merge requests found
......@@ -64,6 +64,12 @@ be specified:
The default is
.IR {SSHA} .
Note that scheme names may need to be protected, due to
.B {
and
.BR } ,
from expansion by the user's command interpreter.
.B {SHA}
and
.B {SSHA}
......
......@@ -377,9 +377,17 @@ struct berval * lutil_passwd_hash(
{
const struct pw_scheme *sc = get_scheme( method );
if( sc == NULL ) {
*text = "scheme not recognized";
return NULL;
}
if( ! sc->hash_fn ) {
*text = "scheme provided no hash function";
return NULL;
}
if( text ) *text = NULL;
if( sc == NULL ) return NULL;
if( ! sc->hash_fn ) return NULL;
return (sc->hash_fn)( &sc->name, passwd, text );
}
......
......@@ -131,10 +131,10 @@ main( int argc, char *argv[] )
}
hash = lutil_passwd_hash( &passwd, scheme, &text );
if( hash == NULL || hash->bv_val == NULL ) {
fprintf( stderr, "Password generation failed. %s\n",
text ? text : "" );
fprintf( stderr,
"Password generation failed for scheme %s: %s\n",
scheme, text ? text : "" );
return EXIT_FAILURE;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment