mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-26 10:09:19 +02:00
nasty hack hides password on commandline
This commit is contained in:
parent
13df3ca856
commit
49ad0dbc86
10
src/common.c
10
src/common.c
|
@ -71,13 +71,11 @@ close_dns(int fd)
|
||||||
void
|
void
|
||||||
do_chroot(char *newroot)
|
do_chroot(char *newroot)
|
||||||
{
|
{
|
||||||
if (newroot) {
|
if (chroot(newroot) != 0 || chdir("/") != 0)
|
||||||
if (chroot(newroot) != 0 || chdir("/") != 0)
|
err(1, "%s", newroot);
|
||||||
err(1, "%s", newroot);
|
|
||||||
|
|
||||||
seteuid(geteuid());
|
seteuid(geteuid());
|
||||||
setuid(getuid());
|
setuid(getuid());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
26
src/iodine.c
26
src/iodine.c
|
@ -681,6 +681,9 @@ main(int argc, char **argv)
|
||||||
case 'P':
|
case 'P':
|
||||||
strncpy(password, optarg, 32);
|
strncpy(password, optarg, 32);
|
||||||
password[32] = 0;
|
password[32] = 0;
|
||||||
|
|
||||||
|
/* XXX: find better way of cleaning up ps(1) */
|
||||||
|
memset(optarg, 0, strlen(optarg));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
|
@ -689,7 +692,7 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (geteuid() != 0) {
|
if (geteuid() != 0) {
|
||||||
printf("Run as root and you'll be happy.\n");
|
warnx("Run as root and you'll be happy.\n");
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -713,14 +716,13 @@ main(int argc, char **argv)
|
||||||
set_nameserver(nameserv_addr);
|
set_nameserver(nameserv_addr);
|
||||||
|
|
||||||
if (strlen(topdomain) > 128 || topdomain[0] == '.') {
|
if (strlen(topdomain) > 128 || topdomain[0] == '.') {
|
||||||
printf("Use a topdomain max 128 chars long. Do not start it with a dot.\n");
|
warnx("Use a topdomain max 128 chars long. Do not start it with a dot.\n");
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(username) {
|
if (username != NULL) {
|
||||||
pw = getpwnam(username);
|
if ((pw = getpwnam(username)) == NULL) {
|
||||||
if (!pw) {
|
warnx("User %s does not exist!\n", username);
|
||||||
printf("User %s does not exist!\n", username);
|
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -739,20 +741,20 @@ main(int argc, char **argv)
|
||||||
if(handshake(dns_fd))
|
if(handshake(dns_fd))
|
||||||
goto cleanup2;
|
goto cleanup2;
|
||||||
|
|
||||||
printf("Sending queries for %s to %s\n", topdomain, nameserv_addr);
|
printf("Sending queries for %s to %s\n", argv[1], argv[0]);
|
||||||
|
|
||||||
do_chroot(newroot);
|
if (newroot != NULL)
|
||||||
|
do_chroot(newroot);
|
||||||
|
|
||||||
if (username) {
|
if (username != NULL) {
|
||||||
if (setgid(pw->pw_gid) < 0 || setuid(pw->pw_uid) < 0) {
|
if (setgid(pw->pw_gid) < 0 || setuid(pw->pw_uid) < 0) {
|
||||||
printf("Could not switch to user %s!\n", username);
|
warnx("Could not switch to user %s!\n", username);
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!foreground) {
|
if (foreground == 0)
|
||||||
do_detach();
|
do_detach();
|
||||||
}
|
|
||||||
|
|
||||||
tunnel(tun_fd, dns_fd);
|
tunnel(tun_fd, dns_fd);
|
||||||
|
|
||||||
|
|
|
@ -573,7 +573,8 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
printf("Listening to dns for domain %s\n", argv[1]);
|
printf("Listening to dns for domain %s\n", argv[1]);
|
||||||
|
|
||||||
do_chroot(newroot);
|
if (newroot != NULL)
|
||||||
|
do_chroot(newroot);
|
||||||
|
|
||||||
signal(SIGINT, sigint);
|
signal(SIGINT, sigint);
|
||||||
if (username) {
|
if (username) {
|
||||||
|
|
Loading…
Reference in New Issue