diff options
Diffstat (limited to 'lib/libtdekrb')
-rw-r--r-- | lib/libtdekrb/src/tdekrbclientsocket.cpp | 66 | ||||
-rw-r--r-- | lib/libtdekrb/src/tdekrbclientsocket.h | 10 | ||||
-rw-r--r-- | lib/libtdekrb/src/tdekrbserversocket.cpp | 66 | ||||
-rw-r--r-- | lib/libtdekrb/src/tdekrbserversocket.h | 10 |
4 files changed, 142 insertions, 10 deletions
diff --git a/lib/libtdekrb/src/tdekrbclientsocket.cpp b/lib/libtdekrb/src/tdekrbclientsocket.cpp index ad7f0bd..a567a09 100644 --- a/lib/libtdekrb/src/tdekrbclientsocket.cpp +++ b/lib/libtdekrb/src/tdekrbclientsocket.cpp @@ -22,6 +22,7 @@ #include <unistd.h> #include <tqapplication.h> +#include <tqbuffer.h> #include <sasl.h> #include <saslplug.h> @@ -78,12 +79,16 @@ 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_negotiatedMaxBufferSize(NET_SEC_BUF_SIZE), m_criticalSection(0) { +TDEKerberosClientSocket::TDEKerberosClientSocket(TQObject *parent, const char *name) : TQSocket(parent, name), m_kerberosRequested(false), m_criticalSection(0), m_negotiatedMaxBufferSize(NET_SEC_BUF_SIZE) { saslData = new SASLDataPrivate; saslData->m_krbConnection = NULL; + m_buffer = new TQBuffer(); + m_buffer->open(IO_ReadWrite); } TDEKerberosClientSocket::~TDEKerberosClientSocket() { + m_buffer->close(); + delete m_buffer; delete saslData; } @@ -102,6 +107,58 @@ void TDEKerberosClientSocket::close() { } } +void TDEKerberosClientSocket::flush() { + if (m_kerberosRequested) { + // RAJA FIXME + } + else { + TQSocket::flush(); + } +} + +TQIODevice::Offset TDEKerberosClientSocket::size() const { + TQIODevice::Offset ret; + + if (m_kerberosRequested) { + // RAJA FIXME + } + else { + ret = TQSocket::size(); + } + + return ret; +} + +TQIODevice::Offset TDEKerberosClientSocket::at() const { + return TQSocket::at(); +} + +bool TDEKerberosClientSocket::at(TQIODevice::Offset off) { + bool ret; + + if (m_kerberosRequested) { + // RAJA FIXME + } + else { + ret = TQSocket::at(off); + } + + return ret; +} + +bool TDEKerberosClientSocket::atEnd() const { + bool ret; + + if (m_kerberosRequested) { + // RAJA FIXME + } + else { + ret = TQSocket::atEnd(); + } + + return ret; +} + int TDEKerberosClientSocket::setUsingKerberos(bool krbactive) { int ret = 0; @@ -227,7 +284,9 @@ void TDEKerberosClientSocket::sendSASLDataToNetwork(const char *buffer, unsigned len = strlen(buf); buf[len] = '\n'; buf[len+1] = 0; - write(netfd, buf, len+1); + if (write(netfd, buf, len+1) < 0) { + // ERROR + } free(buf); } @@ -297,7 +356,7 @@ int TDEKerberosClientSocket::transmitEncryptedData(int fd, const char* readbuf, return 0; } -int TDEKerberosClientSocket::receiveEncryptedData(char *buf, int trunclen) { +int TDEKerberosClientSocket::receiveEncryptedData(char *buf, unsigned int trunclen) { unsigned int recv_len; const char *recv_data; int result; @@ -340,7 +399,6 @@ int TDEKerberosClientSocket::initializeKerberosInterface() { unsigned int len; int slen; const char *data; - char user_authorized = 0; sasl_ssf_t *ssf; char *iplocal = NULL; char *ipremote = NULL; diff --git a/lib/libtdekrb/src/tdekrbclientsocket.h b/lib/libtdekrb/src/tdekrbclientsocket.h index d0eb018..f1330a4 100644 --- a/lib/libtdekrb/src/tdekrbclientsocket.h +++ b/lib/libtdekrb/src/tdekrbclientsocket.h @@ -25,6 +25,7 @@ #define N_CALLBACKS 3 +class TQBuffer; class SASLDataPrivate; class TDEKerberosClientSocket : public TQSocket @@ -37,6 +38,12 @@ class TDEKerberosClientSocket : public TQSocket bool open(int mode); void close(); + void flush(); + Offset size() const; + Offset at() const; + bool at(Offset off); + bool atEnd() const; + TQ_LONG readBlock(char *data, TQ_ULONG maxlen); TQ_LONG writeBlock(const char *data, TQ_ULONG len); TQ_LONG readLine(char *data, TQ_ULONG maxlen); @@ -53,13 +60,14 @@ class TDEKerberosClientSocket : public TQSocket void sendSASLDataToNetwork(const char *buffer, unsigned length, int netfd); int getSASLDataFromNetwork(char *buf, int trunclen); int transmitEncryptedData(int fd, const char* readbuf, int cc); - int receiveEncryptedData(char *buf, int trunclen); + int receiveEncryptedData(char *buf, unsigned int trunclen); private: bool m_kerberosRequested; TQString m_serviceName; TQString m_serverFQDN; int m_criticalSection; + TQBuffer* m_buffer; private: SASLDataPrivate *saslData; diff --git a/lib/libtdekrb/src/tdekrbserversocket.cpp b/lib/libtdekrb/src/tdekrbserversocket.cpp index cd7fa88..1f6d755 100644 --- a/lib/libtdekrb/src/tdekrbserversocket.cpp +++ b/lib/libtdekrb/src/tdekrbserversocket.cpp @@ -22,6 +22,7 @@ #include <unistd.h> #include <tqapplication.h> +#include <tqbuffer.h> #include <sasl.h> #include <saslplug.h> @@ -78,12 +79,16 @@ 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_negotiatedMaxBufferSize(NET_SEC_BUF_SIZE), m_criticalSection(0) { +TDEKerberosServerSocket::TDEKerberosServerSocket(TQObject *parent, const char *name) : TQSocket(parent, name), m_kerberosRequested(false), m_criticalSection(0), m_negotiatedMaxBufferSize(NET_SEC_BUF_SIZE) { saslData = new SASLDataPrivate; saslData->m_krbConnection = NULL; + m_buffer = new TQBuffer(); + m_buffer->open(IO_ReadWrite); } TDEKerberosServerSocket::~TDEKerberosServerSocket() { + m_buffer->close(); + delete m_buffer; delete saslData; } @@ -102,6 +107,58 @@ void TDEKerberosServerSocket::close() { } } +void TDEKerberosServerSocket::flush() { + if (m_kerberosRequested) { + // RAJA FIXME + } + else { + TQSocket::flush(); + } +} + +TQIODevice::Offset TDEKerberosServerSocket::size() const { + TQIODevice::Offset ret; + + if (m_kerberosRequested) { + // RAJA FIXME + } + else { + ret = TQSocket::size(); + } + + return ret; +} + +TQIODevice::Offset TDEKerberosServerSocket::at() const { + return TQSocket::at(); +} + +bool TDEKerberosServerSocket::at(TQIODevice::Offset off) { + bool ret; + + if (m_kerberosRequested) { + // RAJA FIXME + } + else { + ret = TQSocket::at(off); + } + + return ret; +} + +bool TDEKerberosServerSocket::atEnd() const { + bool ret; + + if (m_kerberosRequested) { + // RAJA FIXME + } + else { + ret = TQSocket::atEnd(); + } + + return ret; +} + int TDEKerberosServerSocket::setUsingKerberos(bool krbactive) { int ret = 0; @@ -227,7 +284,9 @@ void TDEKerberosServerSocket::sendSASLDataToNetwork(const char *buffer, unsigned len = strlen(buf); buf[len] = '\n'; buf[len+1] = 0; - write(netfd, buf, len+1); + if (write(netfd, buf, len+1) < 0) { + // ERROR + } free(buf); } @@ -297,7 +356,7 @@ int TDEKerberosServerSocket::transmitEncryptedData(int fd, const char* readbuf, return 0; } -int TDEKerberosServerSocket::receiveEncryptedData(char *buf, int trunclen) { +int TDEKerberosServerSocket::receiveEncryptedData(char *buf, unsigned int trunclen) { unsigned int recv_len; const char *recv_data; int result; @@ -341,7 +400,6 @@ int TDEKerberosServerSocket::initializeKerberosInterface() { int slen; int count; const char *data; - char user_authorized = 0; sasl_ssf_t *ssf; // FIXME diff --git a/lib/libtdekrb/src/tdekrbserversocket.h b/lib/libtdekrb/src/tdekrbserversocket.h index 0b977f5..1cce2ef 100644 --- a/lib/libtdekrb/src/tdekrbserversocket.h +++ b/lib/libtdekrb/src/tdekrbserversocket.h @@ -25,6 +25,7 @@ #define N_CALLBACKS 3 +class TQBuffer; class SASLDataPrivate; class TDEKerberosServerSocket : public TQSocket @@ -37,6 +38,12 @@ class TDEKerberosServerSocket : public TQSocket bool open(int mode); void close(); + void flush(); + Offset size() const; + Offset at() const; + bool at(Offset off); + bool atEnd() const; + TQ_LONG readBlock(char *data, TQ_ULONG maxlen); TQ_LONG writeBlock(const char *data, TQ_ULONG len); TQ_LONG readLine(char *data, TQ_ULONG maxlen); @@ -53,7 +60,7 @@ class TDEKerberosServerSocket : public TQSocket void sendSASLDataToNetwork(const char *buffer, unsigned length, int netfd); int getSASLDataFromNetwork(char *buf, int trunclen); int transmitEncryptedData(int fd, const char* readbuf, int cc); - int receiveEncryptedData(char *buf, int trunclen); + int receiveEncryptedData(char *buf, unsigned int trunclen); protected: TQString m_authenticatedUserName; @@ -64,6 +71,7 @@ class TDEKerberosServerSocket : public TQSocket TQString m_serviceName; TQString m_serverFQDN; int m_criticalSection; + TQBuffer* m_buffer; private: SASLDataPrivate *saslData; |