diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-06-04 19:59:19 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-06-04 19:59:19 +0200 |
commit | 50d92f64547c5c06851976ceab5ed631ec93f647 (patch) | |
tree | b534195938d22b7ccfd630c58b7ab1288653ef8e /src/Server/RequestHandlers | |
parent | f79a215fce13d86a495b6741aae0827ccce43757 (diff) | |
download | mad-50d92f64547c5c06851976ceab5ed631ec93f647.tar mad-50d92f64547c5c06851976ceab5ed631ec93f647.zip |
GSSAPI-Funktionen vor?bergehend entfernt
Diffstat (limited to 'src/Server/RequestHandlers')
-rw-r--r-- | src/Server/RequestHandlers/GSSAPIAuthRequestHandler.cpp | 127 | ||||
-rw-r--r-- | src/Server/RequestHandlers/GSSAPIAuthRequestHandler.h | 48 |
2 files changed, 0 insertions, 175 deletions
diff --git a/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.cpp b/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.cpp deleted file mode 100644 index dba92c7..0000000 --- a/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * GSSAPIAuthRequestHandler.cpp - * - * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de> - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "GSSAPIAuthRequestHandler.h" -#include <Common/Logger.h> -#include <Net/Exception.h> - -#include <cstring> - -namespace Mad { -namespace Server { -namespace RequestHandlers { - -// TODO Error handling - -void GSSAPIAuthRequestHandler::handlePacket(const Common::XmlPacket &packet) { - if(packet.getType() != "AuthGSSAPI") { - Common::Logger::log(Common::Logger::ERROR, "Received an unexpected packet."); - - Common::XmlPacket ret; - ret.setType("Error"); - ret.add("ErrorCode", Net::Exception::UNEXPECTED_PACKET); - - sendPacket(ret); - - signalFinished(); - return; - } - - OM_uint32 majStat, minStat; - gss_buffer_desc recvBuffer, sendBuffer; - - // Needs error handling! - - if(gssContinue) { - const void *pkgData; - packet["authToken"].getBinaryData(&pkgData, &recvBuffer.length); - - recvBuffer.value = std::malloc(recvBuffer.length); - std::memcpy(recvBuffer.value, pkgData, recvBuffer.length); - - majStat = gss_accept_sec_context(&minStat, &gssContext, GSS_C_NO_CREDENTIAL, &recvBuffer, GSS_C_NO_CHANNEL_BINDINGS, 0, 0, &sendBuffer, 0, 0, 0); - - std::free(recvBuffer.value); - - if(majStat == GSS_S_COMPLETE) { - Common::Logger::log(Common::Logger::VERBOSE, "GSS context established."); - gssContinue = false; - } - else if(majStat != GSS_S_CONTINUE_NEEDED) { - gss_release_buffer(&minStat, &sendBuffer); - return; - } - - Common::XmlPacket ret; - ret.setType("AuthGSSAPI"); - ret.addBinary("authToken", sendBuffer.value, sendBuffer.length); - - sendPacket(ret); - - gss_release_buffer(&minStat, &sendBuffer); - } - else if(!sentSignature) { - if(!packet["binary"].isEmpty()) - return; - - /*const gnutls_datum_t *cert = getConnection()->getCertificate(); - - recvBuffer.length = cert->size; - recvBuffer.value = cert->data;*/ - - recvBuffer.value = getConnection()->getCertificate(&recvBuffer.length); - - majStat = gss_get_mic(&minStat, gssContext, GSS_C_QOP_DEFAULT, &recvBuffer, &sendBuffer); - - if(majStat != GSS_S_COMPLETE) { - gss_release_buffer(&minStat, &sendBuffer); - return; - } - - Common::XmlPacket ret; - ret.setType("AuthGSSAPI"); - ret.addBinary("certMic", sendBuffer.value, sendBuffer.length); - - sendPacket(ret); - - gss_release_buffer(&minStat, &sendBuffer); - - sentSignature = true; - } - else { - const void *pkgData; - packet["authToken"].getBinaryData(&pkgData, &recvBuffer.length); - - recvBuffer.value = std::malloc(recvBuffer.length); - std::memcpy(recvBuffer.value, pkgData, recvBuffer.length); - - majStat = gss_process_context_token(&minStat, gssContext, &recvBuffer); - - std::free(recvBuffer.value); - - if(majStat != GSS_S_COMPLETE) - return; - - signalFinished(); - } -} - -} -} -} diff --git a/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.h b/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.h deleted file mode 100644 index 2c5191c..0000000 --- a/src/Server/RequestHandlers/GSSAPIAuthRequestHandler.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * GSSAPIAuthRequestHandler.h - * - * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de> - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef MAD_SERVER_REQUESTHANDLERS_GSSAPIAUTHREQUESTHANDLER_H_ -#define MAD_SERVER_REQUESTHANDLERS_GSSAPIAUTHREQUESTHANDLER_H_ - -#include <Common/RequestHandler.h> -#include <gssapi/gssapi.h> - -namespace Mad { -namespace Server { -namespace RequestHandlers { - -class GSSAPIAuthRequestHandler : public Common::RequestHandler { - private: - gss_ctx_id_t gssContext; - - bool gssContinue, sentSignature; - - protected: - virtual void handlePacket(const Common::XmlPacket &packet); - - public: - GSSAPIAuthRequestHandler(Common::Connection *connection, uint16_t requestId) - : RequestHandler(connection, requestId), gssContext(GSS_C_NO_CONTEXT), gssContinue(true), sentSignature(false) {} -}; - -} -} -} - -#endif /* MAD_SERVER_REQUESTHANDLERS_GSSAPIAUTHREQUESTHANDLER_H_ */ |