From 9c5357a28e27b74a6df7bfeeb24015073d5993e5 Mon Sep 17 00:00:00 2001 From: Abhi Beckert Date: Fri, 3 Mar 2017 15:07:37 +1000 Subject: #2437 disable keychain access when passwords are being sent as cleartext --- Source/SPKeychain.m | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Source/SPKeychain.m b/Source/SPKeychain.m index 066f4011..49e2de69 100644 --- a/Source/SPKeychain.m +++ b/Source/SPKeychain.m @@ -38,6 +38,23 @@ @implementation SPKeychain +- (id)init +{ + if (!(self = [super init])) { + return nil; + } + + NSString *cleartext = [NSProcessInfo processInfo].environment[@"LIBMYSQL_ENABLE_CLEARTEXT_PLUGIN"]; + if (cleartext != nil) { + NSLog(@"LIBMYSQL_ENABLE_CLEARTEXT_PLUGIN is set. Disabling keychain access. See Issue #2437"); + + [self release]; + return nil; + } + + return self; +} + /** * Add the supplied password to the user's Keychain using the supplied name and account. */ -- cgit v1.2.3