freecwmp
[Top] [All Lists]

[PATCH] enable configuring acs digest authentication

To: luka@openwrt.org
Subject: [PATCH] enable configuring acs digest authentication
From: rajsek <miran.rajsek@gmail.com>
Date: Wed, 20 Feb 2013 10:58:46 +0100
Cc: freecwmp@linux-mips.org, rajsek <miroslav.rajsek@innbox.net>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :signed-off-by; bh=on00fI5oDIkp/fw+PwC3etbHen2+K72wLlDshn9NGRM=; b=LJQNGv3xuNJjQJmNKDZuEHrn/jmr05AVRqXUEKY0XUvsRW5bmfo6aLxiXfuLvQaTHH s7mK8c7nxShrN5OaLYPnyqW8wWzZ1aracQ2q97hmeuon3ljnhg5TEdknXYNj83IpqLeP JxoisHveGYsiZmvB8eijC1GhMoMaP4n7Rdv5KSXz3j7yIwTOGSvAuzP8xWCitGIMygi5 G+bTfNSIbXX48JohEQ9dgss0uzmHmfWZH3554wr0xL45qvfzDvMekvOiMWiPXxYt7TAT JKRQ5OQPK+HyK4EdRmes0WFLoSv5KYI+JiRNv1PWzxi571S47cMIhJqWNJXvtO+zCkC1 /9Tg==
Original-recipient: rfc822;freecwmp@linux-mips.org
Sender: freecwmp-bounce@linux-mips.org
Signed-off-by: rajsek <miroslav.rajsek@innbox.net>
From: rajsek <miroslav.rajsek@innbox.net>

---
 src/config.c | 12 ++++++++++++
 src/config.h |  1 +
 src/http.c   |  3 +++
 3 files changed, 16 insertions(+)

diff --git a/src/config.c b/src/config.c
index 9460c2f..af92e99 100644
--- a/src/config.c
+++ b/src/config.c
@@ -237,6 +237,18 @@ section_found:
                        DD("freecwmp.@acs[0].ssl_verify=%d\n", 
config->acs->ssl_verify);
                        goto next;
                }
+
+
+               if (!strcmp((uci_to_option(e))->e.name, "auth_digest")) {
+                       if (!strcmp((uci_to_option(e))->v.string, "enabled")) {
+                               config->acs->auth_digest = true;
+                       } else {
+                               config->acs->auth_digest = false;
+                       }
+                       DD("freecwmp.@acs[0].auth_digest=%d\n", 
config->acs->auth_digest);
+                       goto next;
+               }
+
 #endif /* HTTP_CURL */
 
 next:
diff --git a/src/config.h b/src/config.h
index 8bf5e3d..b658525 100644
--- a/src/config.h
+++ b/src/config.h
@@ -30,6 +30,7 @@ struct acs {
        char *ssl_cert;
        char *ssl_cacert;
        bool ssl_verify;
+       bool auth_digest;
 #endif /* HTTP_CURL */
 };
 
diff --git a/src/http.c b/src/http.c
index c63712f..f1838b1 100644
--- a/src/http.c
+++ b/src/http.c
@@ -155,6 +155,9 @@ http_send_message(char *msg_out, char **msg_in)
        curl = curl_easy_init();
        if (!curl) return -1;
 
+       if (config->acs->auth_digest)
+               curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
+
        curl_easy_setopt(curl, CURLOPT_URL, http_c.url);
        curl_easy_setopt(curl, CURLOPT_HTTPHEADER, http_c.header_list);
 
-- 
1.8.1.1


<Prev in Thread] Current Thread [Next in Thread>