mirror of
https://github.com/yarrick/iodine.git
synced 2024-12-22 05:13:32 +02:00
#77, get password from env variable
This commit is contained in:
parent
8074696a14
commit
01e558022e
4 changed files with 34 additions and 4 deletions
|
@ -21,6 +21,8 @@ CHANGES:
|
|||
- Do not overwrite users CC/CFLAGS/LDFLAGS, only add to them.
|
||||
- Added -F option to write pidfile, based on patch from
|
||||
misc at mandriva.org. Fixes #70.
|
||||
- Allow password to be set via environment variable, fixes #77.
|
||||
Based on patch by logix.
|
||||
|
||||
2009-06-01: 0.5.2 "WifiFree"
|
||||
- Fixed client segfault on OS X, #57
|
||||
|
|
16
man/iodine.8
16
man/iodine.8
|
@ -254,6 +254,22 @@ dig \-t NS foo123.tunnel.com
|
|||
.B MTU issues:
|
||||
These issues should be solved now, with automatic fragmentation of downstream
|
||||
packets. There should be no need to set the MTU explicitly on the server.
|
||||
.SH ENVIRONMENT
|
||||
.SS IODINE_PASS
|
||||
If the environment variable
|
||||
.B IODINE_PASS
|
||||
is set, iodine will use the value it is set to as password instead of asking
|
||||
for one. The
|
||||
.B -P
|
||||
option still has preference.
|
||||
.SS IODINED_PASS
|
||||
If the environment variable
|
||||
.B IODINED_PASS
|
||||
is set, iodined will use the value it is set to as password instead of asking
|
||||
for one. The
|
||||
.B -P
|
||||
option still has preference.
|
||||
.El
|
||||
.SH BUGS
|
||||
File bugs at http://dev.kryo.se/iodine/
|
||||
.SH AUTHORS
|
||||
|
|
10
src/iodine.c
10
src/iodine.c
|
@ -48,6 +48,8 @@ WSADATA wsa_data;
|
|||
static char *__progname;
|
||||
#endif
|
||||
|
||||
#define PASSWORD_ENV_VAR "IODINE_PASS"
|
||||
|
||||
static void
|
||||
sighandler(int sig)
|
||||
{
|
||||
|
@ -260,8 +262,12 @@ main(int argc, char **argv)
|
|||
#endif
|
||||
}
|
||||
|
||||
if (strlen(password) == 0)
|
||||
read_password(password, sizeof(password));
|
||||
if (strlen(password) == 0) {
|
||||
if (NULL != getenv(PASSWORD_ENV_VAR))
|
||||
snprintf(password, sizeof(password), "%s", getenv(PASSWORD_ENV_VAR));
|
||||
else
|
||||
read_password(password, sizeof(password));
|
||||
}
|
||||
|
||||
client_set_password(password);
|
||||
|
||||
|
|
|
@ -65,6 +65,8 @@ WORD req_version = MAKEWORD(2, 2);
|
|||
WSADATA wsa_data;
|
||||
#endif
|
||||
|
||||
#define PASSWORD_ENV_VAR "IODINED_PASS"
|
||||
|
||||
static int running = 1;
|
||||
static char *topdomain;
|
||||
static char password[33];
|
||||
|
@ -1344,8 +1346,12 @@ main(int argc, char **argv)
|
|||
usage();
|
||||
}
|
||||
|
||||
if (strlen(password) == 0)
|
||||
read_password(password, sizeof(password));
|
||||
if (strlen(password) == 0) {
|
||||
if (NULL != getenv(PASSWORD_ENV_VAR))
|
||||
snprintf(password, sizeof(password), "%s", getenv(PASSWORD_ENV_VAR));
|
||||
else
|
||||
read_password(password, sizeof(password));
|
||||
}
|
||||
|
||||
if ((tun_fd = open_tun(device)) == -1) {
|
||||
retval = 1;
|
||||
|
|
Loading…
Reference in a new issue