cvs: php4 /ext/ircg ircg.c

From: Date: Tue, 29 Apr 2003 08:54:29 +0000
Subject: cvs: php4 /ext/ircg ircg.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-20577@lists.php.net to get a copy of this message
sas Tue Apr 29 04:54:29 2003 EDT Modified files: /php4/ext/ircg ircg.c Log: More checks for preventing users to shoot themselves in their foot. Index: php4/ext/ircg/ircg.c diff -u php4/ext/ircg/ircg.c:1.184 php4/ext/ircg/ircg.c:1.185 --- php4/ext/ircg/ircg.c:1.184 Tue Apr 29 03:31:21 2003 +++ php4/ext/ircg/ircg.c Tue Apr 29 04:54:29 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ircg.c,v 1.184 2003/04/29 07:31:21 sas Exp $ */ +/* $Id: ircg.c,v 1.185 2003/04/29 08:54:29 sas Exp $ */ /* {{{ includes */ @@ -1037,6 +1037,11 @@ php_irconn_t *conn; int do_put = 1; + if (IRCGG(flush_data)) { + php_error(E_WARNING, "ircg_set_file/_current must not be called multiple times during one request"); + RETURN_FALSE; + } + if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &p1, &p2) == FAILURE) WRONG_PARAM_COUNT; @@ -1050,8 +1055,8 @@ if (!conn) return; if (conn->fd != -1) { - php_error(E_WARNING, "ircg_set_file cannot be called after " - "ircg_set_current()."); + php_error(E_WARNING, "ircg_set_file cannot be used together with " + "ircg_set_current."); goto out; } @@ -1152,6 +1157,11 @@ php_irconn_t *conn; int do_put = 1; int n; + + if (IRCGG(flush_data)) { + php_error(E_WARNING, "ircg_set_file/_current must not be called multiple times during one request"); + RETURN_FALSE; + } if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &p1) == FAILURE) WRONG_PARAM_COUNT; @@ -1178,17 +1188,20 @@ conn = lookup_irconn(Z_LVAL_PP(p1)); - if (!conn) return; - if (conn->fd >= 0) { +#if WRITE_BUF_SUPPORTS_ASYNC_OPERATION_LIKE_WE_WOULD_NEED_IT #ifdef USE_FD2IRCONN /* There is a HTTP connection alive, kill it */ ircg_hash_index_del(&h_fd2irconn, conn->fd); #endif irc_write_buf_del(&conn->wb); conn->fd = -1; +#else + php_error(E_WARNING, "You called ircg_set_current/_file for this connection before. This is not supported at this time. Ignoring this call."); + goto out; +#endif } if (php_ircg_register_with_sapi(&conn->fd TSRMLS_CC)

« previous php.cvs (#20577) next »