Commit f138fbac authored by Nigel Kukard's avatar Nigel Kukard

Better prompt handling and kwallet fallback

parent cfc438dc
......@@ -257,9 +257,9 @@ Set the LDAP server base DN to use, for example C<dc=example,dc=com>.
=cut
$iniSetup{server} = {};
$iniSetup{server}{uri} = prompt("Your LDAP URI : ");
$iniSetup{server}{uri} = prompt("Your LDAP URI : ", '-tty');
$iniSetup{server}{uri} =~ s/^uri=//;
$iniSetup{server}{base} = prompt("Your LDAP Base : ");
$iniSetup{server}{base} = prompt("Your LDAP Base : ", '-tty');
$iniSetup{server}{base} =~ s/^base=//;
tied(%iniSetup)->WriteConfig($configFile) or die "Could not write settings to new configuration file.";
untie %iniSetup;
......@@ -311,7 +311,7 @@ my $pwent = getpwnam($ENV{'USER'});
(my $username) = split(/,/,$pwent->gecos);
if (!defined($username) || $username eq "") {
print STDERR "WARNING: Cannot determine your name, set your gecos field.\n\n";
$username = prompt("Your LDAP CN : ");
$username = prompt("Your LDAP CN : ", '-tty');
} else {
print STDERR "Your LDAP CN : $username (passwd->gecos)\n";
}
......@@ -324,10 +324,14 @@ my $password;
my ($kwalletObject,$kwalletHandle);
# IF removed, lets rather run this in its own scope...
{
my $dbus = Net::DBus->find();
# Grab the kwallet service off DBus
my $kwalletService = $dbus->get_service('org.kde.kwalletd');
my $kwalletService;
eval {
$kwalletService = $dbus->get_service('org.kde.kwalletd');
};
if (!defined($kwalletService)) {
logger('WARNING',color('magenta')."Kwallet not found on DBus".color('reset'));
goto KWALLET_END;
......@@ -342,7 +346,7 @@ KWALLET_END:
# If kwallet returned nothing, try read from terminal
if (!defined($password) || $password eq "") {
$password = prompt("Your LDAP Password: ", '-echo' => "*");
$password = prompt("Your LDAP Password: ", '-echo' => "*", '-tty');
}
print STDERR "\n";
......@@ -397,6 +401,7 @@ if ($ldapNumResults < 1) {
$counter++;
}
my $menuSelection = prompt("Your selection [1-$ldapNumResults,q]: ",
'-tty',
'-onechar',
'-require' => {
"Invalid Value - Your selection [1-$ldapNumResults,q]: " => sub {
......@@ -579,7 +584,7 @@ if (defined($pkcsProvider) && $pkcsProvider ne "") {
print STDERR "\n";
}
# Only push the config file override to SSH if the config file exists in the users homedir\
# Only push the config file override to SSH if the config file exists in the users homedir
if (-f (my $sshConfigFile = $ENV{"HOME"}.'/.ssh/config')) {
push(@sshArgs,'-F',$sshConfigFile);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment