summaryrefslogtreecommitdiff
path: root/include/asterisk/utils.h
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2009-04-23 20:36:35 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2009-04-23 20:36:35 +0000
commitce6ebaef9712ef2f5d4cd6a717f13906f70364b7 (patch)
treea9289da90accc4137203d99a5205aae4d8ed7edb /include/asterisk/utils.h
parent80b8d3437717ec52af9eed3988ec07b7d6a5793b (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: https://origsvn.digium.com/svn/asterisk/trunk@190349 65c4cc65-6c06-0410-ace0-fbb531ad65f3
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,