<rdar://problem/12243932>

Change RNBSocket from using lockdown's lockdown_secure_checkin()
function to using lockdown's secure_lockdown_checkin() function.

llvm-svn: 172775
This commit is contained in:
Jason Molenda
2013-01-18 01:20:12 +00:00
parent 92c487d13c
commit 7eaf54d8e6
2 changed files with 21 additions and 5 deletions

View File

@@ -188,15 +188,18 @@ RNBSocket::ConnectToService()
DNBLog("Connecting to com.apple.%s service...", DEBUGSERVER_PROGRAM_NAME);
// Disconnect from any previous connections
Disconnect(false);
SSLContextRef ssl_ctx;
bzero(&ssl_ctx, sizeof(ssl_ctx));
if (::lockdown_secure_checkin (&m_fd, &ssl_ctx, NULL, NULL) != kLDESuccess)
if (::secure_lockdown_checkin (&m_ld_conn, NULL, NULL) != kLDESuccess)
{
DNBLogThreadedIf(LOG_RNB_COMM, "::lockdown_secure_checkin(&m_fd, NULL, NULL, NULL) failed");
DNBLogThreadedIf(LOG_RNB_COMM, "::secure_lockdown_checkin(&m_fd, NULL, NULL) failed");
m_fd = -1;
return rnb_not_connected;
}
m_fd = ::lockdown_get_socket (m_ld_conn);
if (m_fd == -1)
{
DNBLogThreadedIf(LOG_RNB_COMM, "::lockdown_get_socket() failed");
return rnb_not_connected;
}
m_fd_from_lockdown = true;
return rnb_success;
}
@@ -238,7 +241,14 @@ RNBSocket::Disconnect (bool save_errno)
{
#ifdef WITH_LOCKDOWN
if (m_fd_from_lockdown)
{
m_fd_from_lockdown = false;
m_fd = -1;
if (lockdown_deactivate (m_ld_conn) == 0)
return rnb_success;
else
return rnb_err;
}
#endif
return ClosePort (m_fd, save_errno);
}

View File

@@ -20,6 +20,10 @@
#include <string>
#include "DNBTimer.h"
#ifdef WITH_LOCKDOWN
#include "lockdown.h"
#endif
class RNBSocket
{
public:
@@ -29,6 +33,7 @@ public:
m_fd (-1),
#ifdef WITH_LOCKDOWN
m_fd_from_lockdown (false),
m_ld_conn (),
#endif
m_timer (true) // Make a thread safe timer
{
@@ -67,6 +72,7 @@ protected:
#ifdef WITH_LOCKDOWN
bool m_fd_from_lockdown;
lockdown_connection m_ld_conn;
#endif
DNBTimer m_timer;