Hello community, here is the log from the commit of package yast2-sudo checked in at Mon Feb 26 19:03:15 CET 2007. -------- --- yast2-sudo/yast2-sudo.changes 2007-01-05 13:29:06.000000000 +0100 +++ /mounts/work_src_done/NOARCH/yast2-sudo/yast2-sudo.changes 2007-02-26 15:29:59.490249000 +0100 @@ -1,0 +2,14 @@ +Mon Feb 26 15:07:28 CET 2007 - kmachalkova@suse.cz + +- Added syntax checking of created file (#227397) +- Save /etc/sudoers as 0440 (FaTE #300934) +- Check if entered command is a valid path or alias (#227397) +- Enable going back to revisit the configuration if the file + cannot be saved (due to syntax errors) +- Correct handling of deleting command aliases +- Correct handling of Cancel button in command and host popup +- Adjusted some dialog layouts (#245284) +- Changed some strings +- 2.15.1 + +------------------------------------------------------------------- Old: ---- yast2-sudo-2.15.0.tar.bz2 New: ---- yast2-sudo-2.15.1.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-sudo.spec ++++++ --- /var/tmp/diff_new_pack.M23449/_old 2007-02-26 19:03:07.000000000 +0100 +++ /var/tmp/diff_new_pack.M23449/_new 2007-02-26 19:03:07.000000000 +0100 @@ -1,5 +1,5 @@ # -# spec file for package yast2-sudo (Version 2.15.0) +# spec file for package yast2-sudo (Version 2.15.1) # # Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -11,12 +11,12 @@ # norootforbuild Name: yast2-sudo -Version: 2.15.0 +Version: 2.15.1 Release: 1 License: GNU General Public License (GPL) Group: System/YaST BuildRoot: %{_tmppath}/%{name}-%{version}-build -Source0: yast2-sudo-2.15.0.tar.bz2 +Source0: yast2-sudo-2.15.1.tar.bz2 prefix: /usr Requires: yast2 yast2-users #ycp::PathComponents @@ -38,7 +38,7 @@ Katarina Machalkova <kmachalkova@suse.cz> %prep -%setup -n yast2-sudo-2.15.0 +%setup -n yast2-sudo-2.15.1 %build %{prefix}/bin/y2tool y2autoconf @@ -72,7 +72,18 @@ /usr/lib/YaST2/servers_non_y2/ag_etc_sudoers %doc %{prefix}/share/doc/packages/yast2-sudo -%changelog -n yast2-sudo +%changelog +* Mon Feb 26 2007 - kmachalkova@suse.cz +- Added syntax checking of created file (#227397) +- Save /etc/sudoers as 0440 (FaTE #300934) +- Check if entered command is a valid path or alias (#227397) +- Enable going back to revisit the configuration if the file + cannot be saved (due to syntax errors) +- Correct handling of deleting command aliases +- Correct handling of Cancel button in command and host popup +- Adjusted some dialog layouts (#245284) +- Changed some strings +- 2.15.1 * Fri Jan 05 2007 - kmachalkova@suse.cz - Do not remove 'targetpw' and 'ALL ALL=ALL' rule from /etc/sudoers since it makes kdesu defunct (#223719) ++++++ yast2-sudo-2.15.0.tar.bz2 -> yast2-sudo-2.15.1.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-sudo-2.15.0/agents/ag_etc_sudoers new/yast2-sudo-2.15.1/agents/ag_etc_sudoers --- old/yast2-sudo-2.15.0/agents/ag_etc_sudoers 2006-10-18 17:31:34.000000000 +0200 +++ new/yast2-sudo-2.15.1/agents/ag_etc_sudoers 2007-02-26 13:44:09.000000000 +0100 @@ -113,13 +113,19 @@ close(OUTFILE); - #system("visudo -c -f $filename.YaST2.new") or return y2error() + #try syntax checking - non-zero return value of system() means failure + my $status = system ("visudo", "-c", "-q", "-f", "$filename.YaST2.new"); + if ($status != 0){ + return y2error("Syntax error in $filename.YaST2.new"), 0; + } if (-f $filename) { rename $filename, "$filename.YaST2.save" or return y2error("Error creating backup: $!"), 0; } rename "$filename.YaST2.new", $filename or return y2error("Error moving temp file: $!"), 0; - chmod(0640,$filename); + + #Save /etc/sudoers with 0440 access rights - FaTE #300934 + chmod(0440,$filename); return 1; } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-sudo-2.15.0/configure new/yast2-sudo-2.15.1/configure --- old/yast2-sudo-2.15.0/configure 2007-01-05 13:06:09.000000000 +0100 +++ new/yast2-sudo-2.15.1/configure 2007-02-26 15:10:13.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.60 for yast2-sudo 2.15.0. +# Generated by GNU Autoconf 2.60 for yast2-sudo 2.15.1. # # Report bugs to <http://bugs.opensuse.org/>. # @@ -559,8 +559,8 @@ # Identity of this package. PACKAGE_NAME='yast2-sudo' PACKAGE_TARNAME='yast2-sudo' -PACKAGE_VERSION='2.15.0' -PACKAGE_STRING='yast2-sudo 2.15.0' +PACKAGE_VERSION='2.15.1' +PACKAGE_STRING='yast2-sudo 2.15.1' PACKAGE_BUGREPORT='http://bugs.opensuse.org/' ac_unique_file="RPMNAME" @@ -1181,7 +1181,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures yast2-sudo 2.15.0 to adapt to many kinds of systems. +\`configure' configures yast2-sudo 2.15.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1252,7 +1252,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of yast2-sudo 2.15.0:";; + short | recursive ) echo "Configuration of yast2-sudo 2.15.1:";; esac cat <<\_ACEOF @@ -1330,7 +1330,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -yast2-sudo configure 2.15.0 +yast2-sudo configure 2.15.1 generated by GNU Autoconf 2.60 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1344,7 +1344,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by yast2-sudo $as_me 2.15.0, which was +It was created by yast2-sudo $as_me 2.15.1, which was generated by GNU Autoconf 2.60. Invocation command line was $ $0 $@ @@ -2145,7 +2145,7 @@ # Define the identity of the package. PACKAGE='yast2-sudo' - VERSION='2.15.0' + VERSION='2.15.1' cat >>confdefs.h <<_ACEOF @@ -2372,7 +2372,7 @@ -VERSION="2.15.0" +VERSION="2.15.1" RPMNAME="yast2-sudo" MAINTAINER="Katarina Machalkova <kmachalkova@suse.cz>" @@ -3258,7 +3258,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by yast2-sudo $as_me 2.15.0, which was +This file was extended by yast2-sudo $as_me 2.15.1, which was generated by GNU Autoconf 2.60. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -3301,7 +3301,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -yast2-sudo config.status 2.15.0 +yast2-sudo config.status 2.15.1 configured by $0, generated by GNU Autoconf 2.60, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-sudo-2.15.0/configure.in new/yast2-sudo-2.15.1/configure.in --- old/yast2-sudo-2.15.0/configure.in 2007-01-05 13:06:05.000000000 +0100 +++ new/yast2-sudo-2.15.1/configure.in 2007-02-26 15:10:07.000000000 +0100 @@ -3,7 +3,7 @@ dnl -- This file is generated by y2autoconf 2.14.0 - DO NOT EDIT! -- dnl (edit configure.in.in instead) -AC_INIT(yast2-sudo, 2.15.0, http://bugs.opensuse.org/, yast2-sudo) +AC_INIT(yast2-sudo, 2.15.1, http://bugs.opensuse.org/, yast2-sudo) dnl Check for presence of file 'RPMNAME' AC_CONFIG_SRCDIR([RPMNAME]) @@ -17,7 +17,7 @@ AM_INIT_AUTOMAKE(tar-ustar) dnl searches for some needed programs dnl Important YaST2 variables -VERSION="2.15.0" +VERSION="2.15.1" RPMNAME="yast2-sudo" MAINTAINER="Katarina Machalkova <kmachalkova@suse.cz>" diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-sudo-2.15.0/src/complex.ycp new/yast2-sudo-2.15.1/src/complex.ycp --- old/yast2-sudo-2.15.0/src/complex.ycp 2006-08-23 10:08:56.000000000 +0200 +++ new/yast2-sudo-2.15.1/src/complex.ycp 2007-02-26 15:28:07.000000000 +0100 @@ -34,24 +34,24 @@ import "Label"; import "Popup"; import "Wizard"; -import "Wizard_hw"; import "Confirm"; import "Sudo"; import "Report"; import "Address"; import "Netmask"; +import "FileUtils"; include "sudo/helps.ycp"; -global string current_alias_name = ""; -global integer current_spec_idx = -1; -global string initial_screen = "user_specs"; +string current_alias_name = ""; +integer current_spec_idx = -1; +string initial_screen = "user_specs"; boolean ValidateHost(string hostname) { string netmask = ""; - if ( find(hostname,"/") != -1 ) { + if ( findfirstof(hostname,"/") != nil ) { list <string> tmp = splitstring(hostname,"/"); hostname = tmp[0]:""; netmask = tmp[1]:""; @@ -77,7 +77,12 @@ UI::OpenDialog(`opt(`decorated), `VBox( `Frame( _("Add New Host to the Alias"), - `TextEntry(`id("host_name"),_("Hostname or Network"), new_host) + `VBox( + `HSpacing(40), + `VSpacing(0.5), + `TextEntry(`id("host_name"),_("Hostname or Network"), new_host), + `VSpacing(0.5) + ) ), `HBox( `PushButton(`id(`ok), Label::OKButton()), @@ -89,7 +94,7 @@ any ret = nil; while (true) { ret = UI::UserInput(); - if (ret == `ok) { + if (ret == `ok) { new_host = (string) UI::QueryWidget(`id("host_name"), `Value); if( !ValidateHost(new_host)) { @@ -98,54 +103,77 @@ } break; } else if (ret == `cancel) { -// new_host = (""); + new_host=""; break; - } - } + } + } UI::CloseDialog(); return (new_host) ; } +boolean ValidateCommand(string cmd){ + if(FileUtils::Exists(cmd) || haskey(Sudo::GetCmndAliases(), cmd) ) + return true; + else { + Popup::Error(sformat(_("File, directory or command alias '%1' does not exist."), cmd)); + return false; + } +} + string AddCommandDialog(string c, string p) { string new_command = c + p; UI::OpenDialog(`opt(`decorated), `VBox( - `Frame( - _("Add new command with optional parameters"), - `VBox( - `HBox( - `TextEntry(`id("cmd"),_("Command"),c), - `VBox ( - `VSpacing(1.1), - `PushButton(`id("browse_c"),_("Browse")) - ) + `Frame( + _("Add new command with optional parameters"), + `VBox( + `VSpacing(0.5), + `VBox( + `HBox( + `MinWidth(40,`Left(`TextEntry(`id("cmd"), _("Command"), c))), + `VBox( + `VSpacing(1.1), + `PushButton(`id("browse_c"),_("Browse")) + ) + ), + `Left(`TextEntry(`id("params"),_("Parameters (optional)"), p)) ), - `TextEntry(`id("params"),_("Parameters (optional)"), p) + `VSpacing(0.5) ) ), - `HBox( + `VSpacing(0.5), + `HBox( `PushButton(`id(`ok), Label::OKButton()), - `HSpacing(1), + `HSpacing(1), `PushButton(`id(`cancel), Label::CancelButton()) - ) - )); + ) + )); any ret = nil; while (true) { - ret = UI::UserInput(); + ret = UI::UserInput(); if (ret == `ok) { string cmd = (string) UI::QueryWidget(`id("cmd"), `Value); string params = (string) UI::QueryWidget(`id("params"), `Value); + + if (!ValidateCommand(cmd)){ + UI::SetFocus(`id("cmd")); + continue; + } + new_command = cmd + " " + params; break; - } else if (ret == `cancel) { + + } else if (ret == `cancel) { + new_command = ""; break; - } else if (ret == "browse_c") { + + } else if (ret == "browse_c") { string new_cmd = UI::AskForExistingFile("/", "*", "Choose a command"); UI::ChangeWidget(`id("cmd"),`Value, new_cmd); - } + } - } + } UI::CloseDialog(); return new_command; } @@ -191,6 +219,10 @@ symbol WriteDialog() { Wizard::RestoreHelp(HELPS["write"]:""); boolean ret = Sudo::Write(); + + //yes-no popup - an error occured when saving the configuration + if ( !ret && Popup::YesNo(_("Saving sudoers configuration failed. Change the settings?")) ) + return `back; return ret ? `next : `abort; } } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-sudo-2.15.0/src/dialog-cmnd.ycp new/yast2-sudo-2.15.1/src/dialog-cmnd.ycp --- old/yast2-sudo-2.15.0/src/dialog-cmnd.ycp 2006-08-23 11:31:13.000000000 +0200 +++ new/yast2-sudo-2.15.1/src/dialog-cmnd.ycp 2007-02-26 14:46:22.000000000 +0100 @@ -93,7 +93,7 @@ }else if(ret == "add_command"){ string new_member = AddCommandDialog("",""); - if(!contains(alias_members, new_member)) { + if(new_member != "" && !contains(alias_members, new_member)) { alias_members = add(alias_members, new_member); RedrawCmndAlias("",alias_members); } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-sudo-2.15.0/src/dialog-spec.ycp new/yast2-sudo-2.15.1/src/dialog-spec.ycp --- old/yast2-sudo-2.15.0/src/dialog-spec.ycp 2006-10-18 16:58:24.000000000 +0200 +++ new/yast2-sudo-2.15.1/src/dialog-spec.ycp 2007-02-26 14:47:51.000000000 +0100 @@ -123,7 +123,7 @@ } else if (ret == "command_add") { string new_command = AddCommandDialog("",""); - if(!contains(commands, new_command)) { + if(new_command != "" && !contains(commands, new_command)) { commands = add(commands, new_command); RedrawCmndTable(commands); } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-sudo-2.15.0/src/dialogs.ycp new/yast2-sudo-2.15.1/src/dialogs.ycp --- old/yast2-sudo-2.15.0/src/dialogs.ycp 2007-01-05 11:06:14.000000000 +0100 +++ new/yast2-sudo-2.15.1/src/dialogs.ycp 2007-02-26 14:18:09.000000000 +0100 @@ -40,7 +40,7 @@ include "sudo/complex.ycp"; -string sudo_caption = _("Sudo Configuration "); +string sudo_caption = _("Sudo Configuration"); symbol HandleUserSpecs(string key, map event) { any ret = event["ID"]:nil; @@ -230,7 +230,7 @@ } if (confirm_delete) { - Sudo::RemoveUserAlias(current_alias_name); + Sudo::RemoveCmndAlias(current_alias_name); UI::ChangeWidget(`id("table_command_aliases"), `Items, filter(term tmp, items, { return tmp[0]:nil != `id(current_alias_name); } )); @@ -313,7 +313,7 @@ `PushButton(`id("delete_spec")," " + Label::DeleteButton() + " ") ) ), - "caption" : sudo_caption + ":" + _("User Specification"), + "caption" : sudo_caption + ": " + _("Rules for sudo"), "tree_item_label" : _("User Specification"), "widget_names" : ["UserSpecifications"], ], @@ -333,7 +333,7 @@ ) ), - "caption" : sudo_caption + ":" + _("User Aliases"), + "caption" : sudo_caption + ": " + _("User Aliases"), "tree_item_label" : _("User Aliases"), "widget_names" : ["UserAliases"], ] , @@ -353,7 +353,7 @@ ) ), - "caption" : sudo_caption + ":" + _("RunAs Aliases"), + "caption" : sudo_caption + ": " + _("RunAs Aliases"), "tree_item_label" : _("RunAs Aliases"), "widget_names" : ["RunAsAliases"], ], @@ -373,7 +373,7 @@ ) ), - "caption" : sudo_caption + ":" + _("Host Aliases"), + "caption" : sudo_caption + ": " + _("Host Aliases"), "tree_item_label" : _("Host Aliases"), "widget_names" : ["HostAliases"], ], @@ -393,7 +393,7 @@ ) ), - "caption" : sudo_caption + ":" + _("Command Aliases"), + "caption" : sudo_caption + ": " + _("Command Aliases"), "tree_item_label" : _("Command Aliases"), "widget_names" : ["CommandAliases"], ], diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-sudo-2.15.0/src/Sudo.ycp new/yast2-sudo-2.15.1/src/Sudo.ycp --- old/yast2-sudo-2.15.0/src/Sudo.ycp 2007-01-05 12:53:18.000000000 +0100 +++ new/yast2-sudo-2.15.1/src/Sudo.ycp 2007-02-26 15:03:06.000000000 +0100 @@ -70,6 +70,7 @@ map <string, list<string> > runas_aliases = $[]; list <list <string> > defaults = []; list < map <string, any> > user_specs = []; +list <string> deleted_specs = []; global list <string> all_users = []; boolean ReadSudoSettings() { @@ -258,20 +259,27 @@ //Restore defaults settings["Defaults"] = defaults; - //Rest - foreach (map <string, any> m, user_specs,{ + //Rest + foreach(map <string, any> m, user_specs,{ string user = (string) m["user"]:""; string host = (string) m["host"]:""; string comment = (string) m["comment"]:""; string rest = (string) m["run_as"]:"" + " " + (( (boolean) m["no_passwd"]:false) ? "NOPASSWD: " : "") + mergestring((list <string>)m["commands"]:[],","); - settings[user] = add(settings[user]:[],[comment, host, rest]); + if( !contains(settings[user]:[], [comment, host, rest]) ) + settings[user] = add(settings[user]:[],[comment, host, rest]); + }); + + foreach(string key, list <list <string> > value, settings, { + if ( deleted_specs != [] && contains(deleted_specs, key)){ + settings = remove(settings, key); + } }); y2milestone("Writing sudo settings %1", settings); if (SCR::Write(.sudo, settings)) - return (SCR::Write(.sudo, nil)); + return SCR::Write(.sudo, nil); else return false; } return true; @@ -282,6 +290,11 @@ } global void RemoveUserSpec(integer i) { + map <string, any> m = user_specs[i]: $[]; + string key = m["user"]:""; + y2milestone("Deleting %1 from user specifications", key); + + deleted_specs = add(deleted_specs, key); user_specs = remove(user_specs,i); } @@ -514,6 +527,8 @@ integer sl = 500; + boolean ret = true; + // We do not set help text here, because it was set outside Progress::New(caption, " ", steps, [ /* Progress stage 1/1 */ @@ -533,13 +548,16 @@ if(PollAbort()) return false; Progress::NextStage(); /* Error message */ - if(!WriteSudoSettings()) Report::Error (_("Cannot write settings.")); + if(!WriteSudoSettings()) { + Report::Error (_("Cannot write settings.")); + ret = false; + } sleep(sl); Progress::NextStage(); sleep(sl); - return true; + return ret; } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-sudo-2.15.0/VERSION new/yast2-sudo-2.15.1/VERSION --- old/yast2-sudo-2.15.0/VERSION 2007-01-05 13:00:50.000000000 +0100 +++ new/yast2-sudo-2.15.1/VERSION 2007-02-26 15:10:01.000000000 +0100 @@ -1 +1 @@ -2.15.0 +2.15.1 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@Hilbert.suse.de