summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 {