XRootD
Loading...
Searching...
No Matches
XrdSecProtocolgsi.cc File Reference
#include <unistd.h>
#include <cctype>
#include <cerrno>
#include <cstdlib>
#include <strings.h>
#include <cstdio>
#include <sys/param.h>
#include <pwd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <dirent.h>
#include <iostream>
#include "XrdVersion.hh"
#include "XrdNet/XrdNetAddr.hh"
#include "XrdSec/XrdSecEntityAttr.hh"
#include "XrdSys/XrdSysHeaders.hh"
#include "XrdSys/XrdSysLogger.hh"
#include "XrdSys/XrdSysError.hh"
#include "XrdOuc/XrdOucPinLoader.hh"
#include "XrdOuc/XrdOucStream.hh"
#include "XrdOuc/XrdOucEnv.hh"
#include "XrdSut/XrdSutAux.hh"
#include "XrdCrypto/XrdCryptoMsgDigest.hh"
#include "XrdCrypto/XrdCryptoX509Chain.hh"
#include "XrdCrypto/XrdCryptoX509Req.hh"
#include "XrdSecgsi/XrdSecProtocolgsi.hh"
#include "XrdSecgsi/XrdSecgsiOpts.hh"
+ Include dependency graph for XrdSecProtocolgsi.cc:

Go to the source code of this file.

Macros

#define POPTS(t, y)
 

Functions

static bool AuthzFunCheck (XrdSutCacheEntry *e, void *a)
 
static const char * ClientStepStr (int kclt)
 
static bool GetCACheck (XrdSutCacheEntry *e, void *a)
 
static bool GetSrvCertEntCheck (XrdSutCacheEntry *e, void *a)
 
static bool QueryGMAPCheck (XrdSutCacheEntry *e, void *a)
 
static bool QueryProxyCheck (XrdSutCacheEntry *e, void *a)
 
static const char * ServerStepStr (int ksrv)
 
char * XrdSecProtocolgsiInit (const char mode, const char *parms, XrdOucErrInfo *erp)
 
XrdSecProtocolXrdSecProtocolgsiObject (const char mode, const char *hostname, XrdNetAddrInfo &endPoint, const char *parms, XrdOucErrInfo *erp)
 
 XrdVERSIONINFO (XrdSecProtocolgsiObject, secgsi)
 

Variables

static const char * gGSErrStr []
 
static const char * gNoPadTag = "nopad"
 
static const char * gsiClientSteps []
 
static const char * gsiServerSteps []
 
XrdOucTracegsiTrace = 0
 
static const char * gUsrPxyDef = "/tmp/x509up_u"
 
static const int kOneDay = 86400
 
static String Prefix = "xrd"
 
static String ProtoID = XrdSecPROTOIDENT
 
static const kXR_int32 Version = XrdSecgsiVERSION
 

Macro Definition Documentation

◆ POPTS

#define POPTS ( t,
y )
Value:
{if (t) {std::cerr <<"Secgsi" <<y <<'\n' << std::flush;}}

Definition at line 68 of file XrdSecProtocolgsi.cc.

Referenced by gsiOptions::Print(), and pwdOptions::Print().

Function Documentation

◆ AuthzFunCheck()

static bool AuthzFunCheck ( XrdSutCacheEntry * e,
void * a )
static

Definition at line 1721 of file XrdSecProtocolgsi.cc.

1721 {
1722
1723 int st_ref = (*((XrdSutCacheArg_t *)a)).arg1;
1724 time_t ts_ref = (time_t)(*((XrdSutCacheArg_t *)a)).arg2;
1725 long to_ref = (*((XrdSutCacheArg_t *)a)).arg3;
1726 int st_exp = (*((XrdSutCacheArg_t *)a)).arg4;
1727
1728 if (e && (e->status == st_ref)) {
1729 // Check expiration, if required
1730 bool expired = 0;
1731 if (to_ref > 0 && (ts_ref - e->mtime) > to_ref) expired = 1;
1732 int notafter = *((int *) e->buf2.buf);
1733 if (to_ref > notafter) expired = 1;
1734
1735 if (expired) {
1736 // Invalidate the entry, if the case
1737 e->status = st_exp;
1738 } else {
1739 return true;
1740 }
1741 }
1742 return false;
1743}
XrdSutCacheEntryBuf buf2

References XrdSutCacheEntryBuf::buf, XrdSutCacheEntry::buf2, XrdSutCacheEntry::mtime, and XrdSutCacheEntry::status.

Referenced by XrdSecProtocolgsi::Authenticate().

+ Here is the caller graph for this function:

◆ ClientStepStr()

static const char * ClientStepStr ( int kclt)
static

Definition at line 223 of file XrdSecProtocolgsi.cc.

224{
225 // Return string with client step
226 static const char *ukn = "Unknown";
227
228 kclt = (kclt < 0) ? 0 : kclt;
229 kclt = (kclt > kXGC_reserved) ? 0 : kclt;
230 kclt = (kclt >= kXGC_certreq) ? (kclt - kXGC_certreq + 1) : kclt;
231
232 if (kclt < 0 || kclt > (kXGC_reserved - kXGC_certreq + 1))
233 return ukn;
234 else
235 return gsiClientSteps[kclt];
236}
static const char * gsiClientSteps[]
@ kXGC_reserved
@ kXGC_certreq

References gsiClientSteps, kXGC_certreq, and kXGC_reserved.

Referenced by XrdSecProtocolgsi::Authenticate(), XrdSecProtocolpwd::Authenticate(), XrdSecProtocolgsi::getCredentials(), and XrdSecProtocolpwd::getCredentials().

+ Here is the caller graph for this function:

◆ GetCACheck()

static bool GetCACheck ( XrdSutCacheEntry * e,
void * a )
static

Definition at line 4624 of file XrdSecProtocolgsi.cc.

4624 {
4625
4626 EPNAME("GetCACheck");
4627
4628 int crl_check = (*((XrdSutCacheArg_t *)a)).arg1;
4629 int crl_refresh = (*((XrdSutCacheArg_t *)a)).arg2;
4630 time_t ts_ref = (time_t)(*((XrdSutCacheArg_t *)a)).arg3;
4631
4632 if (!e) return false;
4633
4634 X509Chain *chain = 0;
4635 // If we had already something, check it, as we may be done
4636 bool goodca = 0;
4637 if ((chain = (X509Chain *)(e->buf1.buf))) {
4638 // Check the validity of the certificates in the chain; if a certificate became invalid,
4639 // we need to reload a valid one for the same CA.
4640 if (chain->CheckValidity() == 0) {
4641 goodca = 1;
4642 } else {
4643 PRINT("CA entry for '"<<e->name<<"' needs refreshing: clean the related entry cache first");
4644 return false;
4645 }
4646 }
4647 if (goodca) {
4649 bool goodcrl = 1;
4650 if ((crl_check == 2 && !crl) || (crl_check == 3 && crl->IsExpired())) goodcrl = 0;
4651 if (crl_refresh > 0 && ((ts_ref - e->mtime) > crl_refresh)) goodcrl = 0;
4652 if (goodcrl) {
4653 return true;
4654 } else if (crl) {
4655 PRINT("CRL entry for '"<<e->name<<"' needs refreshing: clean the related entry cache first ("<<e<<")");
4656 }
4657 }
4658 return false;
4659}
#define EPNAME(x)
#define PRINT(y)
XrdCryptogsiX509Chain X509Chain
virtual int CheckValidity(bool outatfirst=1, int when=0)
virtual bool IsExpired(int when=0)
XrdSutCacheEntryBuf buf1

References XrdSutCacheEntryBuf::buf, XrdSutCacheEntry::buf1, XrdSutCacheEntry::buf2, XrdCryptoX509Chain::CheckValidity(), EPNAME, XrdCryptoX509Crl::IsExpired(), XrdSutCacheEntry::mtime, XrdSutCacheEntry::name, and PRINT.

+ Here is the call graph for this function:

◆ GetSrvCertEntCheck()

static bool GetSrvCertEntCheck ( XrdSutCacheEntry * e,
void * a )
static

Definition at line 5628 of file XrdSecProtocolgsi.cc.

5628 {
5629 int st_ref = (*((XrdSutCacheArg_t *)a)).arg1;
5630 time_t ts_ref = (time_t)(*((XrdSutCacheArg_t *)a)).arg2;
5631 if (e) {
5632 if (e->status > st_ref) {
5633 if (e->mtime >= ts_ref)
5634 return true;
5635 }
5636 }
5637 return false;
5638}

References XrdSutCacheEntry::mtime, and XrdSutCacheEntry::status.

◆ QueryGMAPCheck()

static bool QueryGMAPCheck ( XrdSutCacheEntry * e,
void * a )
static

Definition at line 5208 of file XrdSecProtocolgsi.cc.

5208 {
5209 int st_ref = (*((XrdSutCacheArg_t *)a)).arg1;
5210 time_t ts_ref = (time_t)(*((XrdSutCacheArg_t *)a)).arg2;
5211 long to_ref = (*((XrdSutCacheArg_t *)a)).arg3;
5212 if (e) {
5213 // Check expiration, if required
5214 if ((e->status != st_ref) ||
5215 ((e->status == st_ref) &&
5216 (to_ref > 0) &&
5217 ((ts_ref - e->mtime) > to_ref))) {
5218 return false;
5219 } else {
5220 return true;
5221 }
5222 }
5223 return false;
5224}

References XrdSutCacheEntry::mtime, and XrdSutCacheEntry::status.

◆ QueryProxyCheck()

static bool QueryProxyCheck ( XrdSutCacheEntry * e,
void * a )
static

Definition at line 4985 of file XrdSecProtocolgsi.cc.

4985 {
4986
4987 time_t ts_ref = (time_t)(*((XrdSutCacheArg_t *)a)).arg1;
4988
4989 if (e && e->buf1.buf) {
4990 X509Chain *chain = (X509Chain *)(e->buf1.buf);
4991 if (chain->CheckValidity(1, ts_ref) == 0) return true;
4992 }
4993 return false;
4994}

References XrdSutCacheEntryBuf::buf, XrdSutCacheEntry::buf1, and XrdCryptoX509Chain::CheckValidity().

+ Here is the call graph for this function:

◆ ServerStepStr()

static const char * ServerStepStr ( int ksrv)
static

Definition at line 239 of file XrdSecProtocolgsi.cc.

240{
241 // Return string with server step
242 static const char *ukn = "Unknown";
243
244 ksrv = (ksrv < 0) ? 0 : ksrv;
245 ksrv = (ksrv > kXGS_reserved) ? 0 : ksrv;
246 ksrv = (ksrv >= kXGS_init) ? (ksrv - kXGS_init + 1) : ksrv;
247
248 if (ksrv < 0 || ksrv > (kXGS_reserved - kXGS_init + 1))
249 return ukn;
250 else
251 return gsiServerSteps[ksrv];
252}
static const char * gsiServerSteps[]
@ kXGS_init
@ kXGS_reserved

References gsiServerSteps, kXGS_init, and kXGS_reserved.

Referenced by XrdSecProtocolgsi::Authenticate(), XrdSecProtocolpwd::Authenticate(), XrdSecProtocolgsi::getCredentials(), and XrdSecProtocolpwd::getCredentials().

+ Here is the caller graph for this function:

◆ XrdSecProtocolgsiInit()

char * XrdSecProtocolgsiInit ( const char mode,
const char * parms,
XrdOucErrInfo * erp )

Definition at line 2374 of file XrdSecProtocolgsi.cc.

