summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2004-07-27 10:40:40 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2004-07-27 10:40:40 +0000
commit61ab0df24705d679a32d2f738c59d2e85d7ab437 (patch)
tree248eb48535bf2a24338869f9cccba77618059b10
parentd3a6f64464c54bda502eadd726f070c6234e6975 (diff)
downloaddrakwizard-61ab0df24705d679a32d2f738c59d2e85d7ab437.tar
drakwizard-61ab0df24705d679a32d2f738c59d2e85d7ab437.tar.gz
drakwizard-61ab0df24705d679a32d2f738c59d2e85d7ab437.tar.bz2
drakwizard-61ab0df24705d679a32d2f738c59d2e85d7ab437.tar.xz
drakwizard-61ab0df24705d679a32d2f738c59d2e85d7ab437.zip
perl_checker cleanups
-rw-r--r--ldap_wizard/ldap.pm53
1 files changed, 26 insertions, 27 deletions
diff --git a/ldap_wizard/ldap.pm b/ldap_wizard/ldap.pm
index ccf1a88a..624124db 100644
--- a/ldap_wizard/ldap.pm
+++ b/ldap_wizard/ldap.pm
@@ -54,8 +54,8 @@ name => N("Add POSIX account"),
-my $ldap_suffix=join(',dc=',split(/\./,`hostname -f`));
-$ldap_suffix=~ s/[^,]*,//;
+my $ldap_suffix=join(',dc=', split(/\./, `hostname -f`));
+$ldap_suffix =~ s/[^,]*,//;
my $conf_file = "/etc/sysconfig/ldapconf";
my $LDAPCONF = "/etc/openldap/slapd.conf";
@@ -67,11 +67,11 @@ $o->{var}{srv} = $hostname;
if (-f $conf_file) {
my %conf = getVarsFromSh($conf_file);
- $o->{var}{suffix}= "$conf{suffix}";
- $o->{var}{rootdn}= "$conf{rootdn}";
- $o->{var}{rootpass}= "$conf{rootpass}";
- $o->{var}{srv}= "$conf{srv}";
- $o->{var}{defou}= "$conf{users}";
+ $o->{var}{suffix} = $conf{suffix};
+ $o->{var}{rootdn} = $conf{rootdn};
+ $o->{var}{rootpass} = $conf{rootpass};
+ $o->{var}{srv} = $conf{srv};
+ $o->{var}{defou} = $conf{users};
} else {
@@ -87,8 +87,6 @@ my %level = (
2 => N("Add - Add user in LDAP server"),
);
-my $cn;
-
$o->{pages} = {
welcome => {
name => N("LDAP configuration wizard") . "\n\n" . N("Setup a LDAP server."),
@@ -103,7 +101,7 @@ $o->{pages} = {
},
data => [
{
- label => N("Your choice:"). "\n\n" , val => \$o->{var}{wiz_level}, type => 'list', list => [ keys %level ], format => sub { $level{$_[0]} } },
+ label => N("Your choice:") . "\n\n", val => \$o->{var}{wiz_level}, type => 'list', list => [ keys %level ], format => sub { $level{$_[0]} } },
],
next => 'set_srv',
},
@@ -123,12 +121,12 @@ $o->{pages} = {
{ label => N("Password (again):"), val => \$o->{var}{uidpass2}, hidden => 1 },
],
complete => sub {
- if (not ($o->{var}{uidpass}))
+ if (!$o->{var}{uidpass})
{
$::in->ask_warn(N("Error"), N("You must enter a password for LDAP."));
return 1;
}
- if (not ($o->{var}{uidpass} eq $o->{var}{uidpass2}))
+ if (!($o->{var}{uidpass} eq $o->{var}{uidpass2}))
{
$::in->ask_warn(N("Error"), N("The passwords do not match"));
return 1;
@@ -147,17 +145,17 @@ $o->{pages} = {
{ label => N("LDAP Password (again):"), hidden => 1, val => \$o->{var}{rootpass2} },
],
complete => sub {
- if (not ($o->{var}{suffix}))
+ if (!$o->{var}{suffix})
{
$::in->ask_warn(N("Error"), N("You must enter a suffix for LDAP."));
return 1;
}
- if (not ($o->{var}{rootpass}))
+ if (!$o->{var}{rootpass})
{
$::in->ask_warn(N("Error"), N("You must enter a password for LDAP."));
return 1;
}
- if (not ($o->{var}{rootpass} eq $o->{var}{rootpass2}))
+ if (!($o->{var}{rootpass} eq $o->{var}{rootpass2}))
{
$::in->ask_warn(N("Error"), N("The passwords do not match"));
return 1;
@@ -202,7 +200,7 @@ $o->{pages} = {
};
sub do_it_setldap {
- if (!-f $LDAPCONF) { die "no $LDAPCONF found"};
+ if (!-f $LDAPCONF) { die "no $LDAPCONF found" };
cp_af($LDAPCONF, $LDAPCONF . '.save');
if (!-f "$LDAPCONF.example") { cp_af($LDAPCONF, $LDAPCONF . '.example') };
cp_af($LDAPCONF . '.example', $LDAPCONF);
@@ -210,10 +208,10 @@ sub do_it_setldap {
# set suffix
if (any { /^suffix/ } cat_($LDAPCONF)) {
substInFile {
- s/suffix.*/suffix\t\"$o->{var}{suffix}\"/;
+ s/suffix.*/suffix\t"$o->{var}{suffix}"/;
} $LDAPCONF;
} else {
- append_to_file($LDAPCONF, "suffix\t\"$o->{var}{suffix}\"");
+ append_to_file($LDAPCONF, qq(suffix\t"$o->{var}{suffix}"));
}
# s/example/$dcall
@@ -224,10 +222,10 @@ sub do_it_setldap {
# set rootdn
if (any { /^rootdn/ } cat_($LDAPCONF)) {
substInFile {
- s/rootdn.*/rootdn\t\"cn=$o->{var}{rootdn},$o->{var}{suffix}\"/;
+ s/rootdn.*/rootdn\t"cn=$o->{var}{rootdn},$o->{var}{suffix}"/;
} $LDAPCONF;
} else {
- append_to_file($LDAPCONF, "rootdn\t\"$o->{var}{rootdn},$o->{var}{suffix}\"");
+ append_to_file($LDAPCONF, qq(rootdn\t"$o->{var}{rootdn},$o->{var}{suffix}"));
}
# set rootpass
@@ -237,7 +235,7 @@ sub do_it_setldap {
#s/rootpw.*/rootpw $cryptpass/;
s/rootpw.*/rootpw $o->{var}{rootpass}/;
} $LDAPCONF;
- }else {
+ } else {
#append_to_file($LDAPCONF, "rootpw {CRYPT}$cryptpass");
append_to_file($LDAPCONF, "rootpw $o->{var}{rootpass}");
}
@@ -262,12 +260,13 @@ EOF
sub init_ldap {
-my $root_cn=(split(/\=/,(split(/,/,$o->{var}{rootdn}))[0]))[1];
-my $ldap_dc=(split(/\=/,(split(/,/,$o->{var}{suffix}))[0]))[1];
+my $root_cn = (split('=', (split(/,/, $o->{var}{rootdn}))[0]))[1];
+my $ldap_dc = (split('=', (split(/,/, $o->{var}{suffix}))[0]))[1];
-open(LDAP,"| ldapadd -x -D 'cn=$o->{var}{rootdn},$o->{var}{suffix}' -w $o->{var}{rootpass}");
+ my $LDAP;
+ open($LDAP, "| ldapadd -x -D 'cn=$o->{var}{rootdn},$o->{var}{suffix}' -w $o->{var}{rootpass}");
-print LDAP << "RootLdif";
+ print $LDAP <<RootLdif;
dn: $o->{var}{suffix}
dc: $ldap_dc
objectClass: dcObject
@@ -299,7 +298,7 @@ objectClass: organizationalUnit
RootLdif
-close(LDAP)
+ close($LDAP)
}
@@ -312,7 +311,7 @@ sub do_it_user_add {
}
sub new {
- my ($class, $conf) = @_;
+ my ($class) = @_;
bless {
o => $o,
}, $class;