Author: jsuchome
Date: Fri Apr 11 14:19:56 2008
New Revision: 46403
URL: http://svn.opensuse.org/viewcvs/yast?rev=46403&view=rev
Log:
- added button for leaving AD domain (fate#300458)
- 2.16.5
Modified:
trunk/samba-client/VERSION
trunk/samba-client/package/yast2-samba-client.changes
trunk/samba-client/src/SambaNetJoin.pm
trunk/samba-client/src/dialogs.ycp
trunk/samba-client/src/routines.ycp
trunk/samba-client/src/samba-client.ycp
Modified: trunk/samba-client/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/samba-client/VERSION?rev=46403&r1=46402&r2=46403&view=diff
==============================================================================
--- trunk/samba-client/VERSION (original)
+++ trunk/samba-client/VERSION Fri Apr 11 14:19:56 2008
@@ -1 +1 @@
-2.16.4
+2.16.5
Modified: trunk/samba-client/package/yast2-samba-client.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/samba-client/package/yast2-samba-client.changes?rev=46403&r1=46402&r2=46403&view=diff
==============================================================================
--- trunk/samba-client/package/yast2-samba-client.changes (original)
+++ trunk/samba-client/package/yast2-samba-client.changes Fri Apr 11 14:19:56 2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Fri Apr 11 14:01:43 CEST 2008 - jsuchome@suse.cz
+
+- added button for leaving AD domain (fate#300458)
+- 2.16.5
+
+-------------------------------------------------------------------
Wed Apr 9 15:27:32 CEST 2008 - jsuchome@suse.cz
- enable specifying of the machine account (fate#301320)
Modified: trunk/samba-client/src/SambaNetJoin.pm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/samba-client/src/SambaNetJoin.pm?rev=46403&r1=46402&r2=46403&view=diff
==============================================================================
--- trunk/samba-client/src/SambaNetJoin.pm (original)
+++ trunk/samba-client/src/SambaNetJoin.pm Fri Apr 11 14:19:56 2008
@@ -117,4 +117,46 @@
return ($result && $error ne "") ? $error : "unknown error";
}
+# Joins the host into a given domain. If user is provided, it will use
+# the user and password for joining. If the user is nil, joining will
+# be done anonymously.
+#
+# Attention: It will write the configuration for domain before settings the password
+#
+# @param domain a name of a domain to be left
+# @param user username to be used for joining, or nil for anonymous
+# @param passwd password for the user
+# @return string an error message or nil if successful
+BEGIN{$TYPEINFO{Leave}= [ "function","string","string","string","string"]}
+sub Leave {
+
+ my ($self, $domain, $user, $passwd) = @_;
+
+ my $tmpdir = SCR->Read (".target.tmpdir");
+ my $conf_file = $tmpdir."/smb.conf";
+ my $realm = SambaAD->Realm ();
+
+ SCR->Write (".target.string", $conf_file, "[global]\n\trealm = $realm\n\tsecurity = ADS\n\tworkgroup = $domain\n");
+
+ my $cmd = "net ads leave -s $conf_file"
+ . " -U '" . ($user||"") . "%" . ($passwd||"") . "'";
+
+ my $result = SCR->Execute(".target.bash_output", $cmd);
+ $cmd =~ s/(-U '[^%]*)%[^']*'/$1'/; # hide password in the log
+ y2internal("$cmd => ".Dumper($result));
+
+ # check the exit code, return nil on success
+ if ($result && defined $result->{exit} && $result->{exit} == 0) {
+ # force new testjoin run (maybe domain from first testjoin was replaced
+ # by realm => empty whole hash)
+ %TestJoinCache = ();
+ return undef;
+ }
+
+ # otherwise return stderr
+ my $error = $result->{stdout} ne "" ? $result->{stdout} : $result->{stderr};
+ return ($result && $error ne "") ? $error : "unknown error";
+}
+
+
8;
Modified: trunk/samba-client/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/samba-client/src/dialogs.ycp?rev=46403&r1=46402&r2=46403&view=diff
==============================================================================
--- trunk/samba-client/src/dialogs.ycp (original)
+++ trunk/samba-client/src/dialogs.ycp Fri Apr 11 14:19:56 2008
@@ -156,10 +156,18 @@
}
Popup::ClearFeedback ();
+ term leave_button = (SambaAD::ADS () == "") ? `Empty () :
+ // push button label
+ `PushButton (`id (`leave), _("&Leave"));
UI::ReplaceWidget (`id(`rpstatus),
(Stage::cont () || CheckWorkgroup (domain) != `joined_domain) ?
- // status label
- `Empty() : `Left (`Label (_("Currently a member of this domain")))
+ `Empty() :
+ `HBox (
+ // status label
+ `Left (`Label (_("Currently a member of this domain"))),
+ `HStretch (),
+ leave_button
+ )
);
}
@@ -214,7 +222,8 @@
`VBox (
`HBox(
`HSpacing (0.2),
- `InputField (`id(`workgroup), `opt (`hstretch),
+// `InputField (`id(`workgroup), `opt (`hstretch),
+ `TextEntry (`id(`workgroup), `opt (`hstretch),
(Stage::cont() ?
_("&Domain") :
// translators: text entry label
@@ -286,6 +295,15 @@
if(ReallyAbort()) break;
else continue;
}
+ else if (ret == `leave)
+ {
+ string workgroup = (string)UI::QueryWidget(`id(`workgroup), `Value);
+ if (LeaveDomain (workgroup) == `ok)
+ {
+ check_domain_membership (workgroup);
+ UI::ChangeWidget(`id(`winbind), `Value, false);
+ }
+ }
else if (ret == `winbind) {
UI::ChangeWidget (`id(`mkhomedir), `Enabled, use_winbind);
UI::ChangeWidget (`id(`caching), `Enabled, use_winbind);
Modified: trunk/samba-client/src/routines.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/samba-client/src/routines.ycp?rev=46403&r1=46402&r2=46403&view=diff
==============================================================================
--- trunk/samba-client/src/routines.ycp (original)
+++ trunk/samba-client/src/routines.ycp Fri Apr 11 14:19:56 2008
@@ -34,12 +34,12 @@
* @return map