2376{
2377 // One-time protocol initialization, filling the static flags and options
2378 // of the protocol.
2379 // For clients (mode == 'c') we use values in envs.
2380 // For servers (mode == 's') the command line options are passed through
2381 // parms.
2382 EPNAME("ProtocolgsiInit");
2383
2385 char *rc = (char *)"";
2386 char *cenv = 0;
2387
2388 // Initiate error logging and tracing
2390
2391 //
2392 // Clients first
2393 if (mode == 'c') {
2394 //
2395 // Decode envs:
2396 // "XrdSecDEBUG" debug flag ("0","1","2","3")
2397 // "XrdSecGSICADIR" full path to an alternative path
2398 // containing the CA info
2399 // [/etc/grid-security/certificates]
2400 // "XrdSecGSICRLDIR" full path to an alternative path
2401 // containing the CRL info
2402 // [/etc/grid-security/certificates]
2403 // "XrdSecGSICRLEXT" default extension of CRL files [.r0]
2404 // "XrdSecGSIUSERCERT" full path to an alternative file
2405 // containing the user certificate
2406 // [$HOME/.globus/usercert.pem]
2407 // "XrdSecGSIUSERKEY" full path to an alternative file
2408 // containing the user key
2409 // [$HOME/.globus/userkey.pem]
2410 // "XrdSecGSIUSERPROXY" full path to an alternative file
2411 // containing the user proxy
2412 // [/tmp/x509up_u<uid>]
2413 // "XrdSecGSIPROXYVALID" validity of proxies in the
2414 // grid-proxy-init format
2415 // ["12:00", i.e. 12 hours]
2416 // "XrdSecGSIPROXYDEPLEN" depth of signature path for proxies;
2417 // use -1 for unlimited [0]
2418 // "XrdSecGSIPROXYKEYBITS" bits in PKI for proxies [default: XrdCryptoDefRSABits]
2419 // "XrdSecGSICACHECK" CA check level [1]:
2420 // 0 do not verify;
2421 // 1 verify if self-signed, warn if not;
2422 // 2 verify in all cases, fail if not possible
2423 // "XrdSecGSICRLCHECK" CRL check level [2]:
2424 // 0 don't care;
2425 // 1 use if available;
2426 // 2 require,
2427 // 3 require non-expired CRL
2428 // "XrdSecGSIDELEGPROXY" Forwarding of credentials option:
2429 // 0 deny; 1 sign request created
2430 // by server; 2 forward local proxy
2431 // (include private key) [1]
2432 // "XrdSecGSICREATEPROXY" Controls use of proxy [1]:
2433 // 1 auto-generate proxy from the cert/key pair if no one is not found
2434 // 0 a proxy is used if present; else, the cert/key pair is used if present.
2435 // "XrdSecGSISRVNAMES" Server names allowed: if the server CN
2436 // does not match any of these, or it is
2437 // explicitely denied by these, or it is
2438 // not in the form "*/<hostname>", the
2439 // handshake fails.
2440 // "XrdSecGSIUSEDEFAULTHASH" If this variable is set only the default
2441 // name hashing algorithm is used
2442
2443 //
2444 opts.mode = mode;
2445 // debug
2446 cenv = getenv("XrdSecDEBUG");
2447 if (cenv)
2448 {if (cenv[0] >= 49 && cenv[0] <= 51) opts.debug = atoi(cenv);
2449 else {PRINT("unsupported debug value from env XrdSecDEBUG: "<<cenv<<" - setting to 1");
2450 opts.debug = 1;
2451 }
2452 }
2453
2454 // directory with CA certificates
2455 cenv = (getenv("XrdSecGSICADIR") ? getenv("XrdSecGSICADIR")
2456 : getenv("X509_CERT_DIR"));
2457 if (cenv)
2458 opts.certdir = strdup(cenv);
2459
2460 // directory with CRL info
2461 cenv = (getenv("XrdSecGSICRLDIR") ? getenv("XrdSecGSICRLDIR")
2462 : getenv("X509_CERT_DIR"));
2463 if (cenv)
2464 opts.crldir = strdup(cenv);
2465
2466 // Default extension CRL files
2467 cenv = getenv("XrdSecGSICRLEXT");
2468 if (cenv)
2469 opts.crlext = strdup(cenv);
2470
2471 // CRL refresh or expiration time
2472 cenv = getenv("XrdSecGSICRLRefresh");
2473 if (cenv)
2474 opts.crlrefresh = atoi(cenv);
2475
2476 // file with user cert
2477 cenv = (getenv("XrdSecGSIUSERCERT") ? getenv("XrdSecGSIUSERCERT")
2478 : getenv("X509_USER_CERT"));
2479 if (cenv)
2480 opts.cert = strdup(cenv);
2481
2482 // file with user key
2483 cenv = (getenv("XrdSecGSIUSERKEY") ? getenv("XrdSecGSIUSERKEY")
2484 : getenv("X509_USER_KEY"));
2485 if (cenv)
2486 opts.key = strdup(cenv);
2487
2488 // file with user proxy
2489 cenv = (getenv("XrdSecGSIUSERPROXY") ? getenv("XrdSecGSIUSERPROXY")
2490 : getenv("X509_USER_PROXY"));
2491 if (cenv)
2492 opts.proxy = strdup(cenv);
2493
2494 // file with user proxy
2495 cenv = getenv("XrdSecGSIPROXYVALID");
2496 if (cenv)
2497 opts.valid = strdup(cenv);
2498
2499 // Depth of signature path for proxies
2500 cenv = getenv("XrdSecGSIPROXYDEPLEN");
2501 if (cenv)
2502 opts.deplen = atoi(cenv);
2503
2504 // Key Bit length
2505 cenv = getenv("XrdSecGSIPROXYKEYBITS");
2506 if (cenv)
2507 opts.bits = atoi(cenv);
2508
2509 // CA verification level
2510 cenv = getenv("XrdSecGSICACHECK");
2511 if (cenv)
2512 opts.ca = atoi(cenv);
2513
2514 // CRL check level
2515 cenv = getenv("XrdSecGSICRLCHECK");
2516 if (cenv)
2517 opts.crl = atoi(cenv);
2518
2519 // Delegate proxy
2520 cenv = getenv("XrdSecGSIDELEGPROXY");
2521 if (cenv)
2522 opts.dlgpxy = atoi(cenv);
2523
2524 // No proxy
2525 cenv = getenv("XrdSecGSICREATEPROXY");
2526 if (cenv)
2527 opts.createpxy = atoi(cenv);
2528
2529 // Allowed server name formats
2530 cenv = getenv("XrdSecGSISRVNAMES");
2531 if (cenv)
2532 opts.srvnames = strdup(cenv);
2533
2534 // Name hashing algorithm
2535 cenv = getenv("XrdSecGSIUSEDEFAULTHASH");
2536 if (cenv)
2537 opts.hashcomp = 0;
2538
2539 // DNS trusting control
2540 if ((cenv = getenv("XrdSecGSITRUSTDNS")))
2541 opts.trustdns = (!strcmp(cenv, "0")) ? false : true;
2542
2543 //
2544 // Setup the object with the chosen options
2545 rc = XrdSecProtocolgsi::Init(opts,erp);
2546
2547 // Notify init options, if required or in case of init errors
2548 if (!rc) opts.debug = 1;
2549 opts.Print(gsiTrace);
2550
2551 // Some cleanup
2552 SafeFree(opts.certdir);
2553 SafeFree(opts.crldir);
2554 SafeFree(opts.crlext);
2555 SafeFree(opts.cert);
2556 SafeFree(opts.key);
2557 SafeFree(opts.proxy);
2558 SafeFree(opts.valid);
2559 SafeFree(opts.srvnames);
2560
2561 // We are done
2562 return rc;
2563 }
2564
2565 // Take into account xrootd debug flag
2566 cenv = getenv("XRDDEBUG");
2567 if (cenv && !strcmp(cenv,"1")) opts.debug = 1;
2568
2569 //
2570 // Server initialization
2571 if (parms) {
2572 //
2573 // Duplicate the parms
2574 char parmbuff[1024];
2575 strlcpy(parmbuff, parms, sizeof(parmbuff));
2576 //
2577 // The tokenizer
2578 XrdOucTokenizer inParms(parmbuff);
2579 //
2580 // Decode parms:
2581 // for servers:
2582 // [-d:<debug_level>]
2583 // [-c:[-]ssl[:[-]<CryptoModuleName]]
2584 // [-certdir:<dir_with_CA_info>]
2585 // [-crldir:<dir_with_CRL_info>]
2586 // [-crlext:<default_extension_CRL_files>]
2587 // [-cert:<path_to_server_certificate>]
2588 // [-key:<path_to_server_key>]
2589 // [-cipher:<list_of_supported_ciphers>]
2590 // [-md:<list_of_supported_digests>]
2591 // [-ca:<crl_verification_level>]
2592 // [-crl:<crl_check_level>]
2593 // [-crlrefresh:<crl_refresh_time>]
2594 // [-gridmap:<grid_map_file>]
2595 // [-gmapfun:<grid_map_function>]
2596 // [-gmapfunparms:<grid_map_function_init_parameters>]
2597 // [-authzcall:<authz_callopt>]
2598 // [-authzfun:<authz_function>]
2599 // [-authzfunparms:<authz_function_init_parameters>]
2600 // [-authzto:<authz_cache_entry_validity_in_secs>]
2601 // [-gmapto:<grid_map_cache_entry_validity_in_secs>]
2602 // [-gmapopt:<grid_map_check_option>]
2603 // [-dlgpxy:<proxy_req_option>]
2604 // [-exppxy:<filetemplate>]
2605 // [-authzpxy]
2606 // [-vomsat:<voms_option>]
2607 // [-vomsfun:<voms_function>]
2608 // [-vomsfunparms:<voms_function_init_parameters>]
2609 // [-defaulthash]
2610 // [-trustdns:<0|1>]
2611 //
2612 int debug = -1;
2613 String clist = "";
2614 String certdir = "";
2615 String crldir = "";
2616 String crlext = "";
2617 String cert = "";
2618 String key = "";
2619 String cipher = "";
2620 String md = "";
2621 String gridmap = "";
2622 String gmapfun = "";
2623 String gmapfunparms = "";
2624 String authzfun = "";
2625 String authzfunparms = "";
2626 String vomsfun = "";
2627 String vomsfunparms = "";
2628 String exppxy = "";
2629 int ca = 1;
2630 int crl = 1;
2631 int crlrefresh = 86400;
2632 int ogmap = 1;
2633 int gmapto = 600;
2634 int authzto = -1;
2635 int authzcall = 1;
2636 int dlgpxy = dlgIgnore;
2637 int authzpxy = 0;
2638 int vomsat = vatIgnore; // Was 1 or extract
2639 int moninfo = 0;
2640 int hashcomp = 1;
2641 int trustdns = false;
2642 int showDN = false;
2643 char *op = 0;
2644 while (inParms.GetLine()) {
2645 while ((op = inParms.GetToken())) {
2646 if (!strncmp(op, "-d:",3)) {
2647 debug = atoi(op+3);
2648 } else if (!strncmp(op, "-c:",3)) {
2649 clist = (const char *)(op+3);
2650 } else if (!strncmp(op, "-certdir:",9)) {
2651 certdir = (const char *)(op+9);
2652 } else if (!strncmp(op, "-crldir:",8)) {
2653 crldir = (const char *)(op+8);
2654 } else if (!strncmp(op, "-crlext:",8)) {
2655 crlext = (const char *)(op+8);
2656 } else if (!strncmp(op, "-cert:",6)) {
2657 cert = (const char *)(op+6);
2658 } else if (!strncmp(op, "-key:",5)) {
2659 key = (const char *)(op+5);
2660 } else if (!strncmp(op, "-cipher:",8)) {
2661 cipher = (const char *)(op+8);
2662 } else if (!strncmp(op, "-md:",4)) {
2663 md = (const char *)(op+4);
2664 } else if (!strncmp(op, "-ca:",4)) {
2665 ca = getOptVal(caVerOpts, op+4);
2666 ca = atoi(op+4);
2667 } else if (!strncmp(op, "-crl:",5)) {
2668 crl = getOptVal(crlOpts, op+5);
2669 } else if (!strncmp(op, "-crlrefresh:",12)) {
2670 crlrefresh = atoi(op+12);
2671 } else if (!strncmp(op, "-gmapopt:",9)) {
2672 ogmap = getOptVal(gmoOpts, op+9);
2673 } else if (!strncmp(op, "-gridmap:",9)) {
2674 gridmap = (const char *)(op+9);
2675 } else if (!strncmp(op, "-gmapfun:",9)) {
2676 gmapfun = (const char *)(op+9);
2677 } else if (!strncmp(op, "-gmapfunparms:",14)) {
2678 gmapfunparms = (const char *)(op+14);
2679 } else if (!strncmp(op, "-authzcall:",11)) {
2680 authzcall = getOptVal(azCallOpts, op+11);
2681 } else if (!strncmp(op, "-authzfun:",10)) {
2682 authzfun = (const char *)(op+10);
2683 } else if (!strncmp(op, "-authzfunparms:",15)) {
2684 authzfunparms = (const char *)(op+15);
2685 } else if (!strncmp(op, "-authzto:",9)) {
2686 authzto = atoi(op+9);
2687 } else if (!strncmp(op, "-gmapto:",8)) {
2688 gmapto = atoi(op+8);
2689 } else if (!strncmp(op, "-dlgpxy:",8)) {
2690 opts.dlgpxy = getOptVal(sDlgOpts, op+8);
2691 } else if (!strncmp(op, "-exppxy:",8)) {
2692 exppxy = (const char *)(op+8);
2693 } else if (!strncmp(op, "-authzpxy:",10)) {
2694 opts.authzpxy = getOptVal(azPxyOpts, op+10);
2695 } else if (!strncmp(op, "-authzpxy",9)) {
2696 authzpxy = 11;
2697 } else if (!strncmp(op, "-vomsat:",8)) {
2698 vomsat = getOptVal(vomsatOpts, op+8);
2699 if (vomsat != vatIgnore && vomsfun.length() == 0)
2700 vomsfun = "default";
2701 } else if (!strncmp(op, "-vomsfun:",9)) {
2702 vomsfun = (const char *)(op+9);
2703 } else if (!strncmp(op, "-vomsfunparms:",14)) {
2704 vomsfunparms = (const char *)(op+14);
2705 } else if (!strcmp(op, "-moninfo")) {
2706 moninfo = 1;
2707 } else if (!strncmp(op, "-moninfo:",9)) {
2708 moninfo = atoi(op+9);
2709 } else if (!strcmp(op, "-defaulthash")) {
2710 hashcomp = 0;
2711 } else if (!strncmp(op, "-trustdns:",10)) {
2712 trustdns = getOptVal(tdnsOpts, op+10);
2713 } else if (!strncmp(op, "-showdn:",8)) {
2714 showDN = getOptVal(tdnsOpts, op+8);
2715 } else {
2716 PRINT("ignoring unknown switch: "<<op);
2717 }
2718 }
2719 }
2720
2721 // If vomsfun is 'default' substitute the default plugin. The go on to
2722 // resolve conflicts between vomsfun and vomsat options. So, if vomsfun
2723 // was specified but vomsat is set to 'ignore' then we set vomsat to be
2724 // 'required'.
2725 //
2726 if (vomsfun.length() > 0)
2727 {if (vomsat == vatIgnore) vomsat = vatExtract;
2728 if (vomsfun == "default") vomsfun = LIB_XRDVOMS;
2729 } else authzcall = azAlways;
2730
2731 //
2732 // Build the option object
2733 opts.debug = (debug > -1) ? debug : opts.debug;
2734 opts.mode = 's';
2735 opts.ca = ca;
2736 opts.crl = crl;
2737 opts.crlrefresh = crlrefresh;
2738 opts.ogmap = ogmap;
2739 opts.gmapto = gmapto;
2740 opts.authzcall = authzcall;
2741 opts.authzto = authzto;
2742 opts.dlgpxy = (dlgpxy >= dlgIgnore && dlgpxy <= dlgReqSign) ? dlgpxy : 0;
2743 opts.authzpxy = authzpxy;
2744 opts.vomsat = vomsat;
2745 opts.moninfo = moninfo;
2746 opts.hashcomp = hashcomp;
2747 opts.trustdns = (trustdns <= 0) ? false : true;
2748 opts.showDN = (showDN > 0) ? true : false;
2749 if (clist.length() > 0)
2750 opts.clist = (char *)clist.c_str();
2751 if (certdir.length() > 0)
2752 opts.certdir = (char *)certdir.c_str();
2753 if (crldir.length() > 0)
2754 opts.crldir = (char *)crldir.c_str();
2755 if (crlext.length() > 0)
2756 opts.crlext = (char *)crlext.c_str();
2757 if (cert.length() > 0)
2758 opts.cert = (char *)cert.c_str();
2759 if (key.length() > 0)
2760 opts.key = (char *)key.c_str();
2761 if (cipher.length() > 0)
2762 opts.cipher = (char *)cipher.c_str();
2763 if (md.length() > 0)
2764 opts.md = (char *)md.c_str();
2765 if (gridmap.length() > 0)
2766 opts.gridmap = (char *)gridmap.c_str();
2767 if (gmapfun.length() > 0)
2768 opts.gmapfun = (char *)gmapfun.c_str();
2769 if (gmapfunparms.length() > 0)
2770 opts.gmapfunparms = (char *)gmapfunparms.c_str();
2771 if (authzfun.length() > 0)
2772 opts.authzfun = (char *)authzfun.c_str();
2773 if (authzfunparms.length() > 0)
2774 opts.authzfunparms = (char *)authzfunparms.c_str();
2775 if (exppxy.length() > 0)
2776 opts.exppxy = (char *)exppxy.c_str();
2777 if (vomsfun.length() > 0)
2778 opts.vomsfun = (char *)vomsfun.c_str();
2779 if (vomsfunparms.length() > 0)
2780 opts.vomsfunparms = (char *)vomsfunparms.c_str();
2781
2782 // Notify init options, if required
2783 opts.Print(gsiTrace);
2784
2785 //
2786 // Setup the plug-in with the chosen options
2787 return XrdSecProtocolgsi::Init(opts,erp);
2788 }
2789
2790 // Notify init options, if required
2791 opts.Print(gsiTrace);
2792 //
2793 // Setup the plug-in with the defaults
2794 return XrdSecProtocolgsi::Init(opts,erp);
2795}}
XrdOucString String
#define SafeFree(x)
XrdOucTrace * gsiTrace
#define LIB_XRDVOMS
struct myOpts opts
size_t strlcpy(char *dst, const char *src, size_t sz)
int length() const
const char * c_str() const
static XrdOucTrace * EnableTracing()
static char * Init(gsiOptions o, XrdOucErrInfo *erp)

