mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-23 15:40:01 -06:00
ipa-cldap: send cldap reply
This commit is contained in:
parent
64ce67523f
commit
17cc52a154
@ -204,6 +204,52 @@ done:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void ipa_cldap_respond(struct ipa_cldap_ctx *ctx,
|
||||
struct ipa_cldap_req *req,
|
||||
struct berval *nbtblob)
|
||||
{
|
||||
struct berval *bv = NULL;
|
||||
BerElement *be;
|
||||
int ret;
|
||||
|
||||
be = ber_alloc_t(0);
|
||||
if (!be) {
|
||||
LOG_OOM();
|
||||
return;
|
||||
}
|
||||
|
||||
/* result */
|
||||
ret = ber_printf(be, "{it{s{{s[O]}}}}", req->id,
|
||||
LDAP_RES_SEARCH_ENTRY, "", "netlogon", nbtblob);
|
||||
if (ret == LBER_ERROR) {
|
||||
LOG("Failed to encode CLDAP reply\n");
|
||||
goto done;
|
||||
}
|
||||
/* done */
|
||||
ret = ber_printf(be, "{it{ess}}", req->id,
|
||||
LDAP_RES_SEARCH_RESULT, 0, "", "");
|
||||
if (ret == LBER_ERROR) {
|
||||
LOG("Failed to encode CLDAP reply\n");
|
||||
goto done;
|
||||
}
|
||||
/* get data blob */
|
||||
ret = ber_flatten(be, &bv);
|
||||
if (ret == LBER_ERROR) {
|
||||
LOG("Failed to encode CLDAP reply\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
ret = sendto(ctx->sd, bv->bv_val, bv->bv_len, 0,
|
||||
(struct sockaddr *)&req->ss, req->ss_len);
|
||||
if (ret == -1) {
|
||||
LOG("Failed to send CLDAP reply (%d, %s)\n", errno, strerror(errno));
|
||||
}
|
||||
|
||||
done:
|
||||
ber_bvfree(bv);
|
||||
ber_free(be, 1);
|
||||
}
|
||||
|
||||
static void ipa_cldap_process(struct ipa_cldap_ctx *ctx,
|
||||
struct ipa_cldap_req *req)
|
||||
{
|
||||
@ -222,6 +268,8 @@ static void ipa_cldap_process(struct ipa_cldap_ctx *ctx,
|
||||
goto done;
|
||||
}
|
||||
|
||||
ipa_cldap_respond(ctx, req, &reply);
|
||||
|
||||
done:
|
||||
ipa_cldap_free_kvps(&req->kvps);
|
||||
free(req);
|
||||
|
Loading…
Reference in New Issue
Block a user