diff options
author | Werner Koch <[email protected]> | 2016-02-22 09:56:27 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2016-02-23 14:40:28 +0000 |
commit | f26867928c451443769fecc41c3283e077e8c49f (patch) | |
tree | 5469be6c467d690b0d1ead2472f370f60ac1dcda /g13/g13-syshelp.c | |
parent | tests/openpgp: Qualify executables with extension. (diff) | |
download | gnupg-f26867928c451443769fecc41c3283e077e8c49f.tar.gz gnupg-f26867928c451443769fecc41c3283e077e8c49f.zip |
g13: Run mount after dmsetup.
* g13/g13-syshelp.c (main): Reject userids with a slash.
* g13/sh-dmcrypt.c (sh_dmcrypt_mount_container): Run mount if a
mountpoint is known.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'g13/g13-syshelp.c')
-rw-r--r-- | g13/g13-syshelp.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/g13/g13-syshelp.c b/g13/g13-syshelp.c index b31964e6e..645730fc6 100644 --- a/g13/g13-syshelp.c +++ b/g13/g13-syshelp.c @@ -512,15 +512,23 @@ main ( int argc, char **argv) ctrl.client.uid = (uid_t)myuid; } - pwd = getpwuid (ctrl.client.uid); - if (!pwd || !*pwd->pw_name) - { - log_info ("WARNING: Name for UID not found: %s\n", strerror (errno)); - ctrl.fail_all_cmds = 1; - ctrl.client.uname = xstrdup ("?"); - } - else - ctrl.client.uname = xstrdup (pwd->pw_name); + pwd = getpwuid (ctrl.client.uid); + if (!pwd || !*pwd->pw_name) + { + log_info ("WARNING: Name for UID not found: %s\n", strerror (errno)); + ctrl.fail_all_cmds = 1; + ctrl.client.uname = xstrdup ("?"); + } + else + ctrl.client.uname = xstrdup (pwd->pw_name); + + /* Check that the user name does not contain a directory + separator. */ + if (strchr (ctrl.client.uname, '/')) + { + log_info ("WARNING: Invalid user name passed\n"); + ctrl.fail_all_cmds = 1; + } } #else /*!HAVE_PWD_H || !HAVE_GETPWUID*/ log_info ("WARNING: System does not support required syscalls\n"); |