mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-23 18:15:13 +00:00
Merge branch 'master' of https://github.com/jedisct1/iodine
This commit is contained in:
commit
eca80f769b
@ -230,8 +230,9 @@ do_chroot(char *newroot)
|
|||||||
if (chroot(newroot) != 0 || chdir("/") != 0)
|
if (chroot(newroot) != 0 || chdir("/") != 0)
|
||||||
err(1, "%s", newroot);
|
err(1, "%s", newroot);
|
||||||
|
|
||||||
seteuid(geteuid());
|
if (seteuid(geteuid()) != 0 || setuid(getuid()) != 0) {
|
||||||
setuid(getuid());
|
err(1, "set[e]uid()");
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
warnx("chroot not available");
|
warnx("chroot not available");
|
||||||
#endif
|
#endif
|
||||||
|
@ -134,7 +134,9 @@ main(int argc, char **argv)
|
|||||||
int lazymode;
|
int lazymode;
|
||||||
int selecttimeout;
|
int selecttimeout;
|
||||||
int hostname_maxlen;
|
int hostname_maxlen;
|
||||||
|
#ifdef OPENBSD
|
||||||
int rtable = 0;
|
int rtable = 0;
|
||||||
|
#endif
|
||||||
struct sockaddr_storage nameservaddr;
|
struct sockaddr_storage nameservaddr;
|
||||||
int nameservaddr_len;
|
int nameservaddr_len;
|
||||||
int nameserv_family;
|
int nameserv_family;
|
||||||
@ -208,9 +210,11 @@ main(int argc, char **argv)
|
|||||||
case 'd':
|
case 'd':
|
||||||
device = optarg;
|
device = optarg;
|
||||||
break;
|
break;
|
||||||
|
#ifdef OPENBSD
|
||||||
case 'R':
|
case 'R':
|
||||||
rtable = atoi(optarg);
|
rtable = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case 'P':
|
case 'P':
|
||||||
strncpy(password, optarg, sizeof(password));
|
strncpy(password, optarg, sizeof(password));
|
||||||
password[sizeof(password)-1] = 0;
|
password[sizeof(password)-1] = 0;
|
||||||
|
@ -1591,8 +1591,10 @@ tunnel_bind(int bind_fd, int dns_fd)
|
|||||||
|
|
||||||
/* Get sockaddr from id */
|
/* Get sockaddr from id */
|
||||||
fw_query_get(id, &query);
|
fw_query_get(id, &query);
|
||||||
if (!query && debug >= 2) {
|
if (!query) {
|
||||||
fprintf(stderr, "Lost sender of id %u, dropping reply\n", (id & 0xFFFF));
|
if (debug >= 2) {
|
||||||
|
fprintf(stderr, "Lost sender of id %u, dropping reply\n", (id & 0xFFFF));
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,9 +115,6 @@ readlong(char *packet, char **src, uint32_t *dst)
|
|||||||
int
|
int
|
||||||
readdata(char *packet, char **src, char *dst, size_t len)
|
readdata(char *packet, char **src, char *dst, size_t len)
|
||||||
{
|
{
|
||||||
if (len < 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
memcpy(dst, *src, len);
|
memcpy(dst, *src, len);
|
||||||
|
|
||||||
(*src) += len;
|
(*src) += len;
|
||||||
@ -232,9 +229,6 @@ putlong(char **dst, uint32_t value)
|
|||||||
int
|
int
|
||||||
putdata(char **dst, char *data, size_t len)
|
putdata(char **dst, char *data, size_t len)
|
||||||
{
|
{
|
||||||
if (len < 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
memcpy(*dst, data, len);
|
memcpy(*dst, data, len);
|
||||||
|
|
||||||
(*dst) += len;
|
(*dst) += len;
|
||||||
|
12
src/tun.c
12
src/tun.c
@ -447,6 +447,7 @@ tun_setip(const char *ip, const char *other_ip, int netbits)
|
|||||||
struct in_addr addr;
|
struct in_addr addr;
|
||||||
DWORD len;
|
DWORD len;
|
||||||
#endif
|
#endif
|
||||||
|
const char *display_ip;
|
||||||
|
|
||||||
netmask = 0;
|
netmask = 0;
|
||||||
for (i = 0; i < netbits; i++) {
|
for (i = 0; i < netbits; i++) {
|
||||||
@ -460,15 +461,16 @@ tun_setip(const char *ip, const char *other_ip, int netbits)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#ifndef WINDOWS32
|
#ifndef WINDOWS32
|
||||||
|
# ifdef FREEBSD
|
||||||
|
display_ip = other_ip; /* FreeBSD wants other IP as second IP */
|
||||||
|
# else
|
||||||
|
display_ip = ip;
|
||||||
|
# endif
|
||||||
snprintf(cmdline, sizeof(cmdline),
|
snprintf(cmdline, sizeof(cmdline),
|
||||||
IFCONFIGPATH "ifconfig %s %s %s netmask %s",
|
IFCONFIGPATH "ifconfig %s %s %s netmask %s",
|
||||||
if_name,
|
if_name,
|
||||||
ip,
|
ip,
|
||||||
#ifdef FREEBSD
|
display_ip,
|
||||||
other_ip, /* FreeBSD wants other IP as second IP */
|
|
||||||
#else
|
|
||||||
ip,
|
|
||||||
#endif
|
|
||||||
inet_ntoa(net));
|
inet_ntoa(net));
|
||||||
|
|
||||||
fprintf(stderr, "Setting IP of %s to %s\n", if_name, ip);
|
fprintf(stderr, "Setting IP of %s to %s\n", if_name, ip);
|
||||||
|
Loading…
Reference in New Issue
Block a user