The branch, v3-5-test has been updated
       via  36b7a2d... s3:ads fix dn parsing name was always null
      from  6253cb5... s3:vfs_aixacl2: add missing semicolon

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test


- Log -----------------------------------------------------------------
commit 36b7a2d8dcfccca45e70b6a013316409244ab641
Author: Simo Sorce <[email protected]>
Date:   Mon Mar 1 14:50:50 2010 -0500

    s3:ads fix dn parsing name was always null
    
    While there also use ldap_exploded_dn instead of ldb_dn_validate()
    so we can remove a huge dependency that is hanging there only for one very
    minor marginal use.
    
    Signed-off-by: Günther Deschner <[email protected]>
    (cherry picked from commit 8492f92843aa17eaf4a3ea9d5a9c6319afc97854)
    
    Fix bug #7204 (net ads join createcomputer=Servers/Unix fails with out of
    memory).

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

Summary of changes:
 source3/libads/ldap.c |   35 ++++++++++++++++-------------------
 1 files changed, 16 insertions(+), 19 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 4005ed6..1fd5aa3 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -3855,39 +3855,36 @@ ADS_STATUS ads_check_ou_dn(TALLOC_CTX *mem_ctx,
                           ADS_STRUCT *ads,
                           const char **account_ou)
 {
-       struct ldb_dn *name_dn = NULL;
-       const char *name = NULL;
-       char *ou_string = NULL;
-       struct ldb_context *ldb = ldb_init(mem_ctx, NULL);
-
-       name_dn = ldb_dn_new(mem_ctx, ldb, *account_ou);
-       if (name_dn && ldb_dn_validate(name_dn)) {
-               talloc_free(ldb);
+       char **exploded_dn;
+       const char *name;
+       char *ou_string;
+
+       exploded_dn = ldap_explode_dn(*account_ou, 0);
+       if (exploded_dn) {
+               ldap_value_free(exploded_dn);
                return ADS_SUCCESS;
        }
 
        ou_string = ads_ou_string(ads, *account_ou);
        if (!ou_string) {
-               talloc_free(ldb);
                return ADS_ERROR_LDAP(LDAP_INVALID_DN_SYNTAX);
        }
 
-       name_dn = ldb_dn_new_fmt(mem_ctx, ldb, "%s,%s", ou_string,
-                                ads->config.bind_path);
+       name = talloc_asprintf(mem_ctx, "%s,%s", ou_string,
+                              ads->config.bind_path);
        SAFE_FREE(ou_string);
 
-       if (!name_dn || !ldb_dn_validate(name_dn)) {
-               talloc_free(ldb);
-               return ADS_ERROR_LDAP(LDAP_INVALID_DN_SYNTAX);
+       if (!name) {
+               return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
        }
 
-       *account_ou = talloc_strdup(mem_ctx, name);
-       if (!*account_ou) {
-               talloc_free(ldb);
-               return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
+       exploded_dn = ldap_explode_dn(name, 0);
+       if (!exploded_dn) {
+               return ADS_ERROR_LDAP(LDAP_INVALID_DN_SYNTAX);
        }
+       ldap_value_free(exploded_dn);
 
-       talloc_free(ldb);
+       *account_ou = name;
        return ADS_SUCCESS;
 }
 


-- 
Samba Shared Repository

Reply via email to