2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 2005 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 BerElement *turnvalber = NULL;
46 struct berval *turnvalp = NULL;
49 turnvalber = ber_alloc_t( LBER_USE_DER );
51 ber_printf( turnvalber, "{bs}", mutual, identifier );
53 ber_printf( turnvalber, "{s}", identifier );
55 ber_flatten( turnvalber, &turnvalp );
57 rc = ldap_extended_operation( ld, LDAP_EXOP_X_TURN,
58 turnvalp, sctrls, cctrls, msgidp );
59 ber_free( turnvalber, 1 );
67 LDAP_CONST char* identifier,
69 LDAPControl **cctrls )
71 BerElement *turnvalber = NULL;
72 struct berval *turnvalp = NULL;
75 turnvalber = ber_alloc_t( LBER_USE_DER );
77 ber_printf( turnvalber, "{bs}", 0xFF, identifier );
79 ber_printf( turnvalber, "{s}", identifier );
81 ber_flatten( turnvalber, &turnvalp );
83 rc = ldap_extended_operation_s( ld, LDAP_EXOP_X_TURN,
84 turnvalp, sctrls, cctrls, NULL, NULL );
85 ber_free( turnvalber, 1 );