[network-manager-sstp/fix-auth] Fixing additional cases where connection-type could be NULL
- From: Eivind Næss <eivnaes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-sstp/fix-auth] Fixing additional cases where connection-type could be NULL
- Date: Thu, 15 Sep 2022 17:35:25 +0000 (UTC)
commit 41c692e2550d5ad9aceaddf590efead8f361f938
Author: Eivind Næss <eivnaes yahoo com>
Date: Thu Sep 15 10:35:11 2022 -0700
Fixing additional cases where connection-type could be NULL
Signed-off-by: Eivind Næss <eivnaes yahoo com>
auth-dialog/main.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index cb070ae..7bd0edd 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -192,8 +192,8 @@ get_passwords_required (GHashTable *data,
const char *ctype, *val;
char *prompt = NULL;
const char *const*iter;
- gboolean status;
- NMSettingSecretFlags flags;
+ gboolean status = FALSE;
+ NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_NONE;
*out_need_password = FALSE;
*out_need_certpass = FALSE;
@@ -215,10 +215,14 @@ get_passwords_required (GHashTable *data,
}
ctype = g_hash_table_lookup (data, NM_SSTP_KEY_CONNECTION_TYPE);
- g_return_val_if_fail (ctype != NULL, NULL);
-
+ /* Normal user password */
+ if (ctype == NULL || !strcmp(ctype, NM_SSTP_CONTYPE_PASSWORD)) {
+ status = nm_vpn_service_plugin_get_secret_flags (data, NM_SSTP_KEY_PASSWORD, &flags);
+ if (status && !(flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED))
+ *out_need_password = TRUE;
+ }
/* Certificate Key Password */
- if (!strcmp (ctype, NM_SSTP_CONTYPE_TLS)) {
+ else if (!strcmp(ctype, NM_SSTP_CONTYPE_TLS)) {
status = nm_vpn_service_plugin_get_secret_flags (data, NM_SSTP_KEY_TLS_USER_KEY_SECRET, &flags);
if (status) {
/* ... but only if private key is encrypted */
@@ -227,13 +231,7 @@ get_passwords_required (GHashTable *data,
nm_utils_file_is_private_key (val, out_need_certpass);
}
}
- /* Normal user password */
- } else if (!strcmp (ctype, NM_SSTP_CONTYPE_PASSWORD)) {
- status = nm_vpn_service_plugin_get_secret_flags (data, NM_SSTP_KEY_PASSWORD, &flags);
- if (status && !(flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED))
- *out_need_password = TRUE;
}
-
/* Proxy Password (but only if proxy is specified) */
val = g_hash_table_lookup (data, NM_SSTP_KEY_PROXY_SERVER);
if (val && val[0]) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]