X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=shibsp%2Fremoting%2Fimpl%2FListenerService.cpp;fp=shibsp%2Fremoting%2Fimpl%2FListenerService.cpp;h=312f469b6af0aae2ffa3b39f8aac45c0a8ac82c7;hb=3c1e801d6539b92d6d3d7fb40d661a7ce630ec44;hp=46da64277986f6c37a1b9d891e99368838a63736;hpb=f2621219507344852f967e4099e9c341499eb802;p=shibboleth%2Fsp.git diff --git a/shibsp/remoting/impl/ListenerService.cpp b/shibsp/remoting/impl/ListenerService.cpp index 46da642..312f469 100644 --- a/shibsp/remoting/impl/ListenerService.cpp +++ b/shibsp/remoting/impl/ListenerService.cpp @@ -30,6 +30,7 @@ #include "remoting/ListenerService.h" #include +#include using namespace shibsp; using namespace xmltooling; @@ -103,10 +104,26 @@ void ListenerService::receive(DDF &in, ostream& out) { if (!in.name()) throw ListenerException("Incoming message with no destination address rejected."); - else if (!strcmp("ping",in.name())) { - DDF outmsg=DDF(nullptr).integer(in.integer() + 1); + else if (!strcmp("ping", in.name())) { + DDF outmsg = DDF(nullptr).integer(in.integer() + 1); DDFJanitor jan(outmsg); out << outmsg; + return; + } + else if (!strcmp("hash", in.name())) { +#ifndef SHIBSP_LITE + const char* hashAlg = in["alg"].string(); + const char* data = in["data"].string(); + if (!hashAlg || !*hashAlg || !data || !*data) + throw ListenerException("Hash request missing algorithm or data parameters."); + DDF outmsg(nullptr); + DDFJanitor jan(outmsg); + outmsg.string(SecurityHelper::doHash(hashAlg, data, strlen(data)).c_str()); + out << outmsg; + return; +#else + throw ListenerException("Hash algorithms unavailable in lite build of library."); +#endif } // Two stage lookup, on the listener itself, and the SP interface.