--- ansh/src/ansh3.c 2011/10/14 07:47:21 1.1.1.1.2.5 +++ ansh/src/ansh3.c 2011/10/14 09:04:04 1.1.1.1.2.6 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ - * $Id: ansh3.c,v 1.1.1.1.2.5 2011/10/14 07:47:21 misho Exp $ + * $Id: ansh3.c,v 1.1.1.1.2.6 2011/10/14 09:04:04 misho Exp $ * ************************************************************************* The ELWIX and AITNET software is distributed under the following @@ -50,6 +50,7 @@ SUCH DAMAGE. intptr_t Kill; int Timeout, Verbose; u_int Crypted; +char Key[STRSIZ]; extern char compiled[], compiledby[], compilehost[]; @@ -61,6 +62,7 @@ Usage() " Syntax: ansh [options] \n\n" "\t-i \tService ID (default is 42)\n" "\t-t \tClient session timeout (default is 0 sec)\n" + "\t-k \tService cipher key\n" "\t-u\t\tSwitch to unencrypted traffic between hosts\n" "\t-v\t\tVerbose (more -v, more verbosity ...)\n" "\t-h\t\tThis help screen!\n" @@ -83,13 +85,18 @@ main(int argc, char **argv) Crypted = (u_int) random() % UINT_MAX; } while (!Crypted); - while ((ch = getopt(argc, argv, "hvui:t:")) != -1) + strlcpy(Key, DEFAULT_KEY, sizeof Key); + + while ((ch = getopt(argc, argv, "hvui:t:k:")) != -1) switch (ch) { case 't': Timeout = abs(strtol(optarg, NULL, 0)); break; case 'i': id = strtol(optarg, NULL, 0); + break; + case 'k': + strlcpy(Key, optarg, sizeof Key); break; case 'u': Crypted ^= Crypted;