aboutsummaryrefslogtreecommitdiffstats
path: root/include/asterisk/utils.h
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-04-23 20:36:35 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-04-23 20:36:35 +0000
commit23d5f93d74c885df5a8feee25229d68576b394d3 (patch)
treea9289da90accc4137203d99a5205aae4d8ed7edb /include/asterisk/utils.h
parentc052997dcc8db29dd063ab6eeb2bfa3be1f4ae96 (diff)
Support HTTP digest authentication for the http manager interface.
(closes issue #10961) Reported by: ys Patches: digest_auth_r148468_v5.diff uploaded by ys (license 281) SVN branch http://svn.digium.com/svn/asterisk/team/group/manager_http_auth Tested by: ys, twilson, tilghman Review: http://reviewboard.digium.com/r/223/ Reviewed by: tilghman,russellb,mmichelson git-svn-id: http://svn.digium.com/svn/asterisk/trunk@190349 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include/asterisk/utils.h')
-rw-r--r--include/asterisk/utils.h30
1 files changed, 29 insertions, 1 deletions
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index cb150ae4e..aac5a4651 100644
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -32,8 +32,9 @@
#include "asterisk/time.h"
#include "asterisk/logger.h"
#include "asterisk/localtime.h"
+#include "asterisk/stringfields.h"
-/*!
+/*!
\note \verbatim
Note:
It is very important to use only unsigned variables to hold
@@ -646,6 +647,33 @@ int ast_mkdir(const char *path, int mode);
#define ARRAY_LEN(a) (sizeof(a) / sizeof(0[a]))
+
+/* Definition for Digest authorization */
+struct ast_http_digest {
+ AST_DECLARE_STRING_FIELDS(
+ AST_STRING_FIELD(username);
+ AST_STRING_FIELD(nonce);
+ AST_STRING_FIELD(uri);
+ AST_STRING_FIELD(realm);
+ AST_STRING_FIELD(domain);
+ AST_STRING_FIELD(response);
+ AST_STRING_FIELD(cnonce);
+ AST_STRING_FIELD(opaque);
+ AST_STRING_FIELD(nc);
+ );
+ int qop; /* Flag set to 1, if we send/recv qop="quth" */
+};
+
+/*!
+ *\brief Parse digest authorization header.
+ *\return Returns -1 if we have no auth or something wrong with digest.
+ *\note This function may be used for Digest request and responce header.
+ * request arg is set to nonzero, if we parse Digest Request.
+ * pedantic arg can be set to nonzero if we need to do addition Digest check.
+ */
+int ast_parse_digest(const char *digest, struct ast_http_digest *d, int request, int pedantic);
+
+
#ifdef AST_DEVMODE
#define ast_assert(a) _ast_assert(a, # a, __FILE__, __LINE__, __PRETTY_FUNCTION__)
static void force_inline _ast_assert(int condition, const char *condition_str,