diff options
Diffstat (limited to 'lib/libtdekrb/src/tdekrbserversocket.cpp')
-rw-r--r-- | lib/libtdekrb/src/tdekrbserversocket.cpp | 29 |
1 files changed, 26 insertions, 3 deletions
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 |