hi,

i'm trying to do an ldap_add operation using openldap client lib against
ActiveDirectory on MAC I want to be able to roll back this add operation so
I'm using transactions like this

    int rc = ldap_add_ext_s(ld, [userDN cStringUsingEncoding:
NSUTF8StringEncoding], mods, hcdTC_new, NULL );

    hcdTransactionId.ldctl_value.bv_val = (hcdTC_new[0])->ldctl_value.bv_val
;

    hcdTransactionId.ldctl_value.bv_len = (hcdTC_new[0])->ldctl_value.bv_len
;

when I try to rollback

        rc = ldap_add_ext_s(ld, [userDN cStringUsingEncoding:
NSUTF8StringEncoding], mods, hcdTC_rollback, NULL );;

it says user already exists which means it created the user without my
having to commit the transaction, how can I rollback and ldap add operation

here are the definitions of variables

static LDAPControl hcdTransactionControl_new =

{

    "1.3.18.0.2.10.3",  /* -- hcdTransactionControl -- */

    { 3, "\x4E\x45\x57\x00" }, /* -- NEW ------------- */

    '\0'         /* -- critical --------------- */

} ;

static LDAPControl *hcdTC_new[2] = {  &hcdTransactionControl_new, NULL };



static LDAPControl hcdTransactionId =

{

    "1.3.18.0.2.10.4",  /* -- hcdTransactionId ------ */

    { 1, "\x31\x00" },  /* -- TXN Id ---------------- */

    '\0'         /* -- critical -------------- */

};

static LDAPControl *hcdTC_Id[2] = { &hcdTransactionId, NULL };



static LDAPControl hcdTransactionControl_commit =

{

    "1.3.18.0.2.10.3",    /* -- hcdTransactionControl -- */

    { 6, "\x43\x4F\x4D\x4D\x49\x54\x00" },/* - COMMIT -- */

    '\0'           /* -- critical --------------- */

};

static LDAPControl *hcdTC_commit[3] = { &hcdTransactionControl_commit, &
hcdTransactionId, NULL };



static LDAPControl hcdTransaction_rollback =

{

    "1.3.18.0.2.10.3",    /* -- hcdTransactionControl -- */

    { 8, "\x52\x4F\x4C\x4C\x42\x41\x43\x4B\x00" }, /*ROLLBACK*/

    '\0'           /* -- critical --------------- */

};


static LDAPControl *hcdTC_rollback[3] = { &hcdTransaction_rollback, &
hcdTransactionId, NULL };

Reply via email to