From 1aafdb11dc1fb53689f9207611f06cd01f1f1985 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 5 Mar 2005 10:20:44 +0000 Subject: [PATCH] allow user+passwd to be given via STDIN --- lam-0.4/lib/lamdaemon.pl | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/lam-0.4/lib/lamdaemon.pl b/lam-0.4/lib/lamdaemon.pl index 95580243..8669f832 100755 --- a/lam-0.4/lib/lamdaemon.pl +++ b/lam-0.4/lib/lamdaemon.pl @@ -194,13 +194,27 @@ else { $remotepath = shift @ARGV; use Net::SSH::Perl; if ($ARGV[2] eq "*test") { print "Net::SSH::Perl successfully installed.\n"; } - @username = split (',', $ARGV[0]); - $username[0] =~ s/uid=//; - $password = $ARGV[1]; + if (($ARGV[0] eq "-") and ($ARGV[1] eq "-")) { # user+passwd are in STDIN + $username = ; + chop($username); + @username = split (',', $username); + $username[0] =~ s/uid=//; + $username[0] =~ s/cn=//; + $username = $username[0]; + $password = ; + chop($password); + } + else { + @username = split (',', $ARGV[0]); + $username[0] =~ s/uid=//; + $username[0] =~ s/cn=//; + $username = $username[0]; + $password = $ARGV[1]; + } my $ssh = Net::SSH::Perl->new($hostname, options=>[ "UserKnownHostsFile /dev/null"], protocol => "2,1" ); - $ssh->login($username[0], $password); + $ssh->login($username, $password); # Put all transfered lines in one string if ($ARGV[2] ne "*test") { $string = do {local $/;};