From cc35771abf4fc7e0dd472bd818ff2b4962c7e204 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 16 Sep 2008 01:20:43 +0200 Subject: Bessere Fehlerbehandlung --- src/Common/Requests/GSSAPIAuthRequest.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/Common/Requests/GSSAPIAuthRequest.cpp') diff --git a/src/Common/Requests/GSSAPIAuthRequest.cpp b/src/Common/Requests/GSSAPIAuthRequest.cpp index a4a1b17..91488d0 100644 --- a/src/Common/Requests/GSSAPIAuthRequest.cpp +++ b/src/Common/Requests/GSSAPIAuthRequest.cpp @@ -86,13 +86,17 @@ bool GSSAPIAuthRequest::sendRequest(Net::Connection *connection, uint16_t reques return true; } -bool GSSAPIAuthRequest::handlePacket(Net::Connection *connection, const Net::Packet &packet) { - if(packet.getType() != Net::Packet::GSSAPI_AUTH) - return false; // TODO Logging +void GSSAPIAuthRequest::handlePacket(Net::Connection *connection, const Net::Packet &packet) { + if(packet.getType() != Net::Packet::GSSAPI_AUTH) { + signalFinished().emit(); + return; // TODO Logging + } OM_uint32 majStat, minStat; gss_buffer_desc recvBuffer, sendBuffer; + // Needs error handling! + if(gssContinue) { recvBuffer.length = packet.getLength(); recvBuffer.value = std::malloc(recvBuffer.length); @@ -109,12 +113,12 @@ bool GSSAPIAuthRequest::handlePacket(Net::Connection *connection, const Net::Pac } else if(majStat != GSS_S_CONTINUE_NEEDED) { gss_release_buffer(&minStat, &sendBuffer); - return false; + return; } if(!connection->send(Net::Packet(Net::Packet::GSSAPI_AUTH, packet.getRequestId(), sendBuffer.value, sendBuffer.length))) { gss_release_buffer(&minStat, &sendBuffer); - return false; + return; } gss_release_buffer(&minStat, &sendBuffer); @@ -134,7 +138,7 @@ bool GSSAPIAuthRequest::handlePacket(Net::Connection *connection, const Net::Pac std::free(recvBuffer.value); if(majStat != GSS_S_COMPLETE) - return false; + return; connection->setAuthenticated(); std::cout << "Authentication complete." << std::endl; @@ -143,20 +147,18 @@ bool GSSAPIAuthRequest::handlePacket(Net::Connection *connection, const Net::Pac if(majStat != GSS_S_COMPLETE) { gss_release_buffer(&minStat, &sendBuffer); - return false; + return; } if(!connection->send(Net::Packet(Net::Packet::GSSAPI_AUTH, packet.getRequestId(), sendBuffer.value, sendBuffer.length))) { gss_release_buffer(&minStat, &sendBuffer); - return false; + return; } gss_release_buffer(&minStat, &sendBuffer); signalFinished().emit(); } - - return true; } } -- cgit v1.2.3