/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2005 The OpenLDAP Foundation.
+ * Copyright 1998-2006 The OpenLDAP Foundation.
* Portions Copyright 1998-2003 Kurt D. Zeilenga.
* Portions Copyright 1998-2001 Net Boolean Incorporated.
* Portions Copyright 2001-2003 IBM Corporation.
main( int argc, char **argv )
{
#ifdef LDAP_GROUP_TRANSACTION
- BerElement *txnber;
- struct berval txnCookie = { 0, NULL };
+ BerElement *txnber;
+ struct berval txnCookie = { 0, NULL };
#endif
char *rbuf, *start, *rejbuf = NULL;
FILE *fp, *rejfp;
char *matched_msg, *error_msg;
int rc, retval;
- int count, len;
+ int count, len;
+ int i = 0;
+ LDAPControl c[1];
+
- tool_init();
prog = lutil_progname( "ldapmodify", argc, argv );
/* strncmp instead of strcmp since NT binaries carry .exe extension */
ldapadd = ( strncasecmp( prog, "ldapadd", sizeof("ldapadd")-1 ) == 0 );
+ tool_init( ldapadd ? TOOL_ADD : TOOL_MODIFY );
+
tool_args( argc, argv );
if ( argc != optind ) usage();
if ( debug ) ldif_debug = debug;
- ld = tool_conn_setup( not, 0 );
+ ld = tool_conn_setup( dont, 0 );
- if ( !not ) {
+ if ( !dont ) {
if ( pw_file || want_bindpw ) {
if ( pw_file ) {
rc = lutil_get_filed_password( pw_file, &passwd );
}
#endif
- if ( assertion || authzid || manageDIT || manageDSAit || noop
+ if ( 0
#ifdef LDAP_GROUP_TRANSACTION
|| txn
#endif
- || preread || postread )
+ )
{
- int i = 0;
- LDAPControl c[1];
-
#ifdef LDAP_GROUP_TRANSACTION
if( txn ) {
int err;
i++;
}
#endif
-
- tool_server_controls( ld, c, i );
}
+ tool_server_controls( ld, c, i );
+
rc = 0;
count = 0;
retval = 0;
}
#endif
- if ( !not ) {
+ if ( !dont ) {
tool_unbind( ld );
}
}
if ( newentry ) {
- printf( "%sadding new entry \"%s\"\n", not ? "!" : "", dn );
+ printf( "%sadding new entry \"%s\"\n", dont ? "!" : "", dn );
} else {
- printf( "%smodifying entry \"%s\"\n", not ? "!" : "", dn );
+ printf( "%smodifying entry \"%s\"\n", dont ? "!" : "", dn );
}
- if ( !not ) {
+ if ( !dont ) {
int msgid;
if ( newentry ) {
rc = ldap_add_ext( ld, dn, pmods, pctrls, NULL, &msgid );
int rc;
int msgid;
- printf( _("%sdeleting entry \"%s\"\n"), not ? "!" : "", dn );
- if ( !not ) {
+ printf( _("%sdeleting entry \"%s\"\n"), dont ? "!" : "", dn );
+ if ( !dont ) {
rc = ldap_delete_ext( ld, dn, pctrls, NULL, &msgid );
if ( rc != LDAP_SUCCESS ) {
fprintf( stderr, _("%s: delete failed: %s\n"), prog, dn );
int rc;
int msgid;
- printf( _("%smodifying rdn of entry \"%s\"\n"), not ? "!" : "", dn );
+ printf( _("%smodifying rdn of entry \"%s\"\n"), dont ? "!" : "", dn );
if ( verbose ) {
printf( _("\tnew RDN: \"%s\" (%skeep existing values)\n"),
newrdn, deleteoldrdn ? _("do not ") : "" );
}
- if ( !not ) {
+ if ( !dont ) {
rc = ldap_rename( ld, dn, newrdn, newsup, deleteoldrdn,
pctrls, NULL, &msgid );
if ( rc != LDAP_SUCCESS ) {
rc = ldap_result( ld, msgid,
#ifdef LDAP_GROUP_TRANSACTION
- txn ? 0 : 1,
+ txn ? LDAP_MSG_ONE : LDAP_MSG_ALL,
#else
- 1,
+ LDAP_MSG_ALL,
#endif
&tv, &res );
if ( tool_check_abandon( ld, msgid ) ) {