From a8cbf7f35996c93079752bfa39dc43ea7e4f2956 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 15 Aug 2022 16:35:25 +0100 Subject: [PATCH] prefork: add a magic number to prefork-interp Signed-off-by: Ian Jackson --- cprogs/cgi-fcgi-interp.c | 3 +++ cprogs/prefork-interp.c | 5 +++++ cprogs/prefork.c | 1 + cprogs/prefork.h | 1 + 4 files changed, 10 insertions(+) diff --git a/cprogs/cgi-fcgi-interp.c b/cprogs/cgi-fcgi-interp.c index 3dbfef6..2de4661 100644 --- a/cprogs/cgi-fcgi-interp.c +++ b/cprogs/cgi-fcgi-interp.c @@ -150,6 +150,9 @@ void fusagemessage(FILE *f) { fprintf(f, "usage: #!/usr/bin/cgi-fcgi-interp []\n"); } +void ident_addinit(void) { +} + static int stderr_copy; static void make_stderr_copy(void) { diff --git a/cprogs/prefork-interp.c b/cprogs/prefork-interp.c index 018a791..6ee253f 100644 --- a/cprogs/prefork-interp.c +++ b/cprogs/prefork-interp.c @@ -100,6 +100,11 @@ const struct cmdinfo cmdinfos[]= { { 0 } }; +void ident_addinit(void) { + char ident_magic[1] = { 0 }; + sha256_update(&identsc, sizeof(ident_magic), ident_magic); +} + static void propagate_exit_status(int status, const char *what) { int r; diff --git a/cprogs/prefork.c b/cprogs/prefork.c index aaac059..909d065 100644 --- a/cprogs/prefork.c +++ b/cprogs/prefork.c @@ -206,6 +206,7 @@ void process_opts(const char *const **argv_io) { const char *smashedopt; sha256_init(&identsc); + ident_addinit(); if ((*argv_io)[0] && (smashedopt = (*argv_io)[1]) && diff --git a/cprogs/prefork.h b/cprogs/prefork.h index 617a455..4a3f996 100644 --- a/cprogs/prefork.h +++ b/cprogs/prefork.h @@ -83,5 +83,6 @@ void of_help(const struct cmdinfo *ci, const char *val); void of_iassign(const struct cmdinfo *ci, const char *val); void ident_addstring(const struct cmdinfo *ci, const char *string); void off_ident_addenv(const struct cmdinfo *ci, const char *name); +void ident_addinit(void); #endif /*PREFORK_H*/ -- 2.30.2