summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@gnome.org>2020-02-26 17:21:07 -0600
committerMichael Catanzaro <mcatanzaro@gnome.org>2020-02-27 15:41:55 -0600
commita90a679545f30526da47adcf36009099ecb45b7e (patch)
treefaf77dad5ea02b4f7100dce9b40b69f91462a6ce
parent5f3fb7fdfed9601e20d0909eaa31539e6de5977f (diff)
downloadaccountsservice-mcatanzaro/#83.tar.gz
user: reject requests to change full name to something including a commamcatanzaro/#83
Because real name is stored in the GECOS field of /etc/passwd, which is delimited by commas that cannot be escaped, the user's full name must not contain a comma. Fixes #83
-rw-r--r--src/user.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/user.c b/src/user.c
index aa142fc..f7340bf 100644
--- a/src/user.c
+++ b/src/user.c
@@ -894,6 +894,11 @@ user_set_real_name (AccountsUser *auser,
return TRUE;
}
+ if (g_utf8_strchr (real_name, -1, ',') != NULL) {
+ throw_error (context, ERROR_FAILED, "setting real name failed: real name '%s' must not contain commas", real_name);
+ return TRUE;
+ }
+
if (accounts_user_get_uid (ACCOUNTS_USER (user)) == (uid_t) uid)
action_id = "org.freedesktop.accounts.change-own-user-data";
else