58static const char app[] =
"Authenticate";
127 int res = 0, retries, maxdigits;
128 char passwd[256], *
prompt =
"agent-pass", *argcopy =
NULL;
156 maxdigits = atoi(arglist.maxdigits);
157 if ((maxdigits<1) || (maxdigits>
sizeof(passwd)-2))
158 maxdigits =
sizeof(passwd) - 2;
160 maxdigits =
sizeof(passwd) - 2;
170 for (retries = 0; retries < 3; retries++) {
176 if (arglist.password[0] !=
'/') {
178 if (!strcmp(passwd, arglist.password))
192 char buf[256] =
"", md5passwd[33] =
"", *md5secret =
NULL;
194 if (!(f = fopen(arglist.password,
"r"))) {
205 if (!fgets(
buf,
sizeof(
buf), f)) {
222 if (!strcmp(md5passwd, md5secret)) {
225 ast_channel_accountcode_set(chan,
buf);
231 if (!strcmp(passwd,
buf)) {
234 ast_channel_accountcode_set(chan,
buf);
246 if (md5secret && !strcmp(md5passwd, md5secret))
249 if (!strcmp(passwd,
buf))
254 prompt =
"auth-incorrect";
257 if ((retries < 3) && !res) {
260 ast_channel_accountcode_set(chan, passwd);
static int auth_exec(struct ast_channel *chan, const char *data)
static const struct ast_app_option auth_app_options[128]
static int load_module(void)
static int unload_module(void)
Persistent data storage (akin to *doze registry)
int ast_db_get(const char *family, const char *key, char *value, int valuelen)
Get key value specified by family/key.
int ast_db_del(const char *family, const char *key)
Delete entry in astdb.
static struct ast_str * prompt
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdupa(s)
duplicate a string in memory from the stack
General Asterisk PBX channel definitions.
#define ast_channel_lock(chan)
const char * ast_channel_language(const struct ast_channel *chan)
int ast_answer(struct ast_channel *chan)
Answer a channel.
#define ast_channel_unlock(chan)
ast_channel_state
ast_channel states
Generic File Format Support. Should be included by clients of the file handling routines....
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
int ast_waitstream(struct ast_channel *c, const char *breakon)
Waits for a stream to stop or digit to be pressed.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
enum ast_getdata_result ast_app_getdata(struct ast_channel *c, const char *prompt, char *s, int maxlen, int timeout)
Plays a stream and gets DTMF data from a channel.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
char * strsep(char **str, const char *delims)
Asterisk locking-related definitions:
Asterisk module definitions.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
#define ASTERISK_GPL_KEY
The text the key() function should return.
int ast_unregister_application(const char *app)
Unregister an application.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Core PBX routines and definitions.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Main Channel structure associated with a channel.
Structure used to handle boolean flags.
#define ast_test_flag(p, flag)
void ast_md5_hash(char *output, const char *input)
Produces MD5 hash based on input string.