Skip to content

Commit

Permalink
Fixed docs
Browse files Browse the repository at this point in the history
Appled the fixes to the return codes, suggested by Cedric Serfon
  • Loading branch information
Fabrizio Furano committed Dec 16, 2013
1 parent 4229579 commit c8e421b
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 36 deletions.
1 change: 1 addition & 0 deletions packaging/rhel/xrootd.spec.in
Expand Up @@ -26,6 +26,7 @@ BuildRequires: libxml2-devel
BuildRequires: krb5-devel
BuildRequires: zlib-devel
BuildRequires: ncurses-devel
BuildRequires: voms-devel

%if %{?_with_tests:1}%{!?_with_tests:0}
BuildRequires: cppunit-devel
Expand Down
10 changes: 10 additions & 0 deletions src/XrdHTTP/CMakeLists.txt
@@ -1,5 +1,15 @@
cmake_minimum_required (VERSION 2.6)



# The version number
set (XRDHTTP_VERSION_MAJOR 1)
set (XRDHTTP_VERSION_MINOR 0)
set (XRDHTTP_VERSION_PATCH 0)




# include the directory itself as a path to include directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)

Expand Down
2 changes: 1 addition & 1 deletion src/XrdHTTP/XrdHttpProtocol.cc
Expand Up @@ -1326,7 +1326,7 @@ int XrdHttpProtocol::InitSecurity() {



if (secxtractor) secxtractor->InitSSLCtx(sslctx);
if (secxtractor) secxtractor->Init(sslctx, XrdHttpTrace->What);

ERR_print_errors(sslbio_err);
return 0;
Expand Down
19 changes: 16 additions & 3 deletions src/XrdHTTP/XrdHttpReq.cc
Expand Up @@ -478,6 +478,7 @@ bool XrdHttpReq::Done(XrdXrootd::Bridge::Context & info) {
TRACE(REQ, " XrdHttpReq::Done");

xrdresp = kXR_ok;
this->iovN = 0;

if (PostProcessHTTPReq(true)) reset();

Expand Down Expand Up @@ -1342,7 +1343,19 @@ int XrdHttpReq::PostProcessHTTPReq(bool final) {
stringresp += prot->SecEntity.name;
else
stringresp += prot->Link->ID;


if (prot->SecEntity.vorg) {
stringresp += " (VO: ";
stringresp += prot->SecEntity.vorg;

}

if (prot->SecEntity.role) {
stringresp += " Role: ";
stringresp += prot->SecEntity.role;
stringresp += " )";
}

if (prot->SecEntity.host) {
stringresp += " ( ";
stringresp += prot->SecEntity.host;
Expand Down Expand Up @@ -1543,7 +1556,7 @@ int XrdHttpReq::PostProcessHTTPReq(bool final) {

if (xrdresp != kXR_ok) {

prot->SendSimpleResp(500, NULL, NULL, (char *) "Error man!", 0);
prot->SendSimpleResp(409, NULL, NULL, (char *) "Error man!", 0);
return -1;
}

Expand Down Expand Up @@ -1604,7 +1617,7 @@ int XrdHttpReq::PostProcessHTTPReq(bool final) {
{

if (xrdresp != kXR_ok) {
prot->SendSimpleResp(500, NULL, NULL, (char *) etext.c_str(), 0);
prot->SendSimpleResp(404, NULL, NULL, (char *) etext.c_str(), 0);
return -1;
}

Expand Down
2 changes: 1 addition & 1 deletion src/XrdHTTP/XrdHttpSecXtractor.hh
Expand Up @@ -14,7 +14,7 @@ public:


// Initializes an ssl ctx
virtual int InitSSLCtx(SSL_CTX *) = 0;
virtual int Init(SSL_CTX *, int) = 0;
//------------------------------------------------------------------------------
//! Constructor
//------------------------------------------------------------------------------
Expand Down
47 changes: 39 additions & 8 deletions src/XrdHTTP/XrdHttpVoms.cc
Expand Up @@ -12,9 +12,11 @@
#include "XrdSys/XrdSysPlatform.hh"
#include "XrdOuc/XrdOucEnv.hh"
#include "XrdSec/XrdSecInterface.hh"
#include "XrdHttpTrace.hh"
#include "XrdOuc/XrdOucTrace.hh"
#include "Xrd/XrdLink.hh"



extern "C" {
extern int proxy_app_verify_callback(X509_STORE_CTX *ctx, void *empty);
}
Expand All @@ -28,7 +30,7 @@ class XrdHttpVOMS : public XrdHttpSecXtractor
virtual int GetSecData(XrdLink *, XrdSecEntity &, SSL *);

// Initializes an ssl ctx
virtual int InitSSLCtx(SSL_CTX *);
virtual int Init(SSL_CTX *, int);

XrdHttpVOMS(XrdSysError *);

Expand All @@ -45,6 +47,29 @@ class XrdHttpVOMS : public XrdHttpSecXtractor

#define TRACELINK lp


// Trace flags
//
#define TRACE_ALL 0x0fff
#define TRACE_DEBUG 0x0001
#define TRACE_EMSG 0x0002
#define TRACE_FS 0x0004
#define TRACE_LOGIN 0x0008
#define TRACE_MEM 0x0010
#define TRACE_REQ 0x0020
#define TRACE_REDIR 0x0040
#define TRACE_RSP 0x0080
#define TRACE_SCHED 0x0100
#define TRACE_STALL 0x0200

XrdOucTrace *XrdVomsTrace;
const char *XrdVomsTraceID;

#define TRACEI(act, x) \
if (XrdVomsTrace->What & TRACE_ ## act) \
{XrdVomsTrace->Beg(XrdVomsTraceID,TRACELINK->ID); cerr <<x; XrdVomsTrace->End();}


/******************************************************************************/
/* C o n s t r u c t o r */
/******************************************************************************/
Expand All @@ -53,8 +78,8 @@ XrdHttpVOMS::XrdHttpVOMS(XrdSysError *erp): XrdHttpSecXtractor()
{
//eDest = erp;
//eDest->logger(erp->logger());
XrdHttpTrace = new XrdOucTrace(eDest);
XrdHttpTrace->What = TRACE_ALL;
XrdVomsTrace = new XrdOucTrace(eDest);
XrdVomsTrace->What = TRACE_ALL;
}

int XrdHttpVOMS::GetSecData(XrdLink *lp, XrdSecEntity &sec, SSL *ssl) {
Expand Down Expand Up @@ -91,13 +116,15 @@ int XrdHttpVOMS::GetSecData(XrdLink *lp, XrdSecEntity &sec, SSL *ssl) {
/* Questo ti da la lista di tutti gli fqan della VO primaria
(la prima in voms-proxy-init --voms <vo> per intenderci. */


if (vmd.DefaultData(vm)) {
fqans = vm.fqan;
sec.vorg = strdup(vm.voname.c_str());
for (unsigned int i = 0; i < fqans.size(); i++) {
TRACEI(DEBUG, " fqan :" << fqans[i]);
}
sec.vorg = strdup(fqans[0].c_str());
TRACEI(DEBUG, " Setting main vorg :" << sec.vorg);
sec.role = strdup(fqans[0].c_str());
TRACEI(DEBUG, " Setting VO: " << sec.vorg << " roles :" << sec.role);

}

Expand All @@ -111,7 +138,7 @@ int XrdHttpVOMS::GetSecData(XrdLink *lp, XrdSecEntity &sec, SSL *ssl) {
// fqans.insert(i->fqan.begin(), i->fqan.end());
// }
} else
TRACE(DEBUG, " voms info retrieval failed: " << vmd.ErrorMessage());
TRACEI(DEBUG, " voms info retrieval failed: " << vmd.ErrorMessage());
}

if (peer_cert) X509_free(peer_cert);
Expand All @@ -122,8 +149,12 @@ int XrdHttpVOMS::GetSecData(XrdLink *lp, XrdSecEntity &sec, SSL *ssl) {
return 0;
}

int XrdHttpVOMS::InitSSLCtx(SSL_CTX *sslctx) {
int XrdHttpVOMS::Init(SSL_CTX *sslctx, int mydebug) {
SSL_CTX_set_cert_verify_callback(sslctx, proxy_app_verify_callback, 0);

XrdVomsTrace->What = mydebug;


return 0;
}

Expand Down

0 comments on commit c8e421b

Please sign in to comment.