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
76df0459
Commit
76df0459
authored
Jun 28, 2013
by
Pieter Hintjens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return EINVAL when trying to use CURVE without libsodium
parent
357a9c45
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
20 deletions
+7
-20
options.cpp
src/options.cpp
+7
-20
No files found.
src/options.cpp
View file @
76df0459
...
...
@@ -284,12 +284,10 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
return
0
;
}
break
;
// If libsodium isn't installed, these options provoke EINVAL
# ifdef HAVE_LIBSODIUM
case
ZMQ_CURVE_SERVER
:
# ifndef HAVE_LIBSODIUM
puts
(
"E: libzmq was not built using libsodium, CURVE not available"
);
assert
(
false
);
# endif
if
(
is_int
&&
(
value
==
0
||
value
==
1
))
{
as_server
=
value
;
mechanism
=
value
?
ZMQ_CURVE
:
ZMQ_NULL
;
...
...
@@ -298,10 +296,6 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
break
;
case
ZMQ_CURVE_PUBLICKEY
:
# ifndef HAVE_LIBSODIUM
puts
(
"E: libzmq was not built using libsodium, CURVE not available"
);
assert
(
false
);
# endif
if
(
optvallen_
==
CURVE_KEYSIZE
)
{
memcpy
(
curve_public_key
,
optval_
,
CURVE_KEYSIZE
);
mechanism
=
ZMQ_CURVE
;
...
...
@@ -310,10 +304,6 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
break
;
case
ZMQ_CURVE_SECRETKEY
:
# ifndef HAVE_LIBSODIUM
puts
(
"E: libzmq was not built using libsodium, CURVE not available"
);
assert
(
false
);
# endif
if
(
optvallen_
==
CURVE_KEYSIZE
)
{
memcpy
(
curve_secret_key
,
optval_
,
CURVE_KEYSIZE
);
mechanism
=
ZMQ_CURVE
;
...
...
@@ -322,10 +312,6 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
break
;
case
ZMQ_CURVE_SERVERKEY
:
# ifndef HAVE_LIBSODIUM
puts
(
"E: libzmq was not built using libsodium, CURVE not available"
);
assert
(
false
);
# endif
if
(
optvallen_
==
CURVE_KEYSIZE
)
{
memcpy
(
curve_server_key
,
optval_
,
CURVE_KEYSIZE
);
as_server
=
0
;
...
...
@@ -333,9 +319,7 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
return
0
;
}
break
;
default
:
break
;
# endif
}
errno
=
EINVAL
;
return
-
1
;
...
...
@@ -555,6 +539,8 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
}
break
;
// If libsodium isn't installed, these options provoke EINVAL
# ifdef HAVE_LIBSODIUM
case
ZMQ_CURVE_SERVER
:
if
(
is_int
)
{
*
value
=
as_server
&&
mechanism
==
ZMQ_CURVE
;
...
...
@@ -582,6 +568,7 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
return
0
;
}
break
;
# endif
}
errno
=
EINVAL
;
return
-
1
;
...
...
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