OAuth in iwhd preview patch

Pete Zaitcev zaitcev at redhat.com
Tue Oct 4 19:54:13 UTC 2011


On Tue, 4 Oct 2011 15:36:54 -0400
Matt Wagner <matt.wagner at redhat.com> wrote:

> The one thing that was a little weird is that if I used a correct
> consumer key but an incorrect consumer secret, Ruby raises an "EOFError:
> end of file reached" exception. I infer we're receiving something like
> an empty response as opposed to a reply indicating an authorization
> failure.

Indeed, sorry about that. It's my bug. The fix looks like this

diff --git a/rest.c b/rest.c
index a7e9021..0b0ce8d 100644
--- a/rest.c
+++ b/rest.c
@@ -2800,7 +2800,9 @@ do_oauth (struct MHD_Connection *conn, my_state *ms,
 
        if (strcmp(sig_supplied, sig_calculated) != 0) {
                DPRINTF("OAuth signature mismatch");
-               return -1;
+               do_resp(conn,NULL,MHD_HTTP_FORBIDDEN,NULL,
+                       "403 signature mismatch\r\n");
+               return 1;
        }
        return 0;
 }

Thanks for the help!

-- pete


More information about the iwhd-devel mailing list