1
0
mirror of https://github.com/yarrick/iodine.git synced 2024-11-22 13:06:06 +03:00
This commit is contained in:
Erik Ekman 2014-04-06 13:31:34 +02:00
commit eca80f769b
5 changed files with 18 additions and 15 deletions

View File

@ -230,8 +230,9 @@ do_chroot(char *newroot)
if (chroot(newroot) != 0 || chdir("/") != 0)
err(1, "%s", newroot);
seteuid(geteuid());
setuid(getuid());
if (seteuid(geteuid()) != 0 || setuid(getuid()) != 0) {
err(1, "set[e]uid()");
}
#else
warnx("chroot not available");
#endif

View File

@ -134,7 +134,9 @@ main(int argc, char **argv)
int lazymode;
int selecttimeout;
int hostname_maxlen;
#ifdef OPENBSD
int rtable = 0;
#endif
struct sockaddr_storage nameservaddr;
int nameservaddr_len;
int nameserv_family;
@ -208,9 +210,11 @@ main(int argc, char **argv)
case 'd':
device = optarg;
break;
#ifdef OPENBSD
case 'R':
rtable = atoi(optarg);
break;
#endif
case 'P':
strncpy(password, optarg, sizeof(password));
password[sizeof(password)-1] = 0;

View File

@ -1591,8 +1591,10 @@ tunnel_bind(int bind_fd, int dns_fd)
/* Get sockaddr from id */
fw_query_get(id, &query);
if (!query && debug >= 2) {
fprintf(stderr, "Lost sender of id %u, dropping reply\n", (id & 0xFFFF));
if (!query) {
if (debug >= 2) {
fprintf(stderr, "Lost sender of id %u, dropping reply\n", (id & 0xFFFF));
}
return 0;
}

View File

@ -115,9 +115,6 @@ readlong(char *packet, char **src, uint32_t *dst)
int
readdata(char *packet, char **src, char *dst, size_t len)
{
if (len < 0)
return 0;
memcpy(dst, *src, len);
(*src) += len;
@ -232,9 +229,6 @@ putlong(char **dst, uint32_t value)
int
putdata(char **dst, char *data, size_t len)
{
if (len < 0)
return 0;
memcpy(*dst, data, len);
(*dst) += len;

View File

@ -447,6 +447,7 @@ tun_setip(const char *ip, const char *other_ip, int netbits)
struct in_addr addr;
DWORD len;
#endif
const char *display_ip;
netmask = 0;
for (i = 0; i < netbits; i++) {
@ -460,15 +461,16 @@ tun_setip(const char *ip, const char *other_ip, int netbits)
return 1;
}
#ifndef WINDOWS32
# ifdef FREEBSD
display_ip = other_ip; /* FreeBSD wants other IP as second IP */
# else
display_ip = ip;
# endif
snprintf(cmdline, sizeof(cmdline),
IFCONFIGPATH "ifconfig %s %s %s netmask %s",
if_name,
ip,
#ifdef FREEBSD
other_ip, /* FreeBSD wants other IP as second IP */
#else
ip,
#endif
display_ip,
inet_ntoa(net));
fprintf(stderr, "Setting IP of %s to %s\n", if_name, ip);