summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2017-02-03 14:33:47 +0100
committerJakub Hrozek <jhrozek@redhat.com>2017-03-27 09:58:24 +0200
commit73ce539aa70f43ccd5302b3ef8a02ff028558b12 (patch)
tree67889137bfe57b25f48baecfd1bcbf0762647013
parent8bb2fcbce7c3fcfd986f1bc835fbcc43ac7cd9d1 (diff)
downloadsssd-73ce539aa70f43ccd5302b3ef8a02ff028558b12.tar.gz
sssd-73ce539aa70f43ccd5302b3ef8a02ff028558b12.tar.xz
sssd-73ce539aa70f43ccd5302b3ef8a02ff028558b12.zip
SECRETS: Return a nicer error message on request with no PUT data
I managed to create this pathological situation with the tcurl tool which didn't send any PUT data. The error in sssd-secrets was quite strange (ENOMEM). This patch just adds a safeguard sooner so that we return a graceful error. Reviewed-by: Michal Židek <mzidek@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
-rw-r--r--src/responder/secrets/local.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/responder/secrets/local.c b/src/responder/secrets/local.c
index 9dcdd9925..26c97a284 100644
--- a/src/responder/secrets/local.c
+++ b/src/responder/secrets/local.c
@@ -853,6 +853,12 @@ static struct tevent_req *local_secret_req(TALLOC_CTX *mem_ctx,
break;
case HTTP_PUT:
+ if (secreq->body.length == 0) {
+ DEBUG(SSSDBG_OP_FAILURE, "PUT with no data\n");
+ ret = EINVAL;
+ goto done;
+ }
+
DEBUG(SSSDBG_TRACE_LIBS, "Processing HTTP PUT at [%s]\n", lc_req->path);
if (body_is_json) {
ret = sec_json_to_simple_secret(state, secreq->body.data,