summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 19c5725)
raw | patch | inline | side by side (parent: 19c5725)
author | Frank Cornelis <info@e-contract.be> | |
Fri, 22 Nov 2013 10:51:46 +0000 (11:51 +0100) | ||
committer | Marc Fournier <marc.fournier@camptocamp.com> | |
Mon, 3 Mar 2014 15:02:53 +0000 (16:02 +0100) |
src/collectd.conf.pod | patch | blob | history | |
src/curl.c | patch | blob | history | |
src/curl_json.c | patch | blob | history | |
src/curl_xml.c | patch | blob | history |
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 7a3d6a362484cdb3589867c58b0ec7010b9da26c..532e4af03e02435ddc22ade5027b85165ea37f1a 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
Password to use if authorization is required to read the page.
+=item B<Digest> B<true>|B<false>
+
+Enable HTTP digest authentication.
+
=item B<VerifyPeer> B<true>|B<false>
Enable or disable peer SSL certificate verification. See
Sets the plugin instance to I<Instance>.
=item B<User> I<Name>
+
=item B<Password> I<Password>
+
+=item B<Digest> B<true>|B<false>
+
=item B<VerifyPeer> B<true>|B<false>
+
=item B<VerifyHost> B<true>|B<false>
+
=item B<CACert> I<file>
+
=item B<Header> I<Header>
+
=item B<Post> I<Body>
These options behave exactly equivalent to the appropriate options of the
=item B<Password> I<Password>
+=item B<Digest> B<true>|B<false>
+
=item B<VerifyPeer> B<true>|B<false>
=item B<VerifyHost> B<true>|B<false>
diff --git a/src/curl.c b/src/curl.c
index ae2383459db9f54ae78383cf21cdf2f0f9e8c37f..2e1a583e5c50a1fe49f44a0865b6da2cc7d2856a 100644 (file)
--- a/src/curl.c
+++ b/src/curl.c
char *user;
char *pass;
char *credentials;
+ _Bool digest;
_Bool verify_peer;
_Bool verify_host;
char *cacert;
ssnprintf (wp->credentials, credentials_size, "%s:%s",
wp->user, (wp->pass == NULL) ? "" : wp->pass);
curl_easy_setopt (wp->curl, CURLOPT_USERPWD, wp->credentials);
+
+ if (wp->digest)
+ {
+ curl_easy_setopt (wp->curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
+ curl_easy_setopt (wp->curl, CURLOPT_USERNAME, wp->user);
+ curl_easy_setopt (wp->curl, CURLOPT_PASSWORD, wp->pass);
+ }
}
curl_easy_setopt (wp->curl, CURLOPT_SSL_VERIFYPEER, (long) wp->verify_peer);
page->url = NULL;
page->user = NULL;
page->pass = NULL;
+ page->digest = 0;
page->verify_peer = 1;
page->verify_host = 1;
page->response_time = 0;
status = cf_util_get_string (child, &page->user);
else if (strcasecmp ("Password", child->key) == 0)
status = cf_util_get_string (child, &page->pass);
+ else if (strcasecmp ("Digest", child->key) == 0)
+ status = cf_util_get_boolean (child, &page->digest);
else if (strcasecmp ("VerifyPeer", child->key) == 0)
status = cf_util_get_boolean (child, &page->verify_peer);
else if (strcasecmp ("VerifyHost", child->key) == 0)
diff --git a/src/curl_json.c b/src/curl_json.c
index 36cc468b923c1272586bd4df491a511629a97a71..35461d34cdd04eca21f365274dc372f8e592f25f 100644 (file)
--- a/src/curl_json.c
+++ b/src/curl_json.c
char *user;
char *pass;
char *credentials;
+ _Bool digest;
_Bool verify_peer;
_Bool verify_host;
char *cacert;
ssnprintf (db->credentials, credentials_size, "%s:%s",
db->user, (db->pass == NULL) ? "" : db->pass);
curl_easy_setopt (db->curl, CURLOPT_USERPWD, db->credentials);
+
+ if (db->digest)
+ {
+ curl_easy_setopt (db->curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
+ curl_easy_setopt (db->curl, CURLOPT_USERNAME, db->user);
+ curl_easy_setopt (db->curl, CURLOPT_PASSWORD, db->pass);
+ }
}
curl_easy_setopt (db->curl, CURLOPT_SSL_VERIFYPEER, (long) db->verify_peer);
status = cf_util_get_string (child, &db->user);
else if (db->url && strcasecmp ("Password", child->key) == 0)
status = cf_util_get_string (child, &db->pass);
+ else if (strcasecmp ("Digest", child->key) == 0)
+ status = cf_util_get_boolean (child, &db->digest);
else if (db->url && strcasecmp ("VerifyPeer", child->key) == 0)
status = cf_util_get_boolean (child, &db->verify_peer);
else if (db->url && strcasecmp ("VerifyHost", child->key) == 0)
diff --git a/src/curl_xml.c b/src/curl_xml.c
index 8d505610dbbf003308419967ed1b884797bd2de4..ba24ffd945831d0a47f8e5bdf4abab920fe7958c 100644 (file)
--- a/src/curl_xml.c
+++ b/src/curl_xml.c
char *user;
char *pass;
char *credentials;
+ _Bool digest;
_Bool verify_peer;
_Bool verify_host;
char *cacert;
ssnprintf (db->credentials, credentials_size, "%s:%s",
db->user, (db->pass == NULL) ? "" : db->pass);
curl_easy_setopt (db->curl, CURLOPT_USERPWD, db->credentials);
+
+ if (db->digest)
+ {
+ curl_easy_setopt (db->curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
+ curl_easy_setopt (db->curl, CURLOPT_USERNAME, db->user);
+ curl_easy_setopt (db->curl, CURLOPT_PASSWORD, db->pass);
+ }
}
curl_easy_setopt (db->curl, CURLOPT_SSL_VERIFYPEER, db->verify_peer ? 1L : 0L);
status = cf_util_get_string (child, &db->user);
else if (strcasecmp ("Password", child->key) == 0)
status = cf_util_get_string (child, &db->pass);
+ else if (strcasecmp ("Digest", child->key) == 0)
+ status = cf_util_get_boolean (child, &db->digest);
else if (strcasecmp ("VerifyPeer", child->key) == 0)
status = cf_util_get_boolean (child, &db->verify_peer);
else if (strcasecmp ("VerifyHost", child->key) == 0)