* prefork-interp [<option>,..],<interpreter> <script> [<args> ...]
* prefork-interp '[<option> ..] <interpreter>' <script> [<args> ...]
*
- * Options must specify argument laundering mode.
- * Currently the only mode supported is:
+ * Options must specify argument mediation approach.
+ * Currently the only argument mediation supported is:
+ *
* -U unlaundered: setup and executor both get all arguments and env vars
* ident covers only env vars specified with -E
* ident covers only arguments interpreter and (if present) script
+ *
+ * Options for setting the operation mode:
+ *
+ * (none) Default: start new server if needed, then run service
+ * -f Force a fresh service (old one is terminated)
+ * --kill Kill any existing service; do not actually run anything
+ *
+ * Options for controlling whether different invocations share a server:
+ *
+ * -E VAR ident includes env var VAR (or its absence)
+ * -G STRING ident includes string STRING
+ * -g IDENT use IDENT rather than hex(SHA256(... identity things ...))
+ *
+ * (Ordering of -E and -G options is relevant; invocations with different
+ * -E -G options are different even if the env var settings are the same)
*/
/*
*ci->iassignto = v;
}
-void ident_addstring(const struct cmdinfo *ci, const char *string) {
- /* ci may be 0 and is provided so this can be .call */
+static void ident_addbyte(char c) {
+ IDENT_ADD_OBJ(c);
+}
+
+void ident_addstring(const char *string) {
sha256_update(&identsc,strlen(string)+1,string);
}
+void off_ident_addstring(const struct cmdinfo *ci, const char *string) {
+ ident_addbyte('S');
+ ident_addstring(string);
+}
+
void off_ident_addenv(const struct cmdinfo *ci, const char *name) {
const char *val = getenv(name);
+ ident_addbyte('E');
if (val) {
sha256_update(&identsc,strlen(name),name); /* no nul */
sha256_update(&identsc,1,"=");
- ident_addstring(0,val);
+ ident_addstring(val);
} else {
- ident_addstring(0,name);
+ ident_addstring(name);
}
}
unsigned char bbuf[32];
int i;
- ident_addstring(0,interp);
+ ident_addstring(interp);
if (script)
- ident_addstring(0,script);
+ ident_addstring(script);
sha256_digest(&identsc,sizeof(bbuf),bbuf);
for (i=0; i<identlen; i += 2)
#define PREFORK_CMDINFOS \
{ "help", 0, .call=of_help }, \
{ 0, 'g', 1, .sassignto= &ident }, \
- { 0, 'G', 1, .call= ident_addstring }, \
+ { 0, 'G', 1, .call= off_ident_addstring }, \
{ 0, 'E', 1, .call= off_ident_addenv },
void process_opts(const char *const **argv_io);
void usagemessage(void);
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 ident_addstring(const char *string);
+void off_ident_addstring(const struct cmdinfo *ci, const char *name);
void off_ident_addenv(const struct cmdinfo *ci, const char *name);
void ident_addinit(void);
bool stabs_same_inode(struct stat *a, struct stat *b);