Message passing with cookies (app_tag, gssweb_bg_tag, etc.)
authorMark Donnelly <mark@painless-security.com>
Fri, 3 Oct 2014 18:59:04 +0000 (14:59 -0400)
committerMark Donnelly <mark@painless-security.com>
Fri, 3 Oct 2014 18:59:04 +0000 (14:59 -0400)
The messages passed in to the C++ code will now have the following elements copied in to the response:
  cookies
  method

The c++ code was refactored to have a common point for top-level JSON parsing, and the GSSCommand subclasses now only pull out their specific arguments.

GSSCreateSecContextCommand was renamed to GSSInitSecContext.

There was an error in util_json in how a JSONObject implemented operator= that made it at best a no-op.  (At worst it caused crashes.)

22 files changed:
chrome/app/gssweb.contentscript.js
chrome/app/gssweb_background.js
chrome/app/gssweb_utils.js [new file with mode: 0644]
chrome/app/manifest.json
chrome/app/navigator.gss.js
json_gssapi/CMakeLists.txt
json_gssapi/main.cpp
json_gssapi/src/GSSRequest.cpp [new file with mode: 0644]
json_gssapi/src/GSSRequest.h [new file with mode: 0644]
json_gssapi/src/commands/GSSAcquireCred.cpp
json_gssapi/src/commands/GSSGetMic.cpp
json_gssapi/src/commands/GSSImportName.cpp
json_gssapi/src/commands/GSSInitSecContext.cpp [moved from json_gssapi/src/commands/GSSCreateSecContextCommand.cpp with 77% similarity]
json_gssapi/src/commands/GSSInitSecContext.h [moved from json_gssapi/src/commands/GSSCreateSecContextCommand.h with 79% similarity]
json_gssapi/src/commands/GSSPseudoRandom.cpp
json_gssapi/src/commands/GSSUnwrap.cpp
json_gssapi/src/commands/GSSWrap.cpp
json_gssapi/src/util_json.h
json_gssapi/test/CMakeLists.txt
json_gssapi/test/GSSCreateSecContextTest.cpp
json_gssapi/test/GSSCreateSecContextTest.h
json_gssapi/test/GSSImportNameTest.h

index abcea95..1708612 100644 (file)
@@ -1,11 +1,15 @@
 console.log("Loading content script #6...");
 
-var elt = document.createElement("script");
-elt.setAttribute("src", 
-                 chrome.extension.getURL('navigator.gss.js')
-                );
-document.head.appendChild(elt);
 
+function addScript(url) {
+  var elt = document.createElement("script");
+  elt.setAttribute("src", 
+                   url   );
+  document.head.appendChild(elt);
+}
+
+addScript( chrome.extension.getURL('gssweb_utils.js') );
+addScript( chrome.extension.getURL('navigator.gss.js') );
 
 var port = chrome.runtime.connect({name: "com.painlesssecurity.gssweb"});
 
