#77, get password from env variable

This commit is contained in:
Erik Ekman 2009-09-19 08:09:12 +00:00
parent f229342782
commit dfd74623a6
4 changed files with 34 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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)
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);

View File

@ -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)
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;