s3/winbindd: using default domain with user@domain.com format fails
authorNoel Power <noel.power@suse.com>
Tue, 20 Sep 2016 10:49:49 +0000 (11:49 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 3 Oct 2016 21:37:44 +0000 (23:37 +0200)
For example for samba client joined to a windows AD DC the following
commands fail if 'winbind use default domain = yes'
   getent passwd user@domain.com
   ssh -o user=user@domain.com localhost

The same commands succeed if the setting above has the default 'no' value

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12298

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Oct  3 23:37:44 CEST 2016 on sn-devel-144

source3/winbindd/winbindd_util.c

index f0344b1b26f4ddd052786cffc1646488fa3023f7..d7071738dcedb0bdf43b9086817ad955cbc9cd36 100644 (file)
@@ -1103,10 +1103,11 @@ bool parse_domain_user(const char *domuser, fstring domain, fstring user)
 
        if ( !p ) {
                fstrcpy(user, domuser);
+               p = strchr(domuser, '@');
 
-               if ( assume_domain(lp_workgroup())) {
+               if ( assume_domain(lp_workgroup()) && p == NULL) {
                        fstrcpy(domain, lp_workgroup());
-               } else if ((p = strchr(domuser, '@')) != NULL) {
+               } else if (p != NULL) {
                        fstrcpy(domain, p + 1);
                        user[PTR_DIFF(p, domuser)] = 0;
                } else {