Ignore:
Timestamp:
Apr 9, 2010, 3:20:58 PM (15 years ago)
Author:
Silvan Scherrer
Message:

Samba 3.5.x: update to 3.5.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/libads/ldap.c

    r414 r427  
    38563856                           const char **account_ou)
    38573857{
    3858         struct ldb_dn *name_dn = NULL;
    3859         const char *name = NULL;
    3860         char *ou_string = NULL;
    3861         struct ldb_context *ldb = ldb_init(mem_ctx, NULL);
    3862 
    3863         name_dn = ldb_dn_new(mem_ctx, ldb, *account_ou);
    3864         if (name_dn && ldb_dn_validate(name_dn)) {
    3865                 talloc_free(ldb);
     3858        char **exploded_dn;
     3859        const char *name;
     3860        char *ou_string;
     3861
     3862        exploded_dn = ldap_explode_dn(*account_ou, 0);
     3863        if (exploded_dn) {
     3864                ldap_value_free(exploded_dn);
    38663865                return ADS_SUCCESS;
    38673866        }
     
    38693868        ou_string = ads_ou_string(ads, *account_ou);
    38703869        if (!ou_string) {
    3871                 talloc_free(ldb);
    38723870                return ADS_ERROR_LDAP(LDAP_INVALID_DN_SYNTAX);
    38733871        }
    38743872
    3875         name_dn = ldb_dn_new_fmt(mem_ctx, ldb, "%s,%s", ou_string,
    3876                                 ads->config.bind_path);
     3873        name = talloc_asprintf(mem_ctx, "%s,%s", ou_string,
     3874                              ads->config.bind_path);
    38773875        SAFE_FREE(ou_string);
    38783876
    3879         if (!name_dn || !ldb_dn_validate(name_dn)) {
    3880                 talloc_free(ldb);
     3877        if (!name) {
     3878                return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
     3879        }
     3880
     3881        exploded_dn = ldap_explode_dn(name, 0);
     3882        if (!exploded_dn) {
    38813883                return ADS_ERROR_LDAP(LDAP_INVALID_DN_SYNTAX);
    38823884        }
    3883 
    3884         *account_ou = talloc_strdup(mem_ctx, name);
    3885         if (!*account_ou) {
    3886                 talloc_free(ldb);
    3887                 return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
    3888         }
    3889 
    3890         talloc_free(ldb);
     3885        ldap_value_free(exploded_dn);
     3886
     3887        *account_ou = name;
    38913888        return ADS_SUCCESS;
    38923889}
Note: See TracChangeset for help on using the changeset viewer.