ii

git clone https://orangeshoelaces.net/git/ii.git

c68beccf597984396c7ef22dd5b1a8eed4ab69a1

Author: Nico Golde on 06/16/2012

Committer: Nico Golde on 06/16/2012

-k now points to an environment variable containing the password

Stats

CHANGES | 5 ++++
ii.1    | 9 ++++----
ii.c    | 2 +-
3 files changed, 10 insertions(+), 6 deletions(-)

Patch

diff --git a/CHANGES b/CHANGES
index 7a3238c..d18eca2 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+1.7 (20XX-XX-XX)
+    - -k now specifies an environment variable that contains the
+      server key. This behaviour has been changed in order to not
+      expose the password in the process list.
+
 1.6 (2011-01-31):
     - fix regression introduced for handling unknown commands
 
diff --git a/ii.1 b/ii.1
index 9b3216e..dd1f6e3 100644
--- a/ii.1
+++ b/ii.1
@@ -26,7 +26,7 @@ and ii creates a new channel directory with in and out file.
 .RB [ \-p
 .IR port ]
 .RB [ \-k
-.IR password ]
+.IR environment variable ]
 .RB [ \-i
 .IR prefix ]
 .RB [ \-n
@@ -42,10 +42,9 @@ lets you override the default servername (irc.freenode.net)
 .BI \-p " port"
 lets you override the default port (6667)
 .TP
-.BI \-k " password"
-lets you use a password to authenticate your nick on the server
-(be aware of the problem that this is visible in the process list, if you
-don't want this use a query to submit your password)
+.BI \-k " environment variable"
+lets you specify an environment variable that contains your IRC password, e.g. IIPASS="foobar" ii -k FOOBAR.
+This is done in order to prevent other users from eavesdropping the server password via the process list.
 .TP
 .BI \-i " prefix"
 lets you override the default irc path (~/irc)
diff --git a/ii.c b/ii.c
index 056bfbc..a2acf88 100644
--- a/ii.c
+++ b/ii.c
@@ -477,7 +477,7 @@ int main(int argc, char *argv[]) {
 			case 's': host = argv[++i]; break;
 			case 'p': port = strtol(argv[++i], NULL, 10); break;
 			case 'n': snprintf(nick,sizeof(nick),"%s", argv[++i]); break;
-			case 'k': key = argv[++i]; break;
+			case 'k': key = getenv(argv[++i]); break;
 			case 'f': fullname = argv[++i]; break;
 			default: usage(); break;
 		}