-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
336de16
commit 8f5bed8
Showing
7 changed files
with
167 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
from conans import ConanFile, CMake, tools | ||
from conan import ConanFile | ||
from conan.tools.cmake import CMake | ||
from conan.tools.build import cross_building | ||
from conan.tools.layout import basic_layout | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package_multi" | ||
generators = "CMakeToolchain", "CMakeDeps" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def layout(self): | ||
basic_layout(self) | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) | ||
if not cross_building(self): | ||
cmd = os.path.join(self.cpp.build.bindir, "test_package") | ||
self.run(cmd, env="conanrun") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package) | ||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
find_package(openldap CONFIG REQUIRED) | ||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} openldap::openldap) | ||
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package_multi" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* ldapurl -- a tool for generating LDAP URLs */ | ||
/* $OpenLDAP$ */ | ||
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. | ||
* | ||
* Copyright 2008-2021 The OpenLDAP Foundation. | ||
* Portions Copyright 2008 Pierangelo Masarati, SysNet | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted only as authorized by the OpenLDAP | ||
* Public License. | ||
* | ||
* A copy of this license is available in the file LICENSE in the | ||
* top-level directory of the distribution or, alternatively, at | ||
* <http://www.OpenLDAP.org/license.html>. | ||
*/ | ||
/* Portions Copyright (c) 1992-1996 Regents of the University of Michigan. | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms are permitted | ||
* provided that this notice is preserved and that due credit is given | ||
* to the University of Michigan at Ann Arbor. The name of the | ||
* University may not be used to endorse or promote products derived | ||
* from this software without specific prior written permission. This | ||
* software is provided ``as is'' without express or implied warranty. | ||
*/ | ||
/* ACKNOWLEDGEMENTS: | ||
* This work was originally developed by Pierangelo Masarati | ||
* for inclusion in OpenLDAP software. | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <cstdlib> | ||
#include "openldap.h" | ||
|
||
static int do_uri_create(LDAPURLDesc *lud) { | ||
char *uri; | ||
|
||
if (lud->lud_scheme == NULL) { | ||
lud->lud_scheme = "ldap"; | ||
} | ||
|
||
if (lud->lud_port == -1) { | ||
if (strcasecmp(lud->lud_scheme, "ldap") == 0) { | ||
lud->lud_port = LDAP_PORT; | ||
|
||
} else if (strcasecmp(lud->lud_scheme, "ldaps") == 0) { | ||
lud->lud_port = LDAPS_PORT; | ||
|
||
} else if (strcasecmp(lud->lud_scheme, "ldapi") == 0) { | ||
lud->lud_port = 0; | ||
|
||
} else { | ||
/* forgiving... */ | ||
lud->lud_port = 0; | ||
} | ||
} | ||
|
||
if (lud->lud_scope == -1) { | ||
lud->lud_scope = LDAP_SCOPE_DEFAULT; | ||
} | ||
|
||
uri = ldap_url_desc2str(lud); | ||
|
||
if (uri == NULL) { | ||
fprintf(stderr, "unable to generate URI\n"); | ||
exit(EXIT_FAILURE); | ||
} | ||
|
||
printf("%s\n", uri); | ||
free(uri); | ||
|
||
return 0; | ||
} | ||
|
||
int main() { | ||
LDAPURLDesc lud = {0}; | ||
|
||
lud.lud_port = -1; | ||
lud.lud_scope = -1; | ||
|
||
return do_uri_create(&lud); | ||
} |