Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
P
proxy-in-proxychains
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
proxy-in-proxychains
Commits
50a72acd
Commit
50a72acd
authored
Aug 22, 2012
by
Krzysztof Klis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code cleanup
parent
f4f0fd76
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
proxy.c
proxy.c
+8
-8
No files found.
proxy.c
View file @
50a72acd
...
...
@@ -99,10 +99,10 @@ int main(int argc, char *argv[]) {
/* Parse command line options */
int
parse_options
(
int
argc
,
char
*
argv
[])
{
bool
l
,
h
,
p
,
i
,
o
;
bool
l
,
h
,
p
;
int
c
,
local_port
;
l
=
h
=
p
=
i
=
o
=
FALSE
;
l
=
h
=
p
=
FALSE
;
while
((
c
=
getopt
(
argc
,
argv
,
"l:h:p:i:o:"
))
!=
-
1
)
{
switch
(
c
)
{
...
...
@@ -266,14 +266,14 @@ void forward_data_ext(int source_sock, int destination_sock, char *cmd[]) {
}
if
(
fork
()
==
0
)
{
dup2
(
pipe_in
[
READ
],
STDIN_FILENO
);
// re
direct stdin to input pipe
close
(
pipe_in
[
WRITE
]);
// no need to write to input pipe here
dup2
(
pipe_out
[
WRITE
],
STDOUT_FILENO
);
// redirect stdout to output pipe
close
(
pipe_out
[
READ
]);
//
no need to read output pipe here
dup2
(
pipe_in
[
READ
],
STDIN_FILENO
);
// re
place standard input with input part of pipe_in
dup2
(
pipe_out
[
WRITE
],
STDOUT_FILENO
);
// replace standard output with output part of pipe_out
close
(
pipe_in
[
WRITE
]);
// close unused end of pipe_in
close
(
pipe_out
[
READ
]);
//
close unused end of pipe_out
n
=
execvp
(
cmd
[
0
],
cmd
);
// execute command
exit
(
n
);
}
else
{
close
(
pipe_in
[
READ
]);
// no need to read input pipe here
close
(
pipe_in
[
READ
]);
// no need to read
from
input pipe here
close
(
pipe_out
[
WRITE
]);
// no need to write to output pipe here
while
((
n
=
recv
(
source_sock
,
buffer
,
BUF_SIZE
,
0
))
>
0
)
{
// read data from input socket
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment