1 /* $NetBSD: cancel.c,v 1.1.1.3 2010/12/12 15:21:29 adam Exp $ */ 2 3 /* OpenLDAP: pkg/ldap/libraries/libldap/cancel.c,v 1.10.2.6 2010/04/13 20:22:55 kurt Exp */ 4 /* This work is part of OpenLDAP Software <http://www.openldap.org/>. 5 * 6 * Copyright 1998-2010 The OpenLDAP Foundation. 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted only as authorized by the OpenLDAP 11 * Public License. 12 * 13 * A copy of this license is available in the file LICENSE in the 14 * top-level directory of the distribution or, alternatively, at 15 * <http://www.OpenLDAP.org/license.html>. 16 */ 17 /* ACKNOWLEDGEMENTS: 18 * This program was originally developed by Kurt D. Zeilenga for inclusion 19 * in OpenLDAP Software. 20 */ 21 22 /* 23 * LDAPv3 Cancel Operation Request 24 */ 25 26 #include "portable.h" 27 28 #include <stdio.h> 29 #include <ac/stdlib.h> 30 31 #include <ac/socket.h> 32 #include <ac/string.h> 33 #include <ac/time.h> 34 35 #include "ldap-int.h" 36 #include "ldap_log.h" 37 38 int 39 ldap_cancel( 40 LDAP *ld, 41 int cancelid, 42 LDAPControl **sctrls, 43 LDAPControl **cctrls, 44 int *msgidp ) 45 { 46 BerElement *cancelidber = NULL; 47 struct berval *cancelidvalp = NULL; 48 int rc; 49 50 cancelidber = ber_alloc_t( LBER_USE_DER ); 51 ber_printf( cancelidber, "{i}", cancelid ); 52 ber_flatten( cancelidber, &cancelidvalp ); 53 rc = ldap_extended_operation( ld, LDAP_EXOP_CANCEL, 54 cancelidvalp, sctrls, cctrls, msgidp ); 55 ber_free( cancelidber, 1 ); 56 return rc; 57 } 58 59 int 60 ldap_cancel_s( 61 LDAP *ld, 62 int cancelid, 63 LDAPControl **sctrls, 64 LDAPControl **cctrls ) 65 { 66 BerElement *cancelidber = NULL; 67 struct berval *cancelidvalp = NULL; 68 int rc; 69 70 cancelidber = ber_alloc_t( LBER_USE_DER ); 71 ber_printf( cancelidber, "{i}", cancelid ); 72 ber_flatten( cancelidber, &cancelidvalp ); 73 rc = ldap_extended_operation_s( ld, LDAP_EXOP_CANCEL, 74 cancelidvalp, sctrls, cctrls, NULL, NULL ); 75 ber_free( cancelidber, 1 ); 76 return rc; 77 } 78 79