diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-07-01 20:43:39 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-07-01 20:43:39 -0500 |
commit | 963501ff41849e6bbcaa7a5c12c6e04b37a8a130 (patch) | |
tree | a92d85facc6b5168890d78e9ad8944fd96d5507a /lib | |
parent | e9dafbb9d016a1aa5e90bb12c63c12b8521cf059 (diff) | |
download | ulab-963501ff41849e6bbcaa7a5c12c6e04b37a8a130.tar.gz ulab-963501ff41849e6bbcaa7a5c12c6e04b37a8a130.zip |
Fix crashes in servers
Start work on FPGA client
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libtdekrb/src/tdekrbclientsocket.cpp | 20 | ||||
-rw-r--r-- | lib/libtdekrb/src/tdekrbclientsocket.h | 1 | ||||
-rw-r--r-- | lib/libtdekrb/src/tdekrbserversocket.cpp | 29 | ||||
-rw-r--r-- | lib/libtdekrb/src/tdekrbserversocket.h | 1 |
4 files changed, 45 insertions, 6 deletions
diff --git a/lib/libtdekrb/src/tdekrbclientsocket.cpp b/lib/libtdekrb/src/tdekrbclientsocket.cpp index 6ba35e5..952f28d 100644 --- a/lib/libtdekrb/src/tdekrbclientsocket.cpp +++ b/lib/libtdekrb/src/tdekrbclientsocket.cpp @@ -97,7 +97,7 @@ static int logSASLMessages(void *context __attribute__((unused)), int priority, return SASL_OK; } -TDEKerberosClientSocket::TDEKerberosClientSocket(TQObject *parent, const char *name) : TQSocket(parent, name), m_kerberosRequested(false), m_criticalSection(0), m_bufferLength(0), m_krbInitRunning(false), m_krbInitState(-1), m_dataTimeout(-1), m_canary(NULL), m_negotiatedMaxBufferSize(NET_SEC_BUF_SIZE) { +TDEKerberosClientSocket::TDEKerberosClientSocket(TQObject *parent, const char *name) : TQSocket(parent, name), m_kerberosRequested(false), m_criticalSection(0), m_bufferLength(0), m_krbInitRunning(false), m_krbInitState(-1), m_dataTimeout(-1), kerberosInitLoopTimer(NULL), m_canary(NULL), m_negotiatedMaxBufferSize(NET_SEC_BUF_SIZE) { saslData = new SASLDataPrivate; saslData->m_krbConnection = NULL; m_buffer = new TQBuffer(); @@ -108,6 +108,11 @@ TDEKerberosClientSocket::~TDEKerberosClientSocket() { if (m_canary) { *m_canary = true; } + if (kerberosInitLoopTimer) { + kerberosInitLoopTimer->stop(); + delete kerberosInitLoopTimer; + kerberosInitLoopTimer = NULL; + } m_buffer->close(); delete m_buffer; delete saslData; @@ -795,6 +800,11 @@ void TDEKerberosClientSocket::continueKerberosInitialization() { m_negotiatedMaxBufferSize = NET_SEC_BUF_SIZE; } else { + // For some reason m_negotiatedMaxBufferSize can be set negative under certain circumstances + // Prevent that from happening! + if (m_negotiatedMaxBufferSize < NET_SEC_BUF_SIZE) { + m_negotiatedMaxBufferSize = NET_SEC_BUF_SIZE; + } printf("[DEBUG] Maximum buffer size: %d\n", m_negotiatedMaxBufferSize); } m_krbInitState = 3; @@ -810,7 +820,7 @@ void TDEKerberosClientSocket::continueKerberosInitialization() { } break; } - TQTimer::singleShot(0, this, SLOT(continueKerberosInitialization())); + if (kerberosInitLoopTimer) kerberosInitLoopTimer->start(0, TRUE); } } @@ -869,7 +879,11 @@ int TDEKerberosClientSocket::initializeKerberosInterface() { m_krbInitRunning = true; m_krbInitState = 0; - TQTimer::singleShot(0, this, SLOT(continueKerberosInitialization())); + if (!kerberosInitLoopTimer) { + kerberosInitLoopTimer = new TQTimer(); + connect(kerberosInitLoopTimer, SIGNAL(timeout()), this, SLOT(continueKerberosInitialization())); + } + if (kerberosInitLoopTimer) kerberosInitLoopTimer->start(0, TRUE); return 0; }
\ No newline at end of file diff --git a/lib/libtdekrb/src/tdekrbclientsocket.h b/lib/libtdekrb/src/tdekrbclientsocket.h index f058220..fc7da95 100644 --- a/lib/libtdekrb/src/tdekrbclientsocket.h +++ b/lib/libtdekrb/src/tdekrbclientsocket.h @@ -95,6 +95,7 @@ class TDEKerberosClientSocket : public TQSocket int m_krbInitState; TQString m_prevStatusMessage; int m_dataTimeout; + TQTimer* kerberosInitLoopTimer; bool* m_canary; private: diff --git a/lib/libtdekrb/src/tdekrbserversocket.cpp b/lib/libtdekrb/src/tdekrbserversocket.cpp index 3134738..d395936 100644 --- a/lib/libtdekrb/src/tdekrbserversocket.cpp +++ b/lib/libtdekrb/src/tdekrbserversocket.cpp @@ -97,7 +97,7 @@ static int logSASLMessages(void *context __attribute__((unused)), int priority, return SASL_OK; } -TDEKerberosServerSocket::TDEKerberosServerSocket(TQObject *parent, const char *name) : TQSocket(parent, name), m_kerberosRequested(false), m_criticalSection(0), m_bufferLength(0), m_krbInitRunning(false), m_krbInitState(-1), m_dataTimeout(-1), m_canary(NULL), m_negotiatedMaxBufferSize(NET_SEC_BUF_SIZE) { +TDEKerberosServerSocket::TDEKerberosServerSocket(TQObject *parent, const char *name) : TQSocket(parent, name), m_kerberosRequested(false), m_criticalSection(0), m_bufferLength(0), m_krbInitRunning(false), m_krbInitState(-1), m_dataTimeout(-1), kerberosInitLoopTimer(NULL), m_canary(NULL), m_negotiatedMaxBufferSize(NET_SEC_BUF_SIZE) { saslData = new SASLDataPrivate; saslData->m_krbConnection = NULL; m_buffer = new TQBuffer(); @@ -108,6 +108,11 @@ TDEKerberosServerSocket::~TDEKerberosServerSocket() { if (m_canary) { *m_canary = true; } + if (kerberosInitLoopTimer) { + kerberosInitLoopTimer->stop(); + delete kerberosInitLoopTimer; + kerberosInitLoopTimer = NULL; + } m_buffer->close(); delete m_buffer; delete saslData; @@ -794,6 +799,20 @@ void TDEKerberosServerSocket::continueKerberosInitialization() { else { printf("[DEBUG] Authenticated SSF: %d\n", *ssf); } + + m_krbInitResult = sasl_getprop(saslData->m_krbConnection, SASL_MAXOUTBUF, (const void **)&m_negotiatedMaxBufferSize); + if (m_krbInitResult != SASL_OK) { + printf("[WARNING] Unable to determine maximum buffer size!\n\r"); + m_negotiatedMaxBufferSize = NET_SEC_BUF_SIZE; + } + else { + // For some reason m_negotiatedMaxBufferSize can be set negative under certain circumstances + // Prevent that from happening! + if (m_negotiatedMaxBufferSize < NET_SEC_BUF_SIZE) { + m_negotiatedMaxBufferSize = NET_SEC_BUF_SIZE; + } + printf("[DEBUG] Maximum buffer size: %d\n", m_negotiatedMaxBufferSize); + } m_krbInitState = 4; m_krbInitRunning = false; setStatusMessage(i18n("Kerberos connection established")); @@ -807,7 +826,7 @@ void TDEKerberosServerSocket::continueKerberosInitialization() { } break; } - TQTimer::singleShot(0, this, SLOT(continueKerberosInitialization())); + if (kerberosInitLoopTimer) kerberosInitLoopTimer->start(0, TRUE); } } @@ -884,7 +903,11 @@ int TDEKerberosServerSocket::initializeKerberosInterface() { m_krbInitRunning = true; m_krbInitState = 0; - TQTimer::singleShot(0, this, SLOT(continueKerberosInitialization())); + if (!kerberosInitLoopTimer) { + kerberosInitLoopTimer = new TQTimer(); + connect(kerberosInitLoopTimer, SIGNAL(timeout()), this, SLOT(continueKerberosInitialization())); + } + if (kerberosInitLoopTimer) kerberosInitLoopTimer->start(0, TRUE); return 0; }
\ No newline at end of file diff --git a/lib/libtdekrb/src/tdekrbserversocket.h b/lib/libtdekrb/src/tdekrbserversocket.h index 6276358..42f3a2d 100644 --- a/lib/libtdekrb/src/tdekrbserversocket.h +++ b/lib/libtdekrb/src/tdekrbserversocket.h @@ -99,6 +99,7 @@ class TDEKerberosServerSocket : public TQSocket int m_krbInitState; TQString m_prevStatusMessage; int m_dataTimeout; + TQTimer* kerberosInitLoopTimer; bool* m_canary; private: |