From 1ec21273630659c6f6fee6a40ba7e01e144b1597 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Wed, 22 Mar 2017 21:03:48 -0700 Subject: [PATCH] Pass in password on the command line https://www.virtualmin.com/node/50338 --- samba/save_winbind.cgi | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/samba/save_winbind.cgi b/samba/save_winbind.cgi index d0cab77f4..cef373fb0 100755 --- a/samba/save_winbind.cgi +++ b/samba/save_winbind.cgi @@ -11,7 +11,8 @@ $access{'winbind'} || &error($text{'winbind_ecannot'}); $cmd = "$config{'net'} join"; &error_setup($text{'winbind_err'}); $in{'user'} || &error($text{'winbind_euser'}); -$cmd .= " -U ".quotemeta($in{'user'}); +$cmd .= " -U ".quotemeta($in{'user'}). + ($in{'pass'} ? "%".quotemeta($in{'pass'}) : ""); if (!$in{'dom_def'}) { $in{'dom'} || &error($text{'winbind_edom'}); $cmd .= " -S ".quotemeta($in{'dom'}); @@ -20,13 +21,9 @@ if (!$in{'dom_def'}) { # Run it &ui_print_header(undef, $text{'winbind_title'}, undef); print &text('winbind_cmd', "$cmd"),"\n"; -$temp = &transname(); -open(TEMP, ">$temp"); -print TEMP $in{'pass'},"\n"; -close(TEMP); -$out = `$cmd 2>&1 <$temp`; +$out = &backquote_command("$cmd 2>&1"); unlink($temp); -print "
$out
"; +print "
",&html_escape($out),"
\n"; if ($? || $out =~ /error|failed/i) { print "$text{'winbind_failed'}
\n"; }