~ubuntu-branches/ubuntu/utopic/nordugrid-arc/utopic

« back to all changes in this revision

Viewing changes to src/hed/acc/ldap/ServiceEndpointRetrieverPluginBDII.cpp

  • Committer: Package Import Robot
  • Author(s): Mattias Ellert
  • Date: 2014-05-01 20:51:02 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20140501205102-icy9t3348uxobyx7
Tags: 4.1.0-1
* 4.1.0 Release
* Call dh_autoreconf to support ppc64le (Closes: #744639)

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    return pos != std::string::npos && lower(endpoint.URLString.substr(0, pos)) != "ldap";
23
23
  }
24
24
 
25
 
  static URL CreateURL(std::string service) {
26
 
    std::string::size_type pos1 = service.find("://");
27
 
    if (pos1 == std::string::npos) {
28
 
      service = "ldap://" + service;
29
 
      pos1 = 4;
30
 
    } else if(lower(service.substr(0,pos1)) != "ldap") return URL();
31
 
    
32
 
    std::string::size_type pos2 = service.find(":", pos1 + 3);
33
 
    std::string::size_type pos3 = service.find("/", pos1 + 3);
34
 
    if (pos2 == std::string::npos && pos3 == std::string::npos) {
35
 
      service.append(":2170");
36
 
    }
37
 
    else if (pos2 == std::string::npos || pos2 > pos3) {
38
 
      service.insert(pos3, ":2170");
39
 
    }
40
 
 
41
 
    return service;
42
 
  }
43
 
 
44
25
  static std::string CreateBDIIResourceURL(const std::string& host) { return "ldap://" + host + ":2170/Mds-Vo-name=resource,o=grid"; }
45
26
  
46
27
  EndpointQueryingStatus ServiceEndpointRetrieverPluginBDII::Query(const UserConfig& uc,
47
28
                                                                    const Endpoint& rEndpoint,
48
29
                                                                    std::list<Endpoint>& seList,
49
30
                                                                    const EndpointQueryOptions<Endpoint>&) const {
50
 
    URL url(CreateURL(rEndpoint.URLString));
 
31
    if (isEndpointNotSupported(rEndpoint)) {
 
32
      return EndpointQueryingStatus::FAILED;
 
33
    }
 
34
    URL url((rEndpoint.URLString.find("://") == std::string::npos ? "ldap://" : "") + rEndpoint.URLString, false, 2170);
51
35
    url.ChangeLDAPScope(URL::subtree);
52
36
    //url.ChangeLDAPFilter("(|(GlueServiceType=bdii_site)(GlueServiceType=bdii_top))");
53
37
    if (!url) return EndpointQueryingStatus::FAILED;