mirror of
git://git.gnupg.org/gnupg.git
synced 2025-05-19 09:02:22 +02:00
* gpgsm.c (main): Use GNUPG_DEFAULT_HOMEDIR constant.
* call-agent.c (start_agent): Create and pass the list of FD to keep in the child to assuan. * call-dirmngr.c (start_dirmngr): Ditto. * scdaemon.c (main): Use GNUPG_DEFAULT_HOMEDIR constant. * assuan-pipe-connect.c (assuan_pipe_connect): No special handling for the log_fd and stderr. Connect stderr to /dev/null if it should not be retained.
This commit is contained in:
parent
56b049686f
commit
ad4d81f528
@ -1,3 +1,9 @@
|
|||||||
|
2002-06-27 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* assuan-pipe-connect.c (assuan_pipe_connect): No special handling
|
||||||
|
for the log_fd and stderr. Connect stderr to /dev/null if it
|
||||||
|
should not be retained.
|
||||||
|
|
||||||
2002-06-26 Werner Koch <wk@gnupg.org>
|
2002-06-26 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
* assuan-buffer.c (assuan_write_line): Make sure we never
|
* assuan-buffer.c (assuan_write_line): Make sure we never
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
@ -169,18 +170,16 @@ assuan_pipe_connect (ASSUAN_CONTEXT *ctx, const char *name, char *const argv[],
|
|||||||
{
|
{
|
||||||
int i, n;
|
int i, n;
|
||||||
char errbuf[512];
|
char errbuf[512];
|
||||||
#ifdef HAVE_JNLIB_LOGGING
|
int *fdp;
|
||||||
int log_fd = log_get_fd ();
|
|
||||||
#endif
|
/* Close all files which will not be duped and are not in the
|
||||||
/* close all files which will not be duped but keep stderr
|
fd_child_list. */
|
||||||
and log_stream for now */
|
|
||||||
n = sysconf (_SC_OPEN_MAX);
|
n = sysconf (_SC_OPEN_MAX);
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
n = MAX_OPEN_FDS;
|
n = MAX_OPEN_FDS;
|
||||||
for (i=0; i < n; i++)
|
for (i=0; i < n; i++)
|
||||||
{
|
{
|
||||||
int *fdp = fd_child_list;
|
fdp = fd_child_list;
|
||||||
|
|
||||||
if (fdp)
|
if (fdp)
|
||||||
{
|
{
|
||||||
while (*fdp != -1 && *fdp != i)
|
while (*fdp != -1 && *fdp != i)
|
||||||
@ -188,16 +187,36 @@ assuan_pipe_connect (ASSUAN_CONTEXT *ctx, const char *name, char *const argv[],
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(fdp && *fdp != -1)
|
if (!(fdp && *fdp != -1)
|
||||||
&& i != fileno (stderr)
|
|
||||||
#ifdef HAVE_JNLIB_LOGGING
|
|
||||||
&& i != log_fd
|
|
||||||
#endif
|
|
||||||
&& i != rp[1] && i != wp[0])
|
&& i != rp[1] && i != wp[0])
|
||||||
close(i);
|
close(i);
|
||||||
}
|
}
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
|
||||||
/* Dup handles and to stdin/stdout and exec */
|
/* Dup stderr to /dev/null unless it is in the list of FDs to be
|
||||||
|
passed to the child. */
|
||||||
|
fdp = fd_child_list;
|
||||||
|
if (fdp)
|
||||||
|
{
|
||||||
|
for (; *fdp != -1 && *fdp != STDERR_FILENO; fdp++)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
if (!fdp || *fdp == -1)
|
||||||
|
{
|
||||||
|
int fd = open ("/dev/null", O_WRONLY);
|
||||||
|
if (fd == -1)
|
||||||
|
{
|
||||||
|
LOGERROR1 ("can't open `/dev/null': %s\n", strerror (errno));
|
||||||
|
_exit (4);
|
||||||
|
}
|
||||||
|
if (dup2 (fd, STDERR_FILENO) == -1)
|
||||||
|
{
|
||||||
|
LOGERROR1 ("dup2(dev/null, 2) failed: %s\n", strerror (errno));
|
||||||
|
_exit (4);
|
||||||
|
}
|
||||||
|
close (fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dup handles and to stdin/stdout and exec. */
|
||||||
if (rp[1] != STDOUT_FILENO)
|
if (rp[1] != STDOUT_FILENO)
|
||||||
{
|
{
|
||||||
if (dup2 (rp[1], STDOUT_FILENO) == -1)
|
if (dup2 (rp[1], STDOUT_FILENO) == -1)
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2002-06-27 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* scdaemon.c (main): Use GNUPG_DEFAULT_HOMEDIR constant.
|
||||||
|
|
||||||
2002-06-15 Werner Koch <wk@gnupg.org>
|
2002-06-15 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
* card-dinsig.c: Documented some stuff from the DIN norm.
|
* card-dinsig.c: Documented some stuff from the DIN norm.
|
||||||
|
@ -261,13 +261,7 @@ main (int argc, char **argv )
|
|||||||
looking at the uid or ebtter use an explict option for this */
|
looking at the uid or ebtter use an explict option for this */
|
||||||
opt.homedir = getenv("GNUPGHOME");
|
opt.homedir = getenv("GNUPGHOME");
|
||||||
if (!opt.homedir || !*opt.homedir)
|
if (!opt.homedir || !*opt.homedir)
|
||||||
{
|
opt.homedir = GNUPG_DEFAULT_HOMEDIR;
|
||||||
#ifdef HAVE_DRIVE_LETTERS
|
|
||||||
opt.homedir = "c:/gnupg-test";
|
|
||||||
#else
|
|
||||||
opt.homedir = "~/.gnupg-test";
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check whether we have a config file on the commandline */
|
/* check whether we have a config file on the commandline */
|
||||||
orig_argc = argc;
|
orig_argc = argc;
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2002-06-27 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* gpgsm.c (main): Use GNUPG_DEFAULT_HOMEDIR constant.
|
||||||
|
|
||||||
|
* call-agent.c (start_agent): Create and pass the list of FD to
|
||||||
|
keep in the child to assuan.
|
||||||
|
* call-dirmngr.c (start_dirmngr): Ditto.
|
||||||
|
|
||||||
2002-06-26 Werner Koch <wk@gnupg.org>
|
2002-06-26 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
* import.c (gpgsm_import): Print an STATUS_IMPORTED.
|
* import.c (gpgsm_import): Print an STATUS_IMPORTED.
|
||||||
|
@ -151,6 +151,8 @@ start_agent (void)
|
|||||||
{
|
{
|
||||||
const char *pgmname;
|
const char *pgmname;
|
||||||
const char *argv[3];
|
const char *argv[3];
|
||||||
|
int no_close_list[3];
|
||||||
|
int i;
|
||||||
|
|
||||||
if (opt.verbose)
|
if (opt.verbose)
|
||||||
log_info (_("no running gpg-agent - starting one\n"));
|
log_info (_("no running gpg-agent - starting one\n"));
|
||||||
@ -172,8 +174,15 @@ start_agent (void)
|
|||||||
argv[1] = "--server";
|
argv[1] = "--server";
|
||||||
argv[2] = NULL;
|
argv[2] = NULL;
|
||||||
|
|
||||||
|
i=0;
|
||||||
|
if (log_get_fd () != -1)
|
||||||
|
no_close_list[i++] = log_get_fd ();
|
||||||
|
no_close_list[i++] = fileno (stderr);
|
||||||
|
no_close_list[i] = -1;
|
||||||
|
|
||||||
/* connect to the agent and perform initial handshaking */
|
/* connect to the agent and perform initial handshaking */
|
||||||
rc = assuan_pipe_connect (&ctx, opt.agent_program, (char**)argv, 0);
|
rc = assuan_pipe_connect (&ctx, opt.agent_program, (char**)argv,
|
||||||
|
no_close_list);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -143,6 +143,8 @@ start_dirmngr (void)
|
|||||||
{
|
{
|
||||||
const char *pgmname;
|
const char *pgmname;
|
||||||
const char *argv[3];
|
const char *argv[3];
|
||||||
|
int no_close_list[3];
|
||||||
|
int i;
|
||||||
|
|
||||||
if (opt.verbose)
|
if (opt.verbose)
|
||||||
log_info (_("no running dirmngr - starting one\n"));
|
log_info (_("no running dirmngr - starting one\n"));
|
||||||
@ -164,8 +166,15 @@ start_dirmngr (void)
|
|||||||
argv[1] = "--server";
|
argv[1] = "--server";
|
||||||
argv[2] = NULL;
|
argv[2] = NULL;
|
||||||
|
|
||||||
|
i=0;
|
||||||
|
if (log_get_fd () != -1)
|
||||||
|
no_close_list[i++] = log_get_fd ();
|
||||||
|
no_close_list[i++] = fileno (stderr);
|
||||||
|
no_close_list[i] = -1;
|
||||||
|
|
||||||
/* connect to the agent and perform initial handshaking */
|
/* connect to the agent and perform initial handshaking */
|
||||||
rc = assuan_pipe_connect (&ctx, opt.dirmngr_program, (char**)argv, 0);
|
rc = assuan_pipe_connect (&ctx, opt.dirmngr_program, (char**)argv,
|
||||||
|
no_close_list);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -636,9 +636,7 @@ main ( int argc, char **argv)
|
|||||||
opt.homedir = getenv ("GNUPGHOME");
|
opt.homedir = getenv ("GNUPGHOME");
|
||||||
#endif
|
#endif
|
||||||
if (!opt.homedir || !*opt.homedir )
|
if (!opt.homedir || !*opt.homedir )
|
||||||
{
|
opt.homedir = GNUPG_DEFAULT_HOMEDIR;
|
||||||
opt.homedir = "~/.gnupg-test" /*fixme: GNUPG_HOMEDIR*/;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* first check whether we have a config file on the commandline */
|
/* first check whether we have a config file on the commandline */
|
||||||
orig_argc = argc;
|
orig_argc = argc;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user