@ -37,6 +37,7 @@
# include "main.h"
# include "misc.h"
# include "main.h"
# include "openvpn_config.h"
# include "openvpn-gui-res.h"
/*
@ -641,19 +642,25 @@ ImportConfigFile(const TCHAR* source)
_wsplitpath ( source , NULL , NULL , fileName , ext ) ;
/* check if the source points to the config_dir */
if ( wcsn cmp( source , o . global_config_dir , wcslen ( o . global_config_dir ) ) = = 0
| | wcsn cmp( source , o . config_dir , wcslen ( o . config_dir ) ) = = 0 )
if ( wcsn i cmp( source , o . global_config_dir , wcslen ( o . global_config_dir ) ) = = 0
| | wcsn i cmp( source , o . config_dir , wcslen ( o . config_dir ) ) = = 0 )
{
ShowLocalizedMsg ( IDS_ERR_IMPORT_SOURCE , source ) ;
return ;
}
/* Ensure the source exists and is readable */
if ( ! CheckFileAccess ( source , GENERIC_READ ) )
{
ShowLocalizedMsg ( IDS_ERR_IMPORT_ACCESS , source ) ;
return ;
}
WCHAR destination [ MAX_PATH + 1 ] ;
bool no_overwrite = TRUE ;
/* profile name must be unique: check whether a config by same name exists */
connection_t * c = GetConnByName ( fileName ) ;
if ( c & & wcsn cmp( c - > config_dir , o . config_dir , wcslen ( o . config_dir ) ) = = 0 )
if ( c & & wcsn i cmp( c - > config_dir , o . config_dir , wcslen ( o . config_dir ) ) = = 0 )
{
/* Ask the user whether to replace the profile or not. */
if ( ShowLocalizedMsgEx ( MB_YESNO , NULL , _T ( PACKAGE_NAME ) , IDS_NFO_IMPORT_OVERWRITE , fileName ) = = IDNO )
@ -686,4 +693,6 @@ ImportConfigFile(const TCHAR* source)
}
ShowLocalizedMsg ( IDS_NFO_IMPORT_SUCCESS ) ;
/* rescan file list after import */
BuildFileList ( ) ;
}