mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-01 07:04:56 +00:00
libnmc: don't strip prefix tags from secret names
The daemon is now capable of understanding and removing these prefix tags by itself. It is better than this is not a responsibility of the secret agent because it requires changes in all secret agents to work properly (see https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1536). If the secret agent knows what these prefix tags are, it can remove them only in the text that is displayed in the UI, but maintaining the original string as the secret name that is returned to the daemon. Secret agents that doesn't know what these prefix tags are won't do anything with them, and they will also return the same string as secret name, as expected. The only drawback is that they might display the full string to the user, which is not a nice UX but it will at least work. Also, allow to translate the secret name for the UI in libnmc.
This commit is contained in:
parent
759a11425a
commit
442d7d7d73
|
@ -431,7 +431,7 @@ add_vpn_secrets(RequestData *request, GPtrArray *secrets, char **msg)
|
|||
const NmcVpnPasswordName *p;
|
||||
const char *vpn_msg = NULL;
|
||||
char **iter;
|
||||
char *secret_name;
|
||||
char *ui_name;
|
||||
bool is_challenge = FALSE;
|
||||
bool force_echo;
|
||||
|
||||
|
@ -442,19 +442,19 @@ add_vpn_secrets(RequestData *request, GPtrArray *secrets, char **msg)
|
|||
vpn_msg = &(*iter)[NM_STRLEN(NM_SECRET_TAG_VPN_MSG)];
|
||||
} else {
|
||||
if (NM_STR_HAS_PREFIX(*iter, NM_SECRET_TAG_DYNAMIC_CHALLENGE)) {
|
||||
secret_name = &(*iter)[NM_STRLEN(NM_SECRET_TAG_DYNAMIC_CHALLENGE)];
|
||||
ui_name = &(*iter)[NM_STRLEN(NM_SECRET_TAG_DYNAMIC_CHALLENGE)];
|
||||
is_challenge = TRUE;
|
||||
force_echo = FALSE;
|
||||
} else if (NM_STR_HAS_PREFIX(*iter, NM_SECRET_TAG_DYNAMIC_CHALLENGE_ECHO)) {
|
||||
secret_name = &(*iter)[NM_STRLEN(NM_SECRET_TAG_DYNAMIC_CHALLENGE_ECHO)];
|
||||
ui_name = &(*iter)[NM_STRLEN(NM_SECRET_TAG_DYNAMIC_CHALLENGE_ECHO)];
|
||||
is_challenge = TRUE;
|
||||
force_echo = TRUE;
|
||||
} else {
|
||||
secret_name = *iter;
|
||||
ui_name = *iter;
|
||||
force_echo = FALSE;
|
||||
}
|
||||
|
||||
add_vpn_secret_helper(secrets, s_vpn, secret_name, secret_name, force_echo);
|
||||
add_vpn_secret_helper(secrets, s_vpn, *iter, _(ui_name), force_echo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user