From 81bf363ac69e0036562434ca0e7153c3e624c8c3 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Wed, 23 May 2012 21:35:39 +0200 Subject: piano: Fix ambiguous error message/return value Closes #263. --- src/libpiano/response.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/libpiano/response.c') diff --git a/src/libpiano/response.c b/src/libpiano/response.c index c3bfd6c..73b223a 100644 --- a/src/libpiano/response.c +++ b/src/libpiano/response.c @@ -100,6 +100,17 @@ PianoReturn_t PianoResponse (PianoHandle_t *ph, PianoRequest_t *req) { ret = PIANO_RET_INVALID_RESPONSE; } else { ret = json_object_get_int (code)+PIANO_RET_OFFSET; + + if (ret == PIANO_RET_P_INVALID_PARTNER_LOGIN && + req->type == PIANO_REQUEST_LOGIN) { + PianoRequestDataLogin_t *reqData = req->data; + if (reqData->step == 1) { + /* return value is ambiguous, as both, partnerLogin and + * userLogin return INVALID_PARTNER_LOGIN. Fix that to provide + * better error messages. */ + ret = PIANO_RET_INVALID_LOGIN; + } + } } json_object_put (j); -- cgit v1.2.3