2 * Copyright (c) 2014 <copyright holder> <email>
4 * For license details, see the LICENSE file in the root of this project.
9 #include "../GSSException.h"
11 GSSOID::GSSOID(std::string oid_str)
13 init( GSSBuffer(oid_str) );
16 GSSOID::GSSOID(char *oid_str)
18 init( GSSBuffer(oid_str) );
21 GSSOID::GSSOID(GSSBuffer oid_str)
26 GSSOID::GSSOID(gss_OID gssoid)
29 this->gssInternal = true;
32 GSSOID::GSSOID ( const GSSOID &gssoid )
34 this->oid = gssoid.oid;
35 this->gssInternal = true;
38 void GSSOID::release()
40 OM_uint32 major, minor;
41 if ( (!this->gssInternal) && (oid != GSS_C_NO_OID) )
43 major = gss_release_oid(&minor, &(this->oid));
46 throw GSSException("Error in releasing a GSS OID", major, minor);
56 void GSSOID::init(GSSBuffer oid_str)
59 OM_uint32 major, minor;
65 major = gss_str_to_oid(&minor, oid_str.toGss(), &(this->oid));
68 throw GSSException("Error creating GSS OID", major, minor);
70 this->gssInternal = false;
76 std::string GSSOID::toString() const
79 OM_uint32 major, minor;
85 return std::string("");
88 major = gss_oid_to_str(&minor, this->oid, &buf);
91 throw GSSException("Error in creating a string representation of a GSS OID",
94 ret = std::string((char *)buf.value);
97 major = gss_release_buffer(&minor, &buf);
100 throw GSSException("Error releasing a gss_buffer",
108 JSONObject *GSSOID::toJSONValue() const
110 std::string val = this->toString();
111 JSONObject *ret = new JSONObject( val.c_str() );
115 bool GSSOID::setValue ( GSSBuffer buf )
121 bool GSSOID::setValue ( gss_OID gssOID )
124 this->gssInternal = true;