Author: vlendec
Date: 2006-08-04 21:07:32 +0000 (Fri, 04 Aug 2006)
New Revision: 17406

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17406

Log:
We need to do a translation of winbind separator -> '\\' in
lookup_name_smbconf, otherwise 

force user = domain+administrator

can not work. Also attempt to fix the 'valid users = domain+group' bug at the
same time.

Volker
Modified:
   branches/SAMBA_3_0/source/passdb/lookup_sid.c
   branches/SAMBA_3_0/source/smbd/share_access.c
   branches/SAMBA_3_0_23/source/passdb/lookup_sid.c
   branches/SAMBA_3_0_23/source/smbd/share_access.c


Changeset:
Modified: branches/SAMBA_3_0/source/passdb/lookup_sid.c
===================================================================
--- branches/SAMBA_3_0/source/passdb/lookup_sid.c       2006-08-04 20:49:17 UTC 
(rev 17405)
+++ branches/SAMBA_3_0/source/passdb/lookup_sid.c       2006-08-04 21:07:32 UTC 
(rev 17406)
@@ -395,8 +395,25 @@
        char *qualified_name;
 
        /* NB. No winbindd_separator here as lookup_name needs \\' */
-       if (strchr_m(full_name, '\\')) {
+       if (strchr_m(full_name, *lp_winbind_separator())) {
+
                /* The name is already qualified with a domain. */
+
+               if (*lp_winbind_separator() != '\\') {
+                       char *p, *tmp;
+
+                       /* lookup_name() needs '\\' as a separator */
+
+                       tmp = talloc_strdup(mem_ctx, full_name);
+                       if (!tmp) {
+                               return False;
+                       }
+                       p = strchr_m(tmp, *lp_winbind_separator());
+                       SMB_ASSERT(p != NULL);
+                       *p = '\\';
+                       full_name = tmp;
+               }
+
                return lookup_name(mem_ctx, full_name, flags,
                                ret_domain, ret_name,
                                ret_sid, ret_type);

Modified: branches/SAMBA_3_0/source/smbd/share_access.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/share_access.c       2006-08-04 20:49:17 UTC 
(rev 17405)
+++ branches/SAMBA_3_0/source/smbd/share_access.c       2006-08-04 21:07:32 UTC 
(rev 17406)
@@ -97,7 +97,7 @@
        }
 
        if (!do_group_checks(&name, &prefix)) {
-               if (!lookup_name(mem_ctx, name, LOOKUP_NAME_ALL,
+               if (!lookup_name_smbconf(mem_ctx, name, LOOKUP_NAME_ALL,
                                 NULL, NULL, &sid, &type)) {
                        DEBUG(5, ("lookup_name %s failed\n", name));
                        return False;
@@ -112,7 +112,7 @@
 
        for (/* initialized above */ ; *prefix != '\0'; prefix++) {
                if (*prefix == '+') {
-                       if (!lookup_name(mem_ctx, name,
+                       if (!lookup_name_smbconf(mem_ctx, name,
                                         LOOKUP_NAME_ALL|LOOKUP_NAME_GROUP,
                                         NULL, NULL, &sid, &type)) {
                                DEBUG(5, ("lookup_name %s failed\n", name));

Modified: branches/SAMBA_3_0_23/source/passdb/lookup_sid.c
===================================================================
--- branches/SAMBA_3_0_23/source/passdb/lookup_sid.c    2006-08-04 20:49:17 UTC 
(rev 17405)
+++ branches/SAMBA_3_0_23/source/passdb/lookup_sid.c    2006-08-04 21:07:32 UTC 
(rev 17406)
@@ -370,8 +370,25 @@
        char *qualified_name;
 
        /* NB. No winbindd_separator here as lookup_name needs \\' */
-       if (strchr_m(full_name, '\\')) {
+       if (strchr_m(full_name, *lp_winbind_separator())) {
+
                /* The name is already qualified with a domain. */
+
+               if (*lp_winbind_separator() != '\\') {
+                       char *p, *tmp;
+
+                       /* lookup_name() needs '\\' as a separator */
+
+                       tmp = talloc_strdup(mem_ctx, full_name);
+                       if (!tmp) {
+                               return False;
+                       }
+                       p = strchr_m(tmp, *lp_winbind_separator());
+                       SMB_ASSERT(p != NULL);
+                       *p = '\\';
+                       full_name = tmp;
+               }
+
                return lookup_name(mem_ctx, full_name, flags,
                                ret_domain, ret_name,
                                ret_sid, ret_type);

Modified: branches/SAMBA_3_0_23/source/smbd/share_access.c
===================================================================
--- branches/SAMBA_3_0_23/source/smbd/share_access.c    2006-08-04 20:49:17 UTC 
(rev 17405)
+++ branches/SAMBA_3_0_23/source/smbd/share_access.c    2006-08-04 21:07:32 UTC 
(rev 17406)
@@ -94,7 +94,7 @@
        }
 
        if (!do_group_checks(&name, &prefix)) {
-               if (!lookup_name(mem_ctx, name, LOOKUP_NAME_ALL,
+               if (!lookup_name_smbconf(mem_ctx, name, LOOKUP_NAME_ALL,
                                 NULL, NULL, &sid, &type)) {
                        DEBUG(5, ("lookup_name %s failed\n", name));
                        return False;
@@ -109,7 +109,7 @@
 
        for (/* initialized above */ ; *prefix != '\0'; prefix++) {
                if (*prefix == '+') {
-                       if (!lookup_name(mem_ctx, name,
+                       if (!lookup_name_smbconf(mem_ctx, name,
                                         LOOKUP_NAME_ALL|LOOKUP_NAME_GROUP,
                                         NULL, NULL, &sid, &type)) {
                                DEBUG(5, ("lookup_name %s failed\n", name));

Reply via email to