[PHP-DEV] SOCKS support patch

2001-08-09 Thread Paolo Prandini

Quoting Zeev Suraski [EMAIL PROTECTED]:

 This change was my last major TODO item for PHP 4.0.7.  At this point,
 we
 should try to get PHP 4.0.7 out the door soon.  I suggest we branch
 4.0.7
 away next Tuesday, and start the QA process.  This should give people
 enough time to make any final changes they want to put into 4.0.7.

Would you like SOCKS support to be included in the CVS before the branch?
I enclose the diff file.

Regards,


Paolo Prandini
S.P.E.Sistemi e Progetti Elettronici s.a.s.
Via Liguria 5
I-25125 Brescia (BS)
Tel +39 0302427266
Fax +39 0302449252
Email [EMAIL PROTECTED]
World Wide Web http://www.spe.it

diff file:

diff -urN php-4.0.6.orig/ext/standard/Makefile.in
php-4.0.6/ext/standard/Makefile.in
--- php-4.0.6.orig/ext/standard/Makefile.in Mon Nov 20 11:05:57 2000
+++ php-4.0.6/ext/standard/Makefile.in  Thu Aug  9 11:14:51 2001
@@ -7,7 +7,7 @@
link.c mail.c math.c md5.c metaphone.c microtime.c pack.c pageinfo.c \
 parsedate.c quot_print.c rand.c reg.c soundex.c string.c scanf.c \
syslog.c type.c uniqid.c url.c url_scanner.c var.c output.c assert.c \
-   strnatcmp.c levenshtein.c incomplete_class.c url_scanner_ex.c \
+   strnatcmp.c levenshtein.c incomplete_class.c url_scanner_ex.c socks.c \
ftp_fopen_wrapper.c http_fopen_wrapper.c php_fopen_wrapper.c credits.c

 include $(top_srcdir)/build/dynlib.mk
diff -urN php-4.0.6.orig/ext/standard/basic_functions.c
php-4.0.6/ext/standard/basic_functions.c
--- php-4.0.6.orig/ext/standard/basic_functions.c   Sun May 20 02:31:45 2001
+++ php-4.0.6/ext/standard/basic_functions.cThu Aug  9 11:21:32 2001
@@ -644,6 +644,15 @@
PHP_INI_ENTRY_EX(safe_mode_protected_env_vars,
SAFE_MODE_PROTECTED_ENV_VARS,   PHP_INI_SYSTEM,
OnUpdateSafeModeProtectedEnvVars,   NULL)
PHP_INI_ENTRY_EX(safe_mode_allowed_env_vars,
SAFE_MODE_ALLOWED_ENV_VARS, PHP_INI_SYSTEM,
OnUpdateSafeModeAllowedEnvVars, NULL)
STD_PHP_INI_ENTRY(session.use_trans_sid,  1,
PHP_INI_ALL,OnUpdateBool,   use_trans_sid, 
 php_basic_globals,
basic_globals)
+
+PHP_INI_ENTRY(socks.user,,PHP_INI_ALL,NULL)
+PHP_INI_ENTRY(socks.pass,,PHP_INI_ALL,NULL)
+PHP_INI_ENTRY(socks.default_pass,,PHP_INI_SYSTEM,NULL)
+PHP_INI_ENTRY(socks.default_user,,PHP_INI_SYSTEM,NULL)
+PHP_INI_ENTRY(socks.server,,PHP_INI_SYSTEM,NULL)
+PHP_INI_ENTRY(socks.type,4,PHP_INI_SYSTEM,NULL)
+PHP_INI_ENTRY(socks.port,,PHP_INI_SYSTEM,NULL)
+PHP_INI_ENTRY(socks.local,,PHP_INI_SYSTEM,NULL)
 PHP_INI_END()


diff -urN php-4.0.6.orig/ext/standard/socks.c php-4.0.6/ext/standard/socks.c
--- php-4.0.6.orig/ext/standard/socks.c Thu Jan  1 01:00:00 1970
+++ php-4.0.6/ext/standard/socks.c  Thu Aug  9 11:16:38 2001
@@ -0,0 +1,791 @@
+/*
+
+   phpsocks - an extension to php for use with socks proxies
+   Copyright (C) 2000 Paolo Prandini
+
+   liberally derived from:
+   TSOCKS - Wrapper library for transparent SOCKS
+   Copyright (C) 2000 Shaun Clowes
+
+
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+/* PreProcessor Defines */
+#define DEBUG  1  /* Show error messages? */
+
+/* Header Files */
+#include php.h
+#include php_ini.h
+
+#include stdio.h
+#include stdlib.h
+#include unistd.h
+#include dlfcn.h
+#include sys/types.h
+#include sys/socket.h
+#include string.h
+#include netinet/in.h
+#include arpa/inet.h
+#include pwd.h
+#include errno.h
+#include fcntl.h
+#include stdarg.h
+
+struct socksent {
+struct in_addr localip;
+struct in_addr localnet;
+   struct socksent *next;
+};
+
+struct sockaddr_link {
+struct sockaddr_in ip;
+   struct sockaddr_link *next;
+};
+
+struct sockreq {
+int8_t version;
+int8_t command;
+int16_t dstport;
+int32_t dstip;
+/* A null terminated username goes here */
+};
+
+struct sockrep {
+int8_t version;
+int8_t result;
+int16_t ignore1;
+int32_t ignore2;
+};
+
+/* Global Declarations */
+static struct socksent *localnets = NULL;
+static int initialized = 0;
+static int servertype = 0;
+static int servervalid = 0;
+static unsigned short int

[PHP-DEV] SOCKS support

2001-08-05 Thread Paolo Prandini

I implemented socks support ( with redundant proxies as well) for php.
How can I submit the code for inclusion in the code base?
Thanks  

Paolo Prandini
S.P.E.Sistemi e Progetti Elettronici s.a.s.
Via Liguria 5
I-25125 Brescia (BS)
Tel +39 0302427266
Fax +39 0302449252
Email [EMAIL PROTECTED]
World Wide Web http://www.spe.it


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]