|
20 | 20 | #include <sys/select.h> |
21 | 21 | #include <stdio.h> |
22 | 22 |
|
23 | | -#define ETC_AUTH_SCRIPTS "/etc/containers/auth-scripts" |
| 23 | +#define ETC_PREEXEC_HOOKS "/etc/containers/pre-exec-hooks" |
24 | 24 | #define LIBEXECPODMAN "/usr/libexec/podman" |
25 | 25 |
|
26 | 26 | #ifndef TEMP_FAILURE_RETRY |
@@ -164,23 +164,23 @@ exec_binary (const char *path, char **argv, int argc) |
164 | 164 | } |
165 | 165 | if (WIFEXITED(status) && WEXITSTATUS (status)) |
166 | 166 | { |
167 | | - fprintf (stderr, "external auth script %s failed\n", path); |
| 167 | + fprintf (stderr, "external preexec hook %s failed\n", path); |
168 | 168 | exit (WEXITSTATUS(status)); |
169 | 169 | } |
170 | 170 | if (WIFSIGNALED (status)) |
171 | 171 | { |
172 | | - fprintf (stderr, "external auth script %s failed\n", path); |
| 172 | + fprintf (stderr, "external preexec hook %s failed\n", path); |
173 | 173 | exit (127+WTERMSIG (status)); |
174 | 174 | } |
175 | 175 | if (WIFSTOPPED (status)) |
176 | 176 | { |
177 | | - fprintf (stderr, "external auth script %s failed\n", path); |
| 177 | + fprintf (stderr, "external preexec hook %s failed\n", path); |
178 | 178 | exit (EXIT_FAILURE); |
179 | 179 | } |
180 | 180 | } |
181 | 181 |
|
182 | 182 | static void |
183 | | -do_auth_scripts_dir (const char *dir, char **argv, int argc) |
| 183 | +do_preexec_hooks_dir (const char *dir, char **argv, int argc) |
184 | 184 | { |
185 | 185 | cleanup_free char *buffer = NULL; |
186 | 186 | cleanup_dir DIR *d = NULL; |
@@ -261,13 +261,13 @@ do_auth_scripts_dir (const char *dir, char **argv, int argc) |
261 | 261 | } |
262 | 262 |
|
263 | 263 | static void |
264 | | -do_auth_scripts (char **argv, int argc) |
| 264 | +do_preexec_hooks (char **argv, int argc) |
265 | 265 | { |
266 | | - char *auth_scripts = getenv ("PODMAN_AUTH_SCRIPTS_DIR"); |
267 | | - do_auth_scripts_dir (LIBEXECPODMAN "/auth-scripts", argv, argc); |
268 | | - do_auth_scripts_dir (ETC_AUTH_SCRIPTS, argv, argc); |
269 | | - if (auth_scripts && auth_scripts[0]) |
270 | | - do_auth_scripts_dir (auth_scripts, argv, argc); |
| 266 | + char *preexec_hooks = getenv ("PODMAN_PREEXEC_HOOKS_DIR"); |
| 267 | + do_preexec_hooks_dir (LIBEXECPODMAN "/pre-exec-hooks", argv, argc); |
| 268 | + do_preexec_hooks_dir (ETC_PREEXEC_HOOKS, argv, argc); |
| 269 | + if (preexec_hooks && preexec_hooks[0]) |
| 270 | + do_preexec_hooks_dir (preexec_hooks, argv, argc); |
271 | 271 | } |
272 | 272 |
|
273 | 273 | static void |
@@ -498,7 +498,7 @@ static void __attribute__((constructor)) init() |
498 | 498 | } |
499 | 499 |
|
500 | 500 | if (geteuid () != 0 || getenv ("_CONTAINERS_USERNS_CONFIGURED") == NULL) |
501 | | - do_auth_scripts(argv, argc); |
| 501 | + do_preexec_hooks(argv, argc); |
502 | 502 |
|
503 | 503 | listen_pid = getenv("LISTEN_PID"); |
504 | 504 | listen_fds = getenv("LISTEN_FDS"); |
|
0 commit comments