diff options
Diffstat (limited to 'kopete/protocols/jabber/libiris/iris/xmpp-core/simplesasl.cpp')
-rw-r--r-- | kopete/protocols/jabber/libiris/iris/xmpp-core/simplesasl.cpp | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/kopete/protocols/jabber/libiris/iris/xmpp-core/simplesasl.cpp b/kopete/protocols/jabber/libiris/iris/xmpp-core/simplesasl.cpp index 82a7aac4..c825a2ca 100644 --- a/kopete/protocols/jabber/libiris/iris/xmpp-core/simplesasl.cpp +++ b/kopete/protocols/jabber/libiris/iris/xmpp-core/simplesasl.cpp @@ -20,10 +20,10 @@ #include"simplesasl.h" -#include<qhostaddress.h> -#include<qstringlist.h> -#include<qptrlist.h> -#include<qvaluelist.h> +#include<tqhostaddress.h> +#include<tqstringlist.h> +#include<tqptrlist.h> +#include<tqvaluelist.h> #include<qca.h> #include<stdlib.h> #include"base64.h" @@ -33,17 +33,17 @@ namespace XMPP struct Prop { - QCString var, val; + TQCString var, val; }; -class PropList : public QValueList<Prop> +class PropList : public TQValueList<Prop> { public: - PropList() : QValueList<Prop>() + PropList() : TQValueList<Prop>() { } - void set(const QCString &var, const QCString &val) + void set(const TQCString &var, const TQCString &val) { Prop p; p.var = var; @@ -51,18 +51,18 @@ public: append(p); } - QCString get(const QCString &var) + TQCString get(const TQCString &var) { for(ConstIterator it = begin(); it != end(); ++it) { if((*it).var == var) return (*it).val; } - return QCString(); + return TQCString(); } - QCString toString() const + TQCString toString() const { - QCString str; + TQCString str; bool first = true; for(ConstIterator it = begin(); it != end(); ++it) { if(!first) @@ -73,7 +73,7 @@ public: return str; } - bool fromString(const QCString &str) + bool fromString(const TQCString &str) { PropList list; int at = 0; @@ -81,7 +81,7 @@ public: int n = str.find('=', at); if(n == -1) break; - QCString var, val; + TQCString var, val; var = str.mid(at, n-at); at = n + 1; if(str[at] == '\"') { @@ -122,7 +122,7 @@ public: return true; } - int varCount(const QCString &var) + int varCount(const TQCString &var) { int n = 0; for(ConstIterator it = begin(); it != end(); ++it) { @@ -132,9 +132,9 @@ public: return n; } - QStringList getValues(const QCString &var) + TQStringList getValues(const TQCString &var) { - QStringList list; + TQStringList list; for(ConstIterator it = begin(); it != end(); ++it) { if((*it).var == var) list += (*it).val; @@ -147,19 +147,19 @@ class SimpleSASLContext : public QCA_SASLContext { public: // core props - QString service, host; + TQString service, host; // state int step; - QByteArray in_buf; - QString out_mech; - QByteArray out_buf; + TQByteArray in_buf; + TQString out_mech; + TQByteArray out_buf; bool capable; int err; QCA_SASLNeedParams need; QCA_SASLNeedParams have; - QString user, authz, pass, realm; + TQString user, authz, pass, realm; SimpleSASLContext() { @@ -179,7 +179,7 @@ public: void resetState() { - out_mech = QString(); + out_mech = TQString(); out_buf.resize(0); err = -1; } @@ -195,19 +195,19 @@ public: have.authzid = false; have.pass = false; have.realm = false; - user = QString(); - authz = QString(); - pass = QString(); - realm = QString(); + user = TQString(); + authz = TQString(); + pass = TQString(); + realm = TQString(); } - void setCoreProps(const QString &_service, const QString &_host, QCA_SASLHostPort *, QCA_SASLHostPort *) + void setCoreProps(const TQString &_service, const TQString &_host, QCA_SASLHostPort *, QCA_SASLHostPort *) { service = _service; host = _host; } - void setSecurityProps(bool, bool, bool, bool, bool reqForward, bool reqCreds, bool reqMutual, int ssfMin, int, const QString &, int) + void setSecurityProps(bool, bool, bool, bool, bool reqForward, bool reqCreds, bool reqMutual, int ssfMin, int, const TQString &, int) { if(reqForward || reqCreds || reqMutual || ssfMin > 0) capable = false; @@ -225,10 +225,10 @@ public: return err; } - bool clientStart(const QStringList &mechlist) + bool clientStart(const TQStringList &mechlist) { bool haveMech = false; - for(QStringList::ConstIterator it = mechlist.begin(); it != mechlist.end(); ++it) { + for(TQStringList::ConstIterator it = mechlist.begin(); it != mechlist.end(); ++it) { if((*it) == "DIGEST-MD5") { haveMech = true; break; @@ -249,12 +249,12 @@ public: return clientTryAgain(); } - bool serverStart(const QString &, QStringList *, const QString &) + bool serverStart(const TQString &, TQStringList *, const TQString &) { return false; } - int serverFirstStep(const QString &, const QByteArray *) + int serverFirstStep(const TQString &, const TQByteArray *) { return Error; } @@ -264,7 +264,7 @@ public: return need; } - void setClientParams(const QString *_user, const QString *_authzid, const QString *_pass, const QString *_realm) + void setClientParams(const TQString *_user, const TQString *_authzid, const TQString *_pass, const TQString *_realm) { if(_user) { user = *_user; @@ -288,17 +288,17 @@ public: } } - QString username() const + TQString username() const { - return QString(); + return TQString(); } - QString authzid() const + TQString authzid() const { - return QString(); + return TQString(); } - int nextStep(const QByteArray &in) + int nextStep(const TQByteArray &in) { in_buf = in.copy(); return tryAgain(); @@ -309,17 +309,17 @@ public: return clientTryAgain(); } - QString mech() const + TQString mech() const { return out_mech; } - const QByteArray *clientInit() const + const TQByteArray *clientInit() const { return 0; } - QByteArray result() const + TQByteArray result() const { return out_buf; } @@ -349,7 +349,7 @@ public: return NeedParams; // get props - QCString cs(in_buf.data(), in_buf.size()+1); + TQCString cs(in_buf.data(), in_buf.size()+1); PropList in; if(!in.fromString(cs)) { err = QCA::SASL::BadProto; @@ -357,30 +357,30 @@ public: } // make a cnonce - QByteArray a(32); + TQByteArray a(32); for(int n = 0; n < (int)a.size(); ++n) a[n] = (char)(256.0*rand()/(RAND_MAX+1.0)); - QCString cnonce = Base64::arrayToString(a).latin1(); + TQCString cnonce = Base64::arrayToString(a).latin1(); // make other variables realm = host; - QCString nonce = in.get("nonce"); - QCString nc = "00000001"; - QCString uri = service.utf8() + '/' + host.utf8(); - QCString qop = "auth"; + TQCString nonce = in.get("nonce"); + TQCString nc = "00000001"; + TQCString uri = service.utf8() + '/' + host.utf8(); + TQCString qop = "auth"; // build 'response' - QCString X = user.utf8() + ':' + realm.utf8() + ':' + pass.utf8(); - QByteArray Y = QCA::MD5::hash(X); - QCString tmp = QCString(":") + nonce + ':' + cnonce + ':' + authz.utf8(); - QByteArray A1(Y.size() + tmp.length()); + TQCString X = user.utf8() + ':' + realm.utf8() + ':' + pass.utf8(); + TQByteArray Y = QCA::MD5::hash(X); + TQCString tmp = TQCString(":") + nonce + ':' + cnonce + ':' + authz.utf8(); + TQByteArray A1(Y.size() + tmp.length()); memcpy(A1.data(), Y.data(), Y.size()); memcpy(A1.data() + Y.size(), tmp.data(), tmp.length()); - QCString A2 = "AUTHENTICATE:" + uri; - QCString HA1 = QCA::MD5::hashToString(A1).latin1(); - QCString HA2 = QCA::MD5::hashToString(A2).latin1(); - QCString KD = HA1 + ':' + nonce + ':' + nc + ':' + cnonce + ':' + qop + ':' + HA2; - QCString Z = QCA::MD5::hashToString(KD).latin1(); + TQCString A2 = "AUTHENTICATE:" + uri; + TQCString HA1 = QCA::MD5::hashToString(A1).latin1(); + TQCString HA2 = QCA::MD5::hashToString(A2).latin1(); + TQCString KD = HA1 + ':' + nonce + ':' + nc + ':' + cnonce + ':' + qop + ':' + HA2; + TQCString Z = QCA::MD5::hashToString(KD).latin1(); // build output PropList out; @@ -396,7 +396,7 @@ public: out.set("response", Z); out.set("charset", "utf-8"); out.set("authzid", authz.utf8()); - QCString s = out.toString(); + TQCString s = out.toString(); // done out_buf.resize(s.length()); @@ -410,13 +410,13 @@ public: } } - bool encode(const QByteArray &a, QByteArray *b) + bool encode(const TQByteArray &a, TQByteArray *b) { *b = a.copy(); return true; } - bool decode(const QByteArray &a, QByteArray *b) + bool decode(const TQByteArray &a, TQByteArray *b) { *b = a.copy(); return true; |