From a6d4b489f612145206e3419ee1bb555ece0fe450 Mon Sep 17 00:00:00 2001
From: Michael Davis <michael.davis@cern.ch>
Date: Fri, 6 Oct 2017 11:16:57 +0200
Subject: [PATCH] [cta_eos] Change checksum to upper case and prepend 0X

---
 cmdline/CMakeLists.txt | 2 +-
 cmdline/EosCtaStub.cpp | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/cmdline/CMakeLists.txt b/cmdline/CMakeLists.txt
index e2aee9469f..1cfb43d111 100644
--- a/cmdline/CMakeLists.txt
+++ b/cmdline/CMakeLists.txt
@@ -38,7 +38,7 @@ find_package(cryptopp REQUIRED)
 
 include_directories(${PROTOBUF3_INCLUDE_DIRS} ${XROOTD_INCLUDE_DIR} ${XROOTD_INCLUDE_DIR}/private ../xroot_ssi_pb)
 add_executable(eoscta_stub EosCtaStub.cpp Configuration.cpp)
-target_link_libraries(eoscta_stub cryptopp XrdCtaMessages XrdSsi-4 XrdSsiLib)
+target_link_libraries(eoscta_stub cryptopp ctacommon XrdCtaMessages XrdSsi-4 XrdSsiLib)
 set_property (TARGET eoscta_stub APPEND PROPERTY INSTALL_RPATH ${PROTOBUF3_RPATH})
 # Get some extra debug messages on stdout
 target_compile_definitions(eoscta_stub PUBLIC XRDSSI_DEBUG)
diff --git a/cmdline/EosCtaStub.cpp b/cmdline/EosCtaStub.cpp
index e6ade0d0f2..016b3bbbdf 100644
--- a/cmdline/EosCtaStub.cpp
+++ b/cmdline/EosCtaStub.cpp
@@ -23,6 +23,7 @@
 #include <cryptopp/base64.h>
 
 #include "common/dataStructures/FrontendReturnCode.hpp"
+#include "common/utils/utils.hpp"
 #include "cmdline/Configuration.hpp"
 #include "xroot_plugins/messages/CtaFrontendApi.hpp"
 
@@ -231,7 +232,11 @@ void fillNotification(cta::eos::Notification &notification, bool &isStderr, bool
       else if(argstr == "--diskfilegroup")       notification.mutable_file()->mutable_owner()->set_groupname(argval);
       else if(argstr == "--size")                notification.mutable_file()->set_size(std::stoi(argval));
       else if(argstr == "--checksumtype")        notification.mutable_file()->mutable_cks()->set_name(argval);
-      else if(argstr == "--checksumvalue")       notification.mutable_file()->mutable_cks()->set_value(argval);
+      else if(argstr == "--checksumvalue") {
+         std::string checksumvalue("0X" + argval);
+         cta::utils::toUpper(checksumvalue);
+         notification.mutable_file()->mutable_cks()->set_value(checksumvalue);
+      }
       else if(argstr == "--diskfilepath")        notification.mutable_file()->set_lpath(argval);
       else if(argstr == "--storageclass")        {
          google::protobuf::MapPair<std::string,std::string> sc("CTA_StorageClass", argval);
-- 
GitLab