mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
Fix some crashes related to the use of the "meetme" CLI command. The code for
this command was not locking the conference list at all. (issue #9351, reported by and patch submitted by Junk-Y, committed patch is different and by me) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@67558 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -825,8 +825,10 @@ static int meetme_cmd(int fd, int argc, char **argv)
|
|||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
/* 'MeetMe': List all the conferences */
|
/* 'MeetMe': List all the conferences */
|
||||||
now = time(NULL);
|
now = time(NULL);
|
||||||
|
AST_LIST_LOCK(&confs);
|
||||||
if (AST_LIST_EMPTY(&confs)) {
|
if (AST_LIST_EMPTY(&confs)) {
|
||||||
ast_cli(fd, "No active MeetMe conferences.\n");
|
ast_cli(fd, "No active MeetMe conferences.\n");
|
||||||
|
AST_LIST_UNLOCK(&confs);
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
ast_cli(fd, header_format, "Conf Num", "Parties", "Marked", "Activity", "Creation");
|
ast_cli(fd, header_format, "Conf Num", "Parties", "Marked", "Activity", "Creation");
|
||||||
@@ -843,6 +845,7 @@ static int meetme_cmd(int fd, int argc, char **argv)
|
|||||||
|
|
||||||
total += cnf->users;
|
total += cnf->users;
|
||||||
}
|
}
|
||||||
|
AST_LIST_UNLOCK(&confs);
|
||||||
ast_cli(fd, "* Total number of MeetMe users: %d\n", total);
|
ast_cli(fd, "* Total number of MeetMe users: %d\n", total);
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -897,6 +900,7 @@ static int meetme_cmd(int fd, int argc, char **argv)
|
|||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
/* Find the right conference */
|
/* Find the right conference */
|
||||||
|
AST_LIST_LOCK(&confs);
|
||||||
AST_LIST_TRAVERSE(&confs, cnf, list) {
|
AST_LIST_TRAVERSE(&confs, cnf, list) {
|
||||||
if (strcmp(cnf->confno, argv[2]) == 0)
|
if (strcmp(cnf->confno, argv[2]) == 0)
|
||||||
break;
|
break;
|
||||||
@@ -904,11 +908,12 @@ static int meetme_cmd(int fd, int argc, char **argv)
|
|||||||
if (!cnf) {
|
if (!cnf) {
|
||||||
if ( !concise )
|
if ( !concise )
|
||||||
ast_cli(fd, "No such conference: %s.\n",argv[2]);
|
ast_cli(fd, "No such conference: %s.\n",argv[2]);
|
||||||
|
AST_LIST_UNLOCK(&confs);
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
/* Show all the users */
|
/* Show all the users */
|
||||||
|
time(&now);
|
||||||
AST_LIST_TRAVERSE(&cnf->userlist, user, list) {
|
AST_LIST_TRAVERSE(&cnf->userlist, user, list) {
|
||||||
now = time(NULL);
|
|
||||||
hr = (now - user->jointime) / 3600;
|
hr = (now - user->jointime) / 3600;
|
||||||
min = ((now - user->jointime) % 3600) / 60;
|
min = ((now - user->jointime) % 3600) / 60;
|
||||||
sec = (now - user->jointime) % 60;
|
sec = (now - user->jointime) % 60;
|
||||||
@@ -936,7 +941,7 @@ static int meetme_cmd(int fd, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
if ( !concise )
|
if ( !concise )
|
||||||
ast_cli(fd,"%d users in that conference.\n",cnf->users);
|
ast_cli(fd,"%d users in that conference.\n",cnf->users);
|
||||||
|
AST_LIST_UNLOCK(&confs);
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
} else
|
} else
|
||||||
return RESULT_SHOWUSAGE;
|
return RESULT_SHOWUSAGE;
|
||||||
|
Reference in New Issue
Block a user