Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
af808203
Commit
af808203
authored
Dec 06, 2013
by
Brandon Carpenter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix failing test case in test_filter_ipc.
Add explicit check for primary group.
parent
f5b6bd70
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
5 deletions
+27
-5
configure.ac
configure.ac
+3
-2
ipc_listener.cpp
src/ipc_listener.cpp
+3
-1
test_filter_ipc.cpp
tests/test_filter_ipc.cpp
+21
-2
No files found.
configure.ac
View file @
af808203
...
...
@@ -170,7 +170,6 @@ case "${host_os}" in
fi
AC_DEFINE(ZMQ_HAVE_LINUX, 1, [Have Linux OS])
libzmq_on_linux="yes"
AC_CHECK_DECLS([SO_PEERCRED], [AC_DEFINE(ZMQ_HAVE_SO_PEERCRED, 1, [Have SO_PEERCRED socket option])], [], [#include <sys/socket.h>])
if test "x$libzmq_tipc_support" = "xyes"; then
AC_DEFINE(ZMQ_HAVE_TIPC, 1, [Have TIPC support])
...
...
@@ -216,7 +215,6 @@ case "${host_os}" in
libzmq_pedantic="no"
libzmq_werror="no"
AC_DEFINE(ZMQ_HAVE_OSX, 1, [Have DarwinOSX OS])
AC_CHECK_DECLS([LOCAL_PEERCRED], [AC_DEFINE(ZMQ_HAVE_LOCAL_PEERCRED, 1, [Have LOCAL_PEERCRED socket option])], [], [#include <sys/socket.h>])
AC_LANG_PUSH([C++])
LIBZMQ_CHECK_LANG_FLAG_PREPEND([-Wno-uninitialized])
AC_LANG_POP([C++])
...
...
@@ -351,6 +349,9 @@ if test "x$zmq_disable_eventfd" != "xyes"; then
[AC_DEFINE(ZMQ_HAVE_EVENTFD, 1, [Have eventfd extension.])])
fi
AC_CHECK_DECLS([SO_PEERCRED], [AC_DEFINE(ZMQ_HAVE_SO_PEERCRED, 1, [Have SO_PEERCRED socket option])], [], [#include <sys/socket.h>])
AC_CHECK_DECLS([LOCAL_PEERCRED], [AC_DEFINE(ZMQ_HAVE_LOCAL_PEERCRED, 1, [Have LOCAL_PEERCRED socket option])], [], [#include <sys/socket.h>])
# Use c++ in subsequent tests
AC_LANG_PUSH(C++)
...
...
src/ipc_listener.cpp
View file @
af808203
...
...
@@ -215,6 +215,7 @@ bool zmq::ipc_listener_t::filter (fd_t sock)
if
(
getsockopt
(
sock
,
SOL_SOCKET
,
SO_PEERCRED
,
&
cred
,
&
size
))
return
false
;
if
(
options
.
ipc_uid_accept_filters
.
find
(
cred
.
uid
)
!=
options
.
ipc_uid_accept_filters
.
end
()
||
options
.
ipc_gid_accept_filters
.
find
(
cred
.
gid
)
!=
options
.
ipc_gid_accept_filters
.
end
()
||
options
.
ipc_pid_accept_filters
.
find
(
cred
.
pid
)
!=
options
.
ipc_pid_accept_filters
.
end
())
return
true
;
...
...
@@ -227,9 +228,10 @@ bool zmq::ipc_listener_t::filter (fd_t sock)
it
!=
options
.
ipc_gid_accept_filters
.
end
();
it
++
)
{
if
(
!
(
gr
=
getgrgid
(
*
it
)))
continue
;
for
(
char
**
mem
=
gr
->
gr_mem
;
*
mem
;
mem
++
)
for
(
char
**
mem
=
gr
->
gr_mem
;
*
mem
;
mem
++
)
{
if
(
!
strcmp
(
*
mem
,
pw
->
pw_name
))
return
true
;
}
}
return
false
;
}
...
...
tests/test_filter_ipc.cpp
View file @
af808203
...
...
@@ -20,6 +20,9 @@
#include <string.h>
#include <sys/types.h>
#include <string>
#include <sstream>
#include "testutil.hpp"
static
void
bounce_fail
(
void
*
server
,
void
*
client
)
...
...
@@ -52,6 +55,8 @@ static void bounce_fail (void *server, void *client)
template
<
class
T
>
static
void
run_test
(
int
opt
,
T
optval
,
int
expected_error
,
int
bounce_test
)
{
int
rc
;
void
*
ctx
=
zmq_ctx_new
();
assert
(
ctx
);
...
...
@@ -59,7 +64,7 @@ static void run_test (int opt, T optval, int expected_error, int bounce_test)
assert
(
sb
);
if
(
opt
)
{
int
rc
=
zmq_setsockopt
(
sb
,
opt
,
&
optval
,
sizeof
(
optval
));
rc
=
zmq_setsockopt
(
sb
,
opt
,
&
optval
,
sizeof
(
optval
));
if
(
expected_error
)
{
assert
(
rc
==
-
1
);
assert
(
zmq_errno
()
==
expected_error
);
...
...
@@ -71,6 +76,20 @@ static void run_test (int opt, T optval, int expected_error, int bounce_test)
void
*
sc
=
zmq_socket
(
ctx
,
ZMQ_PAIR
);
assert
(
sc
);
// If a test fails, don't hang for too long
int
timeout
=
1500
;
rc
=
zmq_setsockopt
(
sb
,
ZMQ_RCVTIMEO
,
&
timeout
,
sizeof
(
int
));
assert
(
rc
==
0
);
rc
=
zmq_setsockopt
(
sb
,
ZMQ_SNDTIMEO
,
&
timeout
,
sizeof
(
int
));
assert
(
rc
==
0
);
rc
=
zmq_setsockopt
(
sc
,
ZMQ_RCVTIMEO
,
&
timeout
,
sizeof
(
int
));
assert
(
rc
==
0
);
rc
=
zmq_setsockopt
(
sc
,
ZMQ_SNDTIMEO
,
&
timeout
,
sizeof
(
int
));
assert
(
rc
==
0
);
int
interval
=
-
1
;
rc
=
zmq_setsockopt
(
sc
,
ZMQ_RECONNECT_IVL
,
&
interval
,
sizeof
(
int
));
assert
(
rc
==
0
);
if
(
bounce_test
)
{
int
rc
=
zmq_bind
(
sb
,
"ipc://@/tmp/test"
);
assert
(
rc
==
0
);
...
...
@@ -87,7 +106,7 @@ static void run_test (int opt, T optval, int expected_error, int bounce_test)
close_zero_linger
(
sc
);
close_zero_linger
(
sb
);
int
rc
=
zmq_ctx_term
(
ctx
);
rc
=
zmq_ctx_term
(
ctx
);
assert
(
rc
==
0
);
}
...
...
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