diff --git a/include/payload/payload.h b/include/payload/payload.h index c728727..597ea11 100644 --- a/include/payload/payload.h +++ b/include/payload/payload.h @@ -37,17 +37,28 @@ void NSLog(CFStringRef, ...); extern os_log_t palera1nd_log; +enum { // Legal level values for CFLog() + kCFLogLevelEmergency = 0, + kCFLogLevelAlert = 1, + kCFLogLevelCritical = 2, + kCFLogLevelError = 3, + kCFLogLevelWarning = 4, + kCFLogLevelNotice = 5, + kCFLogLevelInfo = 6, + kCFLogLevelDebug = 7, +}; +CF_EXPORT void CFLog(int32_t level, CFStringRef format, ...); #ifdef DEV_BUILD -#define PALERA1ND_LOG_DEBUG(...) os_log(palera1nd_log, __VA_ARGS__) +#define PALERA1ND_LOG_DEBUG(a, ...) CFLog(kCFLogLevelNotice, CFSTR(a), ##__VA_ARGS__) #else -#define PALERA1ND_LOG_DEBUG(...) +#define PALERA1ND_LOG_DEBUG(a, ...) #endif -#define PALERA1ND_LOG_ERROR(...) os_log(palera1nd_log, __VA_ARGS__) -#define PALERA1ND_LOG_FAULT(...) os_log(palera1nd_log, __VA_ARGS__) -#define PALERA1ND_LOG_INFO(...) os_log(palera1nd_log, __VA_ARGS__) -#define PALERA1ND_LOG(...) os_log(palera1nd_log, __VA_ARGS__) +#define PALERA1ND_LOG_ERROR(a, ...) CFLog(kCFLogLevelNotice, CFSTR(a), ##__VA_ARGS__) +#define PALERA1ND_LOG_FAULT(a, ...) CFLog(kCFLogLevelNotice, CFSTR(a), ##__VA_ARGS__) +#define PALERA1ND_LOG_INFO(a, ...) CFLog(kCFLogLevelNotice, CFSTR(a), ##__VA_ARGS__) +#define PALERA1ND_LOG(a, ...) CFLog(kCFLogLevelNotice, CFSTR(a), ##__VA_ARGS__) typedef int launchctl_cmd_main(xpc_object_t *msg, int argc, char **argv, char **envp, char **apple); launchctl_cmd_main bootstrap_cmd; diff --git a/src/payload/jailbreakd/bootstrap.c b/src/payload/jailbreakd/bootstrap.c index f4f2538..e6d90c6 100644 --- a/src/payload/jailbreakd/bootstrap.c +++ b/src/payload/jailbreakd/bootstrap.c @@ -56,7 +56,7 @@ void* write_log(void* arg) { while ((didRead = read(fd, buf, 0x1000)) != -1) { if (didRead > 0) { - PALERA1ND_LOG("%{public}s: %{public}s", ((struct nslog_stderr_info*)arg)->desc, buf); + PALERA1ND_LOG("%s: %s", ((struct nslog_stderr_info*)arg)->desc, buf); memset(buf, 0, 0x1000); } } diff --git a/src/payload/jailbreakd/handler.c b/src/payload/jailbreakd/handler.c index 715e699..ce8679c 100644 --- a/src/payload/jailbreakd/handler.c +++ b/src/payload/jailbreakd/handler.c @@ -22,7 +22,7 @@ #define RB2_USERREBOOT (0x2000000000000000llu) #ifdef HAVE_DEBUG_JBD_MSG -#define STR_FORMAT "%{public}s" +#define STR_FORMAT "%s" #else #define STR_FORMAT "%s" #endif @@ -66,7 +66,7 @@ void palera1nd_handler(xpc_object_t peer, xpc_object_t request, struct paleinfo* SecTaskRef task = SecTaskCreateWithAuditToken(kCFAllocatorDefault, token); if (task) { CFStringRef signingIdentifier = SecTaskCopySigningIdentifier(task, NULL); - PALERA1ND_LOG("received dictionary from client %{public}@(%d): " STR_FORMAT, signingIdentifier ? signingIdentifier : CFSTR("unknown"), pid, xrequeststr); + PALERA1ND_LOG("received dictionary from client %@(%d): " STR_FORMAT, signingIdentifier ? signingIdentifier : CFSTR("unknown"), pid, xrequeststr); if (signingIdentifier) CFRelease(signingIdentifier); if (task) CFRelease(task); }