mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-27 18:39:20 +02:00
Applied Open/Solaris patch from Albert Lee
This commit is contained in:
parent
f2596cef24
commit
30014e6433
|
@ -11,6 +11,7 @@ CHANGES:
|
||||||
Debian bug #477692 by Vincent Bernat, controlled by -s switch
|
Debian bug #477692 by Vincent Bernat, controlled by -s switch
|
||||||
- Applied a security patch from Andrew Griffiths, use setgroups() to
|
- Applied a security patch from Andrew Griffiths, use setgroups() to
|
||||||
limit the groups of the user
|
limit the groups of the user
|
||||||
|
- Applied a patch to make iodine work on (Open)Solaris, from Albert Lee
|
||||||
|
|
||||||
2007-11-30: 0.4.1 "Tea Online"
|
2007-11-30: 0.4.1 "Tea Online"
|
||||||
- Introduced encoding API
|
- Introduced encoding API
|
||||||
|
|
41
src/common.c
41
src/common.c
|
@ -1,4 +1,5 @@
|
||||||
/* Copyright (c) 2006-2007 Bjorn Andersson <flex@kryo.se>, Erik Ekman <yarrick@kryo.se>
|
/* Copyright (c) 2006-2007 Bjorn Andersson <flex@kryo.se>, Erik Ekman <yarrick@kryo.se>
|
||||||
|
* Copyright (c) 2007 Albert Lee <trisk@acm.jhu.edu>.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -21,6 +22,8 @@
|
||||||
#endif
|
#endif
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/param.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@ -29,10 +32,48 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
/* daemon(3) exists only in 4.4BSD or later, and in GNU libc */
|
||||||
|
#if !(defined(BSD) && (BSD >= 199306)) && !defined(__GLIBC__)
|
||||||
|
static int daemon(int nochdir, int noclose)
|
||||||
|
{
|
||||||
|
int fd, i;
|
||||||
|
|
||||||
|
switch (fork()) {
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
case -1:
|
||||||
|
return -1;
|
||||||
|
default:
|
||||||
|
_exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!nochdir) {
|
||||||
|
chdir("/");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setsid() < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!noclose) {
|
||||||
|
if (fd = open("/dev/null", O_RDWR) >= 0) {
|
||||||
|
for (i = 0; i < 3; i++) {
|
||||||
|
dup2(fd, i);
|
||||||
|
}
|
||||||
|
if (fd > 2) {
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
open_dns(int localport, in_addr_t listen_ip)
|
open_dns(int localport, in_addr_t listen_ip)
|
||||||
{
|
{
|
||||||
|
|
13
src/iodine.c
13
src/iodine.c
|
@ -23,6 +23,7 @@
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -77,6 +78,10 @@ static struct encoder *dataenc;
|
||||||
/* result of case preservation check done after login */
|
/* result of case preservation check done after login */
|
||||||
static int case_preserved;
|
static int case_preserved;
|
||||||
|
|
||||||
|
#if !defined(BSD) && !defined(__GLIBC__)
|
||||||
|
static char *__progname;
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sighandler(int sig)
|
sighandler(int sig)
|
||||||
{
|
{
|
||||||
|
@ -634,6 +639,14 @@ main(int argc, char **argv)
|
||||||
b32 = get_base32_encoder();
|
b32 = get_base32_encoder();
|
||||||
dataenc = get_base32_encoder();
|
dataenc = get_base32_encoder();
|
||||||
|
|
||||||
|
#if !defined(BSD) && !defined(__GLIBC__)
|
||||||
|
__progname = strrchr(argv[0], '/');
|
||||||
|
if (__progname == NULL)
|
||||||
|
__progname = argv[0];
|
||||||
|
else
|
||||||
|
__progname++;
|
||||||
|
#endif
|
||||||
|
|
||||||
while ((choice = getopt(argc, argv, "vfhu:t:d:P:")) != -1) {
|
while ((choice = getopt(argc, argv, "vfhu:t:d:P:")) != -1) {
|
||||||
switch(choice) {
|
switch(choice) {
|
||||||
case 'v':
|
case 'v':
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -51,6 +52,10 @@ static struct encoder *b32;
|
||||||
static int my_mtu;
|
static int my_mtu;
|
||||||
static in_addr_t my_ip;
|
static in_addr_t my_ip;
|
||||||
|
|
||||||
|
#if !defined(BSD) && !defined(__GLIBC__)
|
||||||
|
static char *__progname;
|
||||||
|
#endif
|
||||||
|
|
||||||
static int read_dns(int, struct query *, char *, int);
|
static int read_dns(int, struct query *, char *, int);
|
||||||
static void write_dns(int, struct query *, char *, int);
|
static void write_dns(int, struct query *, char *, int);
|
||||||
|
|
||||||
|
@ -462,6 +467,14 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
b32 = get_base32_encoder();
|
b32 = get_base32_encoder();
|
||||||
|
|
||||||
|
#if !defined(BSD) && !defined(__GLIBC__)
|
||||||
|
__progname = strrchr(argv[0], '/');
|
||||||
|
if (__progname == NULL)
|
||||||
|
__progname = argv[0];
|
||||||
|
else
|
||||||
|
__progname++;
|
||||||
|
#endif
|
||||||
|
|
||||||
memset(password, 0, sizeof(password));
|
memset(password, 0, sizeof(password));
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue