[asterisk-commits] twilson: branch 1.6.1 r310994 - /branches/1.6.1/main/manager.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Mar 16 14:28:46 CDT 2011
Author: twilson
Date: Wed Mar 16 14:28:41 2011
New Revision: 310994
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=310994
Log:
Merged revisions 310992 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2
........
r310992 | twilson | 2011-03-16 14:23:03 -0500 (Wed, 16 Mar 2011) | 4 lines
Don't keep trying to write to a closed connection
See security advisory AST-2011-003.
........
Modified:
branches/1.6.1/main/manager.c
Modified: branches/1.6.1/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.1/main/manager.c?view=diff&rev=310994&r1=310993&r2=310994
==============================================================================
--- branches/1.6.1/main/manager.c (original)
+++ branches/1.6.1/main/manager.c Wed Mar 16 14:28:41 2011
@@ -220,6 +220,7 @@
struct mansession_session *session;
FILE *f;
int fd;
+ int write_error:1;
};
#define NEW_EVENT(m) (AST_LIST_NEXT(m->session->last_ev, eq_next))
@@ -944,11 +945,15 @@
*/
static int send_string(struct mansession *s, char *string)
{
- if (s->f) {
- return ast_careful_fwrite(s->f, s->fd, string, strlen(string), s->session->writetimeout);
- } else {
- return ast_careful_fwrite(s->session->f, s->session->fd, string, strlen(string), s->session->writetimeout);
- }
+ int res;
+
+ if (s->f && (res = ast_careful_fwrite(s->f, s->fd, string, strlen(string), s->session->writetimeout))) {
+ s->write_error = 1;
+ } else if ((res = ast_careful_fwrite(s->session->f, s->session->fd, string, strlen(string), s->session->writetimeout))) {
+ s->write_error = 1;
+ }
+
+ return res;
}
/*!
@@ -3207,7 +3212,7 @@
astman_append(&s, "Asterisk Call Manager/%s\r\n", AMI_VERSION); /* welcome prompt */
for (;;) {
- if ((res = do_message(&s)) < 0)
+ if ((res = do_message(&s)) < 0 || s.write_error)
break;
}
/* session is over, explain why and terminate */
More information about the asterisk-commits
mailing list