References XrdOucString::c_str(), XrdSecProtocolgsi::EnableTracing(), EPNAME, XrdOucTokenizer::GetLine(), XrdOucTokenizer::GetToken(), gsiTrace, XrdSecProtocolgsi::Init(), XrdOucString::length(), LIB_XRDVOMS, opts, PRINT, SafeFree, and strlcpy().

+ Here is the call graph for this function:

◆ XrdSecProtocolgsiObject()

XrdSecProtocol * XrdSecProtocolgsiObject ( const char mode,
const char * hostname,
XrdNetAddrInfo & endPoint,
const char * parms,
XrdOucErrInfo * erp )

Definition at line 2809 of file XrdSecProtocolgsi.cc.

2814{
2815 XrdSecProtocolgsi *prot;
2816 int options = XrdSecNOIPCHK;
2817
2818 //
2819 // Get a new protocol object
2820 if (!(prot = new XrdSecProtocolgsi(options, hostname, endPoint, parms))) {
2821 const char *msg = "Secgsi: Insufficient memory for protocol.";
2822 if (erp)
2823 erp->setErrInfo(ENOMEM, msg);
2824 else
2825 std::cerr <<msg <<std::endl;
2826 return (XrdSecProtocol *)0;
2827 }
2828 //
2829 // We are done
2830 if (!erp)
2831 std::cerr << "protocol object instantiated" << std::endl;
2832 return prot;
2833}}
#define XrdSecNOIPCHK
int setErrInfo(int code, const char *emsg)

