Brian,
What you really want is:
$del_msg = $ldap->modify( $dn,
changes => [
# delete old value
delete => [ SFTrule => [ "$old_value" ] ],
# add new value
add => [ SFTrule => [ "$new_value" ] ]
]
);
Why do both the add and delete in a single modify? So that it is treated as an
atom and if EITHER fails, NEITHER happens (which is the creed -- "at the very
least, do no harm")
This is straight out of the perl-ldap documentation, have you read it?
- Frank
On Apr 25, 2013, at 12:56 PM, Brian Gaber <[email protected]> wrote:
> Or should the syntax be:
>
> $del_mesg = $ldap->modify( $dn,
> delete => {
> SFTrule => [
> "$value" # Remove only this SFTrule value
> ],
> }
> );
>
> This produces a LDAP Error Code: 16 - modify/delete: SFTrule: no such value
>
> -----Original Message-----
> From: Brian Gaber [mailto:[email protected]]
> Sent: Thursday, April 25, 2013 12:33 PM
> To: 'Francis Swasey'
> Cc: [email protected]
> Subject: RE: Modify only one attribute that has multiple values of the same
> name
>
> Would this be the correct Net::LDAP syntax to delete the particular
> multivalued attribute?
>
> $del_mesg = $ldap->modify( $dn,
> delete => {
> member => [
> "SFTrule=$value" # Remove only this member
> ],
> }
> );
>
> I ask because I am getting this error:
>
> LDAP Error Code: 21 - member: value #0 invalid per syntax
>
> Thanks.
>
> -----Original Message-----
> From: Francis Swasey [mailto:[email protected]]
> Sent: Thursday, April 25, 2013 12:04 PM
> To: Brian Gaber
> Cc: [email protected]
> Subject: Re: Modify only one attribute that has multiple values of the same
> name
>
> On Apr 25, 2013, at 11:57 AM, Brian Gaber <[email protected]> wrote:
>
>> I have a LDAP object that contains an attribute SFTrule that can have
>> multiple values. How do I change just one of the SFTrule attribute values?
>
>
> In pure ldif:
>
> dn: existing dn
> changetype: modify
> delete: SFTrule
> SFTrule: old value
> -
> add: SFTrule
> SFTrule: new value
> -