summaryrefslogtreecommitdiff
path: root/source4/libcli/ldap/ldap_ldif.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-05-11 14:38:13 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:16:39 -0500
commit2542d54e9384302c6c9a7b2b2bf4be07b6d95f9c (patch)
treea5fadde6b93a9200d4f90aaa328f8b7477da0e5b /source4/libcli/ldap/ldap_ldif.c
parentdd0266918748a7da3e0a4f19ba96f96cee2eaca8 (diff)
downloadsamba-2542d54e9384302c6c9a7b2b2bf4be07b6d95f9c.tar.gz
samba-2542d54e9384302c6c9a7b2b2bf4be07b6d95f9c.tar.bz2
samba-2542d54e9384302c6c9a7b2b2bf4be07b6d95f9c.zip
r6732: - move sasl send recv code to the ldap lib
- support 'modrdn' ldif metze (This used to be commit b6a1734699953964fcde6fe6ea7048496492eb33)
Diffstat (limited to 'source4/libcli/ldap/ldap_ldif.c')
-rw-r--r--source4/libcli/ldap/ldap_ldif.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/source4/libcli/ldap/ldap_ldif.c b/source4/libcli/ldap/ldap_ldif.c
index e5e5cdd6df..c36106e116 100644
--- a/source4/libcli/ldap/ldap_ldif.c
+++ b/source4/libcli/ldap/ldap_ldif.c
@@ -305,6 +305,53 @@ static BOOL fill_mods(struct ldap_message *msg, char **chunk)
return True;
}
+static BOOL fill_modrdn(struct ldap_message *msg, char **chunk)
+{
+ struct ldap_ModifyDNRequest *r = &msg->r.ModifyDNRequest;
+ const char *attr_name;
+ struct ldap_val value;
+
+ r->newrdn = NULL;
+ r->deleteolddn = False;
+ r->newsuperior = NULL;
+
+ if (next_attr(chunk, &attr_name, &value) != 0) {
+ return False;
+ }
+
+ if (!strequal(attr_name, "newrdn")) {
+ return False;
+ }
+
+ r->newrdn = value.data;
+
+ if (next_attr(chunk, &attr_name, &value) != 0) {
+ return False;
+ }
+
+ if (!strequal(attr_name, "deleteoldrdn")) {
+ return False;
+ }
+
+ if (value.data && (((char *)value.data)[0] != '0')) {
+ r->deleteolddn = True;
+ }
+
+ if (next_attr(chunk, &attr_name, &value) != 0) {
+ /* newsuperior is optional */
+ return True;
+ }
+
+ if (!strequal(attr_name, "newsuperior")) {
+ return False;
+ }
+
+ r->newsuperior = value.data;
+
+ return True;
+}
+
+
/*
read from a LDIF source, creating a ldap_message
*/
@@ -381,6 +428,17 @@ static struct ldap_message *ldif_read(TALLOC_CTX *mem_ctx, int (*fgetc_fn)(void
return msg;
}
+ if (strequal(value.data, "modrdn")) {
+ msg->type = LDAP_TAG_ModifyDNRequest;
+
+ msg->r.ModifyDNRequest.dn = dn;
+
+ if (!fill_modrdn(msg, &s))
+ goto failed;
+
+ return msg;
+ }
+
DEBUG(3, ("changetype %s not supported\n", (char *)value.data));
failed: