#21 Add HTTP Digest Authentication to SOAP funcs

pending
None
6
2012-02-25
2008-09-08
ExitToShell
No

Modified UPnP SDK v1.6.6 to include HTTP Digest Authentication for SOAP requests that require authorization (modem/router setup based on the TR-064/69 specifications for example). Also made to work on Mac OS X 10.3.9 - 10.5 PPC/Intel.

Based on W3C Digest Authentication sample code. Added new UPnP api to set UID/PW credentials, which are stored in the client handle. Added new SOAP api to send an authentication-compatible SOAP request. If the response is HTTP code 502, the request is resent with a MD5 generated Digest Authentication header automatically, if the authentication request fails the SOAP call returns an error as before.

Modifications were made to support Mac OS X software integration that will configure DSL modem/routers with TR-064 interfaces.

Existing clients can continue to use the API transparently, only a single new call to set the credentials is required.

Included files:

digestauth.diff -- diff of changes to existing files in UPnP SDK
httpauth.c -- new file encapsulating HTTP Digest Authentication functions
httpauth.h -- header for same

--

Tim Mityok, Mac Software Developer @ Motive, Inc. Austin, TX.

Discussion

  • ExitToShell
    ExitToShell
    2008-09-08

    One diff of existing SDK files, two new source files.

     
  • Hi Tim,

    First, please forgive me for the long delay to answer, but I had some health problems that are now overcome.

    I have looked at your patch and it seems very nice and carefully done. My only problem in applying it is with regard to the license. In order to apply it you must use an LGPL compatible license. If you agree to that, I will add your files and your patch.

    Regards,
    Marcelo.

     
  • Nick Leverton
    Nick Leverton
    2010-04-16

    Please excuse my interruption. I think most of the rest of pupnp is under a BSD licence. I'm not greatly fussed myself but the Debian team likes to keep track of what is what so I have had to create an 84 line "copyright" file listing all the current copyright holders of each source and their licences ! LGPL is fully compatible with BSD, except that LGPL requires source redistribution along with objects, whereas BSD doesn't. If there are no objections,. it might be simpler to keep to the current BSD licence to reduce licensing complexity.

     
  • Hi Nick,

    That licensing issue is something I would like to settle down once and for all. It is not explicit in pupnp the kind of license, there is an "Intel license", but I don't know if this is actually BSD in disguise. If you can confirm that, I would have no problems in keeping the license style.

    I remember having a conversation with Nek and Michael about that issue, and I though that we had an agreement about using LGPL, but I don't remember that well right now, maybe they could give some contribution to this thread.

     
  • Nick Leverton
    Nick Leverton
    2010-04-16

    Hi Marcelo,

    Perhaps I should start a new thread rather than hijacking Tim's. Give me a moment or two ...

    I agree the HTTP authentication is a valuable contribution and I'm keen to see it included !

    Nick

     
  • Hi Tim,

    I had postponed this issue because of two things:

    1 - You have not commented on the licensing issues raised before, Can I assume you are ok with BSD? I am asking this because you added two files to the project. One of the files has:

    /*
    ** GENERIC INTERFACE TO MESSAGE DIGEST ALGORITHMS
    **
    ** (c) COPYRIGHT W3C/INRIA 1998.
    ** Please first read the full copyright statement in the file COPYRIGHT.
    ** @(#) $Id: HTDigest.c,v 2.2 1999/02/05 17:31:45 frystyk Exp $

    Please provide a pointer to the mentioned COPYRIGHT file, so that we can settle this issue.

    2 - your patch does not apply, and mainly, does not compile. It would require me to fix it manually at each file and there is no directory info in it. Not to mention the patch is against an old revision, that makes things more error prone.

    I would like to apply your patch before releasing 1.6.7, would it be possible to make it a diff against the latest git repository? I will push the changes you did and I apply them to a branch. Try this:

    $ git clone git://pupnp.git.sourceforge.net/gitroot/pupnp/pupnp
    $ git checkout http-digest-auth
    ... fix the code, make sure it compiles, etc...
    $ git add .
    $ git commit
    $ git format-patch HEAD~1

    Post the resulting patch here.

    For the moment I get lots of errors:

    src/soap/soap_ctrlpt.c: In function ‘SoapSendAction’:
    src/soap/soap_ctrlpt.c:602: warning: passing argument 4 of ‘SoapSendActionWithCredentials’ makes integer from pointer without a cast
    src/soap/soap_ctrlpt.c: In function ‘SoapSendActionWithCredentials’:
    src/soap/soap_ctrlpt.c:715: warning: comparison between pointer and integer
    src/soap/soap_ctrlpt.c:720: warning: implicit declaration of function ‘get_auth_challenge’
    src/genlib/net/http/httpauth.c:40: warning: ignoring #pragma mark
    src/genlib/net/http/httpauth.c:41: warning: ignoring #pragma mark HTTP
    src/genlib/net/http/httpauth.c: In function ‘create_digest_credentials’:
    src/genlib/net/http/httpauth.c:92: warning: implicit declaration of function ‘strlen’
    src/genlib/net/http/httpauth.c:92: warning: incompatible implicit declaration of built-in function ‘strlen’
    src/genlib/net/http/httpauth.c:96: warning: implicit declaration of function ‘strcpy’
    src/genlib/net/http/httpauth.c:96: warning: incompatible implicit declaration of built-in function ‘strcpy’
    src/genlib/net/http/httpauth.c:97: warning: implicit declaration of function ‘strcat’
    src/genlib/net/http/httpauth.c:97: warning: incompatible implicit declaration of built-in function ‘strcat’
    src/genlib/net/http/httpparser.c:112: error: ‘HDR_AUTHENTICATE’ undeclared here (not in a function)
    src/genlib/net/http/httpauth.c: In function ‘HTDigest_make’:
    src/genlib/net/http/httpauth.c:142: warning: implicit declaration of function ‘strcasecmp’
    src/genlib/net/http/httpauth.c: In function ‘HTDigest_final’:
    src/genlib/net/http/httpauth.c:256: warning: pointer targets in passing argument 1 of ‘MD5Final’ differ in signedness
    src/genlib/net/http/httpauth.c: At top level:
    src/genlib/net/http/httpauth.c:291: warning: ignoring #pragma mark
    src/genlib/net/http/httpauth.c:292: warning: ignoring #pragma mark Utilities
    src/genlib/net/http/httpauth.c: In function ‘DigestCalcHA1’:
    src/genlib/net/http/httpauth.c:363: warning: incompatible implicit declaration of built-in function ‘strlen’
    src/genlib/net/http/httpauth.c: In function ‘DigestCalcResponse’:
    src/genlib/net/http/httpauth.c:403: warning: incompatible implicit declaration of built-in function ‘strlen’
    src/genlib/net/http/httpauth.c: In function ‘HTSACopy’:
    src/genlib/net/http/httpauth.c:501: warning: incompatible implicit declaration of built-in function ‘strlen’
    src/genlib/net/http/httpauth.c:503: warning: incompatible implicit declaration of built-in function ‘strcpy’
    make[3]: *** [src/genlib/net/http/libupnp_la-httpparser.lo] Error 1
    make[3]: *** Waiting for unfinished jobs....
    src/genlib/net/http/httpauth.c: In function ‘HTSACat’:
    src/genlib/net/http/httpauth.c:514: warning: incompatible implicit declaration of built-in function ‘strlen’
    src/genlib/net/http/httpauth.c:517: warning: incompatible implicit declaration of built-in function ‘strcpy’
    src/genlib/net/http/httpauth.c:519: warning: incompatible implicit declaration of built-in function ‘strlen’
    src/genlib/net/http/httpauth.c:521: warning: incompatible implicit declaration of built-in function ‘strcpy’
    src/genlib/net/http/httpreadwrite.c: In function ‘http_MakeMessage’:
    src/genlib/net/http/httpreadwrite.c:2527: error: expected declaration or statement at end of input
    src/genlib/net/http/httpreadwrite.c:2527: warning: control reaches end of non-void function
    make[3]: *** [src/genlib/net/http/libupnp_la-httpreadwrite.lo] Error 1
    make[2]: *** [all-recursive] Error 1
    make[1]: *** [all-recursive] Error 1
    make: *** [all] Error 2

    Best regards,
    Marcelo.

     
    • assigned_to: nobody --> mroberto
    • priority: 5 --> 6
     
    • status: open --> pending