Bug 396070

Summary: Join Domain Broken yast2
Product: [openSUSE] openSUSE 11.0 Reporter: Megaq Lex <megalexis>
Component: YaST2Assignee: Jiří Suchomel <jsuchome>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Critical    
Priority: P5 - None CC: megalexis, samba-maintainers
Version: RC 1Flags: coolo: SHIP_STOPPER-
Target Milestone: ---   
Hardware: x86   
OS: openSUSE 11.0   
Whiteboard:
Found By: Beta-Customer Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: patch for /usr/share/YaST2/modules/SambaNetJoin.pm
patch for /usr/share/YaST2/modules/SambaNetJoin.pm

Description Megaq Lex 2008-05-30 21:01:51 UTC
Joining a domain through yast2 is broken.
The error reads:

sh:-c:line0: unexpected EOF while looking for matching `"
sh:-c:line1: syntax error: unexpected end of file.

Dont have a clue whats causing this.
Comment 1 Megaq Lex 2008-05-30 21:11:13 UTC
YAST LOG:

2008-05-30 16:09:05 <1> hmp-white2(953) [Perl] modules/SambaAD.pm(SambaAD::GetADS):89 get ads: workgroup: XXXXXX
2008-05-30 16:09:06 <1> hmp-white2(953) [Perl] modules/SambaAD.pm(SambaAD::GetADS):206 returning server: 165.91.110.10
2008-05-30 16:09:06 <1> hmp-white2(953) [Perl] modules/SambaAD.pm(SambaAD::ADDomain2Workgroup):264 workgroup: XXXXXX
2008-05-30 16:09:06 <1> hmp-white2(953) [Perl] modules/SambaAD.pm(SambaAD::GetRealm):298 realm: XXX.XXXXXX
2008-05-30 16:09:06 <3> hmp-white2(953) [bash] ShellCommand.cc(shellcommand):78 Join to domain is not valid: Undetermined error
2008-05-30 16:09:06 <5> hmp-white2(953) [Perl] modules/SambaNetJoin.pm(SambaNetJoin::Test):56 LANG=C net ads testjoin -s /tmp/YaST2-00953-71ewX4/smb.conf -P => $VAR1 = {
          'stderr' => 'Join to domain is not valid: Undetermined error
',
          'exit' => 255,
          'stdout' => ''
        };
2008-05-30 16:09:41 <3> hmp-white2(953) [bash] ShellCommand.cc(shellcommand):78 sh: -c: line 0: unexpected EOF while looking for matching `''
2008-05-30 16:09:41 <3> hmp-white2(953) [bash] ShellCommand.cc(shellcommand):78 sh: -c: line 1: syntax error: unexpected end of file
2008-05-30 16:09:41 <5> hmp-white2(953) [Perl] modules/SambaNetJoin.pm(SambaNetJoin::Join):111 KRB5_CONFIG=/tmp/YaST2-00953-71ewX4/krb5.conf net ads join  -s /tmp/YaST2-00953-71ewX4/smb.conf -U 'xxxxx't' => $VAR1 = {
          'stderr' => 'sh: -c: line 0: unexpected EOF while looking for matching `\'\'
sh: -c: line 1: syntax error: unexpected end of file
',
          'exit' => 2,
          'stdout' => ''
        };
Comment 2 Jiří Suchomel 2008-06-02 06:24:00 UTC
Hm, it looks like the temporary krb/smb.cof is broken, but I cannot reproduce it here.
Could you please try again and attach the configuration files used for join? Just wait after error occurs and look into the log for the path to them, in the situation above the y are /tmp/YaST2-00953-71ewX4/krb5.conf and /tmp/YaST2-00953-71ewX4/smb.conf.

Save the files right after you see the error and don't quit YaST, because temporary files are deleted on YaST's exit.
Comment 3 Jiří Suchomel 2008-06-02 09:08:03 UTC
samba-maintainers: what does the error message from 'net' command mean?
Comment 4 Jiří Suchomel 2008-06-02 10:18:16 UTC
What is the name of your samba Administrator's account? Is it really xxxxx't ?
Comment 5 Jiří Suchomel 2008-06-02 12:37:49 UTC
Created attachment 219497 [details]
patch for /usr/share/YaST2/modules/SambaNetJoin.pm

Please apply this patch to  /usr/share/YaST2/modules/SambaNetJoin.pm and try again.
Comment 6 Jiří Suchomel 2008-06-02 12:40:04 UTC
Comment on attachment 219497 [details]
patch for /usr/share/YaST2/modules/SambaNetJoin.pm

Index: SambaNetJoin.pm
===================================================================
--- SambaNetJoin.pm     (revision 47068)
+++ SambaNetJoin.pm     (working copy)
@@ -12,7 +12,7 @@
 use strict;
 use Data::Dumper;

-use YaST::YCP qw(:DATA :LOGGING);
+use YaST::YCP qw(:LOGGING);
 use YaPI;

 textdomain "samba-client";
@@ -21,6 +21,7 @@
 YaST::YCP::Import("SCR");
 YaST::YCP::Import("SambaConfig");
 YaST::YCP::Import("SambaAD");
+YaST::YCP::Import("String");

 my %TestJoinCache;

@@ -97,7 +98,7 @@
        . ($protocol ne "ads" ? " -w '$domain'" : "")
        . " -s $conf_file"
        . (($protocol ne "ads" && $netbios_name)?" -n '$netbios_name'":"")
-       . " -U '" . ($user||"") . "%" . ($passwd||"") . "'";
+       . " -U '" . String->Quote ($user) . "%" . String->Quote ($passwd) . "'";

     if ($machine) {
        $machine        =~ s/dc=([^,]*)//gi; # remove DC=* parts
@@ -144,7 +145,7 @@
     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||"") . "'";
+       . " -U '" . String->Quote ($user) . "%" . String->Quote ($passwd) . "'";

     my $result = SCR->Execute(".target.bash_output", $cmd);
     $cmd =~ s/(-U '[^%]*)%[^']*'/$1'/; # hide password in the log
Comment 7 Jiří Suchomel 2008-06-02 12:41:19 UTC
Created attachment 219501 [details]
patch for /usr/share/YaST2/modules/SambaNetJoin.pm

Ah, sorry, this should be the correct patch
Comment 8 James McDonough 2008-06-02 18:12:10 UTC
Hmm, unfortunately the "net ads join" error message results from trying to
return an NT status code from what may have been an ldap or kerberos error. 
The only way to know in this case is to see a sniffer trace.

It may well be clock skew...
Comment 9 Megaq Lex 2008-06-03 14:13:37 UTC
Patch fixed it !! Joined the domain. you can close this..

Thanks,
Alex.
Comment 10 Megaq Lex 2008-06-03 14:36:54 UTC
Wait don't close..

I still cant log in because even though it said it joined the domain the gdm or kdm is not showing the option to log in to the domain.
Comment 11 Megaq Lex 2008-06-03 15:07:46 UTC
check box for offline authentication is not checked even though:
winbind offline logon = yes
is set.

Comment 12 Megaq Lex 2008-06-03 15:08:39 UTC
we need another checkbox for this:
winbind use default domain = yes

Comment 13 Andreas Schneider 2008-06-03 15:24:11 UTC
The option 'winbind use default domain = yes' should not be used as it creates more problems than that it helps.

See http://marc.info/?l=samba-technical&m=120358400415871&w=2
Comment 14 Jiří Suchomel 2008-06-03 18:56:10 UTC
Please, leave the other issues into different bug reports, this one is related to the ' character in user name or password.