Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Core
Tor
Commits
b160929c
Commit
b160929c
authored
6 years ago
by
rl1987
Committed by
Nick Mathewson
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add RESOLVE (0xF0) command to socks4_client_request
parent
9155e084
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/trunnel/socks5.c
+6
-6
6 additions, 6 deletions
src/trunnel/socks5.c
src/trunnel/socks5.h
+1
-0
1 addition, 0 deletions
src/trunnel/socks5.h
src/trunnel/socks5.trunnel
+2
-1
2 additions, 1 deletion
src/trunnel/socks5.trunnel
with
9 additions
and
7 deletions
src/trunnel/socks5.c
+
6
−
6
View file @
b160929c
...
...
@@ -345,7 +345,7 @@ socks4_client_request_get_command(const socks4_client_request_t *inp)
int
socks4_client_request_set_command
(
socks4_client_request_t
*
inp
,
uint8_t
val
)
{
if
(
!
((
val
==
CMD_BIND
||
val
==
CMD_CONNECT
||
val
==
CMD_RESOLVE_PTR
)))
{
if
(
!
((
val
==
CMD_BIND
||
val
==
CMD_CONNECT
||
val
==
CMD_RESOLVE
||
val
==
CMD_RESOLVE_PTR
)))
{
TRUNNEL_SET_ERROR_CODE
(
inp
);
return
-
1
;
}
...
...
@@ -413,7 +413,7 @@ socks4_client_request_check(const socks4_client_request_t *obj)
return
"A set function failed on this object"
;
if
(
!
(
obj
->
version
==
4
))
return
"Integer out of bounds"
;
if
(
!
(
obj
->
command
==
CMD_BIND
||
obj
->
command
==
CMD_CONNECT
||
obj
->
command
==
CMD_RESOLVE_PTR
))
if
(
!
(
obj
->
command
==
CMD_BIND
||
obj
->
command
==
CMD_CONNECT
||
obj
->
command
==
CMD_RESOLVE
||
obj
->
command
==
CMD_RESOLVE_PTR
))
return
"Integer out of bounds"
;
if
(
NULL
==
obj
->
username
)
return
"Missing username"
;
...
...
@@ -696,7 +696,7 @@ socks4_client_request_encoded_len(const socks4_client_request_t *obj)
/* Length of u8 version IN [4] */
result
+=
1
;
/* Length of u8 command IN [CMD_BIND, CMD_CONNECT, CMD_RESOLVE_PTR] */
/* Length of u8 command IN [CMD_BIND, CMD_CONNECT,
CMD_RESOLVE,
CMD_RESOLVE_PTR] */
result
+=
1
;
/* Length of u16 port */
...
...
@@ -1006,7 +1006,7 @@ socks4_client_request_encode(uint8_t *output, const size_t avail, const socks4_c
trunnel_set_uint8
(
ptr
,
(
obj
->
version
));
written
+=
1
;
ptr
+=
1
;
/* Encode u8 command IN [CMD_BIND, CMD_CONNECT, CMD_RESOLVE_PTR] */
/* Encode u8 command IN [CMD_BIND, CMD_CONNECT,
CMD_RESOLVE,
CMD_RESOLVE_PTR] */
trunnel_assert
(
written
<=
avail
);
if
(
avail
-
written
<
1
)
goto
truncated
;
...
...
@@ -1354,11 +1354,11 @@ socks4_client_request_parse_into(socks4_client_request_t *obj, const uint8_t *in
if
(
!
(
obj
->
version
==
4
))
goto
fail
;
/* Parse u8 command IN [CMD_BIND, CMD_CONNECT, CMD_RESOLVE_PTR] */
/* Parse u8 command IN [CMD_BIND, CMD_CONNECT,
CMD_RESOLVE,
CMD_RESOLVE_PTR] */
CHECK_REMAINING
(
1
,
truncated
);
obj
->
command
=
(
trunnel_get_uint8
(
ptr
));
remaining
-=
1
;
ptr
+=
1
;
if
(
!
(
obj
->
command
==
CMD_BIND
||
obj
->
command
==
CMD_CONNECT
||
obj
->
command
==
CMD_RESOLVE_PTR
))
if
(
!
(
obj
->
command
==
CMD_BIND
||
obj
->
command
==
CMD_CONNECT
||
obj
->
command
==
CMD_RESOLVE
||
obj
->
command
==
CMD_RESOLVE_PTR
))
goto
fail
;
/* Parse u16 port */
...
...
This diff is collapsed.
Click to expand it.
src/trunnel/socks5.h
+
1
−
0
View file @
b160929c
...
...
@@ -11,6 +11,7 @@
#define CMD_CONNECT 1
#define CMD_BIND 2
#define CMD_UDP_ASSOCIATE 3
#define CMD_RESOLVE 240
#define CMD_RESOLVE_PTR 241
#define ATYPE_IPV4 1
#define ATYPE_IPV6 4
...
...
This diff is collapsed.
Click to expand it.
src/trunnel/socks5.trunnel
+
2
−
1
View file @
b160929c
...
...
@@ -16,6 +16,7 @@ const CMD_CONNECT = 1;
const CMD_BIND = 2;
const CMD_UDP_ASSOCIATE = 3;
// This is a tor extension
const CMD_RESOLVE = 0xF0;
const CMD_RESOLVE_PTR = 0xF1;
const ATYPE_IPV4 = 1;
...
...
@@ -72,7 +73,7 @@ struct socks5_server_userpath_auth {
struct socks4_client_request {
u8 version IN [4];
u8 command IN [CMD_CONNECT,CMD_BIND,CMD_RESOLVE_PTR];
u8 command IN [CMD_CONNECT,CMD_BIND,CMD_RESOLVE
,CMD_RESOLVE
_PTR];
u16 port;
u32 addr;
nulterm username;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment