Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | inet/socks: report errors instead of just early return |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: | 0040d9b1465888edfbd48a6d22301d7747742c0a |
User & Date: | aspect 2018-07-07 18:01:18 |
Context
2018-07-15
| ||
15:14 | "Squinting at Streams" play-along hackery check-in: 54a7e4d746 user: aspect tags: trunk | |
2018-07-07
| ||
18:01 | inet/socks: report errors instead of just early return check-in: 0040d9b146 user: aspect tags: trunk | |
17:52 | service should report "End" even for early returns check-in: 13b0a1b7a6 user: aspect tags: trunk | |
Changes
Changes to inet/inet.tcl.
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
...
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
|
# socks5 is pretty simple - outbound TCP only service socks5/1080 { chan configure $chan -encoding binary -buffering none # authentication scan [read $chan 2] %c%c ver nmeth if {$ver != 5} return binary scan [read $chan $nmeth] c* meths if {0 in $meths} { ;# no authentication! yay puts -nonewline $chan \x05\x00 } elseif {2 in $meths} { ;# user/passwd scan [read $chan 2] %c%c ver len if {$ver != 1} return set username [read $chan $len] scan [read $chan 1] %c len set password [read $chan $len] puts -nonewline $chan \1\0 ;# success! } else { ;# no supported auth methods puts -nonewline $chan \x05\xff return } # request scan [read $chan 4] %c%c%c%c ver cmd z atyp if {$ver != 5 || $z != 0} return if {$atyp == 1} { ;# IPv4 ................................................................................ set dst [join $dst :] } binary scan [read $chan 2] Su dpt if {$cmd == 3} { ;# UDP puts -nonewline $chan \5\7\0\3\0\0\0 ;# cmd not supported ":0" return } elseif {$cmd == 2} { ;# bind puts -nonewline $chan \5\7\0\3\0\0\0 ;# cmd not supported ":0" return } elseif {$cmd == 1} { ;# connect set upchan [socket -async $dst $dpt] finally [list catch [list close $upchan]] yieldto chan event $upchan writable [info coroutine] chan event $upchan writable "" |
|
>
>
|
>
>
|
|
|
|
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
...
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
|
# socks5 is pretty simple - outbound TCP only service socks5/1080 { chan configure $chan -encoding binary -buffering none # authentication scan [read $chan 2] %c%c ver nmeth if {$ver != 5} { error "Invalid SOCKS protocol version $ver (must be 5)" } binary scan [read $chan $nmeth] c* meths if {0 in $meths} { ;# no authentication! yay puts -nonewline $chan \x05\x00 } elseif {2 in $meths} { ;# user/passwd scan [read $chan 2] %c%c ver len if {$ver != 1} { error "user/password authentication $ver not supported (must be 1)" } set username [read $chan $len] scan [read $chan 1] %c len set password [read $chan $len] puts -nonewline $chan \1\0 ;# success! } else { ;# no supported auth methods puts -nonewline $chan \x05\xff error "no supported auth methods out of: $meths" } # request scan [read $chan 4] %c%c%c%c ver cmd z atyp if {$ver != 5 || $z != 0} return if {$atyp == 1} { ;# IPv4 ................................................................................ set dst [join $dst :] } binary scan [read $chan 2] Su dpt if {$cmd == 3} { ;# UDP puts -nonewline $chan \5\7\0\3\0\0\0 ;# cmd not supported ":0" error "UDP not supported" } elseif {$cmd == 2} { ;# bind puts -nonewline $chan \5\7\0\3\0\0\0 ;# cmd not supported ":0" error "bind not supported" } elseif {$cmd == 1} { ;# connect set upchan [socket -async $dst $dpt] finally [list catch [list close $upchan]] yieldto chan event $upchan writable [info coroutine] chan event $upchan writable "" |