2 * Copyright (c) 2014 <copyright holder> <email>
4 * For license details, see the LICENSE file in the root of this project.
8 #include "GSSException.h"
13 static void disp_status(OM_uint32 status, int status_type, gss_OID mech, std::ostream &output_stream)
15 OM_uint32 disp_major, disp_minor, disp_context;
16 gss_buffer_desc disp_buf;
21 disp_major = gss_display_status(&disp_minor,
27 if (GSS_ERROR(disp_major))
29 disp_context = 0; // Get out of this loop.
30 output_stream << " An error occurred, and then another error" << std::endl <<
31 " occurred in creating a message to describe the first one. " << std::endl <<
32 " How embarrassing. It's time to quit before it gets any worse." << std::endl <<
33 " For now, the error code itself was 0x" << std::hex << status << std::dec;
34 std::cout << "\n -------------------------\n Something wonky happened in displaying status:\n";
35 std::cout << " gss_display_status(&disp_minor, " << status << ", " << (int)status_type << ", " << (long int)mech << ", " << disp_context << ", &buf);\n";
36 disp_status(disp_major, GSS_C_GSS_CODE, mech, std::cout);
37 disp_status(disp_minor, GSS_C_MECH_CODE, mech, std::cout);
39 output_stream << " " << (char *)disp_buf.value << std::endl;
40 } while (disp_context != 0);
43 GSSException::GSSException(std::string message,
51 std::stringstream output_stream;
55 output_stream << message << std::endl;
56 output_stream << "GSS Error message:" << std::endl;
57 output_stream << " Major status:" << std::endl;
58 disp_status(major, GSS_C_GSS_CODE, mech, output_stream);
59 output_stream << std::endl;
60 output_stream << " Minor status details: " << std::endl;
61 disp_status(minor, GSS_C_MECH_CODE, mech, output_stream);
62 reason = output_stream.str();