From: Margaret Wasserman Date: Tue, 28 Apr 2015 19:32:15 +0000 (-0400) Subject: Move util_ files into utils directory, move main.cpp into src X-Git-Url: http://www.project-moonshot.org/gitweb/?p=gssweb.git;a=commitdiff_plain;h=ed6b9911b8d439a1587f2fe43c192c75614b471c Move util_ files into utils directory, move main.cpp into src --- diff --git a/json_gssapi/CMakeLists.txt b/json_gssapi/CMakeLists.txt index 483a0e9..df15fd4 100644 --- a/json_gssapi/CMakeLists.txt +++ b/json_gssapi/CMakeLists.txt @@ -22,9 +22,9 @@ add_library(jsongssapi SHARED 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 @@ -35,7 +35,7 @@ set_target_properties( 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) diff --git a/json_gssapi/src/GSSRequest.h b/json_gssapi/src/GSSRequest.h index 33cf6bc..bbba6d7 100644 --- a/json_gssapi/src/GSSRequest.h +++ b/json_gssapi/src/GSSRequest.h @@ -11,7 +11,7 @@ #include #include "jsongssapi_export.h" #include "commands/GSSCommand.h" -#include "util_json.h" +#include "utils/util_json.h" using std::string; diff --git a/json_gssapi/src/cache/GSSContextCache.cpp b/json_gssapi/src/cache/GSSContextCache.cpp index b8b4dc6..b56dd64 100644 --- a/json_gssapi/src/cache/GSSContextCache.cpp +++ b/json_gssapi/src/cache/GSSContextCache.cpp @@ -6,8 +6,8 @@ */ #include -#include "util_random.h" -#include "util_base64.h" +#include "utils/util_random.h" +#include "utils/util_base64.h" #include "GSSContextCache.h" diff --git a/json_gssapi/src/cache/GSSNameCache.cpp b/json_gssapi/src/cache/GSSNameCache.cpp index 59e65da..79a30ba 100644 --- a/json_gssapi/src/cache/GSSNameCache.cpp +++ b/json_gssapi/src/cache/GSSNameCache.cpp @@ -6,8 +6,8 @@ */ #include #include "GSSNameCache.h" -#include "util_base64.h" -#include "util_random.h" +#include "utils/util_base64.h" +#include "utils/util_random.h" #define KEYLEN 128 diff --git a/json_gssapi/src/commands/GSSCommand.h b/json_gssapi/src/commands/GSSCommand.h index 294c1a0..2d60d5e 100644 --- a/json_gssapi/src/commands/GSSCommand.h +++ b/json_gssapi/src/commands/GSSCommand.h @@ -35,7 +35,7 @@ #ifndef GSSCOMMAND_H #define GSSCOMMAND_H -#include "util_json.h" +#include "utils/util_json.h" #include class GSSCommand diff --git a/json_gssapi/src/commands/GSSImportName.cpp b/json_gssapi/src/commands/GSSImportName.cpp index 8c1e9de..9b9ae42 100644 --- a/json_gssapi/src/commands/GSSImportName.cpp +++ b/json_gssapi/src/commands/GSSImportName.cpp @@ -49,24 +49,16 @@ void GSSImportName::execute() /* 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); -// std::cout << "Storing key: " << key << std::endl; this->outputName.setKey(key); /* Cleanup */ /* Return */ - } /* Example output: @@ -125,7 +117,7 @@ bool GSSImportName::loadParameters(JSONObject *params) /* Error checking */ /* Setup */ - // Should I zeroOut? + // Should I zeroOut? MRW -- do initialize here for null inputs /* Main processing */ // Easy stuff(*params) @@ -154,13 +146,3 @@ bool GSSImportName::loadParameters(JSONObject *params) /* Return */ return true; } - - - - -/* Variables */ -/* Error checking */ -/* Setup */ -/* Main */ -/* Cleanup */ -/* Return */ diff --git a/json_gssapi/src/commands/GSSInitSecContext.cpp b/json_gssapi/src/commands/GSSInitSecContext.cpp index 58803fd..c0112ba 100644 --- a/json_gssapi/src/commands/GSSInitSecContext.cpp +++ b/json_gssapi/src/commands/GSSInitSecContext.cpp @@ -43,7 +43,7 @@ #include #include -#include "util_base64.h" +#include "utils/util_base64.h" void GSSInitSecContext::execute() diff --git a/json_gssapi/src/datamodel/GSSCredential.h b/json_gssapi/src/datamodel/GSSCredential.h index e324bc5..40e03a0 100644 --- a/json_gssapi/src/datamodel/GSSCredential.h +++ b/json_gssapi/src/datamodel/GSSCredential.h @@ -8,7 +8,7 @@ #ifndef GSSCREDENTIAL_H #define GSSCREDENTIAL_H -#include "../util_json.h" +#include "utils/util_json.h" #include #include diff --git a/json_gssapi/src/datamodel/GSSOID.h b/json_gssapi/src/datamodel/GSSOID.h index 1280b97..4ec632a 100644 --- a/json_gssapi/src/datamodel/GSSOID.h +++ b/json_gssapi/src/datamodel/GSSOID.h @@ -7,7 +7,7 @@ #include #include "gssapi.h" -#include "../util_json.h" +#include "utils/util_json.h" #include "GSSBuffer.h" diff --git a/json_gssapi/main.cpp b/json_gssapi/src/main.cpp similarity index 100% rename from json_gssapi/main.cpp rename to json_gssapi/src/main.cpp diff --git a/json_gssapi/src/utils/base64.h b/json_gssapi/src/utils/base64.h deleted file mode 100644 index 7deba7c..0000000 --- a/json_gssapi/src/utils/base64.h +++ /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 - -#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 diff --git a/json_gssapi/src/util_base64.cpp b/json_gssapi/src/utils/util_base64.cpp similarity index 100% rename from json_gssapi/src/util_base64.cpp rename to json_gssapi/src/utils/util_base64.cpp diff --git a/json_gssapi/src/util_base64.h b/json_gssapi/src/utils/util_base64.h similarity index 100% rename from json_gssapi/src/util_base64.h rename to json_gssapi/src/utils/util_base64.h diff --git a/json_gssapi/src/util_json.cpp b/json_gssapi/src/utils/util_json.cpp similarity index 100% rename from json_gssapi/src/util_json.cpp rename to json_gssapi/src/utils/util_json.cpp diff --git a/json_gssapi/src/util_json.h b/json_gssapi/src/utils/util_json.h similarity index 100% rename from json_gssapi/src/util_json.h rename to json_gssapi/src/utils/util_json.h diff --git a/json_gssapi/src/util_random.cpp b/json_gssapi/src/utils/util_random.cpp similarity index 100% rename from json_gssapi/src/util_random.cpp rename to json_gssapi/src/utils/util_random.cpp diff --git a/json_gssapi/src/util_random.h b/json_gssapi/src/utils/util_random.h similarity index 100% rename from json_gssapi/src/util_random.h rename to json_gssapi/src/utils/util_random.h diff --git a/json_gssapi/test/CMakeLists.txt b/json_gssapi/test/CMakeLists.txt index e4d6be3..d17e5f7 100644 --- a/json_gssapi/test/CMakeLists.txt +++ b/json_gssapi/test/CMakeLists.txt @@ -27,9 +27,9 @@ add_executable(test GSSExceptionTest.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 diff --git a/json_gssapi/test/GSSCreateSecContextTest.cpp b/json_gssapi/test/GSSCreateSecContextTest.cpp index a0752b4..cf3be56 100644 --- a/json_gssapi/test/GSSCreateSecContextTest.cpp +++ b/json_gssapi/test/GSSCreateSecContextTest.cpp @@ -12,11 +12,11 @@ #include #include #include -#include "util_json.h" +#include "utils/util_json.h" #include #include #include -#include +#include // Registers the fixture into the 'registry' CPPUNIT_TEST_SUITE_REGISTRATION( GSSCreateSecContextTest );