From 4218fe43e71d12510d78cc1432629ddc901d4d9f Mon Sep 17 00:00:00 2001 From: Gerardo Ganis Date: Thu, 22 Jun 2017 11:12:16 +0200 Subject: [PATCH] gsi: fully remove XrdSecgsiGMAPFunLDAP --- src/XrdCl/XrdClDefaultEnv.cc | 1 - src/XrdSecgsi.cmake | 25 +---- src/XrdSecgsi/XrdSecgsiGMAPFunLDAP.cc | 134 -------------------------- src/XrdSecgsi/XrdSecgsiGMAPFunLDAP.cf | 16 --- 4 files changed, 1 insertion(+), 175 deletions(-) delete mode 100644 src/XrdSecgsi/XrdSecgsiGMAPFunLDAP.cc delete mode 100644 src/XrdSecgsi/XrdSecgsiGMAPFunLDAP.cf diff --git a/src/XrdCl/XrdClDefaultEnv.cc b/src/XrdCl/XrdClDefaultEnv.cc index bfa31a94007..e0b6bb8acc9 100644 --- a/src/XrdCl/XrdClDefaultEnv.cc +++ b/src/XrdCl/XrdClDefaultEnv.cc @@ -415,7 +415,6 @@ namespace XrdCl "libXrdSecgsi.dylib", "libXrdSecgsiAuthzVO.dylib", "libXrdSecgsiGMAPDN.dylib", - "libXrdSecgsiGMAPLDAP.dylib", "libXrdSecpwd.dylib", "libXrdSecsss.dylib", "libXrdSecunix.dylib", diff --git a/src/XrdSecgsi.cmake b/src/XrdSecgsi.cmake index 5b616a0de6f..773af88eb7c 100644 --- a/src/XrdSecgsi.cmake +++ b/src/XrdSecgsi.cmake @@ -7,9 +7,6 @@ include( XRootDCommon ) set( XRD_SEC_GSI_VERSION 2.0.0 ) set( XRD_SEC_GSI_SOVERSION 0 ) -set( XRD_SEC_GSI_GMAPLDAP_VERSION 1.0.0 ) -set( XRD_SEC_GSI_GMAPLDAP_SOVERSION 0 ) - set( XRD_SEC_GSI_GMAPDN_VERSION 1.0.0 ) set( XRD_SEC_GSI_GMAPDN_SOVERSION 0 ) @@ -40,26 +37,6 @@ set_target_properties( INTERFACE_LINK_LIBRARIES "" LINK_INTERFACE_LIBRARIES "" ) -#------------------------------------------------------------------------------- -# The XrdSecgsiGMAPLDAP library -#------------------------------------------------------------------------------- -add_library( - XrdSecgsiGMAPLDAP - SHARED - XrdSecgsi/XrdSecgsiGMAPFunLDAP.cc ) - -#target_link_libraries( -# XrdSecgsiGMAPLDAP -# XrdSecgsi ) - -set_target_properties( - XrdSecgsiGMAPLDAP - PROPERTIES - VERSION ${XRD_SEC_GSI_GMAPLDAP_VERSION} - SOVERSION ${XRD_SEC_GSI_GMAPLDAP_SOVERSION} - INTERFACE_LINK_LIBRARIES "" - LINK_INTERFACE_LIBRARIES "" ) - #------------------------------------------------------------------------------- # The XrdSecgsiAuthzVO library #------------------------------------------------------------------------------- @@ -118,7 +95,7 @@ target_link_libraries( # Install #------------------------------------------------------------------------------- install( - TARGETS XrdSecgsi XrdSecgsiGMAPDN XrdSecgsiGMAPLDAP xrdgsiproxy + TARGETS XrdSecgsi XrdSecgsiGMAPDN xrdgsiproxy XrdSecgsiAuthzVO RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) diff --git a/src/XrdSecgsi/XrdSecgsiGMAPFunLDAP.cc b/src/XrdSecgsi/XrdSecgsiGMAPFunLDAP.cc deleted file mode 100644 index 937e11211af..00000000000 --- a/src/XrdSecgsi/XrdSecgsiGMAPFunLDAP.cc +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************/ -/* */ -/* X r d S e c g s i G M A P F u n L D A P . c c */ -/* */ -/* (c) 2008, G. Ganis / CERN */ -/* */ -/* This file is part of the XRootD software suite. */ -/* */ -/* XRootD is free software: you can redistribute it and/or modify it under */ -/* the terms of the GNU Lesser General Public License as published by the */ -/* Free Software Foundation, either version 3 of the License, or (at your */ -/* option) any later version. */ -/* */ -/* XRootD is distributed in the hope that it will be useful, but WITHOUT */ -/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ -/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ -/* License for more details. */ -/* */ -/* You should have received a copy of the GNU Lesser General Public License */ -/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ -/* COPYING (GPL license). If not, see . */ -/* */ -/* The copyright holder's institutional names and contributor's names may not */ -/* be used to endorse or promote products derived from this software without */ -/* specific prior written permission of the institution or contributor. */ -/* */ -/******************************************************************************/ - -/* ************************************************************************** */ -/* */ -/* GMAP function implementation querying a LDAP database */ -/* */ -/* ************************************************************************** */ - -#include -#include -#include -#include - -static char *ldapsrv = 0; -static char *searchbase = 0; -static char *attribute = 0; - -int XrdSecgsiGMAPInit(const char *cfg); - -// -// Main function -// -extern "C" -{ -char *XrdSecgsiGMAPFun(const char *dn, int now) -{ - // Implementation of XrdSecgsiGMAPFun querying an LDAP server - // for the distinguished name 'dn' - - // Init the relevant fields (only once) - if (now <= 0) { - if (XrdSecgsiGMAPInit(dn) != 0) - return (char *)-1; - return (char *)0; - } - - // Output - char *name = 0; - - // Prepare the command to be executed - char cmd[4096]; - sprintf(cmd, "ldapsearch -H %s -x -b \"%s\" \"subject=%s\" %s", - ldapsrv, searchbase, dn, attribute); - - // Execute the command into a pipe - FILE *fp = popen(cmd, "r"); - if (fp) { - char line[1024], att[40], uname[256]; - sprintf(att, "%s: ", attribute); - while (fgets(line, sizeof(line), fp)) { - // Look for a line starting with "uid: " - if (!strncmp(line, att, strlen(att))) { - sscanf(line, "%s %s", att, uname); - name = new char[strlen(uname)+1]; - strcpy(name, uname); - break; - } - } - pclose(fp); - } - - // Done - return name; -}} - -// -// Init the relevant parameters from a dedicated config file -// -int XrdSecgsiGMAPInit(const char *cfg) -{ - // Initialize the relevant parameters from the file 'cfg' or - // from the one defined by XRDGSIGMAPLDAPCF. - // Return 0 on success, -1 otherwise - - if (!cfg) cfg = getenv("XRDGSIGMAPLDAPCF"); - if (!cfg || strlen(cfg) <= 0) { - fprintf(stderr, " +++ XrdSecgsiGMAPInit (LDAP): error: undefined config file path +++\n"); - return -1; - } - - FILE *fcf = fopen(cfg, "r"); - if (fcf) { - char l[4096], k[20], val[4096]; - while (fgets(l, sizeof(l), fcf)) { - int len = strlen(l); - if (len < 2) continue; - if (l[0] == '#') continue; - if (l[len-1] == '\n') l[len-1] = '\0'; - sscanf(l, "%s %s", k, val); - if (!strcmp(k, "srv:")) { - ldapsrv = strdup(val); - } else if (!strcmp(k, "base:")) { - searchbase = strdup(val); - } else if (!strcmp(k, "attr:")) { - attribute = strdup(val); - } else { - fprintf(stderr, "XrdSecgsiGMAPInit (LDAP): warning: unknown key: '%s' - ignoring\n", k); - } - } - fclose(fcf); - } else { - fprintf(stderr, " +++ XrdSecgsiGMAPInit (LDAP): error: config file '%s'" - " could not be open (errno: %d) +++\n", cfg, errno); - return -1; - } - // Done - return 0; -} diff --git a/src/XrdSecgsi/XrdSecgsiGMAPFunLDAP.cf b/src/XrdSecgsi/XrdSecgsiGMAPFunLDAP.cf deleted file mode 100644 index 67c544f4c1f..00000000000 --- a/src/XrdSecgsi/XrdSecgsiGMAPFunLDAP.cf +++ /dev/null @@ -1,16 +0,0 @@ -# -# Example of configuration file for the plug-in retrieving mapping information -# from an LDAP server; the path to this file must be given via the env variable -# XRDGSIGMAPLDAPCF . -# -# The command executed is in the form -# -# ldapsearch -H -x -b "" "subject=" -# -# -# The server URL -srv: ldap://ldapsrv.server.dom:8389 -# The search base -base: ou=People,o=exp,dc=org,dc=dom -# The attribute -attr: uid