[yast-commit] r52689 - in /trunk/support: package/yast2-support.changes src/Support.ycp src/dialogs.ycp

Author: jsrain Date: Wed Oct 29 16:56:14 2008 New Revision: 52689 URL: http://svn.opensuse.org/viewcvs/yast?rev=52689&view=rev Log: fixed passing root password to supportconfig if YaST is run as non-root Modified: trunk/support/package/yast2-support.changes trunk/support/src/Support.ycp trunk/support/src/dialogs.ycp Modified: trunk/support/package/yast2-support.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/support/package/yast2-support.cha... ============================================================================== --- trunk/support/package/yast2-support.changes (original) +++ trunk/support/package/yast2-support.changes Wed Oct 29 16:56:14 2008 @@ -1,7 +1,9 @@ ------------------------------------------------------------------- -Wed Oct 29 14:52:50 CET 2008 - jsrain@suse.cz +Wed Oct 29 16:55:40 CET 2008 - jsrain@suse.cz - issue a warning before starting browser as root +- fixed passing root password to supportconfig if YaST is run as + non-root ------------------------------------------------------------------- Wed Oct 29 14:07:23 CET 2008 - mzugec@suse.de Modified: trunk/support/src/Support.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/support/src/Support.ycp?rev=52689... ============================================================================== --- trunk/support/src/Support.ycp (original) +++ trunk/support/src/Support.ycp Wed Oct 29 16:56:14 2008 @@ -74,14 +74,16 @@ */ global string root_pw = nil; -global string pwd_pipe = nil; +global string pwd_file = nil; global boolean CheckRootPw (string pw) { - if (pwd_pipe == nil) - pwd_pipe = ((string)SCR::Read (.target.tmpdir) + "/pwd_pipe"); - SCR::Execute (.target.bash, "test -e %1 || mkfifo %1", pwd_pipe); - SCR::Write (.target.string, pwd_pipe, pw + "\n"); - integer exit = (integer)SCR::Execute (.target.bash, sformat ("cat %1 | su -c 'echo 0'", pwd_pipe)); + if (pwd_file == nil) + pwd_file = ((string)SCR::Read (.target.tmpdir) + "/pwd_file"); + SCR::Execute (.target.bash, sformat ("test -e %1 || touch %1", pwd_file)); + SCR::Execute (.target.bash, sformat ("chmod 600 %1", pwd_file)); + SCR::Write (.target.string, pwd_file, pw + "\n"); + integer exit = (integer)SCR::Execute (.target.bash, sformat ("cat %1 | su -c 'echo 0'", pwd_file)); + SCR::Write (.target.string, pwd_file, ""); boolean success = (exit == 0); y2milestone ("Root password check: %1", success); if (success) Modified: trunk/support/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/support/src/dialogs.ycp?rev=52689... ============================================================================== --- trunk/support/src/dialogs.ycp (original) +++ trunk/support/src/dialogs.ycp Wed Oct 29 16:56:14 2008 @@ -196,12 +196,14 @@ if (! Support::AskForRootPwd()) return `back; integer id = Support::WhoAmI(); - SCR::Write (.target.string, Support::pwd_pipe, Support::root_pw + "\n"); - command = sformat("cat %2 | su -c '%1'", command, Support::pwd_pipe); + SCR::Write (.target.string, Support::pwd_file, Support::root_pw + "\n"); + command = sformat("cat %2 | su -c '%1'", command, Support::pwd_file); } y2milestone("executing %1", command); map<string, any> output = (map<string, any>)SCR::Execute(.target.bash_output, command); y2milestone("output %1", output); + if (Support::WhoAmI() != 0) + SCR::Write (.target.string, Support::pwd_file, ""); if (output["exit"]:-1 != 0) Report::Error (sformat("%1 : %2",_("Cannot write settings"), output)); else{ command = sformat("find \"%1\" -type f -name \"%2*\"|tr -d '\n'", Support::log_files["tmp_dir"]:"", Support::log_files["log_dir"]:""); @@ -534,8 +536,8 @@ if (! Support::AskForRootPwd()) return `back; integer id = Support::WhoAmI(); - SCR::Write (.target.string, Support::pwd_pipe, Support::root_pw + "\n"); - cmd = sformat("cat %4 | su -c 'supportconfig %1 -t %2 && chown -R %3 %2'", Support::GetParameterList(), Support::log_files["tmp_dir"]:"", id, Support::pwd_pipe); + SCR::Write (.target.string, Support::pwd_file, Support::root_pw + "\n"); + cmd = sformat("cat %4 | su -c 'supportconfig %1 -t %2 && chown -R %3 %2'", Support::GetParameterList(), Support::log_files["tmp_dir"]:"", id, Support::pwd_file); } symbol ret = nil; integer pid = (integer) SCR::Execute(.process.start_shell, cmd); @@ -558,6 +560,8 @@ break; } } + if (Support::WhoAmI() != 0) + SCR::Write (.target.string, Support::pwd_file, ""); while(ret!=`back && ret!=`abort && ret!=`next){ ret = (symbol)UI::UserInput(); } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
jsrain@svn.opensuse.org