diff options
Diffstat (limited to 'cmds/servicemanager')
-rw-r--r-- | cmds/servicemanager/bctest.c | 3 | ||||
-rw-r--r-- | cmds/servicemanager/service_manager.c | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/cmds/servicemanager/bctest.c b/cmds/servicemanager/bctest.c index 6dee816..ff5aced 100644 --- a/cmds/servicemanager/bctest.c +++ b/cmds/servicemanager/bctest.c @@ -14,6 +14,7 @@ void *svcmgr_lookup(struct binder_state *bs, void *target, const char *name) struct binder_io msg, reply; bio_init(&msg, iodata, sizeof(iodata), 4); + bio_put_uint32(&msg, 0); // strict mode header bio_put_string16_x(&msg, SVC_MGR_NAME); bio_put_string16_x(&msg, name); @@ -37,7 +38,7 @@ int svcmgr_publish(struct binder_state *bs, void *target, const char *name, void struct binder_io msg, reply; bio_init(&msg, iodata, sizeof(iodata), 4); - + bio_put_uint32(&msg, 0); // strict mode header bio_put_string16_x(&msg, SVC_MGR_NAME); bio_put_string16_x(&msg, name); bio_put_obj(&msg, ptr); diff --git a/cmds/servicemanager/service_manager.c b/cmds/servicemanager/service_manager.c index c46901b6..a57a72f 100644 --- a/cmds/servicemanager/service_manager.c +++ b/cmds/servicemanager/service_manager.c @@ -195,6 +195,7 @@ int svcmgr_handler(struct binder_state *bs, uint16_t *s; unsigned len; void *ptr; + uint32_t strict_policy; // LOGI("target=%p code=%d pid=%d uid=%d\n", // txn->target, txn->code, txn->sender_pid, txn->sender_euid); @@ -202,8 +203,12 @@ int svcmgr_handler(struct binder_state *bs, if (txn->target != svcmgr_handle) return -1; + // Equivalent to Parcel::enforceInterface(), reading the RPC + // header with the strict mode policy mask and the interface name. + // Note that we ignore the strict_policy and don't propagate it + // further (since we do no outbound RPCs anyway). + strict_policy = bio_get_uint32(msg); s = bio_get_string16(msg, &len); - if ((len != (sizeof(svcmgr_id) / 2)) || memcmp(svcmgr_id, s, sizeof(svcmgr_id))) { fprintf(stderr,"invalid id %s\n", str8(s)); |