# HG changeset patch # User Matt Johnston # Date 1174113011 0 # Node ID fdf06a5a54e4f972a2455d696e8db866faa91fe6 # Parent 91939c8c2572e848be880db60a888f5fdca292ed Allow reading dbclient password from an environment var diff -r 91939c8c2572 -r fdf06a5a54e4 cli-auth.c --- a/cli-auth.c Sun Feb 25 09:48:13 2007 +0000 +++ b/cli-auth.c Sat Mar 17 06:30:11 2007 +0000 @@ -284,6 +284,15 @@ char* getpass_or_cancel(char* prompt) { char* password = NULL; + +#ifdef DROPBEAR_PASSWORD_ENV + /* Password provided in an environment var */ + password = getenv(DROPBEAR_PASSWORD_ENV); + if (password) + { + return password; + } +#endif password = getpass(prompt); diff -r 91939c8c2572 -r fdf06a5a54e4 options.h --- a/options.h Sun Feb 25 09:48:13 2007 +0000 +++ b/options.h Sat Mar 17 06:30:11 2007 +0000 @@ -140,6 +140,14 @@ #define ENABLE_CLI_PUBKEY_AUTH #define ENABLE_CLI_INTERACT_AUTH +/* This variable can be used to set a password for client + * authentication on the commandline. Beware of platforms + * that don't protect environment variables of processes etc. Also + * note that it will be provided for all "hidden" client-interactive + * style prompts - if you want something more sophisticated, use + * SSH_ASKPASS instead. Comment out this var to remove this functionality.*/ +#define DROPBEAR_PASSWORD_ENV "DROPBEAR_PASSWORD" + /* Define this (as well as ENABLE_CLI_PASSWORD_AUTH) to allow the use of * a helper program for the ssh client. The helper program should be * specified in the SSH_ASKPASS environment variable, and dbclient