mirror of https://github.com/OpenVPN/openvpn-gui
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
parent
eb52950f7a
commit
10f34584ea
13
main.c
13
main.c
|
@ -79,21 +79,10 @@ static int
|
||||||
VerifyAutoConnections()
|
VerifyAutoConnections()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
BOOL match;
|
|
||||||
|
|
||||||
for (i = 0; i < MAX_CONFIGS && o.auto_connect[i] != 0; i++)
|
for (i = 0; i < MAX_CONFIGS && o.auto_connect[i] != 0; i++)
|
||||||
{
|
{
|
||||||
int j;
|
if (GetConnByName(o.auto_connect[i]) == NULL)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
/* autostart config not found */
|
/* autostart config not found */
|
||||||
ShowLocalizedMsg(IDS_ERR_AUTOSTART_CONF, o.auto_connect[i]);
|
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 */
|
/* Check if connection should be autostarted */
|
||||||
for (i = 0; i < MAX_CONFIGS && o.auto_connect[i]; ++i)
|
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;
|
c->auto_connect = true;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue