Move util_ files into utils directory, move main.cpp into src
authorMargaret Wasserman <mrw@painless-security.com>
Tue, 28 Apr 2015 19:32:15 +0000 (15:32 -0400)
committerMargaret Wasserman <mrw@painless-security.com>
Tue, 28 Apr 2015 19:32:15 +0000 (15:32 -0400)
19 files changed:
json_gssapi/CMakeLists.txt
json_gssapi/src/GSSRequest.h
json_gssapi/src/cache/GSSContextCache.cpp
json_gssapi/src/cache/GSSNameCache.cpp
json_gssapi/src/commands/GSSCommand.h
json_gssapi/src/commands/GSSImportName.cpp
json_gssapi/src/commands/GSSInitSecContext.cpp
json_gssapi/src/datamodel/GSSCredential.h
json_gssapi/src/datamodel/GSSOID.h
json_gssapi/src/main.cpp [moved from json_gssapi/main.cpp with 100% similarity]
json_gssapi/src/utils/base64.h [deleted file]
json_gssapi/src/utils/util_base64.cpp [moved from json_gssapi/src/util_base64.cpp with 100% similarity]
json_gssapi/src/utils/util_base64.h [moved from json_gssapi/src/util_base64.h with 100% similarity]
json_gssapi/src/utils/util_json.cpp [moved from json_gssapi/src/util_json.cpp with 100% similarity]
json_gssapi/src/utils/util_json.h [moved from json_gssapi/src/util_json.h with 100% similarity]
json_gssapi/src/utils/util_random.cpp [moved from json_gssapi/src/util_random.cpp with 100% similarity]
json_gssapi/src/utils/util_random.h [moved from json_gssapi/src/util_random.h with 100% similarity]
json_gssapi/test/CMakeLists.txt
json_gssapi/test/GSSCreateSecContextTest.cpp

index 483a0e9..df15fd4 100644 (file)
@@ -22,9 +22,9 @@ add_library(jsongssapi SHARED
                        src/commands/GSSPseudoRandom.cpp
                        src/commands/GSSWrap.cpp  
                        src/commands/GSSUnwrap.cpp
                        src/commands/GSSPseudoRandom.cpp
                        src/commands/GSSWrap.cpp  
                        src/commands/GSSUnwrap.cpp
-                       src/util_base64.cpp
-                       src/util_json.cpp
-                       src/util_random.cpp
+                       src/utils/util_base64.cpp
+                       src/utils/util_json.cpp
+                       src/utils/util_random.cpp
                        src/cache/GSSContextCache.cpp
                        src/cache/GSSNameCache.cpp
                        src/datamodel/GSSContext.cpp
                        src/cache/GSSContextCache.cpp
                        src/cache/GSSNameCache.cpp
                        src/datamodel/GSSContext.cpp
@@ -35,7 +35,7 @@ set_target_properties( jsongssapi
 
 GENERATE_EXPORT_HEADER(jsongssapi)
 
 
 GENERATE_EXPORT_HEADER(jsongssapi)
 
-add_executable(json_gssapi main.cpp)
+add_executable(json_gssapi src/main.cpp)
 
 find_package (PkgConfig)
 pkg_check_modules (GLIB2   glib-2.0)
 
 find_package (PkgConfig)
 pkg_check_modules (GLIB2   glib-2.0)
index 33cf6bc..bbba6d7 100644 (file)
@@ -11,7 +11,7 @@
 #include <string>
 #include "jsongssapi_export.h"
 #include "commands/GSSCommand.h"
 #include <string>
 #include "jsongssapi_export.h"
 #include "commands/GSSCommand.h"
-#include "util_json.h"
+#include "utils/util_json.h"
 
 using std::string;
 
 
 using std::string;
 
index b8b4dc6..b56dd64 100644 (file)
@@ -6,8 +6,8 @@
  */
 
 #include <stdexcept>
  */
 
 #include <stdexcept>
-#include "util_random.h"
-#include "util_base64.h"
+#include "utils/util_random.h"
+#include "utils/util_base64.h"
 
 #include "GSSContextCache.h"
 
 
 #include "GSSContextCache.h"
 
index 59e65da..79a30ba 100644 (file)
@@ -6,8 +6,8 @@
  */
 #include <stdexcept>
 #include "GSSNameCache.h"
  */
 #include <stdexcept>
 #include "GSSNameCache.h"
-#include "util_base64.h"
-#include "util_random.h"
+#include "utils/util_base64.h"
+#include "utils/util_random.h"
 
 #define KEYLEN 128
 
 
 #define KEYLEN 128
 
index 294c1a0..2d60d5e 100644 (file)
@@ -35,7 +35,7 @@
 #ifndef GSSCOMMAND_H
 #define GSSCOMMAND_H
 
 #ifndef GSSCOMMAND_H
 #define GSSCOMMAND_H
 
-#include "util_json.h"
+#include "utils/util_json.h"
 #include <iostream>
 
 class GSSCommand
 #include <iostream>
 
 class GSSCommand
index 8c1e9de..9b9ae42 100644 (file)
@@ -49,24 +49,16 @@ void GSSImportName::execute()
 
   /* Main */
   retVal = function(&minor_status, inputName.toGss(), inputNameType.toGss(), &name);
 
   /* Main */
   retVal = function(&minor_status, inputName.toGss(), inputNameType.toGss(), &name);
-//   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);
-//   }
-  
-  
-  
+  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);
   this->outputName.setValue(name);
   key = GSSNameCache::instance()->store(this->outputName);
-//   std::cout << "Storing key: " << key << std::endl;
   this->outputName.setKey(key);
   /* Cleanup */
   /* Return */
   this->outputName.setKey(key);
   /* Cleanup */
   /* Return */
-  
 }
 
 /* Example output:
 }
 
 /* Example output:
@@ -125,7 +117,7 @@ bool GSSImportName::loadParameters(JSONObject *params)
   
   /* Error checking */
   /* Setup */
   
   /* Error checking */
   /* Setup */
-  // Should I zeroOut?
+  // Should I zeroOut?  MRW -- do initialize here for null inputs
   
   /* Main processing */
   // Easy stuff(*params)
   
   /* Main processing */
   // Easy stuff(*params)
@@ -154,13 +146,3 @@ bool GSSImportName::loadParameters(JSONObject *params)
   /* Return */
   return true;
 }
   /* Return */
   return true;
 }
-
-
-
-
-/* Variables */
-/* Error checking */
-/* Setup */
-/* Main */
-/* Cleanup */
-/* Return */
index 58803fd..c0112ba 100644 (file)
@@ -43,7 +43,7 @@
 #include <stdlib.h>
 #include <string.h>
 
 #include <stdlib.h>
 #include <string.h>
 
-#include "util_base64.h"
+#include "utils/util_base64.h"
 
 void
 GSSInitSecContext::execute()
 
 void
 GSSInitSecContext::execute()
index e324bc5..40e03a0 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef GSSCREDENTIAL_H
 #define GSSCREDENTIAL_H
 
 #ifndef GSSCREDENTIAL_H
 #define GSSCREDENTIAL_H
 
-#include "../util_json.h"
+#include "utils/util_json.h"
 #include <gssapi/gssapi.h>
 #include <string>
 
 #include <gssapi/gssapi.h>
 #include <string>
 
index 1280b97..4ec632a 100644 (file)
@@ -7,7 +7,7 @@
 
 #include <string>
 #include "gssapi.h"
 
 #include <string>
 #include "gssapi.h"
-#include "../util_json.h"
+#include "utils/util_json.h"
 
 #include "GSSBuffer.h"
 
 
 #include "GSSBuffer.h"
 
diff --git a/json_gssapi/src/utils/base64.h b/json_gssapi/src/utils/base64.h
deleted file mode 100644 (file)
index 7deba7c..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2014, JANET(UK)
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of JANET(UK) nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifndef BASE64_H
-#define BASE64_H
-
-#include <glib.h>
-
-#define base64_encode(str) g_base64_encode((guchar *)str.c_str(), str.length())
-#define base64_decode(str, outlen) g_base64_decode(str.c_str(), outlen)
-
-#endif
index e4d6be3..d17e5f7 100644 (file)
@@ -27,9 +27,9 @@ add_executable(test GSSExceptionTest.cpp
                     command_mocks/MockImportName.cpp
                     test_run.cpp 
                     ../src/commands/GSSInitSecContext.cpp 
                     command_mocks/MockImportName.cpp
                     test_run.cpp 
                     ../src/commands/GSSInitSecContext.cpp 
-                    ../src/util_base64.cpp
-                    ../src/util_json.cpp 
-                    ../src/util_random.cpp
+                    ../src/utils/util_base64.cpp
+                    ../src/utils/util_json.cpp 
+                    ../src/utils/util_random.cpp
                     ../src/commands/GSSImportName.cpp
                     ../src/GSSException.cpp
                     ../src/commands/GSSGetMic.cpp
                     ../src/commands/GSSImportName.cpp
                     ../src/GSSException.cpp
                     ../src/commands/GSSGetMic.cpp
index a0752b4..cf3be56 100644 (file)
 #include <iostream>
 #include <string.h>
 #include <exception>
 #include <iostream>
 #include <string.h>
 #include <exception>
-#include "util_json.h"
+#include "utils/util_json.h"
 #include <cache/GSSContextCache.h>
 #include <cache/GSSNameCache.h>
 #include <datamodel/GSSContext.h>
 #include <cache/GSSContextCache.h>
 #include <cache/GSSNameCache.h>
 #include <datamodel/GSSContext.h>
-#include <util_base64.h>
+#include <utils/util_base64.h>
 
 // Registers the fixture into the 'registry'
 CPPUNIT_TEST_SUITE_REGISTRATION( GSSCreateSecContextTest );
 
 // Registers the fixture into the 'registry'
 CPPUNIT_TEST_SUITE_REGISTRATION( GSSCreateSecContextTest );