Author: jsuchome
Date: Fri Apr 25 13:25:57 2008
New Revision: 47068
URL: http://svn.opensuse.org/viewcvs/yast?rev=47068&view=rev
Log:
- correctly create machine account: transform DN, use correct
argument, do not try with default value (bnc#383360)
- use temporary krb5.conf also for obtaining machine accounts
- remove AD info from smb.conf when domain was left (bnc#383374)
- 2.16.7
Modified:
trunk/samba-client/VERSION
trunk/samba-client/package/yast2-samba-client.changes
trunk/samba-client/src/SambaAD.pm
trunk/samba-client/src/SambaNetJoin.pm
trunk/samba-client/src/dialogs.ycp
trunk/samba-client/src/routines.ycp
Modified: trunk/samba-client/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/samba-client/VERSION?rev=47068&r1=47067&r2=47068&view=diff
==============================================================================
--- trunk/samba-client/VERSION (original)
+++ trunk/samba-client/VERSION Fri Apr 25 13:25:57 2008
@@ -1 +1 @@
-2.16.6
+2.16.7
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=47068&r1=47067&r2=47068&view=diff
==============================================================================
--- trunk/samba-client/package/yast2-samba-client.changes (original)
+++ trunk/samba-client/package/yast2-samba-client.changes Fri Apr 25 13:25:57 2008
@@ -1,4 +1,13 @@
-------------------------------------------------------------------
+Fri Apr 25 11:47:52 CEST 2008 - jsuchome@suse.cz
+
+- correctly create machine account: transform DN, use correct
+ argument, do not try with default value (bnc#383360)
+- use temporary krb5.conf also for obtaining machine accounts
+- remove AD info from smb.conf when domain was left (bnc#383374)
+- 2.16.7
+
+-------------------------------------------------------------------
Thu Apr 24 12:55:40 CEST 2008 - jsuchome@suse.cz
- text fixes (bnc#383229)
Modified: trunk/samba-client/src/SambaAD.pm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/samba-client/src/SambaAD.pm?rev=47068&r1=47067&r2=47068&view=diff
==============================================================================
--- trunk/samba-client/src/SambaAD.pm (original)
+++ trunk/samba-client/src/SambaAD.pm Fri Apr 25 13:25:57 2008
@@ -51,12 +51,13 @@
my $tmpdir = SCR->Read (".target.tmpdir");
my $conf_file = $tmpdir."/smb.conf";
- my $cmd = "net ads search \"(objectclass=organizationalUnit)\" distinguishedName -s $conf_file -U '$user%". ($passwd||"") . "'";
+ my $krb_file = $tmpdir."/krb5.conf";
+ my $cmd = "KRB5_CONFIG=$krb_file net ads search \"(objectclass=organizationalUnit)\" distinguishedName -s $conf_file -U '$user%". ($passwd||"") . "'";
+ SCR->Write (".target.string", $krb_file, "[realms]\n\t$realm = {\n\tkdc = $ads\n\t}\n");
SCR->Write (".target.string", $conf_file, "[global]\n\trealm = $realm\n\tsecurity = ADS\n\tworkgroup = $domain\n");
my $result = SCR->Execute(".target.bash_output", $cmd);
-
if ($result->{"exit"} eq 0) {
foreach my $line (split (/\n/,$result->{"stdout"} || "")) {
if ($line =~ m/^distinguishedName:/) {
@@ -95,6 +96,7 @@
if (FileUtils->Exists ("/usr/bin/dig")) {
# we have to select server from correct site - see bug #238249.
+ # TODO use +short instead?
my $out = SCR->Execute (".target.bash_output", "dig -t srv _ldap._tcp.dc._msdcs.$workgroup +noall +answer");
y2debug ("dig output: ", Dumper ($out));
my $tmpserver = "";
@@ -103,7 +105,7 @@
y2debug ("line: $line");
next if $server ne "";
- if ($line =~ m/$workgroup/) {
+ if ($line =~ m/$workgroup/ && $line !~ m/^;/) {
$tmpserver = "";
$tmpserver = (split (/[ \t]/, $line))[7] || ".";
chop $tmpserver;
@@ -112,11 +114,11 @@
my $cmd = "LANG=C net ads lookup -S $tmpserver";
$out = SCR->Execute (".target.bash_output", $cmd);
if ($out->{"exit"} eq 0) {
- foreach my $line (split (/\n/,$out->{"stdout"} || "")) {
+ foreach my $l (split (/\n/,$out->{"stdout"} || "")) {
next if $server;
- $server = $tmpserver if ($line =~ m/Is the closest DC/ && $line =~ m/yes/);
- if ($line =~ m/Client Site Name/ && $line !~ m/Default-First-Site-Name/) {
- my $site = $line;
+ $server = $tmpserver if ($l =~ m/Is the closest DC/ && $l =~ m/yes/);
+ if ($l =~ m/Client Site Name/ && $l !~ m/Default-First-Site-Name/) {
+ my $site = $l;
$site =~ s/^Client Site Name:([\t ]*)//g;
}
}
@@ -137,7 +139,7 @@
if ($out->{"exit"} eq 0) {
foreach my $line (split (/\n/,$out->{"stdout"} || "")) {
next if $server;
- if ($line =~ m/$workgroup/) {
+ if ($line =~ m/$workgroup/ && $line !~ m/^;/) {
$server = (split (/[ \t]/, $line))[7] || ".";
chop $server;
}
@@ -319,10 +321,11 @@
BEGIN{$TYPEINFO{AdjustSambaConfig}=["function","void","boolean"]}
sub AdjustSambaConfig {
my ($self, $status) = @_;
+
+ my $workgroup = SambaConfig->GlobalGetStr ("workgroup", "");
+ # remove special AD values if AD is not used
+ my $remove = (($ads || "") eq "");
if ($status) {
- my $workgroup = SambaConfig->GlobalGetStr ("workgroup", "");
- # remove special AD values if AD is not used
- my $remove = (($ads || "") eq "");
SambaConfig->GlobalSetMap({
"security" => $remove ? "domain" : "ADS",
"realm" => $remove ? undef : $realm,
@@ -340,6 +343,14 @@
SambaConfig->GlobalSetStr ("domain master", "Auto")
}
}
+ else {
+ SambaConfig->GlobalSetMap({
+ "security" => $remove ? "domain" : "ADS",
+ "realm" => $remove ? undef : $realm,
+ "template homedir" => $remove ? undef : "/home/%D/%U",
+ "winbind refresh tickets" => $remove ? undef : "yes"
+ });
+ }
}
# Change Kerberos configuration (for AD). Uses current (previously read)
Modified: trunk/samba-client/src/SambaNetJoin.pm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/samba-client/src/SambaNetJoin.pm?rev=47068&r1=47067&r2=47068&view=diff
==============================================================================
--- trunk/samba-client/src/SambaNetJoin.pm (original)
+++ trunk/samba-client/src/SambaNetJoin.pm Fri Apr 25 13:25:57 2008
@@ -99,7 +99,12 @@
. (($protocol ne "ads" && $netbios_name)?" -n '$netbios_name'":"")
. " -U '" . ($user||"") . "%" . ($passwd||"") . "'";
- $cmd = $cmd. " -createcomputer=\"$machine\"" if $machine;
+ if ($machine) {
+ $machine =~ s/dc=([^,]*)//gi; # remove DC=* parts
+ $machine =~ s/([^,]*)=//gi; # leave only values from the rest
+ my $m = join ('/', reverse (split (/,/,$machine)));
+ $cmd = $cmd. " createcomputer=\"$m\"" if $m;
+ }
my $result = SCR->Execute(".target.bash_output", $cmd);
$cmd =~ s/(-U '[^%]*)%[^']*'/$1'/; # hide password in debug
Modified: trunk/samba-client/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/samba-client/src/dialogs.ycp?rev=47068&r1=47067&r2=47068&view=diff
==============================================================================
--- trunk/samba-client/src/dialogs.ycp (original)
+++ trunk/samba-client/src/dialogs.ycp Fri Apr 25 13:25:57 2008
@@ -136,6 +136,7 @@
`ReplacePoint (`id(`rpstatus), `Empty())
);
map pw_data = Samba::password_data;
+ string left_domain = "";
// internal function: update the status line
void check_domain_membership (string domain) {
@@ -300,8 +301,10 @@
string workgroup = (string)UI::QueryWidget(`id(`workgroup), `Value);
if (LeaveDomain (workgroup) == `ok)
{
+ left_domain = workgroup;
check_domain_membership (workgroup);
UI::ChangeWidget(`id(`winbind), `Value, false);
+ SambaAD::SetADS ("");
}
}
else if (ret == `winbind) {
@@ -336,7 +339,8 @@
}
else if(ret == `next) {
string workgroup = (string)UI::QueryWidget(`id(`workgroup), `Value);
- if (workgroup != Samba::GetWorkgroup ())
+ if (workgroup != Samba::GetWorkgroup () &&
+ (left_domain == "" || workgroup != left_domain))
{
check_domain_membership (workgroup);
workgroup = Samba::GetWorkgroup ();
@@ -392,7 +396,9 @@
settings in smb.conf to the default values:
%1"), mergestring (["domain master", "domain logons"], "\n")));
}
- if (!Stage::cont()) {
+ if (!Stage::cont() &&
+ (left_domain=="" || use_winbind || left_domain != workgroup))
+ {
// return `ok, `fail or `nojoin
in_domain = AskJoinDomain(workgroup, workgroup_type);
if (in_domain == `fail) continue;
Modified: trunk/samba-client/src/routines.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/samba-client/src/routines.ycp?rev=47068&r1=47067&r2=47068&view=diff
==============================================================================
--- trunk/samba-client/src/routines.ycp (original)
+++ trunk/samba-client/src/routines.ycp Fri Apr 25 13:25:57 2008
@@ -37,8 +37,9 @@
map