The branch, master has been updated
       via  4432967532897cc90ce7d7b11fab6f6f88f8bfc0 (commit)
       via  4205fab500927a4248fda622e1c338b7e791617f (commit)
       via  49145bfefae54672c5d4cccdbb9dd33e1cd89b88 (commit)
       via  1f8a7739ace7715b20c9b8c72732ab1ff689b552 (commit)
       via  1b9c2ccb1f1ba4d67ee0d82f4ff89b0abd62cbe2 (commit)
       via  e401ce6de79e696d8dda7b56568b1565d2e21f62 (commit)
      from  f0dccdca6a9da4440406f9cccd76805cad87d7e6 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 4432967532897cc90ce7d7b11fab6f6f88f8bfc0
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Sun Sep 21 02:07:43 2008 +0200

    [s3]winbindd_group: don't list the domain twice when expanding internal 
aliases
    
    Before this, "getent group builtin\\administrators" expanded
    domain group members in the form DOMAIN\domain\user.
    
    Michael

commit 4205fab500927a4248fda622e1c338b7e791617f
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Sun Sep 21 02:06:44 2008 +0200

    [s3]winbindd_group: sanely handle NULL domain in add_member().
    
    Michael

commit 49145bfefae54672c5d4cccdbb9dd33e1cd89b88
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Mon Sep 22 10:39:37 2008 +0200

    [s3]winbindd_ads: honour "winbind use default domain" in lookup_groupmem().
    
    This fixes the output of "getent group" when "winbind use default domain = 
yes"
    with security = ads.
    
    Michael

commit 1f8a7739ace7715b20c9b8c72732ab1ff689b552
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Sun Sep 21 01:20:32 2008 +0200

    [s3]winbindd_rpc: add domain prefix to username in lookup_groupmem().
    
    This makes the output of "getent group" of a domain group show the
    domain prefix with "security = domain".
    
    Michael

commit 1b9c2ccb1f1ba4d67ee0d82f4ff89b0abd62cbe2
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Mon Sep 22 10:37:11 2008 +0200

    [s3]winbindd_util: add fill_domain_username_talloc().
    
    A talloc version of fill_domain_username().
    
    Michael

commit e401ce6de79e696d8dda7b56568b1565d2e21f62
Author: Michael Adam <[EMAIL PROTECTED]>
Date:   Mon Sep 22 10:36:32 2008 +0200

    [s3]winbindd_util: add prototype for fill_domain_username_talloc().
    
    A talloc version of fill_domain_username().
    
    Michael

-----------------------------------------------------------------------

Summary of changes:
 source3/winbindd/winbindd_ads.c   |   20 +++++++++++---------
 source3/winbindd/winbindd_group.c |    8 ++++++--
 source3/winbindd/winbindd_proto.h |    4 ++++
 source3/winbindd/winbindd_rpc.c   |    5 ++++-
 source3/winbindd/winbindd_util.c  |   27 +++++++++++++++++++++++++++
 5 files changed, 52 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/winbindd/winbindd_ads.c b/source3/winbindd/winbindd_ads.c
index 894e786..1febddf 100644
--- a/source3/winbindd/winbindd_ads.c
+++ b/source3/winbindd/winbindd_ads.c
@@ -1023,10 +1023,11 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain 
*domain,
                        DEBUG(10,("ads: lookup_groupmem: got sid %s from "
                                  "cache\n", sid_string_dbg(&sid)));
                        sid_copy(&(*sid_mem)[*num_names], &sid);
-                       (*names)[*num_names] = talloc_asprintf(*names, "%s%c%s",
-                                                              domain_name,
-                                                              
*lp_winbind_separator(),
-                                                              name );
+                       (*names)[*num_names] = fill_domain_username_talloc(
+                                                       *names,
+                                                       domain_name,
+                                                       name,
+                                                       true);
 
                        (*name_types)[*num_names] = name_type;
                        (*num_names)++;
