aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authordvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2009-09-03 16:57:35 +0000
committerdvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2009-09-03 16:57:35 +0000
commitd27c458125a3412ca561ec38f6415588c9a9cdaa (patch)
treeba1b5449db44a3b9e545a2ad13d9ac2bbe5c3822 /include
parent18edad800c797bc030a8d53e86b925d85f5e49b4 (diff)
Merge code associated with AST-2009-006
(closes issue #12912) Reported by: rathaus Tested by: tilghman, russell, dvossel, dbrooks git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@215958 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/acl.h15
-rw-r--r--include/asterisk/astobj2.h10
-rw-r--r--include/asterisk/sha1.h81
-rw-r--r--include/asterisk/utils.h4
4 files changed, 106 insertions, 4 deletions
diff --git a/include/asterisk/acl.h b/include/asterisk/acl.h
index ad946d57e..0bc79b897 100644
--- a/include/asterisk/acl.h
+++ b/include/asterisk/acl.h
@@ -36,10 +36,17 @@ extern "C" {
/* Host based access control */
-struct ast_ha;
-
-extern void ast_free_ha(struct ast_ha *ha);
-extern struct ast_ha *ast_append_ha(char *sense, char *stuff, struct ast_ha *path);
+struct ast_ha {
+ /* Host access rule */
+ struct in_addr netaddr;
+ struct in_addr netmask;
+ int sense;
+ struct ast_ha *next;
+};
+
+void ast_free_ha(struct ast_ha *ha);
+void ast_copy_ha(const struct ast_ha *from, struct ast_ha *to);
+struct ast_ha *ast_append_ha(char *sense, const char *stuff, struct ast_ha *path);
extern int ast_apply_ha(struct ast_ha *ha, struct sockaddr_in *sin);
extern int ast_get_ip(struct sockaddr_in *sin, const char *value);
extern int ast_get_ip_or_srv(struct sockaddr_in *sin, const char *value, const char *service);
diff --git a/include/asterisk/astobj2.h b/include/asterisk/astobj2.h
index 8d83a8d23..96437bfb8 100644
--- a/include/asterisk/astobj2.h
+++ b/include/asterisk/astobj2.h
@@ -273,6 +273,16 @@ enum search_flags {
* This implies that it can be passed to the object's hash function
* for optimized searching. */
OBJ_POINTER = (1 << 3),
+ /*!
+ * \brief Continue if a match is not found in the hashed out bucket
+ *
+ * This flag is to be used in combination with OBJ_POINTER. This tells
+ * the ao2_callback() core to keep searching through the rest of the
+ * buckets if a match is not found in the starting bucket defined by
+ * the hash value on the argument.
+ */
+ OBJ_CONTINUE = (1 << 4),
+
};
/*!
diff --git a/include/asterisk/sha1.h b/include/asterisk/sha1.h
new file mode 100644
index 000000000..fa8e2155b
--- /dev/null
+++ b/include/asterisk/sha1.h
@@ -0,0 +1,81 @@
+/*
+ * sha1.h
+ *
+ * Description:
+ * This is the header file for code which implements the Secure
+ * Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
+ * April 17, 1995.
+ *
+ * Many of the variable names in this code, especially the
+ * single character names, were used because those were the names
+ * used in the publication.
+ *
+ * Please read the file sha1.c for more information.
+ *
+ */
+
+
+#ifndef _SHA1_H_
+#define _SHA1_H_
+
+
+
+#if defined(__OpenBSD__) || defined( __FreeBSD__)
+#include <inttypes.h>
+#else
+#include <stdint.h>
+#endif
+
+/*
+ * If you do not have the ISO standard stdint.h header file, then you
+ * must typdef the following:
+ * name meaning
+ * uint32_t unsigned 32 bit integer
+ * uint8_t unsigned 8 bit integer (i.e., unsigned char)
+ *
+ */
+
+#ifndef _SHA_enum_
+#define _SHA_enum_
+enum
+{
+ shaSuccess = 0,
+ shaNull, /* Null pointer parameter */
+ shaInputTooLong, /* input data too long */
+ shaStateError /* called Input after Result */
+};
+#endif
+#define SHA1HashSize 20
+
+/*
+ * This structure will hold context information for the SHA-1
+ * hashing operation
+ */
+typedef struct SHA1Context
+{
+ uint32_t Intermediate_Hash[SHA1HashSize/4]; /* Message Digest */
+
+ uint32_t Length_Low; /* Message length in bits */
+ uint32_t Length_High; /* Message length in bits */
+
+ /* Index into message block array */
+ uint32_t Message_Block_Index; /* 8 bits actually suffice */
+ uint8_t Message_Block[64]; /* 512-bit message blocks */
+
+ int Computed; /* Is the digest computed? */
+ int Corrupted; /* Is the message digest corrupted? */
+} SHA1Context;
+
+/*
+ * Function Prototypes
+ */
+
+
+int SHA1Reset( SHA1Context *);
+int SHA1Input( SHA1Context *,
+ const uint8_t *,
+ unsigned int);
+int SHA1Result( SHA1Context *,
+ uint8_t Message_Digest[SHA1HashSize]);
+
+#endif
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index 0f1df4003..dce96f405 100644
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -144,6 +144,10 @@ struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp);
\brief Produces MD5 hash based on input string */
void ast_md5_hash(char *output, char *input);
+/* ast_sha1_hash
+ \brief Produces SHA1 hash based on input string */
+void ast_sha1_hash(char *output, char *input);
+
int ast_base64encode(char *dst, const unsigned char *src, int srclen, int max);
int ast_base64decode(unsigned char *dst, const char *src, int max);