summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/sys/net.c9
-rw-r--r--daemon/logind/loginc.c2
-rw-r--r--daemon/logind/logind.c3
-rw-r--r--include/cmsys.h2
-rw-r--r--mbbsd/mbbsd.c2
5 files changed, 13 insertions, 5 deletions
diff --git a/common/sys/net.c b/common/sys/net.c
index 883b4d48..232d5bb1 100644
--- a/common/sys/net.c
+++ b/common/sys/net.c
@@ -258,7 +258,7 @@ int send_remote_fd(int tunnel, int fd)
}
// return: remote fd (-1 if error)
-int recv_remote_fd(int tunnel)
+int recv_remote_fd(int tunnel, const char *tunnel_path)
{
struct msghdr msg;
struct iovec iov;
@@ -267,6 +267,7 @@ int recv_remote_fd(int tunnel)
int connfd = -1;
char ccmsg[CMSG_SPACE(sizeof(connfd))];
struct cmsghdr *cmsg;
+ struct sockaddr_un sun = {0};
iov.iov_base = &dummy;
iov.iov_len = 1;
@@ -274,6 +275,12 @@ int recv_remote_fd(int tunnel)
msg.msg_iovlen = 1;
msg.msg_control = ccmsg;
msg.msg_controllen = sizeof(ccmsg);
+ // XXX assigning msg_name here again is stupid,
+ // but seems like Linux need it (while FreeBSD does not...)
+ msg.msg_name = &sun;
+ msg.msg_namelen = sizeof(sun);
+ sun.sun_family = AF_UNIX;
+ strlcpy(sun.sun_path, tunnel_path, sizeof(sun.sun_path));
do {
// ignore EINTR
diff --git a/daemon/logind/loginc.c b/daemon/logind/loginc.c
index 21a4d434..ab60838e 100644
--- a/daemon/logind/loginc.c
+++ b/daemon/logind/loginc.c
@@ -32,7 +32,7 @@ int main(int argc, char *argv[])
const char *encoding = "";
login_data dat = {0};
- if ((xfd = recv_remote_fd(fd)) < 0)
+ if ((xfd = recv_remote_fd(fd, argv[1])) < 0)
{
fprintf(stderr, "recv_remote_fd error. abort.\r\n");
break;
diff --git a/daemon/logind/logind.c b/daemon/logind/logind.c
index bc513c27..934e8046 100644
--- a/daemon/logind/logind.c
+++ b/daemon/logind/logind.c
@@ -1025,6 +1025,7 @@ bind_port(int port)
snprintf(buf, sizeof(buf), "*:%d", port);
+ fprintf(stderr,"binding to port: %d...", port);
if ( (sfd = tobindex(buf, SOCKET_QLEN, _set_bind_opt, 1)) < 0 )
{
fprintf(stderr, "cannot bind to port: %d. abort.\r\n", port);
@@ -1035,7 +1036,7 @@ bind_port(int port)
event_set(pev_listen, sfd, EV_READ | EV_PERSIST, listen_cb, pev_listen);
event_add(pev_listen, NULL);
- fprintf(stderr,"bound to port: %d\r\n", port);
+ fprintf(stderr,"ok. \r\n");
return 0;
}
diff --git a/include/cmsys.h b/include/cmsys.h
index 6ae2119f..88506039 100644
--- a/include/cmsys.h
+++ b/include/cmsys.h
@@ -81,7 +81,7 @@ extern int toconnect(const char *addr);
extern int toread (int fd, void *buf, int len);
extern int towrite (int fd, const void *buf, int len);
extern int send_remote_fd(int tunnel, int fd);
-extern int recv_remote_fd(int tunnel);
+extern int recv_remote_fd(int tunnel, const char *tunnel_path);
/* sort.c */
extern int cmp_int(const void *a, const void *b);
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index d487eca3..c89a86c7 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1842,7 +1842,7 @@ tunnel_login(char *argv0, struct ProgramOption *option)
/* main loop */
while( 1 )
{
- csock = recv_remote_fd(tunnel);
+ csock = recv_remote_fd(tunnel, option->flag_tunnel_path);
// XXX use continue or return herer?
if (csock < 0)