aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_authenticate.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-05-04 19:11:25 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-05-04 19:11:25 +0000
commit5d7c4bb03e33da0be5f91f34313498f3773ef1e3 (patch)
tree6b28979729f7e9ea49043ca3e54b7889d188209f /apps/app_authenticate.c
parent3047e6772d30c76768a9cf9cce54714cad2c7f6d (diff)
strlen fixes and don't destroy SIP channels that still have pending things on them (bug #1552 et al)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@2890 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_authenticate.c')
-rwxr-xr-xapps/app_authenticate.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/apps/app_authenticate.c b/apps/app_authenticate.c
index 2077d3734..4169e59a8 100755
--- a/apps/app_authenticate.c
+++ b/apps/app_authenticate.c
@@ -19,6 +19,7 @@
#include <asterisk/module.h>
#include <asterisk/app.h>
#include <asterisk/astdb.h>
+#include <asterisk/utils.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
@@ -63,7 +64,7 @@ static int auth_exec(struct ast_channel *chan, void *data)
char passwd[256];
char *opts;
char *prompt;
- if (!data || !strlen(data)) {
+ if (!data || ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Authenticate requires an argument(password)\n");
return -1;
}
@@ -108,14 +109,14 @@ static int auth_exec(struct ast_channel *chan, void *data)
char buf[256] = "";
while(!feof(f)) {
fgets(buf, sizeof(buf), f);
- if (!feof(f) && strlen(buf)) {
+ if (!feof(f) && !ast_strlen_zero(buf)) {
buf[strlen(buf) - 1] = '\0';
- if (strlen(buf) && !strcmp(passwd, buf))
+ if (!ast_strlen_zero(buf) && !strcmp(passwd, buf))
break;
}
}
fclose(f);
- if (strlen(buf) && !strcmp(passwd, buf))
+ if (!ast_strlen_zero(buf) && !strcmp(passwd, buf))
break;
} else
ast_log(LOG_WARNING, "Unable to open file '%s' for authentication: %s\n", password, strerror(errno));