---
name: "ldap_tls"
section: "3"
platform: "linux"
package: "libldap"
version: "2.7.2-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/ldap_tls"
---

# ldap\_tls(3)

LDAP TLS initialization routines

## NAME

ldap\_start\_tls, ldap\_start\_tls\_s, ldap\_tls\_inplace, ldap\_install\_tls - LDAP TLS initialization routines

## LIBRARY

OpenLDAP LDAP (libldap, -lldap)

## SYNOPSIS

**#include \<ldap.h\>**

**int ldap\_start\_tls(LDAP \****ld***);**

**int ldap\_start\_tls\_s(LDAP \****ld***, LDAPControl \*\****serverctrls***, LDAPControl \*\****clientctrls***);**

**int ldap\_tls\_inplace(LDAP \****ld***);**

**int ldap\_install\_tls(LDAP \****ld***);**

## DESCRIPTION

These routines are used to initiate TLS processing on an LDAP session. **ldap\_start\_tls\_s**() sends a StartTLS request to a server, waits for the reply, and then installs TLS handlers on the session if the request succeeded. The routine returns **LDAP\_SUCCESS** if everything succeeded, otherwise it returns an LDAP error code. **ldap\_start\_tls**() sends a StartTLS request to a server and does nothing else. It returns **LDAP\_SUCCESS** if the request was sent successfully. **ldap\_tls\_inplace**() returns 1 if TLS handlers have been installed on the specified session, 0 otherwise. **ldap\_install\_tls**() installs the TLS handlers on the given session. It returns **LDAP\_LOCAL\_ERROR** if TLS is already installed.

## SEE ALSO

[**ldap**(3)](/ldap/3.md), [**ldap\_error**(3)](/ldap_error/3.md)

## ACKNOWLEDGEMENTS

**OpenLDAP Software** is developed and maintained by The OpenLDAP Project \<http://www.openldap.org/\>. **OpenLDAP Software** is derived from the University of Michigan LDAP 3.3 Release.
