1
0
mirror of https://github.com/yarrick/iodine.git synced 2024-11-25 14:36:05 +03:00

#77, get password from env variable

This commit is contained in:
Erik Ekman 2009-09-19 08:09:12 +00:00 committed by Erik Ekman
parent 8074696a14
commit 01e558022e
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. - Do not overwrite users CC/CFLAGS/LDFLAGS, only add to them.
- Added -F option to write pidfile, based on patch from - Added -F option to write pidfile, based on patch from
misc at mandriva.org. Fixes #70. 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" 2009-06-01: 0.5.2 "WifiFree"
- Fixed client segfault on OS X, #57 - Fixed client segfault on OS X, #57

View File

@ -254,6 +254,22 @@ dig \-t NS foo123.tunnel.com
.B MTU issues: .B MTU issues:
These issues should be solved now, with automatic fragmentation of downstream 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. 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 .SH BUGS
File bugs at http://dev.kryo.se/iodine/ File bugs at http://dev.kryo.se/iodine/
.SH AUTHORS .SH AUTHORS

View File

@ -48,6 +48,8 @@ WSADATA wsa_data;
static char *__progname; static char *__progname;
#endif #endif
#define PASSWORD_ENV_VAR "IODINE_PASS"
static void static void
sighandler(int sig) sighandler(int sig)
{ {
@ -260,8 +262,12 @@ main(int argc, char **argv)
#endif #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)); read_password(password, sizeof(password));
}
client_set_password(password); client_set_password(password);

View File

@ -65,6 +65,8 @@ WORD req_version = MAKEWORD(2, 2);
WSADATA wsa_data; WSADATA wsa_data;
#endif #endif
#define PASSWORD_ENV_VAR "IODINED_PASS"
static int running = 1; static int running = 1;
static char *topdomain; static char *topdomain;
static char password[33]; static char password[33];
@ -1344,8 +1346,12 @@ main(int argc, char **argv)
usage(); 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)); read_password(password, sizeof(password));
}
if ((tun_fd = open_tun(device)) == -1) { if ((tun_fd = open_tun(device)) == -1) {
retval = 1; retval = 1;