/* $OpenLDAP$ */
/*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
/* ldapmodrdn.c - generic program to modify an entry's RDN using LDAP.
#include <ac/unistd.h>
#include <ldap.h>
+#include "lutil.h"
#include "lutil_ldap.h"
#include "ldap_defaults.h"
" -k use Kerberos authentication\n"
" -K like -k, but do only step 1 of the Kerberos bind\n"
" -M enable Manage DSA IT control (-MM to make critical)\n"
-" -n show what would be done but don't actually search\n"
+" -n show what would be done but don't actually update\n"
" -O props SASL security properties\n"
" -p port port on LDAP server\n"
" -P version procotol version (default: 3)\n"
authmethod = -1;
version = -1;
- prog = (prog = strrchr(argv[0], *LDAP_DIRSEP)) == NULL ? argv[0] : prog + 1;
+ prog = lutil_progname( "ldapmodrdn", argc, argv );
while (( i = getopt( argc, argv, "cf:rs:"
"Cd:D:h:H:IkKMnO:p:P:QR:U:vw:WxX:Y:Z" )) != EOF )
default:
fprintf( stderr, "%s: unrecognized option -%c\n",
prog, optopt );
- usage( argv[0] );
+ usage( prog );
return( EXIT_FAILURE );
}
}
} else if ( argc - optind != 0 ) {
fprintf( stderr, "%s: invalid number of arguments (%d), "
"only two allowed\n", prog, argc-optind );
- usage( argv[0] );
+ usage( prog );
return( EXIT_FAILURE );
}
ld = ldap_init( ldaphost, ldapport );
if( ld == NULL ) {
- perror("ldapsearch: ldap_init");
+ perror("ldapmodify: ldap_init");
return EXIT_FAILURE;
}
return EXIT_FAILURE;
}
- if ( use_tls && ldap_start_tls_s( ld, NULL, NULL ) != LDAP_SUCCESS ) {
+ if ( use_tls && ( ldap_start_tls_s( ld, NULL, NULL ) != LDAP_SUCCESS )) {
ldap_perror( ld, "ldap_start_tls" );
if ( use_tls > 1 ) {
return( EXIT_FAILURE );
}
#else
fprintf( stderr, "%s: not compiled with SASL support\n",
- argv[0] );
+ prog );
return( EXIT_FAILURE );
#endif
}