summaryrefslogtreecommitdiff
path: root/FS/FS
diff options
context:
space:
mode:
authorivan <ivan>2002-11-22 07:50:23 +0000
committerivan <ivan>2002-11-22 07:50:23 +0000
commit7a94fd2dd84ccb204e97e8cbd9ce4162e93fd12e (patch)
tree0741836ce91aaa4d3f46090949bb290424a3df8d /FS/FS
parent66c7798152b9abecd00727d4814af5c10bcc84b3 (diff)
separate root and user dn in ldap export
Diffstat (limited to 'FS/FS')
-rw-r--r--FS/FS/part_export.pm3
-rw-r--r--FS/FS/part_export/ldap.pm10
2 files changed, 8 insertions, 5 deletions
diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm
index 8e8a828..4b15f44 100644
--- a/FS/FS/part_export.pm
+++ b/FS/FS/part_export.pm
@@ -726,7 +726,8 @@ tie my %sqlmail_options, 'Tie::IxHash',
tie my %ldap_options, 'Tie::IxHash',
'dn' => { label=>'Root DN' },
- 'password' => { label=>'Optional DN password' },
+ 'password' => { label=>'Root DN password' },
+ 'userdn' => { label=>'User DN' },
'attributes' => { label=>'Attributes',
type=>'textarea',
default=>join("\n",
diff --git a/FS/FS/part_export/ldap.pm b/FS/FS/part_export/ldap.pm
index a285043..68a6352 100644
--- a/FS/FS/part_export/ldap.pm
+++ b/FS/FS/part_export/ldap.pm
@@ -201,21 +201,23 @@ sub ldap_queue {
$self->machine,
$self->option('dn'),
$self->option('password'),
+ $self->option('userdn'),
@_,
) or $queue;
}
sub ldap_insert { #subroutine, not method
- my $ldap = ldap_connect(shift, (my $dn = shift), shift);
- my( $username_attrib, %attrib ) = @_;
+ my $ldap = ldap_connect(shift, shift, shift);
+ my( $userdn, $username_attrib, %attrib ) = @_;
- $dn = "$username_attrib=$attrib{$username_attrib}, $dn" if $username_attrib;
+ $userdn = "$username_attrib=$attrib{$username_attrib}, $userdn"
+ if $username_attrib;
#icky hack, but should be unsurprising to the LDAPers
foreach my $key ( grep { $attrib{$_} =~ /,/ } keys %attrib ) {
$attrib{$key} = [ split(/,/, $attrib{$key}) ];
}
- my $status = $ldap->add( $dn, attrs => [ %attrib ] );
+ my $status = $ldap->add( $userdn, attrs => [ %attrib ] );
die $status->error if $status->is_error;
$ldap->unbind;