From afb25c2c40ff54cf30a61b2fe5d6d665b7c5968a Mon Sep 17 00:00:00 2001 From: Automerge script Date: Wed, 12 Jul 2006 16:02:19 +0000 Subject: [PATCH] automerge commit git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@37455 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- app.c | 20 ++++++++++++++++---- apps/app_voicemail.c | 3 ++- channels/chan_iax2.c | 6 ++++++ 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/app.c b/app.c index 64fa49fa79..a477769042 100644 --- a/app.c +++ b/app.c @@ -1167,11 +1167,13 @@ enum AST_LOCK_RESULT ast_lock_path(const char *path) time(&start); while (((res = link(fs, s)) < 0) && (errno == EEXIST) && (time(NULL) - start < 5)) usleep(1); + + unlink(fs); + if (res) { ast_log(LOG_WARNING, "Failed to lock path '%s': %s\n", path, strerror(errno)); return AST_LOCK_TIMEOUT; } else { - unlink(fs); ast_log(LOG_DEBUG, "Locked path '%s'\n", path); return AST_LOCK_SUCCESS; } @@ -1180,12 +1182,22 @@ enum AST_LOCK_RESULT ast_lock_path(const char *path) int ast_unlock_path(const char *path) { char *s; + int res; + s = alloca(strlen(path) + 10); - if (!s) + if (!s) { + ast_log(LOG_WARNING, "Out of memory!\n"); return -1; + } + snprintf(s, strlen(path) + 9, "%s/%s", path, ".lock"); - ast_log(LOG_DEBUG, "Unlocked path '%s'\n", path); - return unlink(s); + + if ((res = unlink(s))) + ast_log(LOG_ERROR, "Could not unlock path '%s': %s\n", path, strerror(errno)); + else + ast_log(LOG_DEBUG, "Unlocked path '%s'\n", path); + + return res; } int ast_record_review(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, const char *path) diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 96973623f3..4402d4d4fe 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -2617,7 +2617,8 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ } else if (ast_fileexists(tmptxtfile, NULL, NULL) <= 0) { if (option_debug) ast_log(LOG_DEBUG, "The recorded media file is gone, so we should remove the .txt file too!\n"); - unlink(tmptxtfile); + unlink(tmptxtfile); + ast_unlock_path(dir); } else { for (;;) { make_file(fn, sizeof(fn), dir, msgnum); diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 1ce7fb349d..f75b21c400 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -147,6 +147,7 @@ static char context[80] = "default"; static char language[MAX_LANGUAGE] = ""; static char regcontext[AST_MAX_CONTEXT] = ""; +static int maxauthreq = 0; static int max_retries = 4; static int ping_time = 20; static int lagrq_time = 10; @@ -8432,6 +8433,7 @@ static struct iax2_user *build_user(const char *name, struct ast_variable *v, in if (user) { memset(user, 0, sizeof(struct iax2_user)); + user->maxauthreq = maxauthreq; user->curauthreq = oldcurauthreq; user->prefs = prefs; user->capability = iax2_capability; @@ -8868,6 +8870,10 @@ static int set_config(char *config_file, int reload) } } else if (!strcasecmp(v->name, "language")) { ast_copy_string(language, v->value, sizeof(language)); + } else if (!strcasecmp(v->name, "maxauthreq")) { + maxauthreq = atoi(v->value); + if (maxauthreq < 0) + maxauthreq = 0; } /*else if (strcasecmp(v->name,"type")) */ /* ast_log(LOG_WARNING, "Ignoring %s\n", v->name); */ v = v->next; -- 2.47.2