References XrdOucErrInfo::setErrInfo(), and XrdSecNOIPCHK.

Referenced by XrdVERSIONINFO().

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

◆ XrdVERSIONINFO()

XrdVERSIONINFO ( XrdSecProtocolgsiObject ,
secgsi  )

References XrdSecProtocolgsiObject().

+ Here is the call graph for this function:

Variable Documentation

◆ gGSErrStr

const char* gGSErrStr[]
static
Initial value:
= {
"ErrParseBuffer",
"ErrDecodeBuffer",
"ErrLoadCrypto",
"ErrBadProtocol",
"ErrCreateBucket",
"ErrDuplicateBucket",
"ErrCreateBuffer",
"ErrSerialBuffer",
"ErrGenCipher",
"ErrExportPuK",
"ErrEncRndmTag",
"ErrBadRndmTag",
"ErrNoRndmTag",
"ErrNoCipher",
"ErrNoCreds",
"ErrBadOpt",
"ErrMarshal",
"ErrUnmarshal",
"ErrSaveCreds",
"ErrNoBuffer",
"ErrRefCipher",
"ErrNoPublic",
"ErrAddBucket",
"ErrFinCipher",
"ErrInit",
"ErrBadCreds",
"ErrError"
}

Definition at line 97 of file XrdSecProtocolgsi.cc.

