summaryrefslogtreecommitdiff
path: root/source3/libads
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-04-23 14:31:45 +0200
committerJelmer Vernooij <jelmer@samba.org>2009-04-23 18:27:32 +0200
commitb6981e79dfb22819f48edcd4041b00f9b8cd7a93 (patch)
treead1ac3680665c9bd77191be87d2900ed291ca639 /source3/libads
parent9b64073cf733588b75c3780f2c18728ff3009500 (diff)
downloadsamba-b6981e79dfb22819f48edcd4041b00f9b8cd7a93.tar.gz
samba-b6981e79dfb22819f48edcd4041b00f9b8cd7a93.tar.bz2
samba-b6981e79dfb22819f48edcd4041b00f9b8cd7a93.zip
samba3/ldb: Update the ldb_dn API to match that of the Samba 4 LDB:
* ldb_dn_new() now takes an initial DN string * ldb_dn_string_compose() -> ldb_dn_new_fmt() * dummy ldb_dn_validate(), since LDB DNs in the current implementation are always valid if they could be created.
Diffstat (limited to 'source3/libads')
-rw-r--r--source3/libads/ldap.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 44a73cbfdb..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
@@ -3860,25 +3860,24 @@ ADS_STATUS ads_check_ou_dn(TALLOC_CTX *mem_ctx,
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);
}