- BerElement *ber;
-
- /* create a message to send */
- if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
- return( -1 );
- }
-
- if ( ber_printf( ber, "{it{ssbts}}",
- ++ld->ld_msgid,
- LDAP_REQ_MODRDN,
- dn,
- newrdn,
- deleteoldrdn,
- LDAP_TAG_NEWSUPERIOR,
- newSuperior )
- == -1 ) {
+ /* must be version 3 (or greater) */
+ if ( ld->ld_version < LDAP_VERSION3 ) {
+ ld->ld_errno = LDAP_NOT_SUPPORTED;
+ ber_free( ber, 1 );
+ return( ld->ld_errno );
+ }
+
+ rc = ber_printf( ber, "{it{ssbts}", /* '}' */
+ ++ld->ld_msgid, LDAP_REQ_MODDN,
+ dn, newrdn, (ber_int_t) deleteoldrdn,
+ LDAP_TAG_NEWSUPERIOR, newSuperior );
+
+ } else {
+ rc = ber_printf( ber, "{it{ssb}", /* '}' */
+ ++ld->ld_msgid, LDAP_REQ_MODDN,
+ dn, newrdn, (ber_int_t) deleteoldrdn );
+ }