97 {
98 "ErrParseBuffer", // 10000
99 "ErrDecodeBuffer", // 10001
100 "ErrLoadCrypto", // 10002
101 "ErrBadProtocol", // 10003
102 "ErrCreateBucket", // 10004
103 "ErrDuplicateBucket", // 10005
104 "ErrCreateBuffer", // 10006
105 "ErrSerialBuffer", // 10007
106 "ErrGenCipher", // 10008
107 "ErrExportPuK", // 10009
108 "ErrEncRndmTag", // 10010
109 "ErrBadRndmTag", // 10011
110 "ErrNoRndmTag", // 10012
111 "ErrNoCipher", // 10013
112 "ErrNoCreds", // 10014
113 "ErrBadOpt", // 10015
114 "ErrMarshal", // 10016
115 "ErrUnmarshal", // 10017
116 "ErrSaveCreds", // 10018
117 "ErrNoBuffer", // 10019
118 "ErrRefCipher", // 10020
119 "ErrNoPublic", // 10021
120 "ErrAddBucket", // 10022
121 "ErrFinCipher", // 10023
122 "ErrInit", // 10024
123 "ErrBadCreds", // 10025
124 "ErrError" // 10026
125};

◆ gNoPadTag

const char* gNoPadTag = "nopad"
static

