summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-11-06 20:43:36 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:35 -0500
commite5c8e21129a2144633b518979f9a66eb8953dae6 (patch)
tree7da785938501fe4503a954b8c1671ac9252251a4 /source4
parent8408b3428d8c263f8453a0da8ef71e7fc1e4ec81 (diff)
downloadsamba-e5c8e21129a2144633b518979f9a66eb8953dae6.tar.gz
samba-e5c8e21129a2144633b518979f9a66eb8953dae6.tar.bz2
samba-e5c8e21129a2144633b518979f9a66eb8953dae6.zip
r3584: fix referral handling
metze (This used to be commit 4868f1ea857e94f60dbde83bfb54def8a5ee728f)
Diffstat (limited to 'source4')
-rw-r--r--source4/libcli/ldap/ldap.c15
-rw-r--r--source4/libcli/ldap/ldap.h3
2 files changed, 13 insertions, 5 deletions
diff --git a/source4/libcli/ldap/ldap.c b/source4/libcli/ldap/ldap.c
index 315241e5b1..2eea7b035a 100644
--- a/source4/libcli/ldap/ldap.c
+++ b/source4/libcli/ldap/ldap.c
@@ -361,9 +361,12 @@ static void ldap_encode_response(struct asn1_data *data, struct ldap_Result *res
asn1_write_OctetString(data, result->errormessage,
(result->errormessage) ?
strlen(result->errormessage) : 0);
- if (result->referral != NULL)
+ if (result->referral) {
+ asn1_push_tag(data, ASN1_CONTEXT(3));
asn1_write_OctetString(data, result->referral,
strlen(result->referral));
+ asn1_pop_tag(data);
+ }
}
BOOL ldap_encode(struct ldap_message *msg, DATA_BLOB *result)
@@ -620,7 +623,10 @@ BOOL ldap_encode(struct ldap_message *msg, DATA_BLOB *result)
break;
}
case LDAP_TAG_SearchResultReference: {
-/* struct ldap_SearchResRef *r = &msg->r.SearchResultReference; */
+ struct ldap_SearchResRef *r = &msg->r.SearchResultReference;
+ asn1_push_tag(&data, ASN1_APPLICATION(msg->type));
+ asn1_write_OctetString(&data, r->referral, strlen(r->referral));
+ asn1_pop_tag(&data);
break;
}
case LDAP_TAG_ExtendedRequest: {
@@ -957,8 +963,11 @@ BOOL ldap_decode(struct asn1_data *data, struct ldap_message *msg)
}
case ASN1_APPLICATION(LDAP_TAG_SearchResultReference): {
-/* struct ldap_SearchResRef *r = &msg->r.SearchResultReference; */
+ struct ldap_SearchResRef *r = &msg->r.SearchResultReference;
msg->type = LDAP_TAG_SearchResultReference;
+ asn1_start_tag(data, tag);
+ asn1_read_OctetString_talloc(msg->mem_ctx, data, &r->referral);
+ asn1_end_tag(data);
break;
}
diff --git a/source4/libcli/ldap/ldap.h b/source4/libcli/ldap/ldap.h
index c27aba8d7a..65962bf5b5 100644
--- a/source4/libcli/ldap/ldap.h
+++ b/source4/libcli/ldap/ldap.h
@@ -161,8 +161,7 @@ struct ldap_SearchResEntry {
};
struct ldap_SearchResRef {
- int num_referrals;
- const char **referrals;
+ const char *referral;
};
enum ldap_modify_type {