aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--darwin-bootstrap/bundle-loader.c1
-rw-r--r--darwin-bootstrap/substituted.m8
-rw-r--r--lib/darwin/xxpc.h3
3 files changed, 11 insertions, 1 deletions
diff --git a/darwin-bootstrap/bundle-loader.c b/darwin-bootstrap/bundle-loader.c
index 3b29b55..50cae83 100644
--- a/darwin-bootstrap/bundle-loader.c
+++ b/darwin-bootstrap/bundle-loader.c
@@ -267,6 +267,7 @@ static void init() {
xxpc_object_t message = xxpc_dictionary_create(NULL, NULL, 0);
xxpc_dictionary_set_string(message, "type", "hello");
+ xxpc_dictionary_set_int64(message, "proto-version", 1);
xxpc_dictionary_set_string(message, "argv0", argv0);
xxpc_connection_send_message_with_reply(conn, message, NULL,
^(xxpc_object_t reply) {
diff --git a/darwin-bootstrap/substituted.m b/darwin-bootstrap/substituted.m
index 560d1ac..710a268 100644
--- a/darwin-bootstrap/substituted.m
+++ b/darwin-bootstrap/substituted.m
@@ -346,6 +346,14 @@ enum convert_filters_ret {
if (_argv0 != NULL)
goto bad;
+ int64_t version = xxpc_dictionary_get_int64(request, "proto-version");
+ if (version != 1) {
+ /* in the future there will be a proper unloading mechanism, but here's
+ * a bit of future proofing */
+ NSLog(@"request received from wrong version of bundle-loader: %@", request);
+ xxpc_connection_cancel(_connection);
+ }
+
const char *argv0 = xxpc_dictionary_get_string(request, "argv0");
if (!argv0)
goto bad;
diff --git a/lib/darwin/xxpc.h b/lib/darwin/xxpc.h
index d1bcb9d..3c0ed1d 100644
--- a/lib/darwin/xxpc.h
+++ b/lib/darwin/xxpc.h
@@ -60,11 +60,12 @@ void WRAP(xpc_array_set_string, (xxpc_object_t, size_t, const char *));
OS_OBJECT_RETURNS_RETAINED
xxpc_object_t WRAP(xpc_dictionary_create, (const char *const *,
const xxpc_object_t *, size_t));
-
OS_OBJECT_RETURNS_RETAINED
xxpc_object_t WRAP(xpc_dictionary_create_reply, (xxpc_object_t));
bool WRAP(xpc_dictionary_get_bool, (xxpc_object_t, const char *));
const char *WRAP(xpc_dictionary_get_string, (xxpc_object_t, const char *));
+uint64_t WRAP(xpc_dictionary_get_uint64, (xxpc_object_t, const char *));
+int64_t WRAP(xpc_dictionary_get_int64, (xxpc_object_t, const char *));
xxpc_object_t WRAP(xpc_dictionary_get_value, (xxpc_object_t, const char *));
void WRAP(xpc_dictionary_set_bool, (xxpc_object_t, const char *, bool));
void WRAP(xpc_dictionary_set_string, (xxpc_object_t, const char *, const char *));