Hello community,
here is the log from the commit of package yast2-samba-client
checked in at Fri Sep 12 17:30:44 CEST 2008.
--------
--- yast2-samba-client/yast2-samba-client.changes 2008-09-09 11:24:31.000000000 +0200
+++ /mounts/work_src_done/STABLE/yast2-samba-client/yast2-samba-client.changes 2008-09-12 12:22:52.072059000 +0200
@@ -1,0 +2,7 @@
+Fri Sep 12 12:19:01 CEST 2008 - jsuchome@suse.cz
+
+- added generic dialog for editing 'volume' entries of
+ pam_mount.conf.xml (fate#300967)
+- 2.17.4
+
+-------------------------------------------------------------------
Old:
----
yast2-samba-client-2.17.3.tar.bz2
New:
----
yast2-samba-client-2.17.4.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-samba-client.spec ++++++
--- /var/tmp/diff_new_pack.E25316/_old 2008-09-12 17:30:39.000000000 +0200
+++ /var/tmp/diff_new_pack.E25316/_new 2008-09-12 17:30:40.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-samba-client (Version 2.17.3)
+# spec file for package yast2-samba-client (Version 2.17.4)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -19,15 +19,15 @@
Name: yast2-samba-client
-Version: 2.17.3
+Version: 2.17.4
Release: 1
License: GPL v2 or later
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-samba-client-2.17.3.tar.bz2
+Source0: yast2-samba-client-2.17.4.tar.bz2
Prefix: /usr
BuildRequires: perl-XML-Writer update-desktop-files yast2-devtools yast2-pam yast2-perl-bindings yast2-testsuite
-Requires: yast2-kerberos-client
+Requires: yast2-kerberos-client perl-XML-LibXML
# new Pam.ycp API
Requires: yast2-pam >= 2.14.0
# .etc.ssh.sshd_config
@@ -46,7 +46,7 @@
Stanislav Visnovsky
%prep
-%setup -n yast2-samba-client-2.17.3
+%setup -n yast2-samba-client-2.17.4
%build
%{prefix}/bin/y2tool y2autoconf
@@ -84,6 +84,10 @@
/usr/share/YaST2/schema/autoyast/rnc/samba-client.rnc
%doc %{prefix}/share/doc/packages/yast2-samba-client
%changelog
+* Fri Sep 12 2008 jsuchome@suse.cz
+- added generic dialog for editing 'volume' entries of
+ pam_mount.conf.xml (fate#300967)
+- 2.17.4
* Tue Sep 09 2008 jsuchome@suse.cz
- merged texts from proofread
- 2.17.3
++++++ yast2-samba-client-2.17.3.tar.bz2 -> yast2-samba-client-2.17.4.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-samba-client-2.17.3/agent-pam_mount/ag_pam_mount new/yast2-samba-client-2.17.4/agent-pam_mount/ag_pam_mount
--- old/yast2-samba-client-2.17.3/agent-pam_mount/ag_pam_mount 2008-09-05 15:24:12.000000000 +0200
+++ new/yast2-samba-client-2.17.4/agent-pam_mount/ag_pam_mount 2008-09-12 11:07:34.000000000 +0200
@@ -34,13 +34,20 @@
my %retmap = ();
$pam_mount_file = $argument;
$pam_mount_file = "/etc/security/pam_mount.conf.xml" if ! $argument;
- my $parser = new XML::LibXML;
- $pam_mount = $parser->parse_file ($pam_mount_file);
+ if (-e $pam_mount_file) {
- if ($pam_mount) {
- ycp::Return ("true");
+ my $parser = new XML::LibXML;
+ $pam_mount = $parser->parse_file ($pam_mount_file);
+
+ if ($pam_mount) {
+ ycp::Return ("true");
+ }
+ else {
+ ycp::Return ("false");
+ }
}
else {
+ y2error ("file $pam_mount_file does not exist!");
ycp::Return ("false");
}
}
@@ -128,7 +135,8 @@
# "attrmap" : $[
# "user" : "hh",
# "fstype" : "cifs"
- # ]
+ # ],
+ # "newline" : true
# ]);
# FIXME currently only attributes, no values
# FIXME no new line when new item is added...?
@@ -153,11 +161,58 @@
$root->appendChild ($new_element);
-# my $child = $root->lastChild ();
-# $child->addSibling($new_element);
+ if ($argument->{"newline"}) {
+ $root->appendTextNode ("\n\n");
+ }
+
+ ycp::Return ("true");
+ }
+ }
+ # delete all elemets with given criterias
+ # e.g. delete all "volume" elements with attribute fstype="civfs":
+ # SCR::Write (.pam_mount.delete, $[
+ # "element" : "volume",
+ # "attrmap" : $[
+ # "fstype" : "cifs"
+ # ]
+ # ]);
+ elsif ($path eq ".delete") {
+ if (!defined $argument || ref ($argument) ne "HASH") {
+ y2error ("argument not present or not a map");
+ ycp::Return ("false");
+ }
+ elsif (!$argument->{"element"}) {
+ y2error ("element name not specified");
+ ycp::Return ("false");
+ }
+ else {
+ my $el_name = $argument->{"element"} || "";
+ my $attr_map = $argument->{"attrmap"};
+
+ my $root = $pam_mount->documentElement();
-# my $child = $root->firstChild ();
-# $root->insertBefore ($new_element, $child);
+ my $nodeList = $pam_mount->getElementsByTagName ($el_name);
+ for (my $i=1;$i<= $nodeList->size();$i++) {
+
+ my $element = $nodeList -> get_node ($i);
+ my $delete = 1;
+ # if attributes are present, they specify the elements that
+ # should be deleted
+ while (my ($name, $val) = each %$attr_map) {
+ if (!$element->hasAttribute($name)) {
+ y2debug ("attribute $name not present");
+ $delete = 0;
+ }
+ elsif ($element->getAttribute ($name) ne $val) {
+ y2debug ("attrbute $name has not the value $val");
+ $delete = 0;
+ }
+ }
+
+ if ($delete) {
+ $root->removeChild ($element);
+ }
+ }
ycp::Return ("true");
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-samba-client-2.17.3/src/dialogs.ycp new/yast2-samba-client-2.17.4/src/dialogs.ycp
--- old/yast2-samba-client-2.17.3/src/dialogs.ycp 2008-09-09 11:23:35.000000000 +0200
+++ new/yast2-samba-client-2.17.4/src/dialogs.ycp 2008-09-12 11:01:09.000000000 +0200
@@ -3,7 +3,7 @@
* Summary: Dialogs definitions
* Authors: Stanislav Visnovsky
*
- * $Id: dialogs.ycp 50764 2008-09-05 14:32:29Z jsuchome $
+ * $Id: dialogs.ycp 50874 2008-09-09 09:24:41Z jsuchome $
*/
{
@@ -27,9 +27,86 @@
include "samba-client/routines.ycp";
/**
- * popup for setting various expert settings, like winbind uid/gid keys (F301518)
+ * Popup for editing the mount entry data
*/
-symbol ExpertSettingsPopup () {
+map MountEntryPopup (map volume) {
+
+ // labels of keys which are shown only if they are already present in the
+ // volume entry (manualy added to congig file)
+ map key2label = $[
+ // text entry label
+ "user" : _("&User Name"),
+ // text entry label
+ "uid" : _("U&ID"),
+ // text entry label
+ "pgrp" : _("&Primary Group Name"),
+ // text entry label
+ "sgrp" : _("&Secondary Group Name"),
+ // text entry label
+ "gid" : _("&GID"),
+
+ // we do not show "fstype" key, this is limited to cifs...
+ ];
+
+ term input_fields = `VBox (
+ // text entry label
+ `InputField (`id ("server"), `opt (`hstretch), _("&Server Name")),
+ // text entry label
+ `InputField (`id ("path"), `opt (`hstretch), _("Remote &Path")),
+ // text entry label
+ `InputField (`id ("mountpoint"), `opt (`hstretch), _("&Mount Point")),
+ // text entry label
+ `InputField (`id ("options"), `opt (`hstretch), _("O&ptions"))
+ );
+ // default keys
+ list<string> widgets = [ "server", "path", "mountpoint", "options" ];
+
+ foreach (string key, string label, key2label, {
+ if (haskey (volume, key))
+ {
+ input_fields = add (input_fields,
+ `InputField (`id (key), `opt (`hstretch), label));
+ widgets = add (widgets, key);
+ }
+ });
+
+ UI::OpenDialog (`opt (`decorated), `HBox (`HSpacing (0.2), `VBox (
+ `VSpacing (0.2),
+ input_fields,
+ `VSpacing (0.2),
+ `HBox (
+ `PushButton (`id (`ok), Label::OKButton ()),
+ `PushButton (`id (`cancel), Label::CancelButton ())
+ ),
+ `VSpacing (0.2)
+ ), `HSpacing (0.2)));
+
+ foreach (string key, widgets, {
+ UI::ChangeWidget (`id (key), `Value, volume[key]:"");
+ });
+
+ any ret = UI::UserInput ();
+ if (ret == `ok)
+ {
+ // saving value to the same map we got as argument =>
+ // keys that were not shown (e.g. fstype) are preserved)
+ foreach (string key, widgets, {
+ volume[key] = UI::QueryWidget (`id (key), `Value);
+ });
+ }
+ UI::CloseDialog ();
+
+ // filter out default keys without value (but leave the rest, so they
+ // may appear on next editing)
+ return filter (string k, string v, (map)volume, ``(
+ v != "" || !contains (["server", "path", "mountpoint", "options"], k))
+ );
+}
+
+/**
+ * dialog for setting expert settings, like winbind uid/gid keys (F301518)
+ */
+symbol ExpertSettingsDialog () {
string winbind_uid = SambaConfig::GlobalGetStr ("winbind uid","10000-20000");
list l = splitstring (winbind_uid, "-");
@@ -54,11 +131,33 @@
boolean hosts_resolution = Samba::GetHostsResolution ();
- string mount_server = "";
- string mount_path = "";
- string mount_share = "";
- string unc_path = "";
- // \\\\nue-lurch-1\\Profiles\\storage1\\dom1\\";
+ list<term> mount_items = [];
+ list<map> non_cifs_volumes = [];
+
+ // mapping of unique ID's to volume entries
+ map mount_map = $[];
+ integer i = 0;
+
+ foreach (map volume, Samba::GetPAMMountVolumes (), {
+ if (volume["fstype"]:"" != "cifs")
+ {
+ y2debug ("volume fstype different from cifs, skipping");
+ non_cifs_volumes = add (non_cifs_volumes, volume);
+ return;
+ }
+ mount_map[i] = volume;
+ i = i + 1;
+ });
+
+ list<term> build_mount_items () {
+
+ mount_items = maplist (integer id, map volume, mount_map, {
+ return `item (`id (id),
+ volume["server"]:"", volume["path"]:"",
+ volume["mountpoint"]:"", volume["options"]:"");
+ });
+ return mount_items;
+ }
term contents = `HBox (`HSpacing (3), `VBox (
`VSpacing (0.4),
@@ -85,21 +184,26 @@
)),
`VSpacing (0.4),
// frame label
- `Frame (_("Mount Server Home Directory"), `VBox (
- /*
- // text entry label
- `InputField (`id (`mount_server),`opt (`hstretch),_("&Server Name"),
- mount_server),
- // text entry label
- `InputField (`id (`mount_share), `opt (`hstretch), _("S&hare Name"),
- mount_share),
- // text entry label
- `InputField (`id (`mount_path), `opt (`hstretch),_("&Path"),
- mount_path)
- */
- // text entry label
- `InputField (`id (`mount), `opt (`hstretch), _("&UNC Path"),
- unc_path)
+ `Frame (_("Mount Server Directories"), `VBox (
+ `Table (`id (`table), `opt(`notify), `header (
+ // table header
+// _("UNC Path"),
+ // table header
+ _("Server Name"),
+ // table header
+ _("Remote Path"),
+ // table header
+ _("Local Mount Point"),
+ // table header
+ _("Options")),
+ build_mount_items ()
+ ),
+ `HBox (
+ `PushButton (`id (`add), Label::AddButton ()),
+ `PushButton (`id (`edit), Label::EditButton ()),
+ `PushButton (`id (`delete), Label::DeleteButton ()),
+ `HStretch ()
+ )
))
), `HSpacing (3));
@@ -107,12 +211,46 @@
// dialog title
Wizard::SetContents (_("Expert Settings"), contents, help_text, true, true);
- any ret = `cancel;
+ foreach (symbol s, [`add, `edit, `delete], {
+ UI::ChangeWidget (`id (s), `Enabled, size (mount_items) > 0);
+ });
+
+ any ret = `cancel;
+ integer selected = 0;
while (true)
{
any ret = UI::UserInput ();
if (ret == `cancel)
break;
+ if (ret == `delete || ret == `edit || ret == `table)
+ {
+ selected = (integer) UI::QueryWidget (`id (`table),`CurrentItem);
+ if (ret == `table)
+ ret = `edit;
+ }
+ if (ret == `delete)
+ {
+ mount_map = remove (mount_map, selected);
+ UI::ChangeWidget (`id (`table), `Items, build_mount_items ());
+ foreach (symbol s, [`add, `edit, `delete], {
+ UI::ChangeWidget (`id (s), `Enabled, size (mount_items) > 0);
+ });
+ }
+ if (ret == `add || ret == `edit)
+ {
+ map volume = ret == `edit ? mount_map[selected]:$[] : $[];
+ volume = MountEntryPopup (volume);
+ if (volume == $[])
+ continue;
+ if (ret == `add)
+ volume["fstype"] = "cifs";
+ integer id = ret == `edit ? selected : size (mount_map);
+ mount_map[id] = volume;
+ UI::ChangeWidget (`id (`table), `Items, build_mount_items ());
+ foreach (symbol s, [`add, `edit, `delete], {
+ UI::ChangeWidget (`id (s), `Enabled, size (mount_items) > 0);
+ });
+ }
if (ret == `ok)
{
uid_min = (integer) UI::QueryWidget (`id (`uid_min),`Value);
@@ -135,6 +273,13 @@
Samba::SetDHCP ((boolean)UI::QueryWidget (`id (`dhcp), `Value));
Samba::SetHostsResolution (
(boolean)UI::QueryWidget (`id (`hosts_resolution), `Value));
+
+ list<map> updated_volumes = non_cifs_volumes;
+ foreach (integer id, map volume, mount_map, {
+ updated_volumes = add (updated_volumes, volume);
+ });
+ Samba::SetPAMMountVolumes (updated_volumes);
+Samba::WritePAMMount ();
break;
}
}
@@ -359,7 +504,7 @@
}
else if (ret == `expert)
{
- ExpertSettingsPopup ();
+ ExpertSettingsDialog ();
}
else if (ret == `ntp)
{
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-samba-client-2.17.3/src/Samba.ycp new/yast2-samba-client-2.17.4/src/Samba.ycp
--- old/yast2-samba-client-2.17.3/src/Samba.ycp 2008-09-05 16:32:29.000000000 +0200
+++ new/yast2-samba-client-2.17.4/src/Samba.ycp 2008-09-12 12:18:17.000000000 +0200
@@ -121,8 +121,18 @@
// host line of nsswitch.conf
list<string> hosts_db = [];
+// original value of hosts_resolution, for detecting changes
boolean hosts_resolution_orig = false;
+// path to pam_mount.conf.xml
+string pam_mount_path = "/etc/security/pam_mount.conf.xml";
+
+// the volume data from pam_mount.conf.xml
+list<map> pam_mount_volumes = [];
+
+// original value of pam_mount_volumes, for detecting changes
+list<map> pam_mount_volumes_orig = [];
+
// packages to install for specific arhitectures (#224418)
global map arch_packages = $[
"krb5" : $[
@@ -177,23 +187,80 @@
* Read the data from /etc/security/pam_mount.conf.xml regarding
* mounting user's home directories
*/
-global define boolean ReadPamMount () {
+global boolean ReadPAMMount () {
- if (!FileUtils::Exists ("/etc/security/pam_mount.conf.xml"))
+ if (!FileUtils::Exists (pam_mount_path))
{
- y2warning ("/etc/security/pam_mount.conf.xml does not exist");
+ y2warning ("%1 does not exist", pam_mount_path);
return false;
}
// initially, parse the whole file and let the agent build data map
- if (SCR::Read (.pam_mount) != true)
+ if (SCR::Read (.pam_mount, "/tmp/pam_mount.xml") != true)
{
- y2warning ("reading /etc/security/pam_mount.conf.xml failed");
+ y2warning ("reading %1 failed", pam_mount_path);
return false;
}
- list volumes = (list) SCR::Read (.pam_mount.get, $[
+ pam_mount_volumes = (list<map>) SCR::Read (.pam_mount.get, $[
"element" : "volume",
]);
+ if (pam_mount_volumes == nil)
+ pam_mount_volumes = [];
+
+ pam_mount_volumes_orig = pam_mount_volumes;
+ return true;
+}
+
+/**
+ * Return the list of 'volume' entries from pam_mount.conf.xml
+ */
+global list<map> GetPAMMountVolumes () {
+
+ return pam_mount_volumes;
+}
+
+/**
+ * Set the new list of 'volume' entries
+ */
+global void SetPAMMountVolumes (list<map> new_volumes) {
+
+ pam_mount_volumes = new_volumes;
+}
+
+/**
+ * Write the changes to /etc/security/pam_mount.conf.xml
+ */
+global boolean WritePAMMount () {
+
+ if (sort (pam_mount_volumes) == sort (pam_mount_volumes_orig))
+ {
+ y2milestone ("no changes to pam_mount.conf.xml");
+ return true;
+ }
+ SCR::Execute (.target.bash, sformat ("cp %1 %1.YaST2save", pam_mount_path));
+
+ // 1. delete all volume entries with 'cifs' fstype
+ SCR::Write (.pam_mount.delete, $[
+ "element" : "volume",
+ "attrmap" : $[
+ "fstype" : "cifs"
+ ]
+ ]);
+
+ // 2. save the new set of volume entries
+ foreach (map volume, pam_mount_volumes, {
+ if (volume["fstype"]:"" != "cifs")
+ return;
+ // if no volume entry is present, add new
+ SCR::Write (.pam_mount.add, $[
+ "element" : "volume",
+ // ... the keys without values should not end in config file
+ "attrmap" : filter (
+ string k, string v, (map)volume,``(v != "")),
+ "newline" : true
+ ]);
+ });
+ SCR::Write (.pam_mount, nil);
return true;
}
@@ -633,7 +700,7 @@
SuSEFirewall::Read ();
- ReadPamMount ();
+ ReadPAMMount ();
// finished
Progress::NextStage();
@@ -806,6 +873,7 @@
if (!write_only)
SuSEFirewall::ActivateConfiguration ();
+ WritePAMMount ();
// finished
Progress::NextStage();
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-samba-client-2.17.3/VERSION new/yast2-samba-client-2.17.4/VERSION
--- old/yast2-samba-client-2.17.3/VERSION 2008-09-09 11:24:07.000000000 +0200
+++ new/yast2-samba-client-2.17.4/VERSION 2008-09-12 12:19:52.000000000 +0200
@@ -1 +1 @@
-2.17.3
+2.17.4
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org