Skip to content

Commit

Permalink
removed tperfitt from logging. issu #108
Browse files Browse the repository at this point in the history
  • Loading branch information
twocanoes committed Nov 26, 2023
1 parent ca8e985 commit 0f75ef5
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 29 deletions.
6 changes: 3 additions & 3 deletions DefaultsOverride.swift
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@ public class DefaultsOverride: UserDefaults {
return UserDefaults.standard.double(forKey: defaultName)
}
override public func bool(forKey defaultName: String) -> Bool {
TCSLogInfoWithMark("requested override for \(defaultName)")
TCSLogWithMark("requested override for \(defaultName)")

if let defaultName = cachedPrefs[defaultName] as? Bool {
TCSLogInfoWithMark("override value \(defaultName)")
TCSLogWithMark("override value \(defaultName)")

return defaultName
}
TCSLogInfoWithMark("default not overridden")
TCSLogWithMark("default not overridden")

return UserDefaults.standard.bool(forKey: defaultName)
}
Expand Down
8 changes: 4 additions & 4 deletions XCreds/TCSUnifiedLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,29 @@ typedef enum : NSUInteger {
{ \
char *log_string = malloc(1024); \
snprintf(log_string, 1024, ##__VA_ARGS__); \
[[TCSUnifiedLogger sharedLogger] logString:[NSString stringWithUTF8String:log_string] level:LOGLEVELDEBUG]; \
TCSLog([NSString stringWithUTF8String:log_string]); \
free(log_string); \
}
#define os_log_info(log, ...) \
; \
{ \
char *log_string = malloc(1024); \
snprintf(log_string, 1024, ##__VA_ARGS__); \
[[TCSUnifiedLogger sharedLogger] logString:[NSString stringWithUTF8String:log_string] level:LOGLEVELINFO]; \
TCSLog([NSString stringWithUTF8String:log_string] level:LOGLEVELINFO]; \
free(log_string); \
}
#define os_log_error(log, ...) \
; \
{ \
char *log_string = malloc(1024); \
snprintf(log_string, 1024, ##__VA_ARGS__); \
[[TCSUnifiedLogger sharedLogger] logString:[NSString stringWithUTF8String:log_string] level:LOGLEVELERROR]; \
TCSLog([NSString stringWithUTF8String:log_string] level:LOGLEVELERROR]; \
free(log_string); \
}
#define NSLog(fmt, ...) \
; \
{ \
[[TCSUnifiedLogger sharedLogger] logString:[NSString stringWithFormat:fmt, ##__VA_ARGS__] level:LOGLEVELDEBUG]; \
TCSLog([NSString stringWithFormat:fmt, ##__VA_ARGS__]); \
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ class LoginWebViewWindowController: WebViewWindowController {
if DefaultsOverride.standardOverride.string(forKey: PrefKeys.localAdminUserName.rawValue) != nil &&
DefaultsOverride.standardOverride.string(forKey: PrefKeys.localAdminPassword.rawValue) != nil &&
getManagedPreference(key: .PasswordOverwriteSilent) as? Bool ?? false {
TCSLogInfoWithMark("Set to write keychain silently and we have admin. Skipping.")
TCSLogWithMark("Set to write keychain silently and we have admin. Skipping.")
delegate.setHint(type: .passwordOverwrite, hint: true)
os_log("Hint set for passwordOverwrite", log: uiLog, type: .debug)
break;
Expand Down
27 changes: 14 additions & 13 deletions XCredsLoginPlugIn/XCredsLoginPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

static OSStatus PluginDestroy(AuthorizationPluginRef inPlugin) {

[[TCSUnifiedLogger sharedLogger] logString:[NSString stringWithFormat:@"%s %s:%d",__FUNCTION__, __FILE__,__LINE__] level:LOGLEVELDEBUG];
TCSLog([NSString stringWithFormat:@"%s %s:%d",__FUNCTION__, [[[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lastPathComponent] cStringUsingEncoding:NSUTF8StringEncoding],__LINE__]);

return [authorizationPlugin PluginDestroy:inPlugin];
}
Expand All @@ -27,7 +27,7 @@ static OSStatus MechanismCreate(AuthorizationPluginRef inPlugin,
AuthorizationMechanismId mechanismId,
AuthorizationMechanismRef *outMechanism) {

[[TCSUnifiedLogger sharedLogger] logString:[NSString stringWithFormat:@"%s %s:%d id:%s",__FUNCTION__, __FILE__,__LINE__,mechanismId] level:LOGLEVELDEBUG];
TCSLog([NSString stringWithFormat:@"%s %s:%d id:%s",__FUNCTION__, [[[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lastPathComponent] cStringUsingEncoding:NSUTF8StringEncoding] ,__LINE__,mechanismId]);

return [authorizationPlugin MechanismCreate:inPlugin
EngineRef:inEngine
Expand All @@ -39,23 +39,24 @@ static OSStatus MechanismInvoke(AuthorizationMechanismRef inMechanism) {
MechanismRecord *mechanism = (MechanismRecord *)inMechanism;

// mechanism->fMechID = mechanismId;
[[TCSUnifiedLogger sharedLogger] logString:[NSString stringWithFormat:@"%s %s:%d id:%s",__FUNCTION__, __FILE__,__LINE__,mechanism->fMechID] level:LOGLEVELDEBUG];

TCSLog([NSString stringWithFormat:@"%s %s:%d id:%s",__FUNCTION__, [[[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lastPathComponent] cStringUsingEncoding:NSUTF8StringEncoding],__LINE__,mechanism->fMechID]);

return [authorizationPlugin MechanismInvoke:inMechanism];
}

static OSStatus MechanismDeactivate(AuthorizationMechanismRef inMechanism) {
MechanismRecord *mechanism = (MechanismRecord *)inMechanism;

[[TCSUnifiedLogger sharedLogger] logString:[NSString stringWithFormat:@"%s %s:%d id:%s",__FUNCTION__, __FILE__,__LINE__,mechanism->fMechID] level:LOGLEVELDEBUG];
TCSLog([NSString stringWithFormat:@"%s %s:%d id:%s",__FUNCTION__, [[[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lastPathComponent] cStringUsingEncoding:NSUTF8StringEncoding],__LINE__,mechanism->fMechID]);

return [authorizationPlugin MechanismDeactivate:inMechanism];
}

static OSStatus MechanismDestroy(AuthorizationMechanismRef inMechanism) {
MechanismRecord *mechanism = (MechanismRecord *)inMechanism;

[[TCSUnifiedLogger sharedLogger] logString:[NSString stringWithFormat:@"%s %s:%d id:%s",__FUNCTION__, __FILE__,__LINE__,mechanism->fMechID] level:LOGLEVELDEBUG];
TCSLog([NSString stringWithFormat:@"%s %s:%d id:%s",__FUNCTION__, [[[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lastPathComponent] cStringUsingEncoding:NSUTF8StringEncoding],__LINE__,mechanism->fMechID]);

return [authorizationPlugin MechanismDestroy:inMechanism];
}
Expand All @@ -72,7 +73,7 @@ static OSStatus MechanismDestroy(AuthorizationMechanismRef inMechanism) {
extern OSStatus AuthorizationPluginCreate(const AuthorizationCallbacks *callbacks,
AuthorizationPluginRef *outPlugin,
const AuthorizationPluginInterface **outPluginInterface) {
[[TCSUnifiedLogger sharedLogger] logString:[NSString stringWithFormat:@"%s %s:%d",__FUNCTION__, __FILE__,__LINE__] level:LOGLEVELDEBUG];
TCSLog([NSString stringWithFormat:@"%s %s:%d",__FUNCTION__, [[[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lastPathComponent] cStringUsingEncoding:NSUTF8StringEncoding],__LINE__]);

if (authorizationPlugin == nil) {
authorizationPlugin = [[XCredsLoginPlugin alloc] init];
Expand All @@ -92,7 +93,7 @@ @implementation XCredsLoginPlugin
- (OSStatus)AuthorizationPluginCreate:(const AuthorizationCallbacks *)callbacks
PluginRef:(AuthorizationPluginRef *)outPlugin
PluginInterface:(const AuthorizationPluginInterface **)outPluginInterface {
[[TCSUnifiedLogger sharedLogger] logString:[NSString stringWithFormat:@"%s %s:%d",__FUNCTION__, __FILE__,__LINE__] level:LOGLEVELDEBUG];
TCSLog([NSString stringWithFormat:@"%s %s:%d",__FUNCTION__, [[[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lastPathComponent] cStringUsingEncoding:NSUTF8StringEncoding],__LINE__]);

PluginRecord *plugin = (PluginRecord *) malloc(sizeof(*plugin));
if (plugin == NULL) return errSecMemoryError;
Expand All @@ -107,11 +108,11 @@ - (OSStatus)MechanismCreate:(AuthorizationPluginRef)inPlugin
EngineRef:(AuthorizationEngineRef)inEngine
MechanismId:(AuthorizationMechanismId)mechanismId
MechanismRef:(AuthorizationMechanismRef *)outMechanism {
[[TCSUnifiedLogger sharedLogger] logString:[NSString stringWithFormat:@"%s %s:%d",__FUNCTION__, __FILE__,__LINE__] level:LOGLEVELDEBUG];
TCSLog([NSString stringWithFormat:@"%s %s:%d",__FUNCTION__, [[[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lastPathComponent] cStringUsingEncoding:NSUTF8StringEncoding],__LINE__]);

MechanismRecord *mechanism = (MechanismRecord *)malloc(sizeof(MechanismRecord));
if (mechanism == NULL) return errSecMemoryError;
TCSLogInfo([NSString stringWithFormat:@"==========> Authorization Plugin %s Mechanism created.<===========\n",mechanismId]);
TCSLog([NSString stringWithFormat:@"==========> Authorization Plugin %s Mechanism created.<===========\n",mechanismId]);
mechanism->fMagic = kMechanismMagic;
mechanism->fEngine = inEngine;
mechanism->fPlugin = (PluginRecord *)inPlugin;
Expand All @@ -129,7 +130,7 @@ - (OSStatus)MechanismCreate:(AuthorizationPluginRef)inPlugin
}

- (OSStatus)MechanismInvoke:(AuthorizationMechanismRef)inMechanism {
[[TCSUnifiedLogger sharedLogger] logString:[NSString stringWithFormat:@"%s %s:%d",__FUNCTION__, __FILE__,__LINE__] level:LOGLEVELDEBUG];
TCSLog([NSString stringWithFormat:@"%s %s:%d",__FUNCTION__, [[[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lastPathComponent] cStringUsingEncoding:NSUTF8StringEncoding],__LINE__]);

MechanismRecord *mechanism = (MechanismRecord *)inMechanism;

Expand Down Expand Up @@ -171,7 +172,7 @@ - (OSStatus)MechanismInvoke:(AuthorizationMechanismRef)inMechanism {
}

- (OSStatus)MechanismDeactivate:(AuthorizationMechanismRef)inMechanism {
[[TCSUnifiedLogger sharedLogger] logString:[NSString stringWithFormat:@"%s %s:%d",__FUNCTION__, __FILE__,__LINE__] level:LOGLEVELDEBUG];
TCSLog([NSString stringWithFormat:@"%s %s:%d",__FUNCTION__, [[[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lastPathComponent] cStringUsingEncoding:NSUTF8StringEncoding],__LINE__]);

OSStatus err;
MechanismRecord *mechanism = (MechanismRecord *)inMechanism;
Expand All @@ -181,7 +182,7 @@ - (OSStatus)MechanismDeactivate:(AuthorizationMechanismRef)inMechanism {
}

- (OSStatus)MechanismDestroy:(AuthorizationMechanismRef)inMechanism {
[[TCSUnifiedLogger sharedLogger] logString:[NSString stringWithFormat:@"%s %s:%d",__FUNCTION__, __FILE__,__LINE__] level:LOGLEVELDEBUG];
TCSLog([NSString stringWithFormat:@"%s %s:%d",__FUNCTION__, [[[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lastPathComponent] cStringUsingEncoding:NSUTF8StringEncoding],__LINE__]);

MechanismRecord *mechanism = (MechanismRecord *)inMechanism;
if (mechanism->fLoginWindow) {
Expand All @@ -194,7 +195,7 @@ - (OSStatus)MechanismDestroy:(AuthorizationMechanismRef)inMechanism {
}

- (OSStatus)PluginDestroy:(AuthorizationPluginRef)inPlugin {
[[TCSUnifiedLogger sharedLogger] logString:[NSString stringWithFormat:@"%s %s:%d",__FUNCTION__, __FILE__,__LINE__] level:LOGLEVELDEBUG];
TCSLog([NSString stringWithFormat:@"%s %s:%d",__FUNCTION__, [[[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lastPathComponent] cStringUsingEncoding:NSUTF8StringEncoding],__LINE__]);

free(inPlugin);
return noErr;
Expand Down
12 changes: 6 additions & 6 deletions xCreds.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5217;
CURRENT_PROJECT_VERSION = 5225;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1271,7 +1271,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5217;
CURRENT_PROJECT_VERSION = 5225;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1391,7 +1391,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5217;
CURRENT_PROJECT_VERSION = 5225;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1428,7 +1428,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5217;
CURRENT_PROJECT_VERSION = 5225;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1578,7 +1578,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5217;
CURRENT_PROJECT_VERSION = 5225;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1615,7 +1615,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5217;
CURRENT_PROJECT_VERSION = 5225;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<key>auth_mech_fixup.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>7</integer>
<integer>8</integer>
</dict>
<key>authrights.xcscheme_^#shared#^_</key>
<dict>
Expand All @@ -42,7 +42,7 @@
<key>test.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>8</integer>
<integer>7</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
Expand Down

0 comments on commit 0f75ef5

Please sign in to comment.