Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
7ac44e8c
Commit
7ac44e8c
authored
Mar 06, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add end of stream marker to configd backend service (and commandline tool)
parent
baa9f798
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
7 deletions
+19
-7
configd_ctl.py
src/opnsense/service/configd_ctl.py
+15
-6
processhandler.py
src/opnsense/service/modules/processhandler.py
+4
-1
No files found.
src/opnsense/service/configd_ctl.py
View file @
7ac44e8c
...
...
@@ -38,9 +38,10 @@ import sys
__author__
=
'Ad Schellevis'
configd_socket_name
=
'/var/run/configd.socket'
configd_socket_name
=
'testing/configd.socket'
# set a timeout to the socket
socket
.
setdefaulttimeout
(
120
)
if
len
(
sys
.
argv
)
<=
1
:
print
'usage :
%
s <command>'
%
sys
.
argv
[
0
]
...
...
@@ -52,13 +53,21 @@ else:
sock
.
connect
(
configd_socket_name
)
try
:
sock
.
send
(
exec_command
)
data
=
[]
data
=
""
while
True
:
line
=
sock
.
recv
(
4096
)
if
line
:
data
.
append
(
line
)
else
:
data
=
data
+
line
if
data
.
find
(
"
%
c
%
c
%
c"
%
(
chr
(
0
),
chr
(
0
),
chr
(
0
)))
>
-
1
:
break
print
(
''
.
join
(
data
))
print
(
data
[:
-
3
])
finally
:
sock
.
close
()
src/opnsense/service/modules/processhandler.py
View file @
7ac44e8c
...
...
@@ -103,7 +103,7 @@ class Handler(object):
# run single threaded
cmd_thread
.
run
()
else
:
# r
nu
threaded
# r
un
threaded
cmd_thread
.
start
()
except
KeyboardInterrupt
:
...
...
@@ -171,6 +171,9 @@ class HandlerClient(threading.Thread):
# send response back to client( including trailing enter )
self
.
connection
.
sendall
(
'
%
s
\n
'
%
result
)
# send end of stream characters
self
.
connection
.
sendall
(
"
%
c
%
c
%
c"
%
(
chr
(
0
),
chr
(
0
),
chr
(
0
)))
except
:
print
(
traceback
.
format_exc
())
syslog
.
syslog
(
syslog
.
LOG_ERR
,
...
...
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