|
|
|
@ -83,7 +83,7 @@ TDEKerberosClientSocket::TDEKerberosClientSocket(TQObject *parent, const char *n
|
|
|
|
|
saslData = new SASLDataPrivate;
|
|
|
|
|
saslData->m_krbConnection = NULL;
|
|
|
|
|
m_buffer = new TQBuffer();
|
|
|
|
|
m_buffer->open(IO_ReadWrite);
|
|
|
|
|
m_buffer->open(IO_ReadWrite|IO_Truncate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TDEKerberosClientSocket::~TDEKerberosClientSocket() {
|
|
|
|
@ -109,7 +109,9 @@ void TDEKerberosClientSocket::close() {
|
|
|
|
|
|
|
|
|
|
void TDEKerberosClientSocket::flush() {
|
|
|
|
|
if (m_kerberosRequested) {
|
|
|
|
|
// RAJA FIXME
|
|
|
|
|
// FIXME
|
|
|
|
|
// If a write buffer is implemented, it will need to be flushed before the following call is made
|
|
|
|
|
TQSocket::flush();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
TQSocket::flush();
|
|
|
|
@ -120,7 +122,7 @@ TQIODevice::Offset TDEKerberosClientSocket::size() const {
|
|
|
|
|
TQIODevice::Offset ret;
|
|
|
|
|
|
|
|
|
|
if (m_kerberosRequested) {
|
|
|
|
|
// RAJA FIXME
|
|
|
|
|
ret = m_bufferLength;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
ret = TQSocket::size();
|
|
|
|
@ -134,10 +136,29 @@ TQIODevice::Offset TDEKerberosClientSocket::at() const {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TDEKerberosClientSocket::at(TQIODevice::Offset off) {
|
|
|
|
|
long i;
|
|
|
|
|
bool ret;
|
|
|
|
|
|
|
|
|
|
if (m_kerberosRequested) {
|
|
|
|
|
// RAJA FIXME
|
|
|
|
|
if (off > 0) {
|
|
|
|
|
// Prevent overflow
|
|
|
|
|
if (off > (unsigned long)m_bufferLength) {
|
|
|
|
|
off = m_bufferLength;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Remove the specified bytes from the buffer
|
|
|
|
|
m_bufferLength = m_bufferLength-off;
|
|
|
|
|
TQByteArray ba = m_buffer->buffer();
|
|
|
|
|
for (i=0; i<m_bufferLength;i++) {
|
|
|
|
|
ba[i] = ba[i+off];
|
|
|
|
|
}
|
|
|
|
|
if (m_bufferLength < 1) {
|
|
|
|
|
// Clear the buffer from memory
|
|
|
|
|
m_buffer->close();
|
|
|
|
|
m_buffer->open(IO_ReadWrite|IO_Truncate);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
ret = TQSocket::at(off);
|
|
|
|
@ -150,7 +171,7 @@ bool TDEKerberosClientSocket::atEnd() const {
|
|
|
|
|
bool ret;
|
|
|
|
|
|
|
|
|
|
if (m_kerberosRequested) {
|
|
|
|
|
// RAJA FIXME
|
|
|
|
|
return (m_buffer->at() >= (unsigned long)m_bufferLength);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
ret = TQSocket::atEnd();
|
|
|
|
@ -192,10 +213,36 @@ void TDEKerberosClientSocket::setServerFQDN(TQString name) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQ_LONG TDEKerberosClientSocket::readBlock(char *data, TQ_ULONG maxlen) {
|
|
|
|
|
long i;
|
|
|
|
|
TQ_LONG ret;
|
|
|
|
|
|
|
|
|
|
if (m_kerberosRequested) {
|
|
|
|
|
ret = receiveEncryptedData(data, maxlen);
|
|
|
|
|
int reclen;
|
|
|
|
|
int wrlen;
|
|
|
|
|
char* buf = (char*)malloc(m_negotiatedMaxBufferSize);
|
|
|
|
|
reclen = receiveEncryptedData(buf, m_negotiatedMaxBufferSize);
|
|
|
|
|
m_buffer->at(m_bufferLength);
|
|
|
|
|
wrlen = m_buffer->writeBlock(buf, reclen);
|
|
|
|
|
if (wrlen > 0) {
|
|
|
|
|
m_bufferLength = m_bufferLength + wrlen;
|
|
|
|
|
}
|
|
|
|
|
free(buf);
|
|
|
|
|
|
|
|
|
|
m_buffer->at(0);
|
|
|
|
|
ret = m_buffer->readBlock(data, maxlen);
|
|
|
|
|
if (ret > 0) {
|
|
|
|
|
// Remove the read bytes from the buffer
|
|
|
|
|
m_bufferLength = m_bufferLength-ret;
|
|
|
|
|
TQByteArray ba = m_buffer->buffer();
|
|
|
|
|
for (i=0; i<m_bufferLength;i++) {
|
|
|
|
|
ba[i] = ba[i+ret];
|
|
|
|
|
}
|
|
|
|
|
if (m_bufferLength < 1) {
|
|
|
|
|
// Clear the buffer from memory
|
|
|
|
|
m_buffer->close();
|
|
|
|
|
m_buffer->open(IO_ReadWrite|IO_Truncate);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
ret = TQSocket::readBlock(data, maxlen);
|
|
|
|
@ -218,10 +265,36 @@ TQ_LONG TDEKerberosClientSocket::writeBlock(const char *data, TQ_ULONG len) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQ_LONG TDEKerberosClientSocket::readLine(char *data, TQ_ULONG maxlen) {
|
|
|
|
|
long i;
|
|
|
|
|
TQ_LONG ret;
|
|
|
|
|
|
|
|
|
|
if (m_kerberosRequested) {
|
|
|
|
|
ret = receiveEncryptedData(data, maxlen);
|
|
|
|
|
int reclen;
|
|
|
|
|
int wrlen;
|
|
|
|
|
char* buf = (char*)malloc(m_negotiatedMaxBufferSize);
|
|
|
|
|
reclen = receiveEncryptedData(buf, m_negotiatedMaxBufferSize);
|
|
|
|
|
m_buffer->at(m_bufferLength);
|
|
|
|
|
wrlen = m_buffer->writeBlock(buf, reclen);
|
|
|
|
|
if (wrlen > 0) {
|
|
|
|
|
m_bufferLength = m_bufferLength + wrlen;
|
|
|
|
|
}
|
|
|
|
|
free(buf);
|
|
|
|
|
|
|
|
|
|
m_buffer->at(0);
|
|
|
|
|
ret = m_buffer->readLine(data, maxlen);
|
|
|
|
|
if (ret > 0) {
|
|
|
|
|
// Remove the read bytes from the buffer
|
|
|
|
|
m_bufferLength = m_bufferLength-ret;
|
|
|
|
|
TQByteArray ba = m_buffer->buffer();
|
|
|
|
|
for (i=0; i<m_bufferLength;i++) {
|
|
|
|
|
ba[i] = ba[i+ret];
|
|
|
|
|
}
|
|
|
|
|
if (m_bufferLength < 1) {
|
|
|
|
|
// Clear the buffer from memory
|
|
|
|
|
m_buffer->close();
|
|
|
|
|
m_buffer->open(IO_ReadWrite|IO_Truncate);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
ret = TQSocket::readLine(data, maxlen);
|
|
|
|
@ -231,13 +304,42 @@ TQ_LONG TDEKerberosClientSocket::readLine(char *data, TQ_ULONG maxlen) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQString TDEKerberosClientSocket::readLine() {
|
|
|
|
|
long i;
|
|
|
|
|
TQString ret;
|
|
|
|
|
char *buf;
|
|
|
|
|
|
|
|
|
|
if (m_kerberosRequested) {
|
|
|
|
|
int reclen;
|
|
|
|
|
int wrlen;
|
|
|
|
|
int readlen;
|
|
|
|
|
char* buf = (char*)malloc(m_negotiatedMaxBufferSize);
|
|
|
|
|
reclen = receiveEncryptedData(buf, m_negotiatedMaxBufferSize);
|
|
|
|
|
m_buffer->at(m_bufferLength);
|
|
|
|
|
wrlen = m_buffer->writeBlock(buf, reclen);
|
|
|
|
|
if (wrlen > 0) {
|
|
|
|
|
m_bufferLength = m_bufferLength + wrlen;
|
|
|
|
|
}
|
|
|
|
|
free(buf);
|
|
|
|
|
|
|
|
|
|
m_buffer->at(0);
|
|
|
|
|
buf = (char*)malloc(m_negotiatedMaxBufferSize);
|
|
|
|
|
receiveEncryptedData(buf, m_negotiatedMaxBufferSize);
|
|
|
|
|
ret = TQString(buf);
|
|
|
|
|
readlen = m_buffer->readLine(buf, m_negotiatedMaxBufferSize);
|
|
|
|
|
if (readlen > 0) {
|
|
|
|
|
// Remove the read bytes from the buffer
|
|
|
|
|
m_bufferLength = m_bufferLength-readlen;
|
|
|
|
|
TQByteArray ba = m_buffer->buffer();
|
|
|
|
|
for (i=0; i<m_bufferLength;i++) {
|
|
|
|
|
ba[i] = ba[i+readlen];
|
|
|
|
|
}
|
|
|
|
|
if (m_bufferLength < 1) {
|
|
|
|
|
// Clear the buffer from memory
|
|
|
|
|
m_buffer->close();
|
|
|
|
|
m_buffer->open(IO_ReadWrite|IO_Truncate);
|
|
|
|
|
}
|
|
|
|
|
ret = TQString(buf);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
ret == TQString::null;
|
|
|
|
|
}
|
|
|
|
|
free(buf);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|