aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m
diff options
context:
space:
mode:
Diffstat (limited to 'Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m')
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m31
1 files changed, 2 insertions, 29 deletions
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m
index b143db19..d4146f58 100644
--- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m
+++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m
@@ -34,10 +34,7 @@
#include <pthread.h>
#include <SystemConfiguration/SCNetworkReachability.h>
#include <errno.h>
-#define __STDC_WANT_LIB_EXT1__ 1
#include <string.h>
-#include <stdlib.h>
-#include <dlfcn.h>
#import "SPMySQLUtilities.h"
// Thread flag constant
@@ -56,7 +53,6 @@ const SPMySQLClientFlags SPMySQLConnectionOptions =
const char *SPMySQLSSLPermissibleCiphers = "DHE-RSA-AES256-SHA:AES256-SHA:DHE-RSA-AES128-SHA:AES128-SHA:AES256-RMD:AES128-RMD:DES-CBC3-RMD:DHE-RSA-AES256-RMD:DHE-RSA-AES128-RMD:DHE-RSA-DES-CBC3-RMD:RC4-SHA:RC4-MD5:DES-CBC3-SHA:DES-CBC-SHA:EDH-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC-SHA";
static void PasswordCallback(MYSQL *mysql, const char *plugin, void (^with_password)(const char *passwd));
-static errno_t LegacyMemsetS(void *ptr, rsize_t ignored, int value, rsize_t count);
@implementation SPMySQLConnection
@@ -792,16 +788,8 @@ asm(".desc ___crashreporter_info__, 0x10");
else {
NSLog(@"%s: -getCString:maxLength:encoding: failed for password!", __PRETTY_FUNCTION__);
}
-
- // memset_s is 10.9+ only - if we added a link time dependency, SP wouldn't launch on older targets
- static errno_t (*memsetPtr)(void *, rsize_t, int, rsize_t);
- static dispatch_once_t findMemsetToken;
- dispatch_once(&findMemsetToken, ^{
- memsetPtr = dlsym(RTLD_DEFAULT, "memset_s");
- if(!memsetPtr) memsetPtr = LegacyMemsetS;
- });
-
- memsetPtr(cBuffer, cLength, '\0', cLength); //clear password from memory
+
+ SPMySQLSafeEraseMemory(cBuffer, cLength); //clear password from memory
free(cBuffer);
}
@@ -1240,18 +1228,3 @@ void PasswordCallback(MYSQL *mysql, const char *plugin, void (^with_password)(co
assert(mysql && mysql->sp_context);
[(SPMySQLConnection *)mysql->sp_context _mysqlConnection:mysql wantsPassword:with_password withPlugin:plugin];
}
-
-/**
- * This function tries to emulate the important (to us) parts
- * of memset_s on pre 10.9 systems.
- *
- * The implementation is taken from the original memset_s proposal:
- * http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1381.pdf
- */
-errno_t LegacyMemsetS(void *s, rsize_t smax __attribute__((unused)), int c, rsize_t n)
-{
- volatile unsigned char * addr = (volatile unsigned char *)s;
- while(n--) *addr++ = (unsigned char)c;
-
- return 0;
-}