search for: copy_environ

Displaying 9 results from an estimated 9 matches for "copy_environ".

2020 Apr 15
0
Re: [PATCH nbdkit 6/9] common/utils: Add a copy_environ utility function.
...>+++ b/common/utils/utils.h > >@@ -38,5 +38,6 @@ extern void uri_quote (const char *str, FILE *fp); > > extern int exit_status_to_nbd_error (int status, const char *cmd); > > extern int set_cloexec (int fd); > > extern int set_nonblock (int fd); > >+extern char **copy_environ (char **env, ...); > > Should use __attribute__((sentinel)), to let the compiler enforce > that we don't forget a trailing NULL. Ooops ... I had this in an earlier version and somehow managed to drop it :-( I think when it was originally in a separate header file. Fixed my copy. &...
2020 Apr 15
2
Re: [PATCH nbdkit 6/9] common/utils: Add a copy_environ utility function.
...sertions(+) > > +++ b/common/utils/utils.h > @@ -38,5 +38,6 @@ extern void uri_quote (const char *str, FILE *fp); > extern int exit_status_to_nbd_error (int status, const char *cmd); > extern int set_cloexec (int fd); > extern int set_nonblock (int fd); > +extern char **copy_environ (char **env, ...); Should use __attribute__((sentinel)), to let the compiler enforce that we don't forget a trailing NULL. > +++ b/common/utils/environ.c > + > +DEFINE_VECTOR_TYPE(environ_t, char *); > + > +/* Copy an environ. Also this allows you to add (key, value) pairs t...
2001 Dec 18
1
[PATCH]: Fix environment variable size restriction in Cygwin version
Hi, the following patch changes the Cygwin specific function copy_environment() to not restricting the strlen of a single environment variable to 512 byte. The PAM specific function do_pam_environment() (also in session.c) has the same problem but I don't know if that's important for PAM since only PAM specific environment variables are copied in that function....
2020 Apr 15
0
[PATCH nbdkit 6/9] common/utils: Add a copy_environ utility function.
...bd5f66b..5c121ccb 100644 --- a/common/utils/utils.h +++ b/common/utils/utils.h @@ -38,5 +38,6 @@ extern void uri_quote (const char *str, FILE *fp); extern int exit_status_to_nbd_error (int status, const char *cmd); extern int set_cloexec (int fd); extern int set_nonblock (int fd); +extern char **copy_environ (char **env, ...); #endif /* NBDKIT_UTILS_H */ diff --git a/common/utils/environ.c b/common/utils/environ.c new file mode 100644 index 00000000..a43eeb71 --- /dev/null +++ b/common/utils/environ.c @@ -0,0 +1,116 @@ +/* nbdkit + * Copyright (C) 2018-2020 Red Hat Inc. + * + * Redistribution and us...
2020 Apr 15
0
[PATCH nbdkit 9/9] eval, sh: Define $nbdkit_safe_stdio = 0|1 in scripts.
...nst char *stdio_safe_str = nbdkit_stdio_safe () ? "1" : "0"; pid_t pid = -1; int status; int ret = ERROR; @@ -123,8 +124,11 @@ call3 (const char *wbuf, size_t wbuflen, /* sent to stdin */ debug_call (argv); - /* Copy the environment, and add $tmpdir. */ - env = copy_environ (environ, "tmpdir", tmpdir, NULL); + /* Copy the environment, and add $tmpdir and some other variables. */ + env = copy_environ (environ, + "tmpdir", tmpdir, + "nbdkit_stdio_safe", stdio_safe_str, + NULL)...
2020 Apr 15
18
[PATCH nbdkit 0/9] Generic vector, and pass $nbdkit_stdio_safe to shell scripts.
This was a rather longer trip around the houses than I anticipated! The basic purpose of the patch series is to set $nbdkit_stdio_safe to "0" or "1" in sh and eval plugin scripts. To do that, I ended up adding a nicer way to manipulate environ lists, and to do that, I ended up adding a whole generic vector implementation which is applicable in a lot of different places.
2020 Apr 15
0
[PATCH nbdkit 8/9] eval, sh: Set $tmpdir before running the command, instead of globally.
...t name, used in error messages */ + CLEANUP_FREE_STRING_LIST char **env = NULL; pid_t pid = -1; int status; int ret = ERROR; @@ -122,6 +123,11 @@ call3 (const char *wbuf, size_t wbuflen, /* sent to stdin */ debug_call (argv); + /* Copy the environment, and add $tmpdir. */ + env = copy_environ (environ, "tmpdir", tmpdir, NULL); + if (env == NULL) + goto error; + #ifdef HAVE_PIPE2 if (pipe2 (in_fd, O_CLOEXEC) == -1) { nbdkit_error ("%s: pipe2: %m", argv0); @@ -184,6 +190,11 @@ call3 (const char *wbuf, size_t wbuflen, /* sent to stdin */ /* Restore SIG...
2004 May 04
3
Error with USE_POSIX_THREADS and OpenSSH-3.8p1
Hello, I am using OpenSSH-3.8p1 on HP-UX machine with USE_POSIX_THREADS option. This is for making the kerberos credentials file to be created in the system with PAM. In OpenSSH versions 3.5 when authentication is done with pam kerberos, a /tmp/krb5cc_X_Y file is created on the server side. But the KRB5CCNAME variable is not set by default. So, after we manually set this environment variable, the
2007 Jul 29
38
[Bug 1346] New: PAM environment takes precedence over SendEnv
...bles sent through AcceptEnv/SendEnv. Note that there is no way it could be fixed at the PAM level: PAM prepares the environment for the child not knowing the sent variables. It is openssh-server that does the things in the wrong order. What the patch does: it changes the child_set_env function in copy_environment to child_set_env_safe (basically the same as child_set_env but with a twist): any variable which has already been inserted in the environment is not clobbered by copy_environment. Since the function copy_environment is the one used to bring the PAM settings inside the environment, the PAM sett...