diff --git a/auth-dialog/main.c b/auth-dialog/main.c index a333aeb5bc100d1da970b05502cee515f4d70bde..3eeb4c3eea59607e71e360e7c1e6fbeca07a4e1c 100644 --- a/auth-dialog/main.c +++ b/auth-dialog/main.c @@ -1223,6 +1223,7 @@ static int get_config (auth_ui_data *ui_data, char *proxy; char *xmlconfig; char *hostname; + char localname[HOST_NAME_MAX + 1]; char *csd; #if OPENCONNECT_CHECK_VER(5,8) char *mcakey, *mcacert, *mca_key_pass; @@ -1300,6 +1301,15 @@ static int get_config (auth_ui_data *ui_data, openconnect_setup_csd(vpninfo, getuid(), 1, OC3DUP (csd_wrapper)); } + /* GlobalProtect uniquely identifies connections based in part + on the hostname. Without this, multiple connections to the same + gateway will clobber each other. */ + if (gethostname(localname, sizeof(localname)) == 0) { + localname[HOST_NAME_MAX] = '\0'; + openconnect_set_localname(vpninfo, localname); + } else + g_warning("Failed to get hostname: %s\n", strerror(errno)); + reported_os = g_hash_table_lookup (options, NM_OPENCONNECT_KEY_REPORTED_OS); if (reported_os && reported_os[0]) openconnect_set_reported_os(vpninfo, reported_os);