diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/command/commands.c | 6 | ||||
-rw-r--r-- | src/config/accounts.c | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/command/commands.c b/src/command/commands.c index eed22ed5..1680c27b 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -130,7 +130,7 @@ cmd_connect(gchar **args, struct cmd_help_t help) ProfAccount *account = accounts_get_account(lower); if (account != NULL) { jid = account_create_full_jid(account); - if (account->password == NULL) { + if (account->password == NULL && account->eval_password == NULL) { account->password = ui_ask_password(); } cons_show("Connecting with account %s as %s", account->name, jid); @@ -440,8 +440,8 @@ cmd_account(gchar **args, struct cmd_help_t help) cons_show("Removed password for account %s", account_name); cons_show(""); } else if (strcmp(property, "eval_password") == 0) { - accounts_clear_password(account_name); - cons_show("Removed password for account %s", account_name); + accounts_clear_eval_password(account_name); + cons_show("Removed eval password for account %s", account_name); cons_show(""); } else if (strcmp(property, "server") == 0) { accounts_clear_server(account_name); diff --git a/src/config/accounts.c b/src/config/accounts.c index 0ca93ba6..2c8d5cb5 100644 --- a/src/config/accounts.c +++ b/src/config/accounts.c @@ -227,8 +227,10 @@ accounts_get_account(const char * const name) gchar *password = g_key_file_get_string(accounts, name, "password", NULL); gchar *eval_password = g_key_file_get_string(accounts, name, "eval_password", NULL); + // Evaluate as shell command to retrieve password if (eval_password != NULL) { FILE *stream = popen(eval_password, "r"); + // Limit to 100 bytes to prevent overflows in the case of a poorly chosen command password = g_malloc(100); fgets(password, 100, stream); } |