Code Review
/
src
/
app-framework-binder.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
afb-socket: Handle listening on all interfaces
[src/app-framework-binder.git]
/
src
/
afb-socket.c
diff --git
a/src/afb-socket.c
b/src/afb-socket.c
index
ebbc58e
..
63de2cf
100644
(file)
--- a/
src/afb-socket.c
+++ b/
src/afb-socket.c
@@
-178,6
+178,11
@@
static int open_tcp(const char *spec, int server)
memset(&hint, 0, sizeof hint);
hint.ai_family = AF_INET;
hint.ai_socktype = SOCK_STREAM;
memset(&hint, 0, sizeof hint);
hint.ai_family = AF_INET;
hint.ai_socktype = SOCK_STREAM;
+ if (server) {
+ hint.ai_flags = AI_PASSIVE;
+ if (host[0] == 0 || (host[0] == '*' && host[1] == 0))
+ host = NULL;
+ }
rc = getaddrinfo(host, service, &hint, &rai);
if (rc != 0) {
errno = EINVAL;
rc = getaddrinfo(host, service, &hint, &rai);
if (rc != 0) {
errno = EINVAL;
@@
-217,7
+222,7
@@
static int open_systemd(const char *spec)
{
#if defined(NO_SYSTEMD_ACTIVATION)
errno = EAFNOSUPPORT;
{
#if defined(NO_SYSTEMD_ACTIVATION)
errno = EAFNOSUPPORT;
-
fd =
-1;
+
return
-1;
#else
return afb_systemd_fds_for(spec);
#endif
#else
return afb_systemd_fds_for(spec);
#endif
@@
-366,9
+371,11
@@
const char *afb_socket_api(const char *uri)
{
int offset;
const char *api;
{
int offset;
const char *api;
+ struct entry *entry;
- get_entry(uri, &offset);
+
entry =
get_entry(uri, &offset);
uri += offset;
uri += offset;
+ uri += (entry->type == Type_Unix && *uri == '@');
api = strstr(uri, as_api);
if (api)
api += sizeof as_api - 1;
api = strstr(uri, as_api);
if (api)
api += sizeof as_api - 1;