#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "asterisk.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:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Functions | |
| static char * | builtin_function_checkmd5 (struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) |
| static char * | builtin_function_md5 (struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) |
Variables | |
| static struct ast_custom_function | checkmd5_function |
| static struct ast_custom_function | md5_function |
Definition in file func_md5.c.
|
||||||||||||||||||||||||
|
Definition at line 54 of file func_md5.c. References ast_app_separate_args(), ast_log(), ast_md5_hash(), ast_strdupa, ast_strlen_zero(), and LOG_WARNING. 00055 {
00056 int argc;
00057 char *argv[2];
00058 char *args;
00059 char newmd5[33];
00060
00061 if (!data || ast_strlen_zero(data)) {
00062 ast_log(LOG_WARNING, "Syntax: CHECK_MD5(<digest>,<data>) - missing argument!\n");
00063 return NULL;
00064 }
00065
00066 args = ast_strdupa(data);
00067 argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0]));
00068
00069 if (argc < 2) {
00070 ast_log(LOG_WARNING, "Syntax: CHECK_MD5(<digest>,<data>) - missing argument!\n");
00071 return NULL;
00072 }
00073
00074 ast_md5_hash(newmd5, argv[1]);
00075
00076 if (!strcasecmp(newmd5, argv[0])) /* they match */
00077 ast_copy_string(buf, "1", len);
00078 else
00079 ast_copy_string(buf, "0", len);
00080
00081 return buf;
00082 }
|
|
||||||||||||||||||||||||
|
Definition at line 39 of file func_md5.c. References ast_log(), ast_md5_hash(), ast_strlen_zero(), and LOG_WARNING. 00040 {
00041 char md5[33];
00042
00043 if (ast_strlen_zero(data)) {
00044 ast_log(LOG_WARNING, "Syntax: MD5(<data>) - missing argument!\n");
00045 return NULL;
00046 }
00047
00048 ast_md5_hash(md5, data);
00049 ast_copy_string(buf, md5, len);
00050
00051 return buf;
00052 }
|
|
|
Definition at line 97 of file func_md5.c. |
|
|
Definition at line 87 of file func_md5.c. |
1.4.2