simplify some code, tweak formatting, and reduce indentation

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@101746 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2008-02-01 06:27:41 +00:00
parent 574b5e2a2e
commit 1d016d21e4

View File

@@ -147,15 +147,22 @@ static int auth_exec(struct ast_channel *chan, void *data)
continue;
}
while (!feof(f)) {
for (;;) {
fgets(buf, sizeof(buf), f);
if (!feof(f) && !ast_strlen_zero(buf)) {
if (feof(f))
break;
if (ast_strlen_zero(buf))
continue;
buf[strlen(buf) - 1] = '\0';
if (ast_test_flag(&flags, OPT_MULTIPLE)) {
md5secret = strchr(buf, ':');
md5secret = buf;
strsep(&md5secret, ":");
if (!md5secret)
continue;
*md5secret++ = '\0';
ast_md5_hash(md5passwd, passwd);
if (!strcmp(md5passwd, md5secret)) {
if (ast_test_flag(&flags,OPT_ACCOUNT))
@@ -170,7 +177,6 @@ static int auth_exec(struct ast_channel *chan, void *data)
}
}
}
}
fclose(f);