[ZendTo] IPv6 compliance

Sébastien BLAISOT sebastien at blaisot.org
Sun Aug 11 13:22:12 BST 2013


Hi All,

I just tried ZendTo today in an IPv6 environment and unfortunately 
zendto is not IPv6 compliant due to regexp on line 1149 of 
lib/NSSDropbox.php which looks for an IPv4 address.

attached is a quick and dirty patch to resolve the issue.
as a side effect, IPv4 validation is weaker

Feel free to provide a more complete IPv4+IPv6 validation regexp.

regards,

S. Blaisot
-------------- next part --------------
diff -Nur ZendTo-4.11-11.orig/lib/NSSDropbox.php ZendTo-4.11-11/lib/NSSDropbox.php
--- ZendTo-4.11-11.orig/lib/NSSDropbox.php	2013-05-17 16:47:44.000000000 +0200
+++ ZendTo-4.11-11/lib/NSSDropbox.php	2013-08-11 14:10:10.181082669 +0200
@@ -1146,7 +1146,7 @@
     if ( isset($_COOKIE[$this->_cookieName]) && ($cookieVal = $_COOKIE[$this->_cookieName]) ) {
       // Added (?:\:[0-9]+)? to support IIS7 adding port numbers! :-(
       // Thanks to dturvey at bhc.ltd.uk for this.
-      if ( preg_match('/^(.+)\,([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+(?:\:[0-9]+)?),([0-9]+),([0-9]+),([A-Fa-f0-9]+)$/',$cookieVal,$cookiePieces) ) {
+      if ( preg_match('/^(.+)\,([0-9abcdef\:.]+(?:\:[0-9]+)?),([0-9]+),([0-9]+),([A-Fa-f0-9]+)$/',$cookieVal,$cookiePieces) ) {
         //  Coming from the same remote IP?
         if ( $cookiePieces[2] != $_SERVER['REMOTE_ADDR'] ) {
           return FALSE;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4255 bytes
Desc: Signature cryptographique S/MIME
Url : http://mailman.ecs.soton.ac.uk/pipermail/zendto/attachments/20130811/5164b57c/attachment.bin 


More information about the ZendTo mailing list