Fix broken support for case-sensitive account names

Don't lower account name before calling accounts_get_account().
Only lower if there is no account with the given name and the name is
interpreted as a jid.
Updated unittests to test this behaviour.

Fixes #725

.
This commit is contained in:
Philip Flohr
2019-02-22 11:07:19 +01:00
parent 6034b833be
commit 5b7f9dffbc
4 changed files with 35 additions and 13 deletions

View File

@@ -386,12 +386,11 @@ cmd_connect(ProfWin *window, const char *const command, gchar **args)
}
}
char *lower = g_utf8_strdown(user, -1);
char *jid;
g_free(def);
// connect with account
ProfAccount *account = accounts_get_account(lower);
ProfAccount *account = accounts_get_account(user);
if (account) {
// override account options with connect options
if (altdomain != NULL)
@@ -414,7 +413,7 @@ cmd_connect(ProfWin *window, const char *const command, gchar **args)
account->password = NULL;
} else {
cons_show("Error evaluating password, see logs for details.");
g_free(lower);
g_free(user);
account_free(account);
return TRUE;
}
@@ -432,7 +431,7 @@ cmd_connect(ProfWin *window, const char *const command, gchar **args)
// connect with JID
} else {
jid = strdup(lower);
jid = g_utf8_strdown(user, -1);
char *passwd = ui_ask_password();
conn_status = cl_ev_connect_jid(jid, passwd, altdomain, port, tls_policy);
free(passwd);
@@ -444,7 +443,6 @@ cmd_connect(ProfWin *window, const char *const command, gchar **args)
}
options_destroy(options);
g_free(lower);
free(jid);
return TRUE;