From 5d5588836fa6e9ae734c098aa11f08d9cebb73e7 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sat, 4 Dec 1999 17:19:11 +0000 Subject: [PATCH] Fix ldap_rename parameter order (ITS#387) --- clients/tools/ldapmodrdn.c | 16 ++++++++-------- include/ldap.h | 12 ++++++------ libraries/libldap/modrdn.c | 31 ++++++++++++++++--------------- servers/slurpd/ldap_op.c | 2 +- 4 files changed, 31 insertions(+), 30 deletions(-) diff --git a/clients/tools/ldapmodrdn.c b/clients/tools/ldapmodrdn.c index 3bc2e3140d..0070011adf 100644 --- a/clients/tools/ldapmodrdn.c +++ b/clients/tools/ldapmodrdn.c @@ -38,12 +38,12 @@ static int ldapport = 0; static int not, verbose, contoper; static LDAP *ld; -static int domodrdn LDAP_P(( +static int domodrdn( LDAP *ld, char *dn, char *rdn, - int remove, /* flag: remove old RDN */ - char *newSuperior)); + char *newSuperior, + int remove ); /* flag: remove old RDN */ int main(int argc, char **argv) @@ -252,7 +252,7 @@ main(int argc, char **argv) rc = 0; if (havedn) - rc = domodrdn(ld, entrydn, rdn, remove, newSuperior); + rc = domodrdn( ld, entrydn, rdn, newSuperior, remove ); else while ((rc == 0 || contoper) && fgets(buf, sizeof(buf), fp) != NULL) { if ( *buf != '\0' ) { /* blank lines optional, skip */ buf[ strlen( buf ) - 1 ] = '\0'; /* remove nl */ @@ -262,7 +262,7 @@ main(int argc, char **argv) perror( "strdup" ); return( EXIT_FAILURE ); } - rc = domodrdn(ld, entrydn, rdn, remove, newSuperior); + rc = domodrdn(ld, entrydn, rdn, newSuperior, remove ); havedn = 0; } else if ( !havedn ) { /* don't have DN yet */ if (( entrydn = strdup( buf )) == NULL ) { @@ -284,8 +284,8 @@ static int domodrdn( LDAP *ld, char *dn, char *rdn, - int remove, /* flag: remove old RDN */ - char *newSuperior) + char *newSuperior, + int remove ) /* flag: remove old RDN */ { int i; @@ -299,7 +299,7 @@ static int domodrdn( } if ( !not ) { - i = ldap_rename2_s( ld, dn, rdn, remove, newSuperior ); + i = ldap_rename2_s( ld, dn, rdn, newSuperior, remove ); if ( i != LDAP_SUCCESS ) { ldap_perror( ld, "ldap_rename2_s" ); } else if ( verbose ) { diff --git a/include/ldap.h b/include/ldap.h index 7283d76ef2..f5b733f0fb 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -884,8 +884,8 @@ ldap_rename LDAP_P(( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *newrdn, - int deleteoldrdn, LDAP_CONST char *newSuperior, + int deleteoldrdn, LDAPControl **sctrls, LDAPControl **cctrls, int *msgidp )); @@ -895,8 +895,8 @@ ldap_rename_s LDAP_P(( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *newrdn, - int deleteoldrdn, LDAP_CONST char *newSuperior, + int deleteoldrdn, LDAPControl **sctrls, LDAPControl **cctrls )); @@ -926,16 +926,16 @@ ldap_rename2 LDAP_P(( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *newrdn, - int deleteoldrdn, - LDAP_CONST char *newSuperior )); + LDAP_CONST char *newSuperior, + int deleteoldrdn )); LIBLDAP_F( int ) ldap_rename2_s LDAP_P(( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *newrdn, - int deleteoldrdn, - LDAP_CONST char *newSuperior)); + LDAP_CONST char *newSuperior, + int deleteoldrdn )); LIBLDAP_F( int ) ldap_modrdn LDAP_P(( diff --git a/libraries/libldap/modrdn.c b/libraries/libldap/modrdn.c index 209ec4315a..6e6d9e6193 100644 --- a/libraries/libldap/modrdn.c +++ b/libraries/libldap/modrdn.c @@ -59,8 +59,8 @@ ldap_rename( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *newrdn, - int deleteoldrdn, LDAP_CONST char *newSuperior, + int deleteoldrdn, LDAPControl **sctrls, LDAPControl **cctrls, int *msgidp ) @@ -141,16 +141,16 @@ ldap_rename2( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *newrdn, - int deleteoldrdn, - LDAP_CONST char *newSuperior ) + LDAP_CONST char *newSuperior, + int deleteoldrdn ) { int msgid; int rc; Debug( LDAP_DEBUG_TRACE, "ldap_rename2\n", 0, 0, 0 ); - rc = ldap_rename( ld, dn, newrdn, deleteoldrdn, newSuperior, - NULL, NULL, &msgid ); + rc = ldap_rename( ld, dn, newrdn, newSuperior, + deleteoldrdn, NULL, NULL, &msgid ); return rc == LDAP_SUCCESS ? msgid : -1; } @@ -173,13 +173,13 @@ ldap_modrdn2( LDAP *ld, LDAP_CONST char *newrdn, int deleteoldrdn ) { - return ldap_rename2( ld, dn, newrdn, deleteoldrdn, NULL ); + return ldap_rename2( ld, dn, newrdn, NULL, deleteoldrdn ); } int ldap_modrdn( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *newrdn ) { - return( ldap_rename2( ld, dn, newrdn, 1, NULL ) ); + return( ldap_rename2( ld, dn, newrdn, NULL, 1 ) ); } @@ -188,8 +188,8 @@ ldap_rename_s( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *newrdn, - int deleteoldrdn, LDAP_CONST char *newSuperior, + int deleteoldrdn, LDAPControl **sctrls, LDAPControl **cctrls ) { @@ -197,8 +197,8 @@ ldap_rename_s( int msgid; LDAPMessage *res; - rc = ldap_rename( ld, dn, newrdn, deleteoldrdn, - newSuperior, sctrls, cctrls, &msgid ); + rc = ldap_rename( ld, dn, newrdn, newSuperior, + deleteoldrdn, sctrls, cctrls, &msgid ); if( rc != LDAP_SUCCESS ) { return rc; @@ -218,21 +218,22 @@ ldap_rename2_s( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *newrdn, - int deleteoldrdn, - LDAP_CONST char *newSuperior ) + LDAP_CONST char *newSuperior, + int deleteoldrdn ) { - return ldap_rename_s( ld, dn, newrdn, deleteoldrdn, newSuperior, NULL, NULL ); + return ldap_rename_s( ld, dn, newrdn, newSuperior, + deleteoldrdn, NULL, NULL ); } int ldap_modrdn2_s( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *newrdn, int deleteoldrdn ) { - return ldap_rename_s( ld, dn, newrdn, deleteoldrdn, NULL, NULL, NULL ); + return ldap_rename_s( ld, dn, newrdn, NULL, deleteoldrdn, NULL, NULL ); } int ldap_modrdn_s( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *newrdn ) { - return ldap_rename_s( ld, dn, newrdn, 1, NULL, NULL, NULL ); + return ldap_rename_s( ld, dn, newrdn, NULL, 1, NULL, NULL ); } diff --git a/servers/slurpd/ldap_op.c b/servers/slurpd/ldap_op.c index a6873045da..4c75947010 100644 --- a/servers/slurpd/ldap_op.c +++ b/servers/slurpd/ldap_op.c @@ -471,7 +471,7 @@ op_ldap_modrdn( #endif /* LDAP_DEBUG */ /* Do the modrdn */ - rc = ldap_rename2_s( ri->ri_ldp, re->re_dn, mi->mi_val, drdnflag, newsup ); + rc = ldap_rename2_s( ri->ri_ldp, re->re_dn, mi->mi_val, newsup, drdnflag ); ldap_get_option( ri->ri_ldp, LDAP_OPT_ERROR_NUMBER, &lderr); return( lderr ); -- 2.39.5