diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2010-03-23 16:35:49 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2010-03-25 16:02:27 -0400 |
commit | 80c8a4f94d54b23bce206fdd75ff2648977ce271 (patch) | |
tree | 7a03b98f665e4ebf7005c580fd9873200f023fad /src/providers/ldap/ldap_child.c | |
parent | f94abf5319d8f74cacae0a98d3925d18eb6839eb (diff) | |
download | sssd-80c8a4f94d54b23bce206fdd75ff2648977ce271.tar.gz sssd-80c8a4f94d54b23bce206fdd75ff2648977ce271.tar.xz sssd-80c8a4f94d54b23bce206fdd75ff2648977ce271.zip |
Allow arbitrary-length PAM messages
The PAM standard allows for messages of any length to be returned
to the client. We were discarding all messages of length greater
than 255. This patch dynamically allocates the message buffers so
we can pass the complete message.
This resolves https://fedorahosted.org/sssd/ticket/432
Diffstat (limited to 'src/providers/ldap/ldap_child.c')
-rw-r--r-- | src/providers/ldap/ldap_child.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/providers/ldap/ldap_child.c b/src/providers/ldap/ldap_child.c index 069fbcfe1..6a78ca012 100644 --- a/src/providers/ldap/ldap_child.c +++ b/src/providers/ldap/ldap_child.c @@ -97,6 +97,11 @@ static int pack_buffer(struct response *r, int result, const char *msg) len = strlen(msg); r->size = 2 * sizeof(uint32_t) + len; + r->buf = talloc_array(r, uint8_t, r->size); + if(!r->buf) { + return ENOMEM; + } + /* result */ SAFEALIGN_SET_UINT32(&r->buf[p], result, &p); @@ -265,12 +270,7 @@ static int prepare_response(TALLOC_CTX *mem_ctx, r = talloc_zero(mem_ctx, struct response); if (!r) return ENOMEM; - r->buf = talloc_size(mem_ctx, MAX_CHILD_MSG_SIZE); - if (r->buf == NULL) { - DEBUG(1, ("talloc_size failed.\n")); - return ENOMEM; - } - r->max_size = MAX_CHILD_MSG_SIZE; + r->buf = NULL; r->size = 0; if (kerr == 0) { |