58 static const char app[] =
"Authenticate";
118 int res = 0, retries, maxdigits;
119 char passwd[256], *
prompt =
"agent-pass", *argcopy =
NULL;
147 maxdigits = atoi(arglist.maxdigits);
148 if ((maxdigits<1) || (maxdigits>
sizeof(passwd)-2))
149 maxdigits =
sizeof(passwd) - 2;
151 maxdigits =
sizeof(passwd) - 2;
155 prompt = arglist.prompt;
157 prompt =
"agent-pass";
161 for (retries = 0; retries < 3; retries++) {
167 if (arglist.password[0] !=
'/') {
169 if (!strcmp(passwd, arglist.password))
174 if (!
ast_db_get(arglist.password + 1, passwd, tmp,
sizeof(tmp))) {
183 char buf[256] =
"", md5passwd[33] =
"", *md5secret =
NULL;
185 if (!(f = fopen(arglist.password,
"r"))) {
196 if (!fgets(buf,
sizeof(buf), f)) {
203 len = strlen(buf) - 1;
204 if (buf[len] ==
'\n')
213 if (!strcmp(md5passwd, md5secret)) {
216 ast_channel_accountcode_set(chan, buf);
222 if (!strcmp(passwd, buf)) {
225 ast_channel_accountcode_set(chan, buf);
237 if (md5secret && !strcmp(md5passwd, md5secret))
240 if (!strcmp(passwd, buf))
245 prompt =
"auth-incorrect";
248 if ((retries < 3) && !res) {
251 ast_channel_accountcode_set(chan, passwd);
#define ast_channel_lock(chan)
Main Channel structure associated with a channel.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
int ast_streamfile(struct ast_channel *c, const char *filename, const char *preflang)
Streams a file.
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
#define ast_test_flag(p, flag)
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
ast_channel_state
ast_channel states
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
int ast_unregister_application(const char *app)
Unregister an application.
static struct ast_str * password
static int auth_exec(struct ast_channel *chan, const char *data)
#define ast_strlen_zero(foo)
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
General Asterisk PBX channel definitions.
#define ast_strdupa(s)
duplicate a string in memory from the stack
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.
Core PBX routines and definitions.
static int unload_module(void)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
#define ast_channel_unlock(chan)
Module has failed to load, may be in an inconsistent state.
int ast_db_get(const char *family, const char *key, char *value, int valuelen)
Get key value specified by family/key.
int 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.
static int load_module(void)
Structure used to handle boolean flags.
char * strsep(char **str, const char *delims)
int ast_db_del(const char *family, const char *key)
Delete entry in astdb.
int ast_waitstream(struct ast_channel *c, const char *breakon)
Waits for a stream to stop or digit to be pressed.
int ast_answer(struct ast_channel *chan)
Answer a channel.
const char * ast_channel_language(const struct ast_channel *chan)
union ast_frame::@263 data
static struct ast_str * prompt
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
void ast_md5_hash(char *output, const char *input)
Produces MD5 hash based on input string.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
Persistant data storage (akin to *doze registry)
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
#define AST_APP_ARG(name)
Define an application argument.
static const struct ast_app_option auth_app_options[128]