summaryrefslogtreecommitdiffstats
path: root/ldap_wizard/ldapdef.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2004-08-11 06:45:19 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2004-08-11 06:45:19 +0000
commita498ed71ed0b041723508836a455464e624f5d5f (patch)
treea56a1c55b05f9b936865dace578a26883aafdc52 /ldap_wizard/ldapdef.pm
parent57af37b5bafec6faac52b780f4908e77c44c82b8 (diff)
downloaddrakwizard-a498ed71ed0b041723508836a455464e624f5d5f.tar
drakwizard-a498ed71ed0b041723508836a455464e624f5d5f.tar.gz
drakwizard-a498ed71ed0b041723508836a455464e624f5d5f.tar.bz2
drakwizard-a498ed71ed0b041723508836a455464e624f5d5f.tar.xz
drakwizard-a498ed71ed0b041723508836a455464e624f5d5f.zip
perl_checker fixes
Diffstat (limited to 'ldap_wizard/ldapdef.pm')
-rw-r--r--ldap_wizard/ldapdef.pm40
1 files changed, 19 insertions, 21 deletions
diff --git a/ldap_wizard/ldapdef.pm b/ldap_wizard/ldapdef.pm
index 3d44005b..c68e2eb7 100644
--- a/ldap_wizard/ldapdef.pm
+++ b/ldap_wizard/ldapdef.pm
@@ -91,30 +91,29 @@ if (-f $conf_file) {
}
# Connect to Ldap server
-sub ldap_connect {
-
- my $cnx= Net::LDAP->new($o->{var}{srv}) or die "Impossible de se connecter au server";
+sub ldap_connect() {
+ Net::LDAP->new($o->{var}{srv}) or die "Impossible de se connecter au server";
}
# bind root
-sub root_bind{
+sub root_bind {
my ($ldap) = @_;
- #my $mesg=$ldap->bind(dn =>"cn=".$o->{var}{rootdn}.",".$o->{var}{suffix},password =>$o->{var}{rootpass});
- my $mesg=$ldap->bind(dn =>$o->{var}{rootdn},password =>$o->{var}{rootpass});
+ #my $mesg=$ldap->bind(dn => "cn=" . $o->{var}{rootdn} . "," . $o->{var}{suffix}, password => $o->{var}{rootpass});
+ my $mesg=$ldap->bind(dn => $o->{var}{rootdn},password => $o->{var}{rootpass});
print ldap_error_text($mesg->code);
return $mesg->code;
}
-sub anonymous_bind{
+sub anonymous_bind {
my ($ds) = @_;
my $mesg=$ds->bind;
return $mesg->code;
}
-sub ldap_search{
- my ($ds,$filter,$basedn) = @_;
- my $attrs =['objectClass'];
+sub ldap_search {
+ my ($ds, $filter, $basedn) = @_;
+ my $attrs = ['objectClass'];
my $mesg = $ds->search(
base => $basedn,
filter => $filter,
@@ -123,11 +122,11 @@ sub ldap_search{
);
my $href = $mesg->as_struct;
print("Results of the query\n");
- print "$href";
+ print $href;
}
-sub get_dn{
- my ($ds,$filter,$basedn,$attrs) = @_;
+sub get_dn {
+ my ($ds, $filter, $basedn, $_attrs) = @_;
my $mesg = $ds->search(
base => $basedn,
filter => $filter,
@@ -141,16 +140,15 @@ sub get_dn{
return $mesg
}
-sub get_dse {
-
+sub get_dse() {
my $ldap = ldap_connect();
- my $result = get_dn($ldap,"(objectclass=organization)","$cfg{'base'}");
+ my $result = get_dn($ldap, "(objectclass=organization)", $cfg{base});
my @arrayOfDNs = $result->entries;
#my %ldap = ();
foreach my $dn_value (@arrayOfDNs)
{
my $orga = $dn_value->dn;
- $ldap{'orga'} = $orga;
+ $ldap{orga} = $orga;
}
return %ldap;
}
@@ -162,7 +160,7 @@ sub add_user {
my $result = $ldap->add(
"uid=$u->{var}{uid},$u->{var}{defou},$u->{var}{suffix}",
attr => [
- objectclass => ["top","posixAccount","inetOrgPerson","shadowAccount"],
+ objectclass => ["top", "posixAccount", "inetOrgPerson", "shadowAccount"],
sn => $u->{var}{sn},
uid => $u->{var}{uid},
cn => $u->{var}{cn},
@@ -189,11 +187,11 @@ sub modif_krb5 {
my $result = $ldap->modify(
"uid=$u->{var}{uid},$u->{var}{defou},$u->{var}{suffix}",
changes => [
- replace => [objectClass => ['inetOrgPerson', 'posixAccount', 'shadowAccount','krb5Principal']],
- replace => [ userPassword => 'EROS '],
+ replace => [ objectClass => [ 'inetOrgPerson', 'posixAccount', 'shadowAccount', 'krb5Principal' ] ],
+ replace => [ userPassword => 'EROS ' ],
add => [krb5PrincipalName => $u->{var}{uid}],
]
);
- $result->code && die "failed to add entry: ", $result->error ;
+ $result->code and die "failed to add entry: ", $result->error;
return 1;
}