1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00
This commit is contained in:
Peter Vilim 2015-01-07 21:07:32 -06:00
commit 887cc1f419
2 changed files with 5 additions and 3 deletions

View File

@ -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);

View File

@ -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);
}