@@ -1071,11 +1072,12 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain 
*domain,
                                {
                                        sid_copy(&(*sid_mem)[*num_names],
                                                 &sid_mem_nocache[i]);
-                                       (*names)[*num_names] = talloc_asprintf( 
*names, 
-                                                                               
"%s%c%s",
-                                                                               
domains_nocache[i],
-                                                                               
*lp_winbind_separator(),
-                                                                               
names_nocache[i] );
+                                       (*names)[*num_names] =
+                                               fill_domain_username_talloc(
+                                                       *names,
+                                                       domains_nocache[i],
+                                                       names_nocache[i],
+                                                       true);
                                        (*name_types)[*num_names] = 
name_types_nocache[i];
                                        (*num_names)++;
                                }
diff --git a/source3/winbindd/winbindd_group.c 
b/source3/winbindd/winbindd_group.c
index 088f946..f2b6fbe 100644
--- a/source3/winbindd/winbindd_group.c
+++ b/source3/winbindd/winbindd_group.c
@@ -35,7 +35,11 @@ static void add_member(const char *domain, const char *user,
 {
        fstring name;
 
-       fill_domain_username(name, domain, user, True);
+       if (domain != NULL) {
+               fill_domain_username(name, domain, user, True);
+       } else {
+               fstrcpy(name, user);
+       }
        safe_strcat(name, ",", sizeof(name)-1);
        string_append(pp_members, name);
        *p_num_members += 1;
@@ -136,7 +140,7 @@ static void add_expanded_sid(const DOM_SID *sid,
                        continue;
                }
 
-               add_member(domain->name, names[i], pp_members, p_num_members);
+               add_member(NULL, names[i], pp_members, p_num_members);
        }
 
  done:
diff --git a/source3/winbindd/winbindd_proto.h 
b/source3/winbindd/winbindd_proto.h
index 4774bc8..3836c46 100644
--- a/source3/winbindd/winbindd_proto.h
+++ b/source3/winbindd/winbindd_proto.h
@@ -569,6 +569,10 @@ bool parse_domain_user_talloc(TALLOC_CTX *mem_ctx, const 
char *domuser,
 void parse_add_domuser(void *buf, char *domuser, int *len);
 bool canonicalize_username(fstring username_inout, fstring domain, fstring 
user);
 void fill_domain_username(fstring name, const char *domain, const char *user, 
bool can_assume);
+char *fill_domain_username_talloc(TALLOC_CTX *ctx,
+                                 const char *domain,
+                                 const char *user,
+                                 bool can_assume);
 const char *get_winbind_pipe_dir(void) ;
 char *get_winbind_priv_pipe_dir(void) ;
 int open_winbindd_socket(void);
diff --git a/source3/winbindd/winbindd_rpc.c b/source3/winbindd/winbindd_rpc.c
index df80ad8..9fbea8e 100644
--- a/source3/winbindd/winbindd_rpc.c
+++ b/source3/winbindd/winbindd_rpc.c
@@ -854,7 +854,10 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain 
*domain,
                }
 
                for (r=0; r<tmp_names.count; r++) {
-                       (*names)[i+r] = CONST_DISCARD(char *, 
tmp_names.names[r].string);
+                       (*names)[i+r] = fill_domain_username_talloc(mem_ctx,
+                                               domain->name,
+                                               tmp_names.names[r].string,
+                                               true);
                        (*name_types)[i+r] = tmp_types.ids[r];
                }
 
diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c
index b296465..5b5ca41 100644
--- a/source3/winbindd/winbindd_util.c
+++ b/source3/winbindd/winbindd_util.c
@@ -1213,6 +1213,33 @@ void fill_domain_username(fstring name, const char 
*domain, const char *user, bo
        }
 }
 
+/**
+ * talloc version of fill_domain_username()
+ * return NULL on talloc failure.
+ */
+char *fill_domain_username_talloc(TALLOC_CTX *mem_ctx,
+                                 const char *domain,
+                                 const char *user,
+                                 bool can_assume)
+{
+       char *tmp_user, *name;
+
+       tmp_user = talloc_strdup(mem_ctx, user);
+       strlower_m(tmp_user);
+
+       if (can_assume && assume_domain(domain)) {
+               name = tmp_user;
+       } else {
+               name = talloc_asprintf(mem_ctx, "%s%c%s",
+                                      domain,
+                                      *lp_winbind_separator(),
+                                      tmp_user);
+               TALLOC_FREE(tmp_user);
+       }
+
+       return name;
+}
+
 /*
  * Winbindd socket accessor functions
  */


-- 
Samba Shared Repository

Reply via email to