summaryrefslogtreecommitdiffstats
path: root/lib/libtdekrb/src/tdekrbclientsocket.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-06-26 21:52:21 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-06-26 21:52:21 -0500
commit9c9085621bf01f9b39e15eb856ff521ecb01fccf (patch)
tree0d912f472a89ffccbcc3bb79ceed6a2b3a350118 /lib/libtdekrb/src/tdekrbclientsocket.cpp
parentb2f2dba837c0d28bf73ec36933af901f484633f5 (diff)
downloadulab-9c9085621bf01f9b39e15eb856ff521ecb01fccf.tar.gz
ulab-9c9085621bf01f9b39e15eb856ff521ecb01fccf.zip
Fix krb client/server sockets
Diffstat (limited to 'lib/libtdekrb/src/tdekrbclientsocket.cpp')
-rw-r--r--lib/libtdekrb/src/tdekrbclientsocket.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/libtdekrb/src/tdekrbclientsocket.cpp b/lib/libtdekrb/src/tdekrbclientsocket.cpp
index 647da73..96833a2 100644
--- a/lib/libtdekrb/src/tdekrbclientsocket.cpp
+++ b/lib/libtdekrb/src/tdekrbclientsocket.cpp
@@ -171,7 +171,7 @@ bool TDEKerberosClientSocket::atEnd() const {
bool ret;
if (m_kerberosRequested) {
- return (m_buffer->at() >= (unsigned long)m_bufferLength);
+ ret = TQSocket::atEnd();
}
else {
ret = TQSocket::atEnd();
@@ -230,6 +230,9 @@ TQ_LONG TDEKerberosClientSocket::readBlock(char *data, TQ_ULONG maxlen) {
}
free(buf);
+ if (maxlen > (unsigned int)m_bufferLength) {
+ maxlen = m_bufferLength;
+ }
m_buffer->at(0);
ret = m_buffer->readBlock(data, maxlen);
if (ret > 0) {
@@ -284,6 +287,9 @@ TQ_LONG TDEKerberosClientSocket::readLine(char *data, TQ_ULONG maxlen) {
}
free(buf);
+ if (maxlen > (unsigned int)m_bufferLength) {
+ maxlen = m_bufferLength;
+ }
m_buffer->at(0);
ret = m_buffer->readLine(data, maxlen);
if (ret > 0) {
@@ -310,11 +316,13 @@ TQ_LONG TDEKerberosClientSocket::readLine(char *data, TQ_ULONG maxlen) {
TQString TDEKerberosClientSocket::readLine() {
long i;
TQString ret;
+ long maxlen;
if (m_kerberosRequested) {
int reclen;
int wrlen;
int readlen;
+ maxlen = m_negotiatedMaxBufferSize;
char* buf = (char*)malloc(m_negotiatedMaxBufferSize);
reclen = receiveEncryptedData(buf, m_negotiatedMaxBufferSize);
if (reclen > 0) {
@@ -326,9 +334,12 @@ TQString TDEKerberosClientSocket::readLine() {
}
free(buf);
+ if (maxlen > m_bufferLength) {
+ maxlen = m_bufferLength;
+ }
m_buffer->at(0);
- buf = (char*)malloc(m_negotiatedMaxBufferSize);
- readlen = m_buffer->readLine(buf, m_negotiatedMaxBufferSize);
+ buf = (char*)malloc(maxlen);
+ readlen = m_buffer->readLine(buf, maxlen);
if (readlen > 0) {
// Remove the read bytes from the buffer
m_bufferLength = m_bufferLength-readlen;