In '--connect profile-name' make the extension (.ovpn) optional

Treat '--connect foo.ovpn' and '--connect foo' as the same. This matches
with the behaviour of '--command connect foo'.

Note: the argument is first compared against config file names and then
against config names.

Based on comment by larson0815 here:
https://github.com/selvanair/openvpn-gui/issues/5

Signed-off-by: Selva Nair <selva.nair@gmail.com>
pull/188/head
Selva Nair 8 years ago
parent eb52950f7a
commit 10f34584ea

@ -79,21 +79,10 @@ static int
VerifyAutoConnections()
{
int i;
BOOL match;
for (i = 0; i < MAX_CONFIGS && o.auto_connect[i] != 0; i++)
{
int j;
match = FALSE;
for (j = 0; j < MAX_CONFIGS; j++)
{
if (_tcsicmp(o.conn[j].config_file, o.auto_connect[i]) == 0)
{
match = TRUE;
break;
}
}
if (match == FALSE)
if (GetConnByName(o.auto_connect[i]) == NULL)
{
/* autostart config not found */
ShowLocalizedMsg(IDS_ERR_AUTOSTART_CONF, o.auto_connect[i]);

@ -114,7 +114,8 @@ AddConfigFileToList(int config, const TCHAR *filename, const TCHAR *config_dir)
/* Check if connection should be autostarted */
for (i = 0; i < MAX_CONFIGS && o.auto_connect[i]; ++i)
{
if (_tcsicmp(c->config_file, o.auto_connect[i]) == 0)
if (_tcsicmp(c->config_file, o.auto_connect[i]) == 0
|| _tcsicmp(c->config_name, o.auto_connect[i]) == 0)
{
c->auto_connect = true;
break;

Loading…
Cancel
Save