mirror of
https://github.com/darlinghq/darling-libxpc.git
synced 2024-11-23 11:49:42 +00:00
Implement xpc_dictionary_get_audit_token; remove _od_rpc_call
It's in libinfo now, where it belongs
This commit is contained in:
parent
84e29f89ba
commit
95ff731415
@ -53,8 +53,6 @@ XPC_TYPE(_xpc_type_file_transfer);
|
|||||||
|
|
||||||
int _xpc_runtime_is_app_sandboxed();
|
int _xpc_runtime_is_app_sandboxed();
|
||||||
|
|
||||||
xpc_object_t _od_rpc_call(const char *procname, xpc_object_t payload, xpc_pipe_t (*get_pipe)(bool));
|
|
||||||
|
|
||||||
xpc_object_t xpc_create_with_format(const char * format, ...);
|
xpc_object_t xpc_create_with_format(const char * format, ...);
|
||||||
|
|
||||||
xpc_object_t xpc_create_reply_with_format(xpc_object_t original, const char * format, ...);
|
xpc_object_t xpc_create_reply_with_format(xpc_object_t original, const char * format, ...);
|
||||||
|
@ -44,6 +44,7 @@ struct xpc_dictionary_s {
|
|||||||
XPC_CLASS(connection)* associatedConnection;
|
XPC_CLASS(connection)* associatedConnection;
|
||||||
mach_port_t incoming_port;
|
mach_port_t incoming_port;
|
||||||
mach_port_t outgoing_port;
|
mach_port_t outgoing_port;
|
||||||
|
audit_token_t associated_audit_token;
|
||||||
};
|
};
|
||||||
|
|
||||||
@interface XPC_CLASS_INTERFACE(dictionary)
|
@interface XPC_CLASS_INTERFACE(dictionary)
|
||||||
@ -90,6 +91,9 @@ struct xpc_dictionary_s {
|
|||||||
// useful extensions:
|
// useful extensions:
|
||||||
- (XPC_CLASS(string)*)stringForKey: (const char*)key;
|
- (XPC_CLASS(string)*)stringForKey: (const char*)key;
|
||||||
|
|
||||||
|
- (void)setAssociatedAuditToken: (audit_token_t*)auditToken;
|
||||||
|
- (void)copyAssociatedAuditTokenTo: (audit_token_t*)auditToken;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif // _XPC_OBJECTS_DICTIONARY_H_
|
#endif // _XPC_OBJECTS_DICTIONARY_H_
|
||||||
|
@ -225,6 +225,9 @@ static void dispatch_mach_handler(void* context, dispatch_mach_reason_t reason,
|
|||||||
[message retain]; // because the deserializer consumes a reference on the message
|
[message retain]; // because the deserializer consumes a reference on the message
|
||||||
dict = [XPC_CLASS(deserializer) process: message];
|
dict = [XPC_CLASS(deserializer) process: message];
|
||||||
dict.associatedConnection = self;
|
dict.associatedConnection = self;
|
||||||
|
if (token) {
|
||||||
|
[dict setAssociatedAuditToken: token];
|
||||||
|
}
|
||||||
|
|
||||||
this->event_handler(dict);
|
this->event_handler(dict);
|
||||||
}
|
}
|
||||||
|
@ -134,6 +134,7 @@ XPC_CLASS_HEADER(dictionary);
|
|||||||
if (self = [super init]) {
|
if (self = [super init]) {
|
||||||
XPC_THIS_DECL(dictionary);
|
XPC_THIS_DECL(dictionary);
|
||||||
LIST_INIT(&this->head);
|
LIST_INIT(&this->head);
|
||||||
|
memset(&this->associated_audit_token, 0xff, sizeof(audit_token_t));
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -299,6 +300,28 @@ XPC_CLASS_HEADER(dictionary);
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)setAssociatedAuditToken: (audit_token_t*)auditToken
|
||||||
|
{
|
||||||
|
XPC_THIS_DECL(dictionary);
|
||||||
|
|
||||||
|
if (!auditToken) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(&this->associated_audit_token, auditToken, sizeof(audit_token_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)copyAssociatedAuditTokenTo: (audit_token_t*)auditToken
|
||||||
|
{
|
||||||
|
XPC_THIS_DECL(dictionary);
|
||||||
|
|
||||||
|
if (!auditToken) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(auditToken, &this->associated_audit_token, sizeof(audit_token_t));
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation XPC_CLASS(dictionary) (XPCSerialization)
|
@implementation XPC_CLASS(dictionary) (XPCSerialization)
|
||||||
@ -504,7 +527,9 @@ xpc_connection_t xpc_dictionary_get_remote_connection(xpc_object_t xdict) {
|
|||||||
|
|
||||||
XPC_EXPORT
|
XPC_EXPORT
|
||||||
void xpc_dictionary_get_audit_token(xpc_object_t xdict, audit_token_t* token) {
|
void xpc_dictionary_get_audit_token(xpc_object_t xdict, audit_token_t* token) {
|
||||||
|
TO_OBJC_CHECKED(dictionary, xdict, dict) {
|
||||||
|
[dict copyAssociatedAuditTokenTo: token];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -814,13 +814,6 @@ xpc_pipe_t xpc_pipe_create_from_port(mach_port_t port, uint64_t flags) {
|
|||||||
return [[XPC_CLASS(pipe) alloc] initWithPort: port flags: flags];
|
return [[XPC_CLASS(pipe) alloc] initWithPort: port flags: flags];
|
||||||
};
|
};
|
||||||
|
|
||||||
// actually belongs in libsystem_info
|
|
||||||
XPC_EXPORT
|
|
||||||
xpc_object_t _od_rpc_call(const char* procname, xpc_object_t payload, xpc_pipe_t (*get_pipe)(bool)) {
|
|
||||||
xpc_stub();
|
|
||||||
return NULL;
|
|
||||||
};
|
|
||||||
|
|
||||||
XPC_EXPORT
|
XPC_EXPORT
|
||||||
int xpc_pipe_routine_reply(xpc_object_t xdict) {
|
int xpc_pipe_routine_reply(xpc_object_t xdict) {
|
||||||
TO_OBJC_CHECKED(dictionary, xdict, dict) {
|
TO_OBJC_CHECKED(dictionary, xdict, dict) {
|
||||||
|
Loading…
Reference in New Issue
Block a user