Loading...
Searching...
No Matches
XrdSecgsiAuthzFunDN.cc File Reference
`#include <cstdio>`
`#include <cstdlib>`
`#include <cstring>`
`#include <cerrno>`
`#include "XrdVersion.hh"`
`#include "XrdCrypto/XrdCryptosslAux.hh"`
`#include "XrdCrypto/XrdCryptoX509.hh"`
`#include "XrdCrypto/XrdCryptoX509Chain.hh"`
`#include "XrdOuc/XrdOucString.hh"`
`#include "XrdSec/XrdSecEntity.hh"`
`#include "XrdSecgsi/XrdSecgsiTrace.hh"`
`#include "XrdSut/XrdSutBucket.hh"`
Include dependency graph for XrdSecgsiAuthzFunDN.cc:

Go to the source code of this file.

## Functions

int | XrdSecgsiAuthzFun (XrdSecEntity &entity)
int | XrdSecgsiAuthzInit (const char *cfg)
int | XrdSecgsiAuthzKey (XrdSecEntity &entity, char **key)
| XrdVERSIONINFO (XrdSecgsiAuthzFun, secgsiauthz)
| XrdVERSIONINFO (XrdSecgsiAuthzInit, secgsiauthz)
| XrdVERSIONINFO (XrdSecgsiAuthzKey, secgsiauthz)

## Variables

static int | gCertfmt = 1
XrdOucTrace * | gsiTrace

## Function Documentation

## XrdSecgsiAuthzFun()

int XrdSecgsiAuthzFun | ( | XrdSecEntity & | entity | ) |

Definition at line 77 of file XrdSecgsiAuthzFunDN.cc.

{
// Implementation of XrdSecgsiAuthzFun extracting the information from the
// proxy chain in entity.creds
EPNAME("AuthzFunDN");
// Notify
DEBUG("dummy call for '"<<entity.name<<"'");
// Add something for test
entity.vorg = strdup("VO.dummy.test");
DEBUG("setting vorg: '"<<entity.vorg<<"'");
// Done
return 0;
}}
DEBUG
#define DEBUG(x)
Definition XrdBwmTrace.hh:54
EPNAME
#define EPNAME(x)
Definition XrdBwmTrace.hh:56
XrdSecEntity::vorg
char * vorg
Entity's virtual organization(s).
Definition XrdSecEntity.hh:71
XrdSecEntity::name
char * name
Entity's name.
Definition XrdSecEntity.hh:69

References DEBUG, EPNAME, XrdSecEntity::name, and XrdSecEntity::vorg.

Referenced by XrdVERSIONINFO().

Here is the caller graph for this function:

## XrdSecgsiAuthzInit()

int XrdSecgsiAuthzInit | ( | const char * | cfg | ) |

Definition at line 164 of file XrdSecgsiAuthzFunDN.cc.

{
// Initialize the relevant parameters from the 'cfg' string.
// Return -1 on failure.
// Otherwise, the return code indicates the format required by the mai function for
// the proxy chain:
// 0 proxy chain in 'raw' (opaque) format, to be processed
// using the XrdCrypto tools
// 1 proxy chain in 'PEM base64'
EPNAME("AuthzInitDN");
gCertfmt = 1;
// Parse the config string
XrdOucString cs(cfg), tkn;
int from = 0;
while ((from = cs.tokenize(tkn, from, ' ')) != -1) {
if (tkn == "certfmt=raw") {
gCertfmt = 0;
}
}
// Notify
PRINT("initialized! (certfmt:"<<gCertfmt<<")");
// Done
return gCertfmt;
}}
PRINT
#define PRINT(y)
Definition XrdCryptosslTrace.hh:39
gCertfmt
static int gCertfmt
Definition XrdSecgsiAuthzFunDN.cc:66
XrdOucString
Definition XrdOucString.hh:252

References EPNAME, gCertfmt, and PRINT.

Referenced by XrdVERSIONINFO().

Here is the caller graph for this function:

## XrdSecgsiAuthzKey()

int XrdSecgsiAuthzKey | ( | XrdSecEntity & | entity,
|  | char ** | key )

Definition at line 99 of file XrdSecgsiAuthzFunDN.cc.

{
// Implementation of XrdSecgsiAuthzKey extracting the information from the
// proxy chain in entity.creds
EPNAME("AuthzKeyDN");
// Must have got something
if (!key) {
PRINT("ERROR: 'key' must be defined");
return -1;
}
// We will key on the end proxy DN
XrdCryptoX509Chain *chain = 0;
if (!entity.creds) {
PRINT("ERROR: 'entity.creds' must be defined");
return -1;
}
if (gCertfmt == 0) {
chain = (XrdCryptoX509Chain *) entity.creds;
} else {
XrdOucString s((const char *) entity.creds);
XrdSutBucket *b = new XrdSutBucket(s);
chain = new XrdCryptoX509Chain();
if (XrdCryptosslX509ParseBucket(b, chain) <= 0) {
PRINT("ERROR: no certificates in chain");
delete b;
delete chain; chain = 0;
return -1;
}
if (chain->Reorder() < 0) {
PRINT("ERROR: problems re-ordering proxy chain");
delete b;
delete chain; chain = 0;
return -1;
}
}
// Point to the last certificate
XrdCryptoX509 *proxy = chain->End();
if (!proxy) {
PRINT("ERROR: chain is empty!");
return -1;
}
// Get the DN
const char *dn = proxy->Subject();
int ldn = 0;
if (!dn || (ldn = strlen(dn)) <= 0) {
PRINT("ERROR: proxy dn undefined!");
return -1;
}
// Set the key
*key = new char[ldn+1];
strcpy(*key, dn);
// Done
DEBUG("key is: '"<<*key<<"'");
return 0;
}}
XrdCryptosslX509ParseBucket
int XrdCryptosslX509ParseBucket(XrdSutBucket *b, XrdCryptoX509Chain *chain)
Definition XrdCryptosslAux.cc:575
XrdCryptoX509Chain
Definition XrdCryptoX509Chain.hh:80
XrdCryptoX509Chain::Reorder
virtual int Reorder()
Definition XrdCryptoX509Chain.cc:561
XrdCryptoX509Chain::End
XrdCryptoX509 * End() const
Definition XrdCryptoX509Chain.hh:108
XrdCryptoX509
Definition XrdCryptoX509.hh:51
XrdCryptoX509::Subject
virtual const char * Subject()
Definition XrdCryptoX509.cc:141
XrdSecEntity::creds
char * creds
Raw entity credentials or cert.
Definition XrdSecEntity.hh:77
XrdSutBucket
Definition XrdSutBucket.hh:44

References XrdSecEntity::creds, DEBUG, XrdCryptoX509Chain::End(), EPNAME, gCertfmt, PRINT, XrdCryptoX509Chain::Reorder(), XrdCryptoX509::Subject(), and XrdCryptosslX509ParseBucket().

Referenced by XrdVERSIONINFO().

Here is the call graph for this function:
Here is the caller graph for this function:

## XrdVERSIONINFO() [1/3]

XrdVERSIONINFO | ( | XrdSecgsiAuthzFun | ,
|  | secgsiauthz | )

References XrdSecgsiAuthzFun().

Here is the call graph for this function:

## XrdVERSIONINFO() [2/3]

XrdVERSIONINFO | ( | XrdSecgsiAuthzInit | ,
|  | secgsiauthz | )

References gsiTrace, and XrdSecgsiAuthzInit().

Here is the call graph for this function:

## XrdVERSIONINFO() [3/3]

XrdVERSIONINFO | ( | XrdSecgsiAuthzKey | ,
|  | secgsiauthz | )

References XrdSecgsiAuthzKey().

Here is the call graph for this function:

## Variable Documentation

## gCertfmt

int gCertfmt = 1

static

Definition at line 66 of file XrdSecgsiAuthzFunDN.cc.

Referenced by XrdSecgsiAuthzInit(), and XrdSecgsiAuthzKey().

## gsiTrace

XrdOucTrace* gsiTrace

extern

Definition at line 119 of file XrdSecgsiProxy.cc.

Referenced by XrdSecProtocolgsi::Init(), main(), XrdSecProtocolgsiInit(), and XrdVERSIONINFO().