summaryrefslogtreecommitdiff
path: root/src/providers/ldap/ldap_child.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2010-09-02 16:11:10 -0400
committerStephen Gallagher <sgallagh@redhat.com>2010-10-13 09:49:37 -0400
commit64783bdc0aff447a356c5169c027dadc05dfb312 (patch)
treeb3d24832dcdee042f0b0fc50bc07610789b05641 /src/providers/ldap/ldap_child.c
parent80df25198ad743b0b927bafc9c27227db860578a (diff)
downloadsssd-64783bdc0aff447a356c5169c027dadc05dfb312.tar.gz
sssd-64783bdc0aff447a356c5169c027dadc05dfb312.tar.bz2
sssd-64783bdc0aff447a356c5169c027dadc05dfb312.zip
Make ldap_child report kerberos return code to parent
Diffstat (limited to 'src/providers/ldap/ldap_child.c')
-rw-r--r--src/providers/ldap/ldap_child.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/providers/ldap/ldap_child.c b/src/providers/ldap/ldap_child.c
index 5d784b11..f4be1857 100644
--- a/src/providers/ldap/ldap_child.c
+++ b/src/providers/ldap/ldap_child.c
@@ -94,13 +94,15 @@ static errno_t unpack_buffer(uint8_t *buf, size_t size,
return EOK;
}
-static int pack_buffer(struct response *r, int result, const char *msg, time_t expire_time)
+static int pack_buffer(struct response *r, int result, krb5_error_code krberr,
+ const char *msg, time_t expire_time)
{
int len;
size_t p = 0;
len = strlen(msg);
- r->size = 2 * sizeof(uint32_t) + len + sizeof(time_t);
+ r->size = 2 * sizeof(uint32_t) + sizeof(krb5_error_code) +
+ len + sizeof(time_t);
r->buf = talloc_array(r, uint8_t, r->size);
if(!r->buf) {
@@ -110,6 +112,9 @@ static int pack_buffer(struct response *r, int result, const char *msg, time_t e
/* result */
SAFEALIGN_SET_UINT32(&r->buf[p], result, &p);
+ /* krb5 error code */
+ safealign_memcpy(&r->buf[p], &krberr, sizeof(krberr), &p);
+
/* message size */
SAFEALIGN_SET_UINT32(&r->buf[p], len, &p);
@@ -311,7 +316,7 @@ static int prepare_response(TALLOC_CTX *mem_ctx,
r->size = 0;
if (kerr == 0) {
- ret = pack_buffer(r, EOK, ccname, expire_time);
+ ret = pack_buffer(r, EOK, kerr, ccname, expire_time);
} else {
krb5_msg = sss_krb5_get_error_message(krb5_error_ctx, kerr);
if (krb5_msg == NULL) {
@@ -319,7 +324,7 @@ static int prepare_response(TALLOC_CTX *mem_ctx,
return ENOMEM;
}
- ret = pack_buffer(r, EFAULT, krb5_msg, 0);
+ ret = pack_buffer(r, EFAULT, kerr, krb5_msg, 0);
sss_krb5_free_error_message(krb5_error_ctx, krb5_msg);
}