MCPcopy Create free account
hub / github.com/OpenVPN/openvpn-gui / BuildFileList

Function BuildFileList

openvpn_config.c:375–437  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

373}
374
375void
376BuildFileList()
377{
378 static bool issue_warnings = true;
379 int recurse_depth = 20; /* maximum number of levels below config_dir to recurse into */
380 int flags = 0;
381 static int root_gp, system_gp, persistent_gp;
382
383 if (o.silent_connection)
384 {
385 issue_warnings = false;
386 }
387
388 /*
389 * If first time or no entries in the connection list reset groups and rescan
390 * to make a new list. Else we keep all current configs and
391 * rescan to add any new one's found.
392 */
393 if (!o.num_configs)
394 {
395 o.num_groups = 0;
396 flags |= FLAG_ADD_CONFIG_GROUPS;
397 root_gp = NewConfigGroup(L"ROOT", -1, flags); /* -1 indicates no parent */
398 persistent_gp = NewConfigGroup(L"Persistent Profiles", root_gp, flags);
399 system_gp = NewConfigGroup(L"System Profiles", root_gp, flags);
400 }
401 /* else these parent groups use their saved values */
402
403 if (&o.groups[persistent_gp] != PERSISTENT_ROOT_GROUP)
404 {
405 MsgToEventLog(EVENTLOG_ERROR_TYPE, L"%hs:%d Logic error", __func__, __LINE__);
406 return;
407 }
408
409 if (issue_warnings)
410 {
411 flags |= FLAG_WARN_DUPLICATES | FLAG_WARN_MAX_CONFIGS;
412 }
413
414 BuildFileList0(o.config_dir, recurse_depth, root_gp, flags);
415
416 if (!IsSamePath(o.global_config_dir, o.config_dir))
417 {
418 BuildFileList0(o.global_config_dir, recurse_depth, system_gp, flags);
419 }
420
421 if (o.service_state == service_connected && o.enable_persistent)
422 {
423 if (!IsSamePath(o.config_auto_dir, o.config_dir))
424 {
425 BuildFileList0(o.config_auto_dir, recurse_depth, persistent_gp, flags);
426 }
427 }
428
429 if (o.num_configs == 0 && issue_warnings)
430 {
431 ShowLocalizedMsg(IDS_NFO_NO_CONFIGS, o.config_dir, o.global_config_dir);
432 }

Callers 3

RecreatePopupMenusFunction · 0.85
_tWinMainFunction · 0.85
InitializeUIFunction · 0.85

Calls 6

NewConfigGroupFunction · 0.85
MsgToEventLogFunction · 0.85
BuildFileList0Function · 0.85
IsSamePathFunction · 0.85
ShowLocalizedMsgFunction · 0.85
ActivateConfigGroupsFunction · 0.85

Tested by

no test coverage detected