1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

gpgconf: New option --chuid.

* tools/gpgconf.c (oChUid, opts): New option --chuid.
(main): Implement.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2020-08-06 15:32:43 +02:00
parent 8ff00ef0de
commit d10f45184c
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
3 changed files with 19 additions and 1 deletions

View File

@ -1196,7 +1196,7 @@ pkd:0:1024:B665B1435F4C2 .... FF26ABB:
*** MANUFACTURER <n> [<string>]
This status returns the Manufactorer ID as the unsigned number N.
For OpenPGP this is weel defined; for other cards this is 0. The
For OpenPGP this is well defined; for other cards this is 0. The
name of the manufacturer is also given as <string>; spaces are not
escaped. For PKCS#15 cards <string> is TokenInfo.manufactorerID.

View File

@ -415,6 +415,16 @@ Try to be as quiet as possible.
@include opt-homedir.texi
@item --chuid @var{uid}
@opindex chuid
Change the current user to @var{uid} which may either be a number or a
name. This can be used from the root account to get information on
the GnuPG environment of the specified user or to start or kill
daemons. If @var{uid} is not the current UID a standard PATH is set
and the envvar GNUPGHOME is unset. To override the latter the option
@option{--homedir} can be used. This option has currently no effect
on Windows.
@item -n
@itemx --dry-run
Do not actually change anything. This is currently only implemented

View File

@ -51,6 +51,7 @@ enum cmd_and_opt_values
oBuilddir,
oStatusFD,
oShowSocket,
oChUid,
aListComponents,
aCheckPrograms,
@ -113,6 +114,7 @@ static gpgrt_opt_t opts[] =
{ oNull, "null", 0, "@" },
{ oNoVerbose, "no-verbose", 0, "@"},
ARGPARSE_s_n (oShowSocket, "show-socket", "@"),
ARGPARSE_s_s (oChUid, "chuid", "@"),
ARGPARSE_end(),
};
@ -547,6 +549,7 @@ main (int argc, char **argv)
enum cmd_and_opt_values cmd = 0;
estream_t outfp = NULL;
int show_socket = 0;
const char *changeuser = NULL;
early_system_init ();
gnupg_reopen_std (GPGCONF_NAME);
@ -579,6 +582,7 @@ main (int argc, char **argv)
set_status_fd (translate_sys2libc_fd_int (pargs.r.ret_int, 1));
break;
case oShowSocket: show_socket = 1; break;
case oChUid: changeuser = pargs.r.ret_str; break;
case aListDirs:
case aListComponents:
@ -620,6 +624,10 @@ main (int argc, char **argv)
fname = argc ? *argv : NULL;
/* If requested switch to the requested user or die. */
if (changeuser && (err = gnupg_chuid (changeuser, 0)))
gpgconf_failure (err);
/* Set the configuraton directories for use by gpgrt_argparser. We
* don't have a configuration file for this program but we have code
* which reads the component's config files. */