◆ gsiClientSteps

const char* gsiClientSteps[]
static
Initial value:
= {
"kXGC_none",
"kXGC_certreq",
"kXGC_cert",
"kXGC_sigpxy",
"kXGC_reserved"
}

Definition at line 81 of file XrdSecProtocolgsi.cc.

81 {
82 "kXGC_none",
83 "kXGC_certreq",
84 "kXGC_cert",
85 "kXGC_sigpxy",
86 "kXGC_reserved"
87};

Referenced by ClientStepStr().

◆ gsiServerSteps

const char* gsiServerSteps[]
static
Initial value:
= {
"kXGS_none",
"kXGS_init",
"kXGS_cert",
"kXGS_pxyreq",
"kXGS_reserved"
}

Definition at line 89 of file XrdSecProtocolgsi.cc.

89 {
90 "kXGS_none",
91 "kXGS_init",
92 "kXGS_cert",
93 "kXGS_pxyreq",
94 "kXGS_reserved"
95};

Referenced by ServerStepStr().

◆ gsiTrace

XrdOucTrace* gsiTrace = 0

◆ gUsrPxyDef

const char* gUsrPxyDef = "/tmp/x509up_u"
static

Definition at line 130 of file XrdSecProtocolgsi.cc.

Referenced by XrdSecProtocolgsi::Init(), and gsiOptions::Print().

◆ kOneDay

const int kOneDay = 86400
static

Definition at line 128 of file XrdSecProtocolgsi.cc.

◆ Prefix

String Prefix = "xrd"
static

Definition at line 77 of file XrdSecProtocolgsi.cc.

Referenced by XrdSecProtocolpwd::Init().

◆ ProtoID

String ProtoID = XrdSecPROTOIDENT
static

Definition at line 78 of file XrdSecProtocolgsi.cc.

◆ Version