2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 2005-2012 The OpenLDAP Foundation.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted only as authorized by the OpenLDAP
11 * A copy of this license is available in the file LICENSE in the
12 * top-level directory of the distribution or, alternatively, at
13 * <http://www.OpenLDAP.org/license.html>.
16 * This program was orignally developed by Kurt D. Zeilenga for inclusion in
21 * LDAPv3 Turn Operation Request
27 #include <ac/stdlib.h>
29 #include <ac/socket.h>
30 #include <ac/string.h>
40 LDAP_CONST char* identifier,
45 #ifdef LDAP_EXOP_X_TURN
46 BerElement *turnvalber = NULL;
47 struct berval *turnvalp = NULL;
50 turnvalber = ber_alloc_t( LBER_USE_DER );
52 ber_printf( turnvalber, "{bs}", mutual, identifier );
54 ber_printf( turnvalber, "{s}", identifier );
56 ber_flatten( turnvalber, &turnvalp );
58 rc = ldap_extended_operation( ld, LDAP_EXOP_X_TURN,
59 turnvalp, sctrls, cctrls, msgidp );
60 ber_free( turnvalber, 1 );
63 return LDAP_CONTROL_NOT_FOUND;
71 LDAP_CONST char* identifier,
73 LDAPControl **cctrls )
75 #ifdef LDAP_EXOP_X_TURN
76 BerElement *turnvalber = NULL;
77 struct berval *turnvalp = NULL;
80 turnvalber = ber_alloc_t( LBER_USE_DER );
82 ber_printf( turnvalber, "{bs}", 0xFF, identifier );
84 ber_printf( turnvalber, "{s}", identifier );
86 ber_flatten( turnvalber, &turnvalp );
88 rc = ldap_extended_operation_s( ld, LDAP_EXOP_X_TURN,
89 turnvalp, sctrls, cctrls, NULL, NULL );
90 ber_free( turnvalber, 1 );
93 return LDAP_CONTROL_NOT_FOUND;