1 /* Copyright (c) 2012 Apple Inc. All Rights Reserved. */
4 #include "authd_private.h"
5 #include "authutilities.h"
8 #include <dispatch/dispatch.h>
9 #include <CoreFoundation/CoreFoundation.h>
11 // sudo defaults write /Library/Preferences/com.apple.security.coderequirements Entitlements -string always
14 security_auth_verbose(void)
16 static dispatch_once_t onceToken
;
17 static bool verbose_enabled
= false;
19 //sudo defaults write /Library/Preferences/com.apple.authd verbose -bool true
20 dispatch_once(&onceToken
, ^{
21 CFTypeRef verbose
= (CFNumberRef
)CFPreferencesCopyValue(CFSTR("verbose"), CFSTR(SECURITY_AUTH_NAME
), kCFPreferencesAnyUser
, kCFPreferencesCurrentHost
);
23 if (verbose
&& CFGetTypeID(verbose
) == CFBooleanGetTypeID()) {
24 verbose_enabled
= CFBooleanGetValue((CFBooleanRef
)verbose
);
27 syslog(LOG_NOTICE
, "verbose: %s", verbose_enabled
? "enabled" : "disabled");
29 CFReleaseSafe(verbose
);
32 return verbose_enabled
;
36 security_auth_log(int type
,const char * format
,...)
42 vsyslog(LOG_NOTICE
, format
, ap
);
44 case AUTH_LOG_VERBOSE
:
45 if (security_auth_verbose()) {
46 vsyslog(LOG_NOTICE
, format
, ap
);
50 vsyslog(LOG_ERR
, format
, ap
);
58 void _show_cf(CFTypeRef value
)
60 CFStringRef string
= NULL
;
62 require(value
!= NULL
, done
);
64 if (security_auth_verbose()) {
65 string
= CFCopyDescription(value
);
66 tmp
= _copy_cf_string(string
, NULL
);
68 syslog(LOG_NOTICE
, "%s", tmp
);
72 CFReleaseSafe(string
);