diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-08-05 21:44:19 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-08-05 21:44:19 +0000 |
commit | c19fd5066cdded2153cb10596506fbc71b382f5f (patch) | |
tree | 344b090f7852555cf3ad500480fc16cc5e76b332 /apps/app_authenticate.c | |
parent | c7503d31d324862f238c4d041fd54e67ea55337d (diff) |
Fix newline issue (bug #4632)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6291 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_authenticate.c')
-rwxr-xr-x | apps/app_authenticate.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/app_authenticate.c b/apps/app_authenticate.c index 887bf237d..903e7b411 100755 --- a/apps/app_authenticate.c +++ b/apps/app_authenticate.c @@ -125,6 +125,7 @@ static int auth_exec(struct ast_channel *chan, void *data) while (!feof(f)) { fgets(buf, sizeof(buf), f); if (!feof(f) && !ast_strlen_zero(buf)) { + buf[strlen(buf) - 1] = '\0'; if (strchr(opts, 'm')) { md5secret = strchr(buf, ':'); if (md5secret == NULL) @@ -133,12 +134,16 @@ static int auth_exec(struct ast_channel *chan, void *data) md5secret++; ast_md5_hash(md5passwd, passwd); if (!strcmp(md5passwd, md5secret)) { - ast_cdr_setaccount(chan, buf); + if (strchr(opts, 'a')) + ast_cdr_setaccount(chan, buf); break; } } else { - if(!strcmp(passwd, buf)) + if(!strcmp(passwd, buf)) { + if (strchr(opts, 'a')) + ast_cdr_setaccount(chan, buf); break; + } } } } |