1
# Copyright (c) 1998 Graham Barr <gbarr@pobox.com>. All rights reserved.
2
# This program is free software; you can redistribute it and/or
3
# modify it under the same terms as Perl itself.
12
use URI::Escape qw(uri_unescape);
17
my $query = $self->query;
18
my @bits = (split(/\?/,defined($query) ? $query : ""),("")x4);
19
my $old = $bits[$elem];
25
$query = join("?",@bits);
27
$query = undef unless length($query);
35
my $old = shift->path(@_);
42
my $old = _ldap_elem($self,0, @_ ? join(",", map { my $tmp = $_; $tmp =~ s/,/%2C/g; $tmp } @_) : ());
43
return $old unless wantarray;
44
map { uri_unescape($_) } split(/,/,$old);
49
my $old = _ldap_elem($self,1, @_);
50
return unless defined wantarray && defined $old;
56
$old = "base" unless length $old;
62
my $old = _ldap_elem($self,2, @_);
63
return unless defined wantarray && defined $old;
64
uri_unescape($old); # || "(objectClass=*)";
69
$old = "(objectClass=*)" unless length $old;
79
push(@ext, join("=", map { $_="" unless defined; s/,/%2C/g; $_ } $key, $value));
81
@ext = join(",", @ext) if @ext;
82
my $old = _ldap_elem($self,3, @ext);
83
return $old unless wantarray;
84
map { uri_unescape($_) } map { /^([^=]+)=(.*)$/ } split(/,/,$old);
90
my $other = $self->_nonldap_canonical;
92
# The stuff below is not as efficient as one might hope...
94
$other = $other->clone if $other == $self;
96
$other->dn(_normalize_dn($other->dn));
98
# Should really know about mixed case "postalAddress", etc...
99
$other->attributes(map lc, $other->attributes);
101
# Lowecase scope, remove default
102
my $old_scope = $other->scope;
103
my $new_scope = lc($old_scope);
104
$new_scope = "" if $new_scope eq "base";
105
$other->scope($new_scope) if $new_scope ne $old_scope;
107
# Remove filter if default
108
my $old_filter = $other->filter;
109
$other->filter("") if lc($old_filter) eq "(objectclass=*)" ||
110
lc($old_filter) eq "objectclass=*";
112
# Lowercase extensions types and deal with known extension values
113
my @ext = $other->extensions;
114
for (my $i = 0; $i < @ext; $i += 2) {
115
my $etype = $ext[$i] = lc($ext[$i]);
116
if ($etype =~ /^!?bindname$/) {
117
$ext[$i+1] = _normalize_dn($ext[$i+1]);
120
$other->extensions(@ext) if @ext;
125
sub _normalize_dn # RFC 2253
130
# The code below will fail if the "+" or "," is embedding in a quoted
131
# string or simply escaped...
133
my @dn = split(/([+,])/, $dn);
135
s/^([a-zA-Z]+=)/lc($1)/e;