How to port OpenLDAP to Windows

Source: Internet
Author: User
Tags openldap

First, at least berkeleydb and Cyrus SASL are required.
If TLS is required, OpenSSL is required.
OpenLDAP has not provided engineering files for porting to Windows since version 2.2x, but it still has such problems, so it can be implemented after transplantation. After two or three days of experiment, I have compiled several important libraries. The following describes how to compile OpenLDAP in windows. My compiling environment is Win XP, VC 6.0, and cygwin is also used. It is not important to copy the code generated in Linux.

1. Compile liblber
(1) create a static Link Library project file named liblber
(2) Import four header files to OpenLDAP \ include:
Lber_types.h
Ldap_config.h
Ldap_features.h
Portable. h
(2) Import files from librares \ liblber without the need to include idtest. C, Dtest. C, and Etest. C.
(3) Disable macros:
Time_with_sys_time
Have_sys_time_h
Ldap_syslog
Have_long_long
Have_poll_h
Have_getopt_h
Have_getopt
Have_sys_ioctl_h
Have_fcntl
Have_nonposix_strerror_r
Have_strerror_r
Have_strerror
Open macro:
Have_winsock2
Have_winsock2_h
Have_winsock_h
Have_winsock
(4) change all definitions of long type to unsigned long type.
(5) compile and generate liblber. Lib

2. Compile libldap
(1) create a static Link Library Project libldap
(2) import the files in libraries \ libldap, except for the test projects dntest. c ftest. C test. C.
(3) Disable macros:
Have_sys_param_h
Have_arpa_nameser_h
Have_sys_file_h
Have_resolv_h
Have_res_query
Have_tls
Have_poll
Have_tls
Have_sysconf
Have_sys_uio_h
Ldap_pf_local
Have_di1__h
Have_hstrerror
Have_getdtablesize
Have_inet_aton
Open macro:
# Define socklen_t int
Add the following two lines to portable. h:
# Define strcasecmp stricmp
# Define strncasecmp strnicmp
(4) compile and generate libldap. Lib

3. Compile liblutil
(1) create a static library project liblutil
(2) Import files in libraries \ liblutil, but do not import detach. c
(3) Disable macros:
Have_flock
Have_sigaction
Urandom_device
Add the following four lines after portable. h:
# Define prov_rsa_full 1
Typedef unsigned long hcryptprov;
Typedef unsigned long DWORD;
Typedef unsigned char byte;
(4) compile and generate liblutil. Lib

Basically, if you want to develop a client, you can compile the three libraries. I tried to add, delete, modify, and query the databases, note that libsasl is required in addition to connecting to these libraries during client development. for libraries such as lib and ws2_32.lib, wsock32.lib may be available. If the connection fails, try again...

I hope you can correct the shortcomings. I want to speak a lot. I want to talk about anything with rotten eggs and flowers. Haha

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.