]> git.sur5r.net Git - openldap/commitdiff
ITS#2906: improved passwd error handling
authorKurt Zeilenga <kurt@openldap.org>
Sat, 10 Jan 2004 19:25:47 +0000 (19:25 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sat, 10 Jan 2004 19:25:47 +0000 (19:25 +0000)
doc/man/man8/slappasswd.8
libraries/liblutil/passwd.c
servers/slapd/tools/slappasswd.c

index 190f245a2036a0b27a75c918cdda2c66d209b28b..f46699712caf2c5a20c58fec4a4fe4da56e845af 100644 (file)
@@ -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}
index abf26784e76e8d9c56cf8b0c15369617c96ff5db..ac780b9d4b743e5ae1c73bbfa200bc06f89a6ca9 100644 (file)
@@ -377,9 +377,17 @@ struct berval * lutil_passwd_hash(
 {
        const struct pw_scheme *sc = get_scheme( method );
 
+       if( sc == NULL ) {
+               if( text ) *text = "scheme not recognized";
+               return NULL;
+       }
+
+       if( ! sc->hash_fn ) {
+               if( text ) *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 );
 }
index 92443e205150346f421430c1f9c9f4f28e52b43b..b144ae5937f9c923e8f957f7a14aa9e77eb279a6 100644 (file)
@@ -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;
        }