include_directories(src/)
add_library(jsongssapi SHARED
+ src/datamodel/GSSDisplayStatus.cpp
src/datamodel/GSSName.cpp
src/datamodel/GSSOID.cpp
src/datamodel/GSSOIDSet.cpp
#include "GSSImportName.h"
#include "GSSException.h"
#include <cache/GSSNameCache.h>
+#include <datamodel/GSSDisplayStatus.h>
typedef OM_uint32 (*gss_imp_name_type)(
/* Main */
retVal = function(&minor_status, inputName.toGss(), inputNameType.toGss(), &name);
- if ( GSS_ERROR(this->retVal) )
- {
- std::string errMsg;
- errMsg += "Cannot import name: ";
- errMsg += inputName.toString();
- throw GSSException(errMsg.c_str(), this->retVal, this->minor_status, inputNameType.toGss());
- }
+// if ( GSS_ERROR(this->retVal) )
+// {
+ JSONObject errors;
+ GSSDisplayStatus ds(retVal, minor_status, inputNameType.toGss());
+ errors.set("major_status_message", ds.getMajorMessage().c_str());
+ errors.set("minor_status_message", ds.getMinorMessage().c_str());
+ values->set("errors", errors);
+// }
+
+
+
this->outputName.setValue(name);
key = GSSNameCache::instance()->store(this->outputName);
// std::cout << "Storing key: " << key << std::endl;
JSONObject *GSSImportName::toJSON()
{
/* Variables */
- JSONObject *values = new JSONObject();
-
/* Error checking */
/* Setup */
{
// defaults
function = fn;
- inputName = "";
- inputNameType.setValue(GSSBuffer("{ 1 2 840 113554 1 2 1 4 }"));
+ inputName = string("");
+ inputNameType.setValue(GSSBuffer( string("{ 1 2 840 113554 1 2 1 4 }") ));
+ values = new JSONObject();
}
GSSImportName::GSSImportName(JSONObject *params, gss_imp_name_type fn) : GSSCommand(params)
/* Error checking */
/* Setup */
/* Main */
+ values = new JSONObject();
loadParameters(params);
function = fn;
/* Cleanup */
GSSBuffer inputName;
GSSOID inputNameType;
GSSName outputName;
+
+ JSONObject *values;
};
#endif // GSSIMPORTNAME_H
--- /dev/null
+/*
+ * Copyright (c) 2014 <copyright holder> <email>
+ *
+ * For license details, see the LICENSE file in the root of this project.
+ *
+ */
+
+#include "GSSDisplayStatus.h"
+
+#include <sstream>
+
+static void disp_status(OM_uint32 status, int status_type, gss_OID mech, std::ostream &output_stream)
+{
+ OM_uint32 disp_major, disp_minor, disp_context;
+ gss_buffer_desc disp_buf;
+
+ disp_context = 0;
+ do
+ {
+ disp_major = gss_display_status(&disp_minor,
+ status,
+ status_type,
+ mech,
+ &disp_context,
+ &disp_buf);
+ if (GSS_ERROR(disp_major))
+ {
+ output_stream << "Internal, unknown GSS error";
+ break; // Get out of this loop.
+ } else
+ output_stream << (char *)disp_buf.value;
+ } while (disp_context != 0);
+}
+
+
+GSSDisplayStatus::GSSDisplayStatus(OM_uint32 major,
+ OM_uint32 minor,
+ gss_OID mech )
+{
+ std::stringstream major_stream;
+ std::stringstream minor_stream;
+ /* Setup */
+
+ /* Main */
+ disp_status(major, GSS_C_GSS_CODE, mech, major_stream);
+ majorMessage = major_stream.str();
+
+ disp_status(minor, GSS_C_MECH_CODE, mech, minor_stream);
+ minorMessage = minor_stream.str();
+}
+
+GSSDisplayStatus::~GSSDisplayStatus()
+{
+
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 <copyright holder> <email>
+ *
+ * For license details, see the LICENSE file in the root of this project.
+ *
+ */
+
+#ifndef GSSDISPLAYSTATUS_H
+#define GSSDISPLAYSTATUS_H
+
+#include <gssapi.h>
+#include <string>
+#include <ostream>
+
+using std::string;
+
+class GSSDisplayStatus
+{
+public:
+ GSSDisplayStatus(OM_uint32 major,
+ OM_uint32 minor,
+ gss_OID mech );
+ ~GSSDisplayStatus();
+
+ string getMajorMessage() const { return majorMessage; }
+ string getMinorMessage() const { return minorMessage; }
+
+private:
+ string minorMessage;
+ string majorMessage;
+
+ GSSDisplayStatus& operator= ( const GSSDisplayStatus& other ) {};
+};
+
+#endif // GSSDISPLAYSTATUS_H
../src/commands/GSSWrap.cpp
../src/datamodel/GSSBuffer.cpp
../src/datamodel/GSSCredential.cpp
+ ../src/datamodel/GSSDisplayStatus.cpp
../src/datamodel/GSSName.cpp
../src/datamodel/GSSOID.cpp
../src/datamodel/GSSOIDSet.cpp