Closed Bug 3343 Opened 26 years ago Closed 26 years ago

inconsistant treatment of $self->{"_self_obj_"} in Entry.pm

Categories

(Directory :: PerLDAP, defect, P1)

All
Solaris
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: leif, Assigned: leif)

Details

From: Brett Lemoine <bl@incyte.com> While attempting to fix the removeValue followed by either addValue or setValue problem, I noticed that some of the stuff under $self->{"_self_obj"} wasn't being treated consistantly. The following patch includes both the fix to addValue and setValue as well as always going through _self_obj_ when dealing with: _${attr}_modified_ _${attr}_deleted_ _${attr}_save_ _oc_order_ _oc_numattr_ --- Entry.pm.bak Thu Jan 21 15:52:42 1999 +++ Entry.pm Fri Feb 12 09:48:42 1999 @@ -233,7 +233,7 @@ return 0 unless (defined($attr) && ($attr ne "")); return 0 unless defined($self->{$attr}); - return 0 if $self->{"_${attr}_deleted_"}; + return 0 if $self->{"_self_obj_"}->{"_${attr}_deleted_"}; return ($attr !~ /^_.+_$/); } @@ -270,10 +270,10 @@ return 0 unless defined($self->{$attr}); undef $self->{"_self_obj_"}->{"_${attr}_deleted_"}; - if (defined $self->{"_${attr}_save_"}) + if (defined $self->{"_self_obj_"}->{"_${attr}_save_"}) { - @{$self->{$attr}} = @{$self->{"_${attr}_save_"}}; - undef @{$selfl->{"_${key}_save_"}}; + @{$self->{$attr}} = @{$self->{"_self_obj_"}->{"_${attr}_save_"}}; + undef @{$selfl->{"_self_obj_"}->{"_${key}_save_"}}; } return 1; @@ -298,8 +298,8 @@ return 0 unless defined($self->{$attr}); $val = normalizeDN($val) if (defined($norm) && $norm); - @{$self->{"_${attr}_save_"}} = @{$self->{$attr}} unless - defined $self->{"_${attr}_save_"}; + @{$self->{"_self_obj_"}->{"_${attr}_save_"}} = @{$self->{$attr}} unless + defined $self->{"_self_obj_"}->{"_${attr}_save_"}; foreach (@{$self->{$attr}}) { @@ -367,20 +367,24 @@ if (defined($self->{$attr})) { - @{$self->{"_${attr}_save_"}} = @{$self->{$attr}} - unless $self->{"_${attr}_save_"}; + @{$self->{"_self_obj_"}->{"_${attr}_save_"}} = @{$self->{$attr}} + unless $self->{"_self_obj_"}->{"_${attr}_save_"}; } $self->{"_self_obj_"}->{"_${attr}_modified_"} = 1; push(@{$self->{$attr}}, $val); # Potentially add the attribute to the OC order list. - if (($attr ne "dn") && !grep(/^$attr$/i, @{$self->{"_oc_order_"}})) + if (($attr ne "dn") && !grep(/^$attr$/i, @{$self->{"_self_obj_"}->{"_oc_order_"}})) { - push(@{$self->{"_oc_order_"}}, $attr); - $self->{"_oc_numattr_"}++; + push(@{$self->{"_self_obj_"}->{"_oc_order_"}}, $attr); + $self->{"_self_obj_"}->{"_oc_numattr_"}++; } + # If this attribute was set as 'deleted', it should no longer be + delete $self->{"_self_obj_"}->{"_${attr}_deleted_"} + if ( $self->{"_self_obj_"}->{"_${attr}_deleted_"} == 1 ); + return 1; } @@ -416,6 +420,11 @@ return 0 unless (defined($attr) && ($attr ne "")); $self->{$attr} = [@vals]; + + # If this attribute was set as 'deleted', it should no longer be + delete $self->{"_self_obj_"}->{"_${attr}_deleted_"} + if ( $self->{"_self_obj_"}->{"_${attr}_deleted_"} == 1 ); + return 1; } @@ -579,10 +588,10 @@ my $attr; print "dn: ", $self->getDN(),"\n"; - foreach $attr (@{$self->{"_oc_order_"}}) + foreach $attr (@{$self->{"_self_obj_"}->{"_oc_order_"}}) { next if ($attr =~ /^_.+_$/); - next if $self->{"_${attr}_deleted_"}; + next if $self->{"_self_obj_"}->{"_${attr}_deleted_"}; grep((print "$attr: $_\n"), @{$self->{$attr}}); }
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Fixed where appropriate. Note that we don't use the "direct" access of the _self_obj_ for reading attribute values, only when modifying them. Update both Conn.pm and Entry.pm to make this consistent.
You need to log in before you can comment on or make changes to this bug.