[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sockets sockets.c
andrei Thu Jun 4 18:17:28 2009 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/socketssockets.c Log: Fix invalid test against addr6 result. http://cvs.php.net/viewvc.cgi/php-src/ext/sockets/sockets.c?r1=1.171.2.9.2.25&r2=1.171.2.9.2.26&diff_format=u Index: php-src/ext/sockets/sockets.c diff -u php-src/ext/sockets/sockets.c:1.171.2.9.2.25 php-src/ext/sockets/sockets.c:1.171.2.9.2.26 --- php-src/ext/sockets/sockets.c:1.171.2.9.2.25Wed May 20 09:06:31 2009 +++ php-src/ext/sockets/sockets.c Thu Jun 4 18:17:28 2009 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: sockets.c,v 1.171.2.9.2.25 2009/05/20 09:06:31 lbarnaud Exp $ */ +/* $Id: sockets.c,v 1.171.2.9.2.26 2009/06/04 18:17:28 andrei Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1466,10 +1466,11 @@ zval_dtor(arg5); zval_dtor(arg6); + memset(addr6, 0, INET6_ADDRSTRLEN); inet_ntop(AF_INET6, &sin6.sin6_addr, addr6, INET6_ADDRSTRLEN); ZVAL_STRINGL(arg2, recv_buf, retval, 0); - ZVAL_STRING(arg5, addr6 ? addr6 : "::", 1); + ZVAL_STRING(arg5, addr6[0] ? addr6 : "::", 1); ZVAL_LONG(arg6, ntohs(sin6.sin6_port)); break; #endif -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sockets sockets.c
felipe Sun May 10 01:07:01 2009 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/socketssockets.c Log: - MFH: Fixed memory leak (patch by Christian Weiske) http://cvs.php.net/viewvc.cgi/php-src/ext/sockets/sockets.c?r1=1.171.2.9.2.23&r2=1.171.2.9.2.24&diff_format=u Index: php-src/ext/sockets/sockets.c diff -u php-src/ext/sockets/sockets.c:1.171.2.9.2.23 php-src/ext/sockets/sockets.c:1.171.2.9.2.24 --- php-src/ext/sockets/sockets.c:1.171.2.9.2.23Thu Apr 16 05:32:38 2009 +++ php-src/ext/sockets/sockets.c Sun May 10 01:07:01 2009 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: sockets.c,v 1.171.2.9.2.23 2009/04/16 05:32:38 pajoye Exp $ */ +/* $Id: sockets.c,v 1.171.2.9.2.24 2009/05/10 01:07:01 felipe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1418,6 +1418,7 @@ sin.sin_family = AF_INET; if (arg6 == NULL) { + efree(recv_buf); WRONG_PARAM_COUNT; } @@ -1446,6 +1447,7 @@ sin6.sin6_family = AF_INET6; if (arg6 == NULL) { + efree(recv_buf); WRONG_PARAM_COUNT; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sockets sockets.c
pajoye Thu Apr 16 05:32:38 2009 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/socketssockets.c Log: - #47978, typo in ext/sockets/sockets.c http://cvs.php.net/viewvc.cgi/php-src/ext/sockets/sockets.c?r1=1.171.2.9.2.22&r2=1.171.2.9.2.23&diff_format=u Index: php-src/ext/sockets/sockets.c diff -u php-src/ext/sockets/sockets.c:1.171.2.9.2.22 php-src/ext/sockets/sockets.c:1.171.2.9.2.23 --- php-src/ext/sockets/sockets.c:1.171.2.9.2.22Tue Feb 3 19:22:40 2009 +++ php-src/ext/sockets/sockets.c Thu Apr 16 05:32:38 2009 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: sockets.c,v 1.171.2.9.2.22 2009/02/03 19:22:40 iliaa Exp $ */ +/* $Id: sockets.c,v 1.171.2.9.2.23 2009/04/16 05:32:38 pajoye Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -229,7 +229,7 @@ sock->type = PF_INET; if (bind(sock->bsd_socket, (struct sockaddr *)&la, sizeof(la)) < 0) { - PHP_SOCKET_ERROR(sock, "unable to bind to given adress", errno); + PHP_SOCKET_ERROR(sock, "unable to bind to given address", errno); close(sock->bsd_socket); efree(sock); return 0; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sockets sockets.c
iliaa Tue Feb 3 19:22:40 2009 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/socketssockets.c Log: Return empty string when recv() does not fetch any data http://cvs.php.net/viewvc.cgi/php-src/ext/sockets/sockets.c?r1=1.171.2.9.2.21&r2=1.171.2.9.2.22&diff_format=u Index: php-src/ext/sockets/sockets.c diff -u php-src/ext/sockets/sockets.c:1.171.2.9.2.21 php-src/ext/sockets/sockets.c:1.171.2.9.2.22 --- php-src/ext/sockets/sockets.c:1.171.2.9.2.21Wed Dec 31 11:17:43 2008 +++ php-src/ext/sockets/sockets.c Tue Feb 3 19:22:40 2009 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: sockets.c,v 1.171.2.9.2.21 2008/12/31 11:17:43 sebastian Exp $ */ +/* $Id: sockets.c,v 1.171.2.9.2.22 2009/02/03 19:22:40 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -901,6 +901,9 @@ efree(tmpbuf); RETURN_FALSE; + } else if (!retval) { + efree(tmpbuf); + RETURN_EMPTY_STRING(); } tmpbuf = erealloc(tmpbuf, retval + 1); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sockets sockets.c
lbarnaudThu Oct 23 20:21:30 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/socketssockets.c Log: MFH: Fixed bug #46360 (TCP_NODELAY constant for socket_{get,set}_option) [DOC] Added TCP_NODELAY constant to sockets extension, to be used with socket_set_option() to disable TCP's Nagle algorithm. Avail in PHP>=5.2.7. http://cvs.php.net/viewvc.cgi/php-src/ext/sockets/sockets.c?r1=1.171.2.9.2.19&r2=1.171.2.9.2.20&diff_format=u Index: php-src/ext/sockets/sockets.c diff -u php-src/ext/sockets/sockets.c:1.171.2.9.2.19 php-src/ext/sockets/sockets.c:1.171.2.9.2.20 --- php-src/ext/sockets/sockets.c:1.171.2.9.2.19Wed Jul 16 14:10:50 2008 +++ php-src/ext/sockets/sockets.c Thu Oct 23 20:21:30 2008 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: sockets.c,v 1.171.2.9.2.19 2008/07/16 14:10:50 jani Exp $ */ +/* $Id: sockets.c,v 1.171.2.9.2.20 2008/10/23 20:21:30 lbarnaud Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -509,6 +509,9 @@ REGISTER_LONG_CONSTANT("SO_ERROR", SO_ERROR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SOL_SOCKET",SOL_SOCKET, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SOMAXCONN", SOMAXCONN, CONST_CS | CONST_PERSISTENT); +#ifdef TCP_NODELAY + REGISTER_LONG_CONSTANT("TCP_NODELAY", TCP_NODELAY,CONST_CS | CONST_PERSISTENT); +#endif REGISTER_LONG_CONSTANT("PHP_NORMAL_READ", PHP_NORMAL_READ, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("PHP_BINARY_READ", PHP_BINARY_READ, CONST_CS | CONST_PERSISTENT); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sockets sockets.c
felipe Tue Jul 15 11:20:06 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/socketssockets.c Log: - Reverted fix for #44197 (unsuitable for minor versions) http://cvs.php.net/viewvc.cgi/php-src/ext/sockets/sockets.c?r1=1.171.2.9.2.17&r2=1.171.2.9.2.18&diff_format=u Index: php-src/ext/sockets/sockets.c diff -u php-src/ext/sockets/sockets.c:1.171.2.9.2.17 php-src/ext/sockets/sockets.c:1.171.2.9.2.18 --- php-src/ext/sockets/sockets.c:1.171.2.9.2.17Thu Feb 21 02:39:43 2008 +++ php-src/ext/sockets/sockets.c Tue Jul 15 11:20:06 2008 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: sockets.c,v 1.171.2.9.2.17 2008/02/21 02:39:43 felipe Exp $ */ +/* $Id: sockets.c,v 1.171.2.9.2.18 2008/07/15 11:20:06 felipe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -584,10 +584,7 @@ zval**dest_element; php_socket *php_sock; HashTable *new_hash; - char*key; int num = 0; - ulong num_key; - uintkey_len; if (Z_TYPE_P(sock_array) != IS_ARRAY) return 0; @@ -602,14 +599,8 @@ if (PHP_SAFE_FD_ISSET(php_sock->bsd_socket, fds)) { /* Add fd to new array */ - switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(sock_array), &key, &key_len, &num_key, 0, NULL)) { - case HASH_KEY_IS_STRING: - zend_hash_add(new_hash, key, key_len, (void *)element, sizeof(zval *), (void **)&dest_element); - break; - case HASH_KEY_IS_LONG: - zend_hash_index_update(new_hash, num_key, (void *)element, sizeof(zval *), (void **)&dest_element); - break; - } + zend_hash_next_index_insert(new_hash, (void *)element, sizeof(zval *), (void **)&dest_element); + if (dest_element) zval_add_ref(dest_element); } num++; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sockets sockets.c
felipe Thu Feb 21 02:39:43 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/socketssockets.c Log: Fix typo http://cvs.php.net/viewvc.cgi/php-src/ext/sockets/sockets.c?r1=1.171.2.9.2.16&r2=1.171.2.9.2.17&diff_format=u Index: php-src/ext/sockets/sockets.c diff -u php-src/ext/sockets/sockets.c:1.171.2.9.2.16 php-src/ext/sockets/sockets.c:1.171.2.9.2.17 --- php-src/ext/sockets/sockets.c:1.171.2.9.2.16Thu Feb 21 02:34:50 2008 +++ php-src/ext/sockets/sockets.c Thu Feb 21 02:39:43 2008 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: sockets.c,v 1.171.2.9.2.16 2008/02/21 02:34:50 felipe Exp $ */ +/* $Id: sockets.c,v 1.171.2.9.2.17 2008/02/21 02:39:43 felipe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -585,7 +585,7 @@ php_socket *php_sock; HashTable *new_hash; char*key; - int num; + int num = 0; ulong num_key; uintkey_len; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sockets sockets.c
tony2001Wed Sep 26 10:55:07 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/socketssockets.c Log: MFH http://cvs.php.net/viewvc.cgi/php-src/ext/sockets/sockets.c?r1=1.171.2.9.2.13&r2=1.171.2.9.2.14&diff_format=u Index: php-src/ext/sockets/sockets.c diff -u php-src/ext/sockets/sockets.c:1.171.2.9.2.13 php-src/ext/sockets/sockets.c:1.171.2.9.2.14 --- php-src/ext/sockets/sockets.c:1.171.2.9.2.13Tue Jul 24 11:35:08 2007 +++ php-src/ext/sockets/sockets.c Wed Sep 26 10:55:07 2007 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: sockets.c,v 1.171.2.9.2.13 2007/07/24 11:35:08 jani Exp $ */ +/* $Id: sockets.c,v 1.171.2.9.2.14 2007/09/26 10:55:07 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -616,7 +616,7 @@ } /* }}} */ -/* {{{ proto int socket_select(array &read_fds, array &write_fds, &array except_fds, int tv_sec[, int tv_usec]) U +/* {{{ proto int socket_select(array &read_fds, array &write_fds, array &except_fds, int tv_sec[, int tv_usec]) U Runs the select() system call on the sets mentioned with a timeout specified by tv_sec and tv_usec */ PHP_FUNCTION(socket_select) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sockets sockets.c
janiSun Jul 22 22:47:18 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/socketssockets.c Log: MFH: ws fix + sync U stuff for patches to MFB easier http://cvs.php.net/viewvc.cgi/php-src/ext/sockets/sockets.c?r1=1.171.2.9.2.10&r2=1.171.2.9.2.11&diff_format=u Index: php-src/ext/sockets/sockets.c diff -u php-src/ext/sockets/sockets.c:1.171.2.9.2.10 php-src/ext/sockets/sockets.c:1.171.2.9.2.11 --- php-src/ext/sockets/sockets.c:1.171.2.9.2.10Sun Jul 22 22:22:09 2007 +++ php-src/ext/sockets/sockets.c Sun Jul 22 22:47:18 2007 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: sockets.c,v 1.171.2.9.2.10 2007/07/22 22:22:09 jani Exp $ */ +/* $Id: sockets.c,v 1.171.2.9.2.11 2007/07/22 22:47:18 jani Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -101,7 +101,7 @@ ZEND_ARG_PASS_INFO(1) ZEND_END_ARG_INFO(); -static +static ZEND_BEGIN_ARG_INFO(second_fifth_and_sixth_args_force_ref, 0) ZEND_ARG_PASS_INFO(0) ZEND_ARG_PASS_INFO(1) @@ -143,11 +143,11 @@ #endif PHP_FE(socket_last_error, NULL) PHP_FE(socket_clear_error, NULL) - + /* for downwards compatability */ PHP_FALIAS(socket_getopt, socket_get_option, NULL) PHP_FALIAS(socket_setopt, socket_set_option, NULL) - + {NULL, NULL, NULL} }; /* }}} */ @@ -205,7 +205,7 @@ efree(sock); return 0; } - + memcpy((char *) &la.sin_addr, hp->h_addr, hp->h_length); la.sin_family = hp->h_addrtype; la.sin_port = htons((unsigned short) port); @@ -242,7 +242,7 @@ { socklen_t salen; php_socket *out_sock = (php_socket*)emalloc(sizeof(php_socket)); - + *new_sock = out_sock; salen = sizeof(*la); @@ -253,7 +253,7 @@ efree(out_sock); return 0; } - + return 1; } /* }}} */ @@ -290,24 +290,24 @@ * in the first pass. no_read becomes 2 in the second pass, * and if this is nonblocking, we should return.. */ } - + if (no_read > 200) { set_errno(ECONNRESET); return -1; } } - + if (n < maxlen) { m = recv(bsd_socket, (void *) t, 1, flags); } - + if (errno != 0 && errno != ESPIPE && errno != EAGAIN) { return -1; } - + set_errno(0); } - + if (n < maxlen) { n++; /* The only reasons it makes it to here is @@ -316,7 +316,7 @@ * '\n' or '\r' in the count (since read() takes * place at the end of the loop..) */ } - + return n; } /* }}} */ @@ -344,26 +344,26 @@ } else { buf = strerror(error); } -#else +#else { LPTSTR tmp = NULL; buf = NULL; if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &tmp, 0, NULL)) { - + NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &tmp, 0, NULL) + ) { if (SOCKETS_G(strerror_buf)) { efree(SOCKETS_G(strerror_buf)); } SOCKETS_G(strerror_buf) = estrdup(tmp); LocalFree(tmp); - + buf = SOCKETS_G(strerror_buf); } } #endif - + return (buf ? (char *) buf : ""); } /* }}} */ @@ -508,7 +508,7 @@ if ((pe = getprotobyname("udp"))) { REGISTER_LONG_CONSTANT("SOL_UDP", pe->p_proto, CONST_CS | CONST_PERSISTENT); } - + return SUCCESS; } /* }}} */ @@ -540,7 +540,7 @@ zval**element; php_socket *php_sock; int num = 0; - + if (Z_TYPE_P(sock_array) != IS_ARRAY) return 0; for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(sock_array)); @@ -599,7 +599,7 @@ } /* }}} */ -/* {{{ proto int socket_select(array &read_fds, array &write_fds, &array except_fds, int tv_sec[, int tv_usec]) +/* {{{ proto int socket_select(array &read_fds, array &write_fds, &array except_fds, int tv_sec[, int tv_usec]) U Runs the select() system call on the sets mentioned with a
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sockets sockets.c
janiSun Jul 22 22:22:09 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/socketssockets.c Log: MFH: sync http://cvs.php.net/viewvc.cgi/php-src/ext/sockets/sockets.c?r1=1.171.2.9.2.9&r2=1.171.2.9.2.10&diff_format=u Index: php-src/ext/sockets/sockets.c diff -u php-src/ext/sockets/sockets.c:1.171.2.9.2.9 php-src/ext/sockets/sockets.c:1.171.2.9.2.10 --- php-src/ext/sockets/sockets.c:1.171.2.9.2.9 Sat May 19 17:58:22 2007 +++ php-src/ext/sockets/sockets.c Sun Jul 22 22:22:09 2007 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: sockets.c,v 1.171.2.9.2.9 2007/05/19 17:58:22 iliaa Exp $ */ +/* $Id: sockets.c,v 1.171.2.9.2.10 2007/07/22 22:22:09 jani Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -180,15 +180,16 @@ /* inet_ntop should be used instead of inet_ntoa */ int inet_ntoa_lock = 0; -static void php_destroy_socket(zend_rsrc_list_entry *rsrc TSRMLS_DC) +static void php_destroy_socket(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */ { php_socket *php_sock = (php_socket *) rsrc->ptr; close(php_sock->bsd_socket); efree(php_sock); } +/* }}} */ -static int php_open_listen_sock(php_socket **php_sock, int port, int backlog TSRMLS_DC) +static int php_open_listen_sock(php_socket **php_sock, int port, int backlog TSRMLS_DC) /* {{{ */ { struct sockaddr_in la; struct hostent *hp; @@ -235,8 +236,9 @@ return 1; } +/* }}} */ -static int php_accept_connect(php_socket *in_sock, php_socket **new_sock, struct sockaddr *la TSRMLS_DC) +static int php_accept_connect(php_socket *in_sock, php_socket **new_sock, struct sockaddr *la TSRMLS_DC) /* {{{ */ { socklen_t salen; php_socket *out_sock = (php_socket*)emalloc(sizeof(php_socket)); @@ -254,6 +256,7 @@ return 1; } +/* }}} */ /* {{{ php_read -- wrapper around read() so that it only reads to a \r or \n. */ static int php_read(int bsd_socket, void *buf, size_t maxlen, int flags) @@ -318,7 +321,7 @@ } /* }}} */ -static char *php_strerror(int error TSRMLS_DC) +static char *php_strerror(int error TSRMLS_DC) /* {{{ */ { const char *buf; @@ -363,10 +366,11 @@ return (buf ? (char *) buf : ""); } +/* }}} */ #if HAVE_IPV6 /* Sets addr by hostname, or by ip in string form (AF_INET6) */ -static int php_set_inet6_addr(struct sockaddr_in6 *sin6, char *string, php_socket *php_sock TSRMLS_DC) +static int php_set_inet6_addr(struct sockaddr_in6 *sin6, char *string, php_socket *php_sock TSRMLS_DC) /* {{{ */ { struct in6_addr tmp; #if HAVE_GETADDRINFO @@ -401,7 +405,7 @@ #else /* No IPv6 specific hostname resolution is available on this system? */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Host lookup failed: getaddrinfo() not available on this system."); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Host lookup failed: getaddrinfo() not available on this system"); return 0; #endif @@ -409,10 +413,11 @@ return 1; } +/* }}} */ #endif /* Sets addr by hostname, or by ip in string form (AF_INET) */ -static int php_set_inet_addr(struct sockaddr_in *sin, char *string, php_socket *php_sock TSRMLS_DC) +static int php_set_inet_addr(struct sockaddr_in *sin, char *string, php_socket *php_sock TSRMLS_DC) /* {{{ */ { struct in_addr tmp; struct hostent *host_entry; @@ -438,12 +443,15 @@ return 1; } +/* }}} */ +/* {{{ PHP_GINIT_FUNCTION */ static PHP_GINIT_FUNCTION(sockets) { sockets_globals->last_error = 0; sockets_globals->strerror_buf = NULL; } +/* }}} */ /* {{{ PHP_MINIT_FUNCTION */ @@ -527,7 +535,7 @@ } /* }}} */ -static int php_sock_array_to_fd_set(zval *sock_array, fd_set *fds, PHP_SOCKET *max_fd TSRMLS_DC) +static int php_sock_array_to_fd_set(zval *sock_array, fd_set *fds, PHP_SOCKET *max_fd TSRMLS_DC) /* {{{ */ { zval**element; php_socket *php_sock; @@ -551,8 +559,9 @@ return num ? 1 : 0; } +/* }}} */ -static int php_sock_array_from_fd_set(zval *sock_array, fd_set *fds TSRMLS_DC) +static int php_sock_array_from_fd_set(zval *sock_array, fd_set *fds TSRMLS_DC) /* {{{ */ { zval**element; zval**dest_element; @@ -588,6 +597,7 @@ return num ? 1 : 0; } +/* }}} */ /* {{{ proto int socket_select(array &read_fds, array &write_fds, &array except_fds, int tv_sec[, int tv_usec]) Runs the select() system call on the sets mentioned with a timeout specified by tv_sec and tv_usec */ @@ -601,8 +611,9 @@ int retval, sets = 0; longusec = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!a!a!z!|l", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE) + if (zend_parse_parameters(ZEND_NU
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sockets sockets.c
tony2001Sun Feb 25 22:59:33 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/socketssockets.c Log: MFH: zerofill socket structs http://cvs.php.net/viewvc.cgi/php-src/ext/sockets/sockets.c?r1=1.171.2.9.2.7&r2=1.171.2.9.2.8&diff_format=u Index: php-src/ext/sockets/sockets.c diff -u php-src/ext/sockets/sockets.c:1.171.2.9.2.7 php-src/ext/sockets/sockets.c:1.171.2.9.2.8 --- php-src/ext/sockets/sockets.c:1.171.2.9.2.7 Wed Jan 10 15:25:07 2007 +++ php-src/ext/sockets/sockets.c Sun Feb 25 22:59:32 2007 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: sockets.c,v 1.171.2.9.2.7 2007/01/10 15:25:07 bjori Exp $ */ +/* $Id: sockets.c,v 1.171.2.9.2.8 2007/02/25 22:59:32 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1118,6 +1118,8 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Socket of type AF_INET6 requires 3 arguments"); RETURN_FALSE; } + + memset(&sin6, 0, sizeof(struct sockaddr_in6)); sin6.sin6_family = AF_INET6; sin6.sin6_port = htons((unsigned short int)port); @@ -1134,6 +1136,8 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Socket of type AF_INET requires 3 arguments"); RETURN_FALSE; } + + memset(&sin, 0, sizeof(struct sockaddr_in)); sin.sin_family = AF_INET; sin.sin_port = htons((unsigned short int)port); @@ -1146,6 +1150,8 @@ break; case AF_UNIX: + memset(&s_un, 0, sizeof(struct sockaddr_un)); + s_un.sun_family = AF_UNIX; snprintf(s_un.sun_path, 108, "%s", addr); retval = connect(php_sock->bsd_socket, (struct sockaddr *) &s_un, SUN_LEN(&s_un)); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sockets sockets.c /ext/standard reg.c
tony2001Thu Dec 28 14:17:39 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/standard reg.c /php-src/ext/socketssockets.c Log: MFH http://cvs.php.net/viewvc.cgi/php-src/ext/standard/reg.c?r1=1.82.2.3&r2=1.82.2.3.2.1&diff_format=u Index: php-src/ext/standard/reg.c diff -u php-src/ext/standard/reg.c:1.82.2.3 php-src/ext/standard/reg.c:1.82.2.3.2.1 --- php-src/ext/standard/reg.c:1.82.2.3 Sun Feb 26 10:49:50 2006 +++ php-src/ext/standard/reg.c Thu Dec 28 14:17:38 2006 @@ -17,7 +17,7 @@ | Jaakko Hyvätti <[EMAIL PROTECTED]> | +--+ */ -/* $Id: reg.c,v 1.82.2.3 2006/02/26 10:49:50 helly Exp $ */ +/* $Id: reg.c,v 1.82.2.3.2.1 2006/12/28 14:17:38 tony2001 Exp $ */ #include #include @@ -425,7 +425,7 @@ buf = nbuf; } /* stick that last bit of string on our output */ - strcat(buf, &string[pos]); + strlcat(buf, &string[pos], buf_len); } } http://cvs.php.net/viewvc.cgi/php-src/ext/sockets/sockets.c?r1=1.171.2.9.2.4&r2=1.171.2.9.2.5&diff_format=u Index: php-src/ext/sockets/sockets.c diff -u php-src/ext/sockets/sockets.c:1.171.2.9.2.4 php-src/ext/sockets/sockets.c:1.171.2.9.2.5 --- php-src/ext/sockets/sockets.c:1.171.2.9.2.4 Tue Oct 3 19:51:01 2006 +++ php-src/ext/sockets/sockets.c Thu Dec 28 14:17:38 2006 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: sockets.c,v 1.171.2.9.2.4 2006/10/03 19:51:01 iliaa Exp $ */ +/* $Id: sockets.c,v 1.171.2.9.2.5 2006/12/28 14:17:38 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1600,11 +1600,12 @@ { zval*arg1, **arg4; struct linger lv; - struct timeval tv; php_socket *php_sock; int ov, optlen, retval; #ifdef PHP_WIN32 int timeout; +#else + struct timeval tv; #endif longlevel, optname; void*opt_ptr; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/sockets sockets.c
tony2001Sun Jul 30 11:54:18 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/socketssockets.c Log: improve checks and fix #38251 http://cvs.php.net/viewvc.cgi/php-src/ext/sockets/sockets.c?r1=1.171.2.9.2.1&r2=1.171.2.9.2.2&diff_format=u Index: php-src/ext/sockets/sockets.c diff -u php-src/ext/sockets/sockets.c:1.171.2.9.2.1 php-src/ext/sockets/sockets.c:1.171.2.9.2.2 --- php-src/ext/sockets/sockets.c:1.171.2.9.2.1 Thu Jun 15 18:33:08 2006 +++ php-src/ext/sockets/sockets.c Sun Jul 30 11:54:17 2006 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: sockets.c,v 1.171.2.9.2.1 2006/06/15 18:33:08 dmitry Exp $ */ +/* $Id: sockets.c,v 1.171.2.9.2.2 2006/07/30 11:54:17 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -536,6 +536,7 @@ { zval**element; php_socket *php_sock; + int num = 0; if (Z_TYPE_P(sock_array) != IS_ARRAY) return 0; @@ -550,9 +551,10 @@ if (php_sock->bsd_socket > *max_fd) { *max_fd = php_sock->bsd_socket; } + num++; } - return 1; + return num ? 1 : 0; } static int php_sock_array_from_fd_set(zval *sock_array, fd_set *fds TSRMLS_DC) @@ -561,6 +563,7 @@ zval**dest_element; php_socket *php_sock; HashTable *new_hash; + int num = 0; if (Z_TYPE_P(sock_array) != IS_ARRAY) return 0; @@ -578,6 +581,7 @@ zend_hash_next_index_insert(new_hash, (void *)element, sizeof(zval *), (void **)&dest_element); if (dest_element) zval_add_ref(dest_element); } + num++; } /* Destroy old array, add new one */ @@ -587,7 +591,7 @@ zend_hash_internal_pointer_reset(new_hash); Z_ARRVAL_P(sock_array) = new_hash; - return 1; + return num ? 1 : 0; } /* {{{ proto int socket_select(array &read_fds, array &write_fds, &array except_fds, int tv_sec[, int tv_usec]) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php