summaryrefslogtreecommitdiff
path: root/source3/libads/ldap.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-04-24 09:17:08 +0200
committerAndrew Bartlett <abartlet@samba.org>2009-04-24 09:17:08 +0200
commit2ee9ee2c17ce435ce45a773f19302a7b474554c2 (patch)
tree2ea91c2d36664f02e001575be0591660190d86ed /source3/libads/ldap.c
parentb82a204b9b2c28707ab7866a511ea4f5912826ac (diff)
parentaf6316d1500cfcedd5fd59ed0ddbba9aec9c3756 (diff)
downloadsamba-2ee9ee2c17ce435ce45a773f19302a7b474554c2.tar.gz
samba-2ee9ee2c17ce435ce45a773f19302a7b474554c2.tar.bz2
samba-2ee9ee2c17ce435ce45a773f19302a7b474554c2.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba into abartlet-devel
Diffstat (limited to 'source3/libads/ldap.c')
-rw-r--r--source3/libads/ldap.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index cc72d81b86..588c0a131c 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -22,7 +22,7 @@
*/
#include "includes.h"
-#include "lib/ldb/include/includes.h"
+#include "lib/ldb/include/ldb.h"
#ifdef HAVE_LDAP
@@ -3858,34 +3858,36 @@ ADS_STATUS ads_check_ou_dn(TALLOC_CTX *mem_ctx,
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_explode(mem_ctx, *account_ou);
- if (name_dn) {
+ name_dn = ldb_dn_new(mem_ctx, ldb, *account_ou);
+ if (name_dn && ldb_dn_validate(name_dn)) {
+ talloc_free(ldb);
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 = talloc_asprintf(mem_ctx, "%s,%s", ou_string,
- ads->config.bind_path);
+ name_dn = ldb_dn_new_fmt(mem_ctx, ldb, "%s,%s", ou_string,
+ ads->config.bind_path);
SAFE_FREE(ou_string);
- if (!name) {
- return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
- }
- name_dn = ldb_dn_explode(mem_ctx, name);
- if (!name_dn) {
+ if (!name_dn || !ldb_dn_validate(name_dn)) {
+ talloc_free(ldb);
return ADS_ERROR_LDAP(LDAP_INVALID_DN_SYNTAX);
}
*account_ou = talloc_strdup(mem_ctx, name);
if (!*account_ou) {
+ talloc_free(ldb);
return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
}
+ talloc_free(ldb);
return ADS_SUCCESS;
}