aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaiki Ueno2009-11-27 07:35:14 +0000
committerDaiki Ueno2009-11-27 07:35:14 +0000
commit6c6f788d8a5e09e2c3ffa2d5f7cfad6898825fd7 (patch)
tree1d77dad0faa533269e7a609ac05a105808b6f953
parent6f06a17190784b62e45686ce3efd17e838ec1cb6 (diff)
downloademacs-6c6f788d8a5e09e2c3ffa2d5f7cfad6898825fd7.tar.gz
emacs-6c6f788d8a5e09e2c3ffa2d5f7cfad6898825fd7.zip
(socks-send-command): Convert binary request to
unibyte before sending. This fixes mishandling of some port numbers such as 129.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/net/socks.el42
2 files changed, 28 insertions, 20 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ef98cf4e5c0..7227f11add3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12009-11-27 Daiki Ueno <ueno@unixuser.org>
2
3 * net/socks.el (socks-send-command): Convert binary request to
4 unibyte before sending. This fixes mishandling of some port
5 numbers such as 129.
6
12009-11-27 Stefan Monnier <monnier@iro.umontreal.ca> 72009-11-27 Stefan Monnier <monnier@iro.umontreal.ca>
2 8
3 * help.el (describe-bindings-internal): Remove `interactive'. 9 * help.el (describe-bindings-internal): Remove `interactive'.
diff --git a/lisp/net/socks.el b/lisp/net/socks.el
index 0b13996e84f..b1c045e3bc0 100644
--- a/lisp/net/socks.el
+++ b/lisp/net/socks.el
@@ -435,27 +435,29 @@ version.")
435 (error "Unsupported address type for HTTP: %d" atype))) 435 (error "Unsupported address type for HTTP: %d" atype)))
436 port))) 436 port)))
437 ((equal version 4) 437 ((equal version 4)
438 (setq request (format 438 (setq request (string-make-unibyte
439 "%c%c%c%c%s%s%c" 439 (format
440 version ; version 440 "%c%c%c%c%s%s%c"
441 command ; command 441 version ; version
442 (lsh port -8) ; port, high byte 442 command ; command
443 (- port (lsh (lsh port -8) 8)) ; port, low byte 443 (lsh port -8) ; port, high byte
444 addr ; address 444 (- port (lsh (lsh port -8) 8)) ; port, low byte
445 (user-full-name) ; username 445 addr ; address
446 0 ; terminate username 446 (user-full-name) ; username
447 ))) 447 0 ; terminate username
448 ))))
448 ((equal version 5) 449 ((equal version 5)
449 (setq request (format 450 (setq request (string-make-unibyte
450 "%c%c%c%c%s%c%c" 451 (format
451 version ; version 452 "%c%c%c%c%s%c%c"
452 command ; command 453 version ; version
453 0 ; reserved 454 command ; command
454 atype ; address type 455 0 ; reserved
455 addr ; address 456 atype ; address type
456 (lsh port -8) ; port, high byte 457 addr ; address
457 (- port (lsh (lsh port -8) 8)) ; port, low byte 458 (lsh port -8) ; port, high byte
458 ))) 459 (- port (lsh (lsh port -8) 8)) ; port, low byte
460 ))))
459 (t 461 (t
460 (error "Unknown protocol version: %d" version))) 462 (error "Unknown protocol version: %d" version)))
461 (process-send-string proc request) 463 (process-send-string proc request)