]> git.sur5r.net Git - openldap/blobdiff - clients/tools/ldappasswd.c
Be a bit more liberal
[openldap] / clients / tools / ldappasswd.c
index ee5547d8ec0cee24630fb3c2a21f17afde02bf04..b79e4d3f23a431caeaccfdcbccb5725c9cfe1277 100644 (file)
@@ -49,12 +49,12 @@ usage(const char *s)
 "  -p port    port on LDAP server\n"
 "  -Q         use SASL Quiet mode\n"
 "  -R realm   SASL realm\n"
-"  -U user    SASL authentication identity (username)\n"
+"  -U authcid SASL authentication identity\n"
 "  -v         run in verbose mode (diagnostics to standard output)\n"
 "  -w passwd  bind passwd (for simple authentication)\n"
 "  -W         prompt for bind passwd\n"
 "  -x         Simple authentication\n"
-"  -X id      SASL authorization identity (\"dn:<dn>\" or \"u:<user>\")\n"
+"  -X authzid SASL authorization identity (\"dn:<dn>\" or \"u:<user>\")\n"
 "  -Y mech    SASL mechanism\n"
 "  -Z         Start TLS request (-ZZ to require successful response)\n"
                , s );
@@ -124,7 +124,7 @@ main( int argc, char *argv[] )
                        {
                                char* p;
 
-                               for( p = optarg; *p == '\0'; p++ ) {
+                               for( p = optarg; *p != '\0'; p++ ) {
                                        *p = '\0';
                                }
                        }
@@ -139,7 +139,7 @@ main( int argc, char *argv[] )
                        {
                                char* p;
 
-                               for( p = optarg; *p == '\0'; p++ ) {
+                               for( p = optarg; *p != '\0'; p++ ) {
                                        *p = '\0';
                                }
                        }
@@ -397,7 +397,7 @@ main( int argc, char *argv[] )
                {
                        char* p;
 
-                       for( p = optarg; *p == '\0'; p++ ) {
+                       for( p = optarg; *p != '\0'; p++ ) {
                                *p = '\0';
                        }
                }
@@ -533,9 +533,6 @@ main( int argc, char *argv[] )
 
        if (want_bindpw && passwd.bv_val == NULL ) {
                /* handle bind password */
-               if( binddn != NULL ) {
-                       fprintf( stderr, "Bind DN: %s\n", binddn );
-               }
                passwd.bv_val = strdup( getpassphrase("Enter bind password: "));
                passwd.bv_len = passwd.bv_val ? strlen( passwd.bv_val ) : 0;
        }
@@ -600,11 +597,10 @@ main( int argc, char *argv[] )
        }
 
        if ( use_tls && ldap_start_tls_s( ld, NULL, NULL ) != LDAP_SUCCESS ) {
+               ldap_perror( ld, "ldap_start_tls" );
                if ( use_tls > 1 ) {
-                       ldap_perror( ld, "ldap_start_tls" );
                        return( EXIT_FAILURE );
                }
-               fprintf( stderr, "WARNING: could not start TLS\n" );
        }
 
        if ( authmethod == LDAP_AUTH_SASL ) {
@@ -672,7 +668,7 @@ main( int argc, char *argv[] )
 
                if( oldpw != NULL ) {
                        ber_printf( ber, "ts",
-                               LDAP_TAG_EXOP_X_MODIFY_PASSWD_NEW, oldpw );
+                               LDAP_TAG_EXOP_X_MODIFY_PASSWD_OLD, oldpw );
                        free(oldpw);
                }