#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"
Include dependency graph for func_md5.c:
Go to the source code of this file.
Functions | |
AST_MODULE_INFO_STANDARD (ASTERISK_GPL_KEY,"MD5 digest dialplan functions") | |
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_custom_function | checkmd5_function |
static struct ast_custom_function | md5_function |
Definition in file func_md5.c.
AST_MODULE_INFO_STANDARD | ( | ASTERISK_GPL_KEY | , | |
"MD5 digest dialplan functions" | ||||
) |
static int checkmd5 | ( | struct ast_channel * | chan, | |
char * | cmd, | |||
char * | parse, | |||
char * | buf, | |||
size_t | len | |||
) | [static] |
Definition at line 59 of file func_md5.c.
References AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_log(), ast_md5_hash(), AST_STANDARD_APP_ARGS, ast_strlen_zero(), and LOG_WARNING.
00061 { 00062 char newmd5[33]; 00063 static int deprecated = 0; 00064 AST_DECLARE_APP_ARGS(args, AST_APP_ARG(digest); AST_APP_ARG(data);); 00065 00066 if (ast_strlen_zero(parse)) { 00067 ast_log(LOG_WARNING, 00068 "Syntax: CHECK_MD5(<digest>,<data>) - missing argument!\n"); 00069 return -1; 00070 } 00071 00072 AST_STANDARD_APP_ARGS(args, parse); 00073 00074 if (args.argc < 2) { 00075 ast_log(LOG_WARNING, 00076 "Syntax: CHECK_MD5(<digest>,<data>) - missing argument!\n"); 00077 return -1; 00078 } 00079 00080 if (!deprecated) { 00081 deprecated = 1; 00082 ast_log(LOG_WARNING, "CHECK_MD5() is deprecated in Asterisk 1.4 and later.\n"); 00083 } 00084 00085 ast_md5_hash(newmd5, args.data); 00086 00087 if (!strcasecmp(newmd5, args.digest)) /* they match */ 00088 ast_copy_string(buf, "1", len); 00089 else 00090 ast_copy_string(buf, "0", len); 00091 00092 return 0; 00093 }
static int load_module | ( | void | ) | [static] |
Definition at line 116 of file func_md5.c.
References ast_custom_function_register(), checkmd5_function, and md5_function.
00117 { 00118 return ast_custom_function_register(&md5_function) | 00119 ast_custom_function_register(&checkmd5_function); 00120 }
static int md5 | ( | struct ast_channel * | chan, | |
char * | cmd, | |||
char * | data, | |||
char * | buf, | |||
size_t | len | |||
) | [static] |
Definition at line 45 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().
00047 { 00048 if (ast_strlen_zero(data)) { 00049 ast_log(LOG_WARNING, "Syntax: MD5(<data>) - missing argument!\n"); 00050 return -1; 00051 } 00052 00053 ast_md5_hash(buf, data); 00054 buf[32] = '\0'; 00055 00056 return 0; 00057 }
static int unload_module | ( | void | ) | [static] |
Definition at line 110 of file func_md5.c.
References ast_custom_function_unregister(), checkmd5_function, and md5_function.
00111 { 00112 return ast_custom_function_unregister(&md5_function) | 00113 ast_custom_function_unregister(&checkmd5_function); 00114 }
struct ast_custom_function checkmd5_function [static] |
struct ast_custom_function md5_function [static] |