mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
Fix newline issue (bug #4632)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6291 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -125,6 +125,7 @@ static int auth_exec(struct ast_channel *chan, void *data)
|
|||||||
while (!feof(f)) {
|
while (!feof(f)) {
|
||||||
fgets(buf, sizeof(buf), f);
|
fgets(buf, sizeof(buf), f);
|
||||||
if (!feof(f) && !ast_strlen_zero(buf)) {
|
if (!feof(f) && !ast_strlen_zero(buf)) {
|
||||||
|
buf[strlen(buf) - 1] = '\0';
|
||||||
if (strchr(opts, 'm')) {
|
if (strchr(opts, 'm')) {
|
||||||
md5secret = strchr(buf, ':');
|
md5secret = strchr(buf, ':');
|
||||||
if (md5secret == NULL)
|
if (md5secret == NULL)
|
||||||
@@ -133,15 +134,19 @@ static int auth_exec(struct ast_channel *chan, void *data)
|
|||||||
md5secret++;
|
md5secret++;
|
||||||
ast_md5_hash(md5passwd, passwd);
|
ast_md5_hash(md5passwd, passwd);
|
||||||
if (!strcmp(md5passwd, md5secret)) {
|
if (!strcmp(md5passwd, md5secret)) {
|
||||||
|
if (strchr(opts, 'a'))
|
||||||
ast_cdr_setaccount(chan, buf);
|
ast_cdr_setaccount(chan, buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(!strcmp(passwd, buf))
|
if(!strcmp(passwd, buf)) {
|
||||||
|
if (strchr(opts, 'a'))
|
||||||
|
ast_cdr_setaccount(chan, buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
if (!ast_strlen_zero(buf)) {
|
if (!ast_strlen_zero(buf)) {
|
||||||
if (strchr(opts, 'm')) {
|
if (strchr(opts, 'm')) {
|
||||||
|
@@ -901,6 +901,7 @@ static int console_sendtext(int fd, int argc, char *argv[])
|
|||||||
strncat(text2send, argv[tmparg++], sizeof(text2send) - strlen(text2send) - 1);
|
strncat(text2send, argv[tmparg++], sizeof(text2send) - strlen(text2send) - 1);
|
||||||
strncat(text2send, " ", sizeof(text2send) - strlen(text2send) - 1);
|
strncat(text2send, " ", sizeof(text2send) - strlen(text2send) - 1);
|
||||||
}
|
}
|
||||||
|
text2send[strlen(text2send) - 1] = '\n';
|
||||||
f.data = text2send;
|
f.data = text2send;
|
||||||
f.datalen = strlen(text2send) + 1;
|
f.datalen = strlen(text2send) + 1;
|
||||||
grab_owner();
|
grab_owner();
|
||||||
|
@@ -1019,6 +1019,7 @@ static int console_sendtext(int fd, int argc, char *argv[])
|
|||||||
sizeof(text2send) - strlen(text2send) - 1);
|
sizeof(text2send) - strlen(text2send) - 1);
|
||||||
}
|
}
|
||||||
if (!ast_strlen_zero(text2send)) {
|
if (!ast_strlen_zero(text2send)) {
|
||||||
|
text2send[strlen(text2send) - 1] = '\n';
|
||||||
f.frametype = AST_FRAME_TEXT;
|
f.frametype = AST_FRAME_TEXT;
|
||||||
f.subclass = 0;
|
f.subclass = 0;
|
||||||
f.data = text2send;
|
f.data = text2send;
|
||||||
|
Reference in New Issue
Block a user