Author: kmachalkova
Date: Tue Dec 16 17:28:03 2008
New Revision: 54196
URL: http://svn.opensuse.org/viewcvs/yast?rev=54196&view=rev
Log:
Consider all possible command tags (NOPASSWD, NOEXEC
SETENV) when parsing sudoers file (only NOPASSWD can
be set in UI, but we should not delete the others,
if they're there)
Modified:
trunk/sudo/src/Sudo.ycp
trunk/sudo/src/dialog-spec.ycp
trunk/sudo/src/dialogs.ycp
Modified: trunk/sudo/src/Sudo.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/sudo/src/Sudo.ycp?rev=54196&r1=54195&r2=54196&view=diff
==============================================================================
--- trunk/sudo/src/Sudo.ycp (original)
+++ trunk/sudo/src/Sudo.ycp Tue Dec 16 17:28:03 2008
@@ -125,13 +125,16 @@
if (regexpmatch(line[3]:"","\\(.*\\)")){
m["run_as"] = regexpsub(line[3]:"","(\\(.*\\))", "\\1");
}
+ if (regexpmatch(line[3]:"","NOPASSWD:|SETENV:|NOEXEC:")){
+ m["tag"] = regexpsub(line[3]:"", "(NOPASSWD:|SETENV:|NOEXEC:)","\\1");
+ }
- if(issubstring(line[3]:"","NOPASSWD:")) {
+ /*if(issubstring(line[3]:"","NOPASSWD:")) {
m["no_passwd"] = (boolean) true;
}
else {
m["no_passwd"] = (boolean) false;
- }
+ }*/
cmd = splitstring(line[3]:"","):");
m["commands"] = (list <string>) splitstring (cmd[ size(cmd) -1 ]:"",",");
@@ -203,7 +206,9 @@
list <string> line = [ a["c"]:"", "Cmnd_Alias", a["name"]:"", mergestring(a["mem"]:[],",")];
set = add(set, line);
});
+
set = ( list < list <any> > ) merge(set, defaults);
+
foreach(map a, runas_aliases2,{
list <string> line = [ a["c"]:"", "Runas_Alias", a["name"]:"", mergestring(a["mem"]:[],",")];
set = add(set, line);
@@ -215,7 +220,7 @@
user = mergestring (splitstring(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"]:[],",");
+ string rest = (string) m["run_as"]:"" + " " + (string) m["tag"]:"" + mergestring((list <string>)m["commands"]:[],",");
set = add(set,[comment, user, host, rest]);
});
Modified: trunk/sudo/src/dialog-spec.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/sudo/src/dialog-spec.ycp?rev=54196&r1=54195&r2=54196&view=diff
==============================================================================
--- trunk/sudo/src/dialog-spec.ycp (original)
+++ trunk/sudo/src/dialog-spec.ycp Tue Dec 16 17:28:03 2008
@@ -73,7 +73,7 @@
UI::ChangeWidget(`id("user_name"),`Value, spec["user"]:"");
UI::ChangeWidget(`id("host_name"),`Value, spec["host"]:"");
UI::ChangeWidget(`id("run_as"),`Value, deletechars(spec["run_as"]:"","()"));
- UI::ChangeWidget(`id("no_passwd"),`Value, spec["no_passwd"]:false);
+ UI::ChangeWidget(`id("no_passwd"),`Value, (spec["tag"]:"" == "NOPASSWD:"));
RedrawCmndTable(commands);
@@ -86,9 +86,15 @@
spec["user"] = UI::QueryWidget(`id("user_name"),`Value);
spec["host"] = UI::QueryWidget(`id("host_name"),`Value);
spec["run_as"] = (string)UI::QueryWidget(`id("run_as"),`Value);
- spec["no_passwd"] = UI::QueryWidget(`id("no_passwd"),`Value);
spec["commands"] = commands;
+ if ( (boolean) UI::QueryWidget(`id("no_passwd"),`Value))
+ {
+ spec["tag"] = "NOPASSWD:";
+ }
+ else
+ spec["tag"] = "";
+
if (spec["user"]:"" == "") {
Popup::Error(_("User name must not be empty."));
UI::SetFocus(`id("user_name"));
Modified: trunk/sudo/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/sudo/src/dialogs.ycp?rev=54196&r1=54195&r2=54196&view=diff
==============================================================================
--- trunk/sudo/src/dialogs.ycp (original)
+++ trunk/sudo/src/dialogs.ycp Tue Dec 16 17:28:03 2008
@@ -137,7 +137,9 @@
else
cmds = (ent["commands"]:[])[0]:"";
- items = add(items, `item(`id(idx), (string) ent["user"]:"", (string) ent["host"]:"", (string) ent["run_as"]:"",(ent["no_passwd"]:false)? _("Yes") : _("No"), cmds));
+ items = add(items, `item(`id(idx),
+ (string) ent["user"]:"", (string) ent["host"]:"", (string) ent["run_as"]:"",
+ (ent["tag"]:"" == "NOPASSWD:") ? _("Yes") : _("No"), cmds));
idx = idx + 1;
});
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org