@@ -14,7 +18,9 @@ var port = chrome.runtime.connect({name: "com.painlesssecurity.gssweb"});
  */
 port.onMessage.addListener(
   function(gssReplyJSON) {
-     console.log("Extension port listener received message: [" + 
+     var appTag = gssReplyJSON.cookies.app_tag;
+     
+     console.log("[" + appTag + "] Extension port listener received message: [" + 
                   JSON.stringify(gssReplyJSON) + "]"
                ); 
      window.postMessage(gssReplyJSON, "*");
@@ -25,10 +31,16 @@ window.addEventListener("message", function(event) {
     // We only accept messages from ourselves
     if (event.source != window)
        return;
-
-    console.log("Window message listener received message: [" +
+    
+    if ( typeof(event.data.cookies) == 'undefined' )
+    {
+      event.data.cookies = {};
+    }
+    var appTag = event.data.cookies.app_tag;
+    
+    console.log("[" + appTag + "] Window message listener received message: [" +
                JSON.stringify(event.data) + "]"
                );
     port.postMessage(event.data);
 }, false);
-    
+
index 9233aa5..4103ecb 100644 (file)
@@ -2,19 +2,50 @@ console.log("gssweb_background.js loading: #4");
 
 
 
-
 var gssNativePort = null;
-var applicationPort = null;
+var applicationPorts = {};
 
 /* What to do with the output of the GSS command line */
 function onGSSResponse(msg) {
-  console.info('Response from GSS command line: [' + 
+  var nonce;
+  var appPort;
+  var appTag;
+
+  // Read the cookies out of the response  
+  if ( typeof(msg.cookies) == 'undefined' ||
+       typeof(msg.cookies.gssweb_bg_tag) == 'undefined' )
+  {
+    console.error(
+      "gssweb_background.js received a response from the command-line NativeHost with no gssweb_bg_tag cookie."
+    );
+    return;    
+  }
+  appTag = msg.cookies.app_tag;
+  nonce = msg.cookies.gssweb_bg_tag;
+  msg.cookies.gssweb_bg_tag = undefined;
+
+  // Informationally log
+  console.info('[' + appTag + '] Response from GSS command line: [' + 
               JSON.stringify(msg) + ']'
              );
-  
+
+  // Find the content script's port that should receive this message  
+  appPort = applicationPorts[nonce]
+  applicationPorts[nonce] = undefined;
+  if ( typeof(appPort) == "undefined")
+  {
+    console.error(
+      "[" + appTag + "] gssweb_background.js received a response from the command-line NativeHost with no associated application port."
+    );
+    return;    
+  }
+  // appPort is now guaranteed to exist.
+
+
   // Send the message on to the content script
-  applicationPort.postMessage(msg);
-  console.info('Response sent to the content script.');
+  appPort.postMessage(msg);
+  
+  console.info('[' + appTag + '] Response sent to the content script.');
 }
 
 function connectToNativeHost() {
@@ -30,24 +61,37 @@ connectToNativeHost();
 
 // When we receive a connection from a page through the content script...
 chrome.runtime.onConnect.addListener(
-  function(thePort) 
+  function(appPort) 
   {
     // ... First, make sure that we're talking to the right people
-    console.assert(thePort.name == "com.painlesssecurity.gssweb");
-
-    // ... Second, save out the port
-    applicationPort = thePort;
+    console.assert(appPort.name == "com.painlesssecurity.gssweb");
     
-    applicationPort.onMessage.addListener(
+    appPort.onMessage.addListener(
       // Now, when we receive a message
       function(msg)
       {
+        var nonce;
+        var appTag;
+
+        // Deal with the cookies in the message
+        if ( typeof(msg.cookies) == 'undefined')
+        {
+          msg.cookies = {};
+        }
+        appTag = msg.cookies.app_tag;
+
+        // Save out the port
+        nonce = navigator.generateNonce();
+        applicationPorts[nonce] = appPort;
+        msg.cookies.gssweb_bg_tag = nonce;
+        
+        // Send the message to the NativePort / command line
         console.info(
-          'About to send message to Native Port: [' +
+          '[' + appTag + '] About to send message to Native Port: [' +
           JSON.stringify(msg) + ']'
         );
        gssNativePort.postMessage(msg);
-        console.info('... message sent to Native Port.')
+        console.info('[' + appTag + '] ... message sent to Native Port.')
        
       }
     );
diff --git a/chrome/app/gssweb_utils.js b/chrome/app/gssweb_utils.js
new file mode 100644 (file)
index 0000000..dc3c411
--- /dev/null
@@ -0,0 +1,9 @@
+console.log('Loading gssweb_utils.js - #1');
+
+navigator.generateNonce = function() {
+  // TODO: Make sure that we don't have a collision!
+  // Random integer in the range [0..(2^32-1)]
+  return Math.floor(Math.random() * ( 4294967295 )) ;
+}
+
+
index a0a1355..dc30d9a 100644 (file)
@@ -5,7 +5,10 @@
       }
    },
    "background": {
-       "scripts": ["gssweb_background.js"]
+       "scripts": [
+           "gssweb_utils.js",
+           "gssweb_background.js"
+       ]
    },
    "content_scripts": [
        {
@@ -20,6 +23,7 @@
    "permissions": [ "nativeMessaging" ],
    "version": "1.0",
    "web_accessible_resources": [
-      "navigator.gss.js"
+      "navigator.gss.js",
+      "gssweb_utils.js"
    ]
 }
index d65b810..b011894 100644 (file)
@@ -2,32 +2,49 @@ console.log('Loading navigator.gss.js - #5');
 
 /* This file gets injected into the web page verbatim */
 
-navigator.gss_import_name = function(name, mech, nonce, callbackFn){
-    console.log("Name: " + name);
-    console.log("Mech: " + mech);
+navigator.gss_callbacks = {};
+
+/*
+navigator.generateNonce = function() {
+  // TODO: Make sure that we don't have a collision!
+  // Random integer in the range [0..(2^32-1)]
+  return Math.floor(Math.random() * ( 4294967295 )) ;
+}
+*/
+
+navigator.gss_import_name = function(name, mech, callbackFn, appTag){
+    var nonce = navigator.generateNonce();
+    navigator.gss_callbacks[nonce] = callbackFn;
     
     /* Listen for a message back from the content script */
     window.addEventListener(
       "message",
       function(event)
       {
-        var nonce;
+        var app_tag;
         var name;
+        var callback;
+        var nonce;
         
-        if (event.data.command != "gss_import_name" ||
+        if (event.data.method != "gss_import_name" ||
             (typeof(event.data.return_values) == "undefined") )
         {
           return;
         }
         
+        var nonce = event.data.cookies.navigator_gss_tag;
+        event.data.cookies.navigator_gss_tag = undefined;
+        callback = navigator.gss_callbacks[nonce];
+        navigator.gss_callbacks[nonce] = undefined;
+        
         // Extract the data from the returned JSON
         name = event.data.return_values.gss_name;
-        nonce = event.data.nonce;
+        app_tag = event.data.cookies.app_tag;
         major = event.data.return_values.major_status;
         minor = event.data.return_values.minor_status;
         
         // Invoke the callback with the extracted data
-        callbackFn(name, nonce, major, minor);
+        callback(name, major, minor, app_tag);
       }
     );
 
@@ -41,7 +58,11 @@ navigator.gss_import_name = function(name, mech, nonce, callbackFn){
            "input_name": name,
            "input_name_type": mech
        },
-        "nonce": nonce
+        "cookies":
+        {
+            "navigator_gss_tag": nonce,
+            "app_tag": appTag
+        }
     }, "*");
 
 };
index c5b3c7a..3a9eb1c 100644 (file)
@@ -11,8 +11,9 @@ add_library(jsongssapi SHARED
                        src/datamodel/GSSBuffer.cpp
                        src/datamodel/GSSCredential.cpp
                        src/GSSException.cpp
+                       src/GSSRequest.cpp 
                        src/commands/GSSGetMic.cpp
-                       src/commands/GSSCreateSecContextCommand.cpp
+                       src/commands/GSSInitSecContext.cpp
                        src/commands/GSSCommand.cpp 
                        src/commands/GSSImportName.cpp
                        src/commands/GSSAcquireCred.cpp 
index 5c2a53d..d16d09f 100644 (file)
@@ -1,5 +1,5 @@
 #include <commands/GSSImportName.h>
-#include <commands/GSSCreateSecContextCommand.h>
+#include <commands/GSSInitSecContext.h>
 #include <commands/GSSAcquireCred.h>
 #include <datamodel/GSSBuffer.h>
 #include <exception>
@@ -7,6 +7,7 @@
 #include <string>
 #include <unistd.h>
 #include <util_json.h>
+#include <GSSRequest.h>
 
 
 using std::cin;
@@ -17,13 +18,8 @@ using std::string;
 
 int main(int argc, char **argv) {
   /* Variables */
-  string method, output;
-  const char* c_str;
+  string output;
   char *input;
-  JSONObject json;
-  JSONObject *result;
-  json_error_t jsonErr;
-  GSSCommand *cmd;
   int len;
   ssize_t readTotal, readThisRound, readRemaining;
   
@@ -34,107 +30,40 @@ int main(int argc, char **argv) {
   /* Main processing */
   do 
   {
-    try 
+    // Read 32 bit length
+    len = 0;
+    readThisRound = readTotal = 0;
+    while(4 != readTotal)
     {
-      // Read 32 bit length
-      len = 0;
-      readThisRound = readTotal = 0;
-      while(4 != readTotal)
-      {
-        readThisRound = read(0, ((&len) + readTotal), 4 - readTotal);
-       readTotal += readThisRound;
-      }
-      
-      // Reads the number of bytes indicated by the above read
-      input = new char[len + 1];
-      readTotal = readThisRound = 0;
-      while (readTotal < len)
-      {
-        readRemaining = len - readTotal;
-        readThisRound = read( 0, &(input[readTotal]), readRemaining);
-        if (-1 == readThisRound)
-          break;
-        else
-          readTotal += readThisRound;
-      }
-      // ... and null-terminate it
-      input[len] = '\0';
-      
-      
-      // Parse the JSON
-      JSONObject json = JSONObject::load(input, 0, &jsonErr);
-      delete[] input;
-      
-      if ( json.get("method").isNull() )
-      {
-        JSONObject response;
-        response.set("method", "unknown");
-        response.set("error_message", "Did not find a valid method to execute.");
-       output = response.dump();
-       len = output.length();
-       cout.write((char *)&len, 4);
-        cout << output << endl;
-       continue;
-      }
-
-      // Oh, how I wish I could simply use: switch(json.get("method"))
-      c_str = json.get("method").string();
-      method = c_str;
-      if ("gss_import_name" == method)
-      {
-        cmd = new GSSImportName(&json);
-      }
-      else if ("gss_create_sec_context" == method)
-      {
-        cmd = new GSSCreateSecContextCommand(&json);
-      }
-      else if ("gss_acquire_cred" == method)
-      {
-        cmd = new GSSAcquireCred(&json);
-      }
-      else 
-      {
-        JSONObject response;
-        response.set("method", "unknown");
-        response.set("error_message", "Did not find a valid method to execute.");
-       output = response.dump();
-       len = output.length();
-       cout.write((char *)&len, 4);
-        cout << output << endl;
-      
-        continue;
-      }
-
-      cmd->execute();
-      result = cmd->toJSON();
-      delete cmd;
-      
-      output = result->dump();
-      len = output.length();
-      
-      cout.write((char *)&len, 4);
-      cout << output;
-      cout.flush();
-
+      readThisRound = read(0, ((&len) + readTotal), 4 - readTotal);
+      readTotal += readThisRound;
     }
-    catch ( std::bad_alloc& e )
+    
+    // Reads the number of bytes indicated by the above read
+    input = new char[len + 1];
+    readTotal = readThisRound = 0;
+    while (readTotal < len)
     {
-      JSONObject response;
-      JSONObject error;
-      response.set("method", "unknown");
-      response.set("error_message", "Could not parse the input JSON");
-      response.set("original message", input);
-      error.set("text", jsonErr.text);
-      error.set("source", jsonErr.source);
-      error.set("line", jsonErr.line);
-      error.set("column", jsonErr.column);
-      error.set("position", jsonErr.position);
-      response.set("error", error);
-      output = response.dump();
-      len = output.length();
-      cout.write((char *)&len, 4);
-      cout << output << endl;
+      readRemaining = len - readTotal;
+      readThisRound = read( 0, &(input[readTotal]), readRemaining);
+      if (-1 == readThisRound)
+        break;
+      else
+        readTotal += readThisRound;
     }
+    // ... and null-terminate it
+    input[len] = '\0';
+    
+    
+    GSSRequest *req = new GSSRequest(string(input));
+    req->execute();
+    output = req->getResponse();
+    len = output.length();
+    
+    cout.write((char *)&len, 4);
+    cout << output;
+    cout.flush();
+    
   } while(1);
   
   return 0;
diff --git a/json_gssapi/src/GSSRequest.cpp b/json_gssapi/src/GSSRequest.cpp
new file mode 100644 (file)
index 0000000..aa3de6e
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2014 <copyright holder> <email>
+ *
+ * For license details, see the LICENSE file in the root of this project.
+ *
+ */
+
+#include <cstddef>
+#include <stdexcept>
+
+#include "commands/GSSAcquireCred.h"
+#include "commands/GSSInitSecContext.h"
+#include "commands/GSSImportName.h"
+#include "GSSRequest.h"
+
+using std::bad_alloc;
+
+GSSRequest::GSSRequest ( string jsonString )
+{
+  /* Local variables */
+  /* Error checking */
+  /* Setup */
+  /* Main processing */
+  response = JSONObject();
+  cmd = NULL;
+  requestString = jsonString;
+  
+  /* Cleanup */
+  /* Return */
+}
+
+void GSSRequest::execute()
+{
+  /* variables */
+  /* Error checking */
+  /* Setup */
+  parseJSON();
+  getCommand();
+  
+  /* Main processing */
+  if (NULL != cmd)
+    cmd->execute();
+  
+  /* Cleanup */
+  /* Return */
+}
+
+
+
+void GSSRequest::parseJSON()
+{
+  /* variables */
+  json_error_t jsonErr;
+  
+  try {
+    JSONObject cookies;
+    request = JSONObject::load(requestString.c_str(), 0, &jsonErr);
+    cookies = request.get("cookies");
+    response.set("cookies", cookies );
+    response.set("method", request.get("method").string());
+  }
+  /* bad_alloc is thrown when JSONObject can't parse the input string as JSON */
+  catch ( bad_alloc& e ) 
+  {
+    // Top-level response
+    response.set("error_message", "Could not parse the input JSON.");
+    response.set("original_message", requestString.c_str());
+  }
+}
+
+
+void GSSRequest::getCommand()
+{
+  string method;
+  JSONObject arguments = request.get("arguments");
+  
+  /* Error checking */
+  /* Setup */
+  if (request.get("method").isNull() )
+    method = "";
+  else
+    method = string( request.get("method").string() );
+  
+  if ( "gss_import_name" == method ) 
+  {
+    cmd = new GSSImportName ( &arguments );
+  } 
+  else if ( "gss_create_sec_context" == method ) 
+  {
+    cmd = new GSSInitSecContext ( &arguments );
+  } 
+  else if ( "gss_acquire_cred" == method ) 
+  {
+    cmd = new GSSAcquireCred ( &arguments );
+  } 
+  else 
+  {
+    string error_message = string("Unrecognized command: ") + method;
+    response.set("error_message", error_message.c_str() );
+    response.set("original_message", requestString.c_str());
+    cmd = NULL;
+  }
+}
+
+string GSSRequest::getResponse()
+{
+  /* Variables */
+  JSONObject *return_values;
+  string gssResponse;
+  
+  /* Main processing */
+  // Put the return values into the response, assuming that the command
+  // was actually executed.
+  if (NULL != cmd)
+  {
+    return_values = cmd->toJSON();
+    response.set("return_values", *return_values);
+  }
+  
+  // Convert the response into a string to return.
+  gssResponse = string( response.dump() );
+  
+  /* Return */
+  return(gssResponse);
+}
diff --git a/json_gssapi/src/GSSRequest.h b/json_gssapi/src/GSSRequest.h
new file mode 100644 (file)
index 0000000..663f799
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014 <copyright holder> <email>
+ *
+ * For license details, see the LICENSE file in the root of this project.
+ *
+ */
+
+#ifndef GSSREQUEST_H
+#define GSSREQUEST_H
+
+#include <string>
+
+#include "commands/GSSCommand.h"
+#include "util_json.h"
+
+using std::string;
+
+class GSSRequest
+{
+public:
+  GSSRequest(string jsonString);
+  ~GSSRequest();
+  
+  void execute();
+  string getResponse();
+  
+private:
+  string      requestString;
+  JSONObject  request;
+  JSONObject  response;
+  GSSCommand *cmd;
+  
+  void getCommand();
+  void parseJSON();
+};
+
+#endif // GSSREQUEST_H
index ed86a17..f805e8d 100644 (file)
@@ -60,11 +60,11 @@ bool GSSAcquireCred::loadParameters(JSONObject *params)
   /**************
    * cred_usage *
    **************/
-  if ( ! params->get("arguments").get("cred_usage").isNull() )
+  if ( ! params->get("cred_usage").isNull() )
   {
-    if (params->get("arguments").get("cred_usage").isString())
+    if (params->get("cred_usage").isString())
     {
-      sCredUsage = params->get("arguments").get("cred_usage").string();
+      sCredUsage = params->get("cred_usage").string();
       if (sCredUsage == "GSS_C_BOTH")
         this->cred_usage = GSS_C_BOTH;
       else if (sCredUsage == "GSS_C_INITIATE")
@@ -73,8 +73,8 @@ bool GSSAcquireCred::loadParameters(JSONObject *params)
         this->cred_usage = GSS_C_ACCEPT;
       else
         throw std::invalid_argument( std::string("Invalid cred_usage type given: ") + sCredUsage );
-    } else if (params->get("arguments").get("cred_usage").isInteger())
-      this->cred_usage = (gss_cred_usage_t)( params->get("arguments").get("cred_usage").integer() );
+    } else if (params->get("cred_usage").isInteger())
+      this->cred_usage = (gss_cred_usage_t)( params->get("cred_usage").integer() );
     else
       throw std::invalid_argument( "Unrecognized argument type for cred_usage." );
       }
@@ -82,15 +82,15 @@ bool GSSAcquireCred::loadParameters(JSONObject *params)
   /*****************
    * desired_mechs *
    *****************/
-  if ( ! params->get("arguments").get("desired_mechs").isNull() )
+  if ( ! params->get("desired_mechs").isNull() )
   {
-    if ( params->get("arguments").get("desired_mechs").isArray() )
+    if ( params->get("desired_mechs").isArray() )
     {
       for (nDesiredMechs = 0; 
-          nDesiredMechs < params->get("arguments").get("desired_mechs").size();
+          nDesiredMechs < params->get("desired_mechs").size();
           nDesiredMechs++)
       {
-        std::string mechStr = params->get("arguments").get("desired_mechs")[nDesiredMechs].string();
+        std::string mechStr = params->get("desired_mechs")[nDesiredMechs].string();
         desiredMechs.addOID( GSSOID(mechStr).toGss() );
       }
     } else
@@ -100,9 +100,9 @@ bool GSSAcquireCred::loadParameters(JSONObject *params)
   /****************
    * desired_name *
    ****************/
-  if ( ! params->get("arguments").get("desired_name").isNull() )
+  if ( ! params->get("desired_name").isNull() )
   {
-    std::string key = params->get("arguments").get("desired_name").string();
+    std::string key = params->get("desired_name").string();
     this->desired_name = GSSNameCache::instance()->retrieve(key);
   }
 
@@ -152,8 +152,6 @@ void GSSAcquireCred::execute()
 /* Desired JSON output:
  * 
  * {
- *   "command": "gss_acquire_cred",
- *   "return_values": {
  *     "major_status": 0,
  *     "minor_status": 0,
  *     "cred_handle": "###########",
@@ -162,15 +160,12 @@ void GSSAcquireCred::execute()
  *       "{ 5 6 7 8 }"
  *     ],
  *     "time_rec": 0
- *   }
  * }
  */
 JSONObject *GSSAcquireCred::toJSON()
 {
   /* Variables */
-  JSONObject *ret = new JSONObject();
   JSONObject *values = new JSONObject();
-//   JSONObject mechs = JSONObject::array();
   JSONObject *temp;
   
   /* Error checking */
@@ -191,12 +186,8 @@ JSONObject *GSSAcquireCred::toJSON()
   temp = this->actualMechs.toJSONValue();
   values->set("actual_mechs", *temp);
   
-  // Put it all together.
-  ret->set("command", "gss_acquire_cred");
-  ret->set("return_values", *values);
-  
   /* Cleanup */
   
   /* Return */
-  return(ret);
+  return(values);
 }
index 7fdbe2a..654c1ce 100644 (file)
@@ -18,14 +18,11 @@ GSSGetMic::GSSGetMic ( JSONObject* params, gss_get_mic_type fn )
 }
 
 /*
- * {"method": "gss_get_mic",
- *  "arguments":
  *  {
  *       "context_handle": "#######",
  *       "qop_req": "GSS_C_QOP_DEFAULT",
  *       "input_message": "mary had a little lamb"
  *  }
- * }
  * 
  */
 bool GSSGetMic::loadParameters ( JSONObject* params )
@@ -41,17 +38,17 @@ bool GSSGetMic::loadParameters ( JSONObject* params )
   /***********
    * QOP_REQ *
    ***********/
-  if ( ! params->get("arguments").get("qop_req").isNull() )
+  if ( ! params->get("qop_req").isNull() )
   {
-    if (params->get("arguments").get("qop_req").isString())
+    if (params->get("qop_req").isString())
     {
-      sQopReq = params->get("arguments").get("qop_req").string();
+      sQopReq = params->get("qop_req").string();
       if (sQopReq == "GSS_C_QOP_DEFAULT")
         this->qop_req = GSS_C_QOP_DEFAULT;
       else
         throw std::invalid_argument( std::string("Invalid QOP type given: ") + sQopReq );
-    } else if (params->get("arguments").get("qop_req").isInteger())
-      this->qop_req = (gss_cred_usage_t)( params->get("arguments").get("qop_req").integer() );
+    } else if (params->get("qop_req").isInteger())
+      this->qop_req = (gss_cred_usage_t)( params->get("qop_req").integer() );
     else
       throw std::invalid_argument( "Unrecognized argument type for qop_req." );
   }
@@ -59,18 +56,18 @@ bool GSSGetMic::loadParameters ( JSONObject* params )
   /*****************
    * input_message *
    *****************/
-  if ( ! params->get("arguments").get("input_message").isNull() )
+  if ( ! params->get("input_message").isNull() )
   {
-    sInputMessage = params->get("arguments").get("input_message").string();
+    sInputMessage = params->get("input_message").string();
     this->inputMessage.setValue(sInputMessage);
   }
   
   /******************
    * context_handle *
    ******************/
-  if ( ! params->get("arguments").get("context_handle").isNull() )
+  if ( ! params->get("context_handle").isNull() )
   {
-    sInputMessage = params->get("arguments").get("context_handle").string();
+    sInputMessage = params->get("context_handle").string();
     GSSContext ctx = GSSContextCache::instance()->retrieve(sInputMessage);
     this->context = ctx.getContext();
   }
@@ -98,7 +95,6 @@ void GSSGetMic::execute()
 JSONObject* GSSGetMic::toJSON()
 {
   /* Variables */
-  JSONObject *ret = new JSONObject();
   JSONObject *values = new JSONObject();
   
   /* Error checking */
@@ -116,12 +112,8 @@ JSONObject* GSSGetMic::toJSON()
     this->outputToken.toString().c_str()
   );
   
-  // Put it all together.
-  ret->set("command", "gss_get_mic");
-  ret->set("return_values", *values);
-  
   /* Cleanup */
   
   /* Return */
-  return(ret);
+  return(values);
 }
index 6045a81..2e6d5c7 100644 (file)
@@ -47,21 +47,16 @@ void GSSImportName::execute()
 
 /* Example output:
  * 
- * {
- *   "command": "gss_import_name",
- *   "return_values":
  *   {
  *     "major_status": 0,
  *     "minor_status": 0,
  *     "gss_name": "base64_encoded_string"
  *   }
- * }
  * 
  */
 JSONObject *GSSImportName::toJSON()
 {
   /* Variables */
-  JSONObject *ret = new JSONObject();
   JSONObject *values = new JSONObject();
   
   /* Error checking */
@@ -72,13 +67,11 @@ JSONObject *GSSImportName::toJSON()
   values->set("major_status", this->retVal);
   values->set("minor_status", this->minor_status);
   values->set("gss_name", this->outputName.getKey().c_str() );
-  ret->set("command", "gss_import_name");
-  ret->set("return_values", *values);
   
   /* Cleanup */
   
   /* Return */
-  return(ret);
+  return(values);
 }
 
 GSSImportName::GSSImportName ( gss_imp_name_type fn )
@@ -112,23 +105,23 @@ bool GSSImportName::loadParameters(JSONObject *params)
   
   /* Main processing */
   // Easy stuff(*params)
-  if ( params->get("arguments").isNull() )
+  if ( params->isNull() )
     return true;
   
-  if ( !params->get("arguments").get("input_name").isNull() )
+  if ( !params->get("input_name").isNull() )
   {
-    if ( params->get("arguments").get("input_name").isString() )
+    if ( params->get("input_name").isString() )
     {
-      std::string input_name = params->get("arguments").get("input_name").string();
+      std::string input_name = params->get("input_name").string();
       this->inputName.setValue( input_name );
     }
   }
   
-  if ( !params->get("arguments").get("input_name_type").isNull() )
+  if ( !params->get("input_name_type").isNull() )
   {
-    if ( params->get("arguments").get("input_name_type").isString() )
+    if ( params->get("input_name_type").isString() )
     {
-      std::string input_name_type = params->get("arguments").get("input_name_type").string();
+      std::string input_name_type = params->get("input_name_type").string();
       this->inputNameType.setValue( input_name_type );
     }
   }
@@ -139,32 +132,6 @@ bool GSSImportName::loadParameters(JSONObject *params)
 }
 
 
-//   /***********
-//    * QOP_REQ *
-//    ***********/
-//   if ( ! params->get("arguments").get("qop_req").isNull() )
-//   {
-//     if (params->get("arguments").get("qop_req").isString())
-//     {
-//       sQopReq = params->get("arguments").get("qop_req").string();
-//       if (sQopReq == "GSS_C_QOP_DEFAULT")
-//         this->qop_req = GSS_C_QOP_DEFAULT;
-//       else
-//         throw std::invalid_argument( std::string("Invalid QOP type given: ") + sQopReq );
-//     } else if (params->get("arguments").get("qop_req").isInteger())
-//       this->qop_req = (gss_cred_usage_t)( params->get("arguments").get("qop_req").integer() );
-//     else
-//       throw std::invalid_argument( "Unrecognized argument type for qop_req." );
-//   }
-//   
-//   /*****************
-//    * input_message *
-//    *****************/
-//   if ( ! params->get("arguments").get("input_message").isNull() )
-//   {
-//     sInputMessage = params->get("arguments").get("input_message").string();
-//     this->inputMessage.setValue(sInputMessage);
-//   }
 
 
 /* Variables */
@@ -5,7 +5,7 @@
  * 
  */
 
-#include "GSSCreateSecContextCommand.h"
+#include "GSSInitSecContext.h"
 #include "GSSException.h"
 #include <cache/GSSContextCache.h>
 #include <cache/GSSNameCache.h>
@@ -32,7 +32,7 @@ typedef OM_uint32 (*init_sec_context)(
 );
 
 void
-GSSCreateSecContextCommand::execute()
+GSSInitSecContext::execute()
 {
   /* Variables */
   init_sec_context fn = (init_sec_context)function;
@@ -77,7 +77,7 @@ GSSCreateSecContextCommand::execute()
   /* Return */
 }
 
-const char* GSSCreateSecContextCommand::getTargetDisplayName()
+const char* GSSInitSecContext::getTargetDisplayName()
 {
   /* Variables */
   gss_buffer_desc output_name;
@@ -102,13 +102,13 @@ const char* GSSCreateSecContextCommand::getTargetDisplayName()
   return( ret );
 }
 
-bool GSSCreateSecContextCommand::loadParameters(JSONObject *params)
+bool GSSInitSecContext::loadParameters(JSONObject *params)
 {
   /* Variables */
   std::string key;
   
   /* Error checking */
-  if ( params->get("arguments").isNull() )
+  if ( params->isNull() )
     return true;
   
   /* Setup */
@@ -116,19 +116,19 @@ bool GSSCreateSecContextCommand::loadParameters(JSONObject *params)
   
   /* Main processing */
   // Easy stuff(*params)
-  if ( !params->get("arguments").get("time_req").isNull() )
-    this->time_req = params->get("arguments").get("time_req").integer();
+  if ( !params->get("time_req").isNull() )
+    this->time_req = params->get("time_req").integer();
   
-  if ( !params->get("arguments").get("req_flags").isNull() )
-    this->req_flags = params->get("arguments").get("req_flags").integer();
+  if ( !params->get("req_flags").isNull() )
+    this->req_flags = params->get("req_flags").integer();
   
   // context_handle
-  if ( ! params->get("arguments").get("context_handle").isNull() )
+  if ( ! params->get("context_handle").isNull() )
   {
     this->context_handle = GSS_C_NO_CONTEXT;
-    if (params->get("arguments").get("context_handle").isString())
+    if (params->get("context_handle").isString())
     {
-      key = params->get("arguments").get("context_handle").string();
+      key = params->get("context_handle").string();
       context = GSSContextCache::instance()->retrieve( key.c_str() );
       this->context_handle = context.getContext();
     }
@@ -137,12 +137,12 @@ bool GSSCreateSecContextCommand::loadParameters(JSONObject *params)
   }
   
   // target_name
-  if ( ! params->get("arguments").get("target_name").isNull() )
+  if ( ! params->get("target_name").isNull() )
   {
     this->target_name = GSS_C_NO_NAME;
-    if (params->get("arguments").get("target_name").isString())
+    if (params->get("target_name").isString())
     {
-      key = params->get("arguments").get("target_name").string();
+      key = params->get("target_name").string();
       
       targetName = GSSNameCache::instance()->retrieve(key);
       
@@ -153,12 +153,12 @@ bool GSSCreateSecContextCommand::loadParameters(JSONObject *params)
   }
   
   // mech_type  
-  if ( ! params->get("arguments").get("mech_type").isNull() )
+  if ( ! params->get("mech_type").isNull() )
   {
     key.clear();
-    if (params->get("arguments").get("mech_type").isString())
+    if (params->get("mech_type").isString())
     {
-      key = params->get("arguments").get("mech_type").string();
+      key = params->get("mech_type").string();
       mechType.setValue(key);
     }
     if (GSS_C_NO_OID == this->mechType.toGss() )
@@ -166,9 +166,9 @@ bool GSSCreateSecContextCommand::loadParameters(JSONObject *params)
   }
   
   // input_token
-  if ( ! params->get("arguments").get("input_token").isNull() )
+  if ( ! params->get("input_token").isNull() )
   {
-    key = params->get("arguments").get("input_token").string();
+    key = params->get("input_token").string();
     this->input_token.value = (void *)key.c_str();
     this->input_token.length = key.length();
   }
@@ -180,7 +180,7 @@ bool GSSCreateSecContextCommand::loadParameters(JSONObject *params)
   return true;
 }
 
-bool GSSCreateSecContextCommand::zeroOut(bool initialized)
+bool GSSInitSecContext::zeroOut(bool initialized)
 {
   /* Error checking */
   /* Variables */
@@ -227,10 +227,9 @@ bool GSSCreateSecContextCommand::zeroOut(bool initialized)
   return(true);
 }
 
-JSONObject *GSSCreateSecContextCommand::toJSON()
+JSONObject *GSSInitSecContext::toJSON()
 {
   /* Variables */
-  JSONObject *ret = new JSONObject();
   JSONObject *values = new JSONObject();
   
   /* Error checking */
@@ -245,16 +244,14 @@ JSONObject *GSSCreateSecContextCommand::toJSON()
   values->set("output_token", (const char *)this->output_token.value);
   values->set("ret_flags", this->ret_flags);
   values->set("time_rec", this->time_rec);
-  ret->set("command", "gss_init_sec_context");
-  ret->set("return_values", *values);
   
   /* Cleanup */
   
   /* Return */
-  return(ret);
+  return(values);
 }
 
-GSSCreateSecContextCommand::GSSCreateSecContextCommand(
+GSSInitSecContext::GSSInitSecContext(
   JSONObject *params, 
   void *fn) : GSSCommand(params)
 {
@@ -263,7 +260,7 @@ GSSCreateSecContextCommand::GSSCreateSecContextCommand(
   function = fn;
 }
 
-GSSCreateSecContextCommand::GSSCreateSecContextCommand(void *fn)
+GSSInitSecContext::GSSInitSecContext(void *fn)
 {
   zeroOut(false);
   function = fn;
@@ -5,8 +5,8 @@
  * 
  */
 
-#ifndef GSSCREATESECCONTEXTCOMMAND_H
-#define GSSCREATESECCONTEXTCOMMAND_H
+#ifndef GSSINITSECCONTEXT_H
+#define GSSINITSECCONTEXT_H
 
 #include "GSSCommand.h"
 #include <datamodel/GSSContext.h>
@@ -14,7 +14,7 @@
 #include <datamodel/GSSOID.h>
 #include <gssapi.h>
 
-class GSSCreateSecContextCommand : public GSSCommand
+class GSSInitSecContext : public GSSCommand
 {
 public:
 
@@ -32,8 +32,8 @@ public:
   
     void execute();
     JSONObject *toJSON();
-    GSSCreateSecContextCommand(void *fn = (void *)&gss_init_sec_context);
-    GSSCreateSecContextCommand(JSONObject *params, void *fn = (void *)&gss_init_sec_context);
+    GSSInitSecContext(void *fn = (void *)&gss_init_sec_context);
+    GSSInitSecContext(JSONObject *params, void *fn = (void *)&gss_init_sec_context);
     
     bool loadParameters(JSONObject *params);
     bool zeroOut(bool initialized = true);
@@ -59,4 +59,4 @@ private:
     std::string contextKey;
 };
 
-#endif // GSSCREATESECCONTEXTCOMMAND_H
+#endif // GSSINITSECCONTEXT_H
index 48ea33d..7079a42 100644 (file)
@@ -27,8 +27,6 @@ GSSPseudoRandom::GSSPseudoRandom(JSONObject *params,
 
 /* JSON input
  * 
- * {"method":    "gss_pseudo_random",
- *  "arguments": 
  *   {
  *     "context_handle":     "########",
  *     "prf_key":            ###,
@@ -49,10 +47,10 @@ bool GSSPseudoRandom::loadParameters ( JSONObject* params )
   /***********
    * prf_key *
    ***********/
-  if ( ! params->get("arguments").get("prf_key").isNull() )
+  if ( ! params->get("prf_key").isNull() )
   {
-    if (params->get("arguments").get("prf_key").isInteger())
-      this->key = params->get("arguments").get("prf_key").integer();
+    if (params->get("prf_key").isInteger())
+      this->key = params->get("prf_key").integer();
     else
       throw std::invalid_argument( "Unrecognized argument type for prf_key." );
   }  
@@ -61,10 +59,10 @@ bool GSSPseudoRandom::loadParameters ( JSONObject* params )
   /**********************
    * desired_output_len *
    **********************/
-  if ( ! params->get("arguments").get("desired_output_len").isNull() )
+  if ( ! params->get("desired_output_len").isNull() )
   {
-    if (params->get("arguments").get("desired_output_len").isInteger())
-      this->desiredOutputLength = params->get("arguments").get("desired_output_len").integer();
+    if (params->get("desired_output_len").isInteger())
+      this->desiredOutputLength = params->get("desired_output_len").integer();
     else
       throw std::invalid_argument( "Unrecognized argument type for desired_output_len." );
   }  
@@ -73,11 +71,11 @@ bool GSSPseudoRandom::loadParameters ( JSONObject* params )
   /**********
    * prf_in *
    **********/
-  if ( ! params->get("arguments").get("prf_in").isNull() )
+  if ( ! params->get("prf_in").isNull() )
   {
-    if (params->get("arguments").get("prf_in").isString())
+    if (params->get("prf_in").isString())
     {
-      sInputMessage = params->get("arguments").get("prf_in").string();
+      sInputMessage = params->get("prf_in").string();
       this->inputMessage.setValue(sInputMessage);
     }
   }
@@ -86,11 +84,11 @@ bool GSSPseudoRandom::loadParameters ( JSONObject* params )
   /******************
    * context_handle *
    ******************/
-  if ( ! params->get("arguments").get("context_handle").isNull() )
+  if ( ! params->get("context_handle").isNull() )
   {
-    if (params->get("arguments").get("context_handle").isString())
+    if (params->get("context_handle").isString())
     {
-      std::string contextKey = params->get("arguments").get("context_handle").string();
+      std::string contextKey = params->get("context_handle").string();
       GSSContext ctx = GSSContextCache::instance()->retrieve(contextKey);
       this->context = ctx.getContext();
     }
@@ -136,7 +134,6 @@ void GSSPseudoRandom::execute()
 JSONObject* GSSPseudoRandom::toJSON()
 {
   /* Variables */
-  JSONObject *ret = new JSONObject();
   JSONObject *values = new JSONObject();
   
   /* Error checking */
@@ -154,13 +151,9 @@ JSONObject* GSSPseudoRandom::toJSON()
     this->outputMessage.toString().c_str()
   );
   
-  // Put it all together.
-  ret->set("command", "gss_pseudo_random");
-  ret->set("return_values", *values);
-  
   /* Cleanup */
   
   /* Return */
-  return(ret);
+  return(values);
 }
 
index 8e2d742..76c952f 100644 (file)
@@ -28,18 +28,18 @@ bool GSSUnwrap::loadParameters(JSONObject *params)
   /*****************
    * input_message *
    *****************/
-  if ( ! params->get("arguments").get("input_message").isNull() )
+  if ( ! params->get("input_message").isNull() )
   {
-    sInputMessage = params->get("arguments").get("input_message").string();
+    sInputMessage = params->get("input_message").string();
     this->inputMessage.setValue(sInputMessage);
   }
   
   /******************
    * context_handle *
    ******************/
-  if ( ! params->get("arguments").get("context_handle").isNull() )
+  if ( ! params->get("context_handle").isNull() )
   {
-    sInputMessage = params->get("arguments").get("context_handle").string();
+    sInputMessage = params->get("context_handle").string();
     GSSContext ctx = GSSContextCache::instance()->retrieve(sInputMessage);
     this->context = ctx.getContext();
   }
@@ -71,7 +71,6 @@ JSONObject* GSSUnwrap::toJSON()
 {
   /* Variables */
   const char *conf_state;
-  JSONObject *ret = new JSONObject();
   JSONObject *values = new JSONObject();
   
   /* Error checking */
@@ -94,12 +93,8 @@ JSONObject* GSSUnwrap::toJSON()
     this->outputMessage.toString().c_str()
   );
   
-  // Put it all together.
-  ret->set("command", "gss_wrap");
-  ret->set("return_values", *values);
-  
   /* Cleanup */
   
   /* Return */
-  return(ret);
+  return(values);
 }
index 64bd065..2bc4320 100644 (file)
@@ -37,19 +37,19 @@ bool GSSWrap::loadParameters(JSONObject *params)
   /************
    * CONF_REQ *
    ************/
-  if ( ! params->get("arguments").get("conf_req").isNull() )
+  if ( ! params->get("conf_req").isNull() )
   {
-    if (params->get("arguments").get("conf_req").isString())
+    if (params->get("conf_req").isString())
     {
-      sConfReq = params->get("arguments").get("conf_req").string();
+      sConfReq = params->get("conf_req").string();
       if (sConfReq == "TRUE")
         this->conf_req = 1;
       else if (sConfReq == "FALSE")
         this->conf_req = 0;
       else
         throw std::invalid_argument( std::string("Invalid QOP type given: ") + sConfReq );
-    } else if (params->get("arguments").get("conf_req").isInteger())
-      this->conf_req = (gss_cred_usage_t)( params->get("arguments").get("conf_req").integer() );
+    } else if (params->get("conf_req").isInteger())
+      this->conf_req = (gss_cred_usage_t)( params->get("conf_req").integer() );
     else
       throw std::invalid_argument( "Unrecognized argument type for conf_req." );
   }  
@@ -57,17 +57,17 @@ bool GSSWrap::loadParameters(JSONObject *params)
   /***********
    * QOP_REQ *
    ***********/
-  if ( ! params->get("arguments").get("qop_req").isNull() )
+  if ( ! params->get("qop_req").isNull() )
   {
-    if (params->get("arguments").get("qop_req").isString())
+    if (params->get("qop_req").isString())
     {
-      sQopReq = params->get("arguments").get("qop_req").string();
+      sQopReq = params->get("qop_req").string();
       if (sQopReq == "GSS_C_QOP_DEFAULT")
         this->qop_req = GSS_C_QOP_DEFAULT;
       else
         throw std::invalid_argument( std::string("Invalid QOP type given: ") + sQopReq );
-    } else if (params->get("arguments").get("qop_req").isInteger())
-      this->qop_req = (gss_cred_usage_t)( params->get("arguments").get("qop_req").integer() );
+    } else if (params->get("qop_req").isInteger())
+      this->qop_req = (gss_cred_usage_t)( params->get("qop_req").integer() );
     else
       throw std::invalid_argument( "Unrecognized argument type for qop_req." );
   }
@@ -75,18 +75,18 @@ bool GSSWrap::loadParameters(JSONObject *params)
   /*****************
    * input_message *
    *****************/
-  if ( ! params->get("arguments").get("input_message").isNull() )
+  if ( ! params->get("input_message").isNull() )
   {
-    sInputMessage = params->get("arguments").get("input_message").string();
+    sInputMessage = params->get("input_message").string();
     this->inputMessage.setValue(sInputMessage);
   }
   
   /***********
    * context *
    ***********/
-  if ( ! params->get("arguments").get("context_handle").isNull() )
+  if ( ! params->get("context_handle").isNull() )
   {
-    std::string contextKey = params->get("arguments").get("context_handle").string();
+    std::string contextKey = params->get("context_handle").string();
     GSSContext ctx = GSSContextCache::instance()->retrieve(contextKey);
     this->context = ctx.getContext();
   }
@@ -128,22 +128,18 @@ void GSSWrap::execute()
 
 /* Desired JSON output:
  * 
- * {
- *  "command":       "gss_wrap",
- *  "return_values": 
  *  {
  *      "major_status":   0,
  *      "minor_status":   0,
  *      "conf_state":     "TRUE",
  *      "output_message": "asdf"
  *  }
- * }
+ * 
  */
 JSONObject *GSSWrap::toJSON()
 {
   /* Variables */
   const char *conf_state;
-  JSONObject *ret = new JSONObject();
   JSONObject *values = new JSONObject();
   
   /* Error checking */
@@ -164,13 +160,9 @@ JSONObject *GSSWrap::toJSON()
     this->outputMessage.toString().c_str()
   );
   
-  // Put it all together.
-  ret->set("command", "gss_wrap");
-  ret->set("return_values", *values);
-  
   /* Cleanup */
   
   /* Return */
-  return(ret);
+  return(values);
 }
 
index c9358df..7f3716d 100644 (file)
@@ -159,7 +159,7 @@ private:
     void set(json_t *obj) {
        if (m_obj != obj) {
            json_decref(m_obj);
-           m_obj = json_incref(m_obj);
+           m_obj = json_incref(obj);
        }
     }
 
index 1037324..61b1f62 100644 (file)
@@ -25,7 +25,7 @@ add_executable(test GSSExceptionTest.cpp
                     GSSImportNameTest.cpp
                     command_mocks/MockImportName.cpp
                     test_run.cpp 
-                    ../src/commands/GSSCreateSecContextCommand.cpp 
+                    ../src/commands/GSSInitSecContext.cpp 
                     ../src/util_json.cpp 
                     ../src/commands/GSSImportName.cpp
                     ../src/GSSException.cpp
index 8669267..c225031 100644 (file)
@@ -7,7 +7,7 @@
 
 
 #include "GSSCreateSecContextTest.h"
-#include "GSSCreateSecContextCommand.h"
+#include "GSSInitSecContext.h"
 #include "command_mocks/InitSecContextMock.h"
 #include <iostream>
 #include <string.h>
@@ -84,7 +84,7 @@ GSSCreateSecContextTest::tearDown()
 void
 GSSCreateSecContextTest::testConstructor()
 {
-  GSSCreateSecContextCommand cmd = GSSCreateSecContextCommand();
+  GSSInitSecContext cmd = GSSInitSecContext();
   void *cmdFn;
   void *GSSFn;
   
@@ -150,7 +150,7 @@ void GSSCreateSecContextTest::testConstructorWithJSONObject()
   const char *in = input.c_str();
   JSONObject json = JSONObject::load(in, 0, &jsonErr);
   
-  GSSCreateSecContextCommand cmd = GSSCreateSecContextCommand(
+  GSSInitSecContext cmd = GSSInitSecContext(
     &json, 
     (void *)&mock_init_sec
   );
@@ -193,7 +193,7 @@ GSSCreateSecContextTest::testEmptyCall()
 {
   gss_ctx_id_t expectedResult, expectedArgument;
   
-  GSSCreateSecContextCommand cmd ((void *)&mock_init_sec);
+  GSSInitSecContext cmd ((void *)&mock_init_sec);
   
   /* Set expectations on what the GSS function will be called with */
   cmd.time_req = rand() % 1024;
@@ -309,7 +309,7 @@ GSSCreateSecContextTest::testEmptyCall()
 void GSSCreateSecContextTest::testJSONMarshal()
 {
   /* Variables */
-  GSSCreateSecContextCommand cmd ((void *)&mock_init_sec);
+  GSSInitSecContext cmd ((void *)&mock_init_sec);
   JSONObject *result;
   GSSContextCache *cache = GSSContextCache::instance();
   GSSContext context;
index dee46e1..f3b8304 100644 (file)
@@ -15,7 +15,7 @@
 
 #include <gssapi.h>
 
-#include "commands/GSSCreateSecContextCommand.h"
+#include "commands/GSSInitSecContext.h"
 
 class GSSCreateSecContextTest :  public CppUnit::TestFixture
 {
@@ -40,7 +40,7 @@ public:
   void getCache();
   
 private:
-  GSSCreateSecContextCommand command;
+  GSSInitSecContext command;
 };
 
 #endif // GSSCREATESECCONTEXTTEST_H
index 8c12252..051375d 100644 (file)
@@ -25,7 +25,7 @@
 #include <cppunit/extensions/HelperMacros.h>
 
 #include <gssapi.h>
-#include "GSSCreateSecContextCommand.h"
+#include "GSSInitSecContext.h"
 
 #include <stdlib.h>