The branch, master has been updated
       via  01ea4249da246b0b99a4b89eb36aa6b1c0d46994 (commit)
       via  d07464b21fe652e205f5eb2c74d12495bab100ce (commit)
       via  3194ad2838bedee3eff60c767552d8a801b5eb70 (commit)
      from  7a5475f098c6a20f867adc081ca455e6c393755b (commit)

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


- Log -----------------------------------------------------------------
commit 01ea4249da246b0b99a4b89eb36aa6b1c0d46994
Author: Volker Lendecke <[email protected]>
Date:   Wed May 27 18:40:31 2009 +0200

    TALLOC_ZERO_P->talloc_zero

commit d07464b21fe652e205f5eb2c74d12495bab100ce
Author: Volker Lendecke <[email protected]>
Date:   Wed May 27 18:40:13 2009 +0200

    Do not segfault in pdb_search_destructor if no real search was started

commit 3194ad2838bedee3eff60c767552d8a801b5eb70
Author: Volker Lendecke <[email protected]>
Date:   Thu May 28 01:02:40 2009 +0200

    Add smbldap_pull_sid

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

Summary of changes:
 source3/include/smbldap.h      |    2 ++
 source3/lib/smbldap.c          |   20 ++++++++++++++++++++
 source3/libads/ldap.c          |   14 +-------------
 source3/passdb/pdb_interface.c |    6 ++++--
 4 files changed, 27 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/smbldap.h b/source3/include/smbldap.h
index 3ac770a..c28d43d 100644
--- a/source3/include/smbldap.h
+++ b/source3/include/smbldap.h
@@ -214,6 +214,8 @@ char * smbldap_talloc_single_attribute(LDAP *ldap_struct, 
LDAPMessage *entry,
 char * smbldap_talloc_smallest_attribute(LDAP *ldap_struct, LDAPMessage *entry,
                                         const char *attribute,
                                         TALLOC_CTX *mem_ctx);
+bool smbldap_pull_sid(LDAP *ld, LDAPMessage *msg, const char *attrib,
+                     struct dom_sid *sid);
 void talloc_autofree_ldapmsg(TALLOC_CTX *mem_ctx, LDAPMessage *result);
 void talloc_autofree_ldapmod(TALLOC_CTX *mem_ctx, LDAPMod **mod);
 char *smbldap_talloc_dn(TALLOC_CTX *mem_ctx, LDAP *ld,
diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c
index 4360d3a..b6921c3 100644
--- a/source3/lib/smbldap.c
+++ b/source3/lib/smbldap.c
@@ -389,6 +389,26 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = {
        return result;
 }
 
+ bool smbldap_pull_sid(LDAP *ld, LDAPMessage *msg, const char *attrib,
+                      struct dom_sid *sid)
+{
+       struct berval **values;
+       bool ret = False;
+
+       values = ldap_get_values_len(ld, msg, attrib);
+
+       if (!values) {
+               return false;
+       }
+
+       if (values[0] != NULL) {
+               ret = sid_parse(values[0]->bv_val, values[0]->bv_len, sid);
+       }
+
+       ldap_value_free_len(values);
+       return ret;
+}
+
  static int ldapmsg_destructor(LDAPMessage **result) {
        ldap_msgfree(*result);
        return 0;
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 588c0a1..3e5764a 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -2619,19 +2619,7 @@ int ads_count_replies(ADS_STRUCT *ads, void *res)
  bool ads_pull_sid(ADS_STRUCT *ads, LDAPMessage *msg, const char *field,
                   DOM_SID *sid)
 {
-       struct berval **values;
-       bool ret = False;
-
-       values = ldap_get_values_len(ads->ldap.ld, msg, field);
-
-       if (!values)
-               return False;
-
-       if (values[0])
-               ret = sid_parse(values[0]->bv_val, values[0]->bv_len, sid);
-       
-       ldap_value_free_len(values);
-       return ret;
+       return smbldap_pull_sid(ads->ldap.ld, msg, field, sid);
 }
 
 /**
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index 340867a..b4e1bd4 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -1711,7 +1711,7 @@ static NTSTATUS pdb_default_lookup_names(struct 
pdb_methods *methods,
 
 static int pdb_search_destructor(struct pdb_search *search)
 {
-       if (!search->search_ended) {
+       if ((!search->search_ended) && (search->search_end != NULL)) {
                search->search_end(search);
        }
        return 0;
@@ -1733,6 +1733,7 @@ struct pdb_search *pdb_search_init(TALLOC_CTX *mem_ctx,
        result->num_entries = 0;
        result->cache_size = 0;
        result->search_ended = False;
+       result->search_end = NULL;
 
        /* Segfault appropriately if not initialized */
        result->next_entry = NULL;
@@ -2021,7 +2022,8 @@ NTSTATUS make_pdb_method( struct pdb_methods **methods )
 {
        /* allocate memory for the structure as its own talloc CTX */
 
-       if ( !(*methods = TALLOC_ZERO_P(talloc_autofree_context(), struct 
pdb_methods) ) ) {
+       *methods = talloc_zero(talloc_autofree_context(), struct pdb_methods);
+       if (*methods == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
 


-- 
Samba Shared Repository

Reply via email to