#include "asterisk.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/logger.h"
#include "asterisk/utils.h"
#include "asterisk/app.h"
Go to the source code of this file.
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | checkmd5 (struct ast_channel *chan, char *cmd, char *parse, char *buf, size_t len) |
static int | load_module (void) |
static int | md5 (struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .description = "MD5 digest dialplan functions" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "361d7bb937402d51e4658efb5b4d76e4" , .load = load_module, .unload = unload_module, } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_custom_function | checkmd5_function |
static struct ast_custom_function | md5_function |
Russell Bryant <russelb@clemson.edu>
Definition in file func_md5.c.
static void __reg_module | ( | void | ) | [static] |
Definition at line 120 of file func_md5.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 120 of file func_md5.c.
static int checkmd5 | ( | struct ast_channel * | chan, | |
char * | cmd, | |||
char * | parse, | |||
char * | buf, | |||
size_t | len | |||
) | [static] |
Definition at line 57 of file func_md5.c.
References AST_APP_ARG, ast_copy_string(), AST_DECLARE_APP_ARGS, ast_log(), ast_md5_hash(), AST_STANDARD_APP_ARGS, ast_strlen_zero(), and LOG_WARNING.
00059 { 00060 char newmd5[33]; 00061 static int deprecated = 0; 00062 AST_DECLARE_APP_ARGS(args, AST_APP_ARG(digest); AST_APP_ARG(data);); 00063 00064 if (ast_strlen_zero(parse)) { 00065 ast_log(LOG_WARNING, 00066 "Syntax: CHECK_MD5(<digest>,<data>) - missing argument!\n"); 00067 return -1; 00068 } 00069 00070 AST_STANDARD_APP_ARGS(args, parse); 00071 00072 if (args.argc < 2) { 00073 ast_log(LOG_WARNING, 00074 "Syntax: CHECK_MD5(<digest>,<data>) - missing argument!\n"); 00075 return -1; 00076 } 00077 00078 if (!deprecated) { 00079 deprecated = 1; 00080 ast_log(LOG_WARNING, "CHECK_MD5() is deprecated in Asterisk 1.4 and later.\n"); 00081 } 00082 00083 ast_md5_hash(newmd5, args.data); 00084 00085 if (!strcasecmp(newmd5, args.digest)) /* they match */ 00086 ast_copy_string(buf, "1", len); 00087 else 00088 ast_copy_string(buf, "0", len); 00089 00090 return 0; 00091 }
static int load_module | ( | void | ) | [static] |
Definition at line 114 of file func_md5.c.
References ast_custom_function_register(), checkmd5_function, and md5_function.
00115 { 00116 return ast_custom_function_register(&md5_function) | 00117 ast_custom_function_register(&checkmd5_function); 00118 }
static int md5 | ( | struct ast_channel * | chan, | |
char * | cmd, | |||
char * | data, | |||
char * | buf, | |||
size_t | len | |||
) | [static] |
Definition at line 43 of file func_md5.c.
References ast_log(), ast_md5_hash(), ast_strlen_zero(), and LOG_WARNING.
Referenced by ast_md5_hash(), authenticate(), authenticate_verify(), decrypt_frame(), prov_ver_calc(), register_verify(), try_firmware(), and try_load_key().
00045 { 00046 if (ast_strlen_zero(data)) { 00047 ast_log(LOG_WARNING, "Syntax: MD5(<data>) - missing argument!\n"); 00048 return -1; 00049 } 00050 00051 ast_md5_hash(buf, data); 00052 buf[32] = '\0'; 00053 00054 return 0; 00055 }
static int unload_module | ( | void | ) | [static] |
Definition at line 108 of file func_md5.c.
References ast_custom_function_unregister(), checkmd5_function, and md5_function.
00109 { 00110 return ast_custom_function_unregister(&md5_function) | 00111 ast_custom_function_unregister(&checkmd5_function); 00112 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .description = "MD5 digest dialplan functions" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "361d7bb937402d51e4658efb5b4d76e4" , .load = load_module, .unload = unload_module, } [static] |
Definition at line 120 of file func_md5.c.
const struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 120 of file func_md5.c.
struct ast_custom_function checkmd5_function [static] |
struct ast_custom_function md5_function [static] |