Sfoglia il codice sorgente

Update github.com/Psiphon-Inc/goptlib to 18963be

Rod Hynes 7 anni fa
parent
commit
3bc8e31020
2 ha cambiato i file con 37 aggiunte e 15 eliminazioni
  1. 34 12
      vendor/github.com/Psiphon-Inc/goptlib/socks.go
  2. 3 3
      vendor/vendor.json

+ 34 - 12
vendor/github.com/Psiphon-Inc/goptlib/socks.go

@@ -288,17 +288,33 @@ func socks5NegotiateAuth(rw *bufio.ReadWriter) (method byte, err error) {
 	// Pick the most "suitable" method.
 	method = socksAuthNoAcceptableMethods
 	for _, m := range methods {
+		// [Psiphon]
+		// Some SOCKS5 clients send both None and Username/Password when in fact they are only
+		// able to auth with None. Since we don't need pluggable transport parameters and prefer
+		// enabling clients to proxy, we prefer None, which allows those clients to connect.
+		/*
+			switch m {
+			case socksAuthNoneRequired:
+				// Pick Username/Password over None if the client happens to
+				// send both.
+				if method == socksAuthNoAcceptableMethods {
+					method = m
+				}
+
+			case socksAuthUsernamePassword:
+				method = m
+			}
+		*/
 		switch m {
 		case socksAuthNoneRequired:
-			// Pick Username/Password over None if the client happens to
-			// send both.
+			method = m
+
+		case socksAuthUsernamePassword:
 			if method == socksAuthNoAcceptableMethods {
 				method = m
 			}
-
-		case socksAuthUsernamePassword:
-			method = m
 		}
+		// [Psiphon]
 	}
 
 	// Send the negotiated method.
@@ -404,13 +420,19 @@ func socks5AuthRFC1929(rw *bufio.ReadWriter, req *SocksRequest) (err error) {
 		req.Password = string(passwd)
 	}
 
-	// Mash the username/password together and parse it as a pluggable
-	// transport argument string.
-	if req.Args, err = parseClientParameters(req.Username + req.Password); err != nil {
-		sendErrResp()
-		err = newTemporaryNetError("socks5AuthRFC1929: failed to parse client parameters: %s", err)
-		return
-	}
+	// [Psiphon]
+	// Since we don't need pluggable transport parameters and prefer enabling clients to proxy,
+	// don't parse or validate username/password as PT args.
+	/*
+		// Mash the username/password together and parse it as a pluggable
+		// transport argument string.
+		if req.Args, err = parseClientParameters(req.Username + req.Password); err != nil {
+			sendErrResp()
+			err = newTemporaryNetError("socks5AuthRFC1929: failed to parse client parameters: %s", err)
+			return
+		}
+	*/
+	// [Psiphon]
 
 	// Write success response
 	resp := []byte{socksAuthRFC1929Ver, socksAuthRFC1929Success}

+ 3 - 3
vendor/vendor.json

@@ -21,10 +21,10 @@
 			"revisionTime": "2016-08-25T06:51:56Z"
 		},
 		{
-			"checksumSHA1": "x09IEL3yeVxmiSQM5WTA3ZVbNhM=",
+			"checksumSHA1": "bBh2OEkNOoHZuXk/0/orkmFF3J0=",
 			"path": "github.com/Psiphon-Inc/goptlib",
-			"revision": "9c6c4313bc75846711ee5c6f4d561d138a49a733",
-			"revisionTime": "2015-01-15T15:45:38Z"
+			"revision": "18963be5f9c52609b1dd6960d1370d34e63fc3fb",
+			"revisionTime": "2018-04-26T17:24:40Z"
 		},
 		{
 			"checksumSHA1": "aFs1ojFW1UmUNMtN6rdRJ2FEIRE=",