]> git.sur5r.net Git - openldap/blobdiff - clients/tools/ldappasswd.c
Very crude LDIF changes:
[openldap] / clients / tools / ldappasswd.c
index 597d5d1ecbaf138c023b15df0f41006bcc4367bc..3d48a2d2c5eebfd64104a0ffb81f57bacb371a6e 100644 (file)
@@ -16,7 +16,8 @@
 #include "portable.h"
 
 #include <stdio.h>
-#include <stdlib.h>
+
+#include <ac/stdlib.h>
 
 #include <ac/ctype.h>
 #include <ac/signal.h>
 #include <lutil_md5.h>
 #include <lutil_sha1.h>
 
-#include "ldapconfig.h"
+#include "ldap_defaults.h"
 
 /* local macros */
 #define CEILING(x)     ((double)(x) > (int)(x) ? (int)(x) + 1 : (int)(x))
 
 #define LDAP_PASSWD_ATTRIB "userPassword"
-#define LDAP_PASSWD_CONF   DEFAULT_SYSCONFDIR DIRSEP "passwd.conf"
+#define LDAP_PASSWD_CONF   LDAP_SYSCONFDIR LDAP_DIRSEP "passwd.conf"
 
 #define HS_NONE  0
 #define HS_PLAIN 1
@@ -189,7 +190,7 @@ hash_crypt (const char *pw_in, Salt * salt)
                crypted_pw = crypt (pw_in, (char *)lsalt.salt);
                free (lsalt.salt);
        }
-       return (STRDUP (crypted_pw));
+       return (strdup (crypted_pw));
 }
 #endif
 
@@ -306,7 +307,7 @@ modify_dn (LDAP * ld, char *targetdn, char *pwattr, char *oldpw,
 
        strvals[0] = buf;
        strvals[1] = NULL;
-       mod.mod_vals.modv_strvals = strvals;
+       mod.mod_values = strvals;
        mod.mod_type = pwattr;
        mod.mod_op = LDAP_MOD_REPLACE;
        mods[0] = &mod;
@@ -513,6 +514,13 @@ main (int argc, char *argv[])
 
                case 'w':       /* bind password */
                        bindpw = strdup (optarg);
+                       {
+                               char* p;
+
+                               for( p = optarg; *p == '\0'; p++ ) {
+                                       *p = '*';
+                               }
+                       }
                        break;
 
                case 'Y':       /* salt length */
@@ -560,10 +568,10 @@ main (int argc, char *argv[])
        }
 
        if ( debug ) {
-               if( ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ) != LBER_OPT_ERROR ) {
+               if( ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &debug ) != LBER_OPT_SUCCESS ) {
                        fprintf( stderr, "Could not set LBER_OPT_DEBUG_LEVEL %d\n", debug );
                }
-               if( ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug ) != LDAP_OPT_ERROR ) {
+               if( ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &debug ) != LDAP_OPT_SUCCESS ) {
                        fprintf( stderr, "Could not set LDAP_OPT_DEBUG_LEVEL %d\n", debug );
                }
        }
@@ -596,12 +604,12 @@ main (int argc, char *argv[])
 
        /* set options */
        if (timelimit != -1 &&
-               ldap_set_option( ld, LDAP_OPT_TIMELIMIT, (void *) &timelimit ) == LDAP_OPT_ERROR )
+               ldap_set_option( ld, LDAP_OPT_TIMELIMIT, (void *) &timelimit ) != LDAP_OPT_SUCCESS )
        {
                fprintf( stderr, "Could not set LDAP_OPT_TIMELIMIT %d\n", timelimit );
        }
        if (sizelimit != -1 &&
-               ldap_set_option( ld, LDAP_OPT_SIZELIMIT, (void *) &sizelimit ) == LDAP_OPT_ERROR )
+               ldap_set_option( ld, LDAP_OPT_SIZELIMIT, (void *) &sizelimit ) != LDAP_OPT_SUCCESS )
        {
                fprintf( stderr, "Could not set LDAP_OPT_SIZELIMIT %d\n", sizelimit );
        }
@@ -613,7 +621,7 @@ main (int argc, char *argv[])
        }
 
        if (version != -1 &&
-               ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version ) == LDAP_OPT_ERROR)
+               ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &version ) != LDAP_OPT_SUCCESS )
        {
                fprintf( stderr, "Could not set LDAP_OPT_PROTOCOL_VERSION %d\n", version );
        }