cancel.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* $OpenLDAP$ */
  2. /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  3. *
  4. * Copyright 1998-2022 The OpenLDAP Foundation.
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted only as authorized by the OpenLDAP
  9. * Public License.
  10. *
  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>.
  14. */
  15. /* ACKNOWLEDGEMENTS:
  16. * This program was originally developed by Kurt D. Zeilenga for inclusion
  17. * in OpenLDAP Software.
  18. */
  19. /*
  20. * LDAPv3 Cancel Operation Request
  21. */
  22. #include "portable.h"
  23. #include <stdio.h>
  24. #include <ac/stdlib.h>
  25. #include <ac/socket.h>
  26. #include <ac/string.h>
  27. #include <ac/time.h>
  28. #include "ldap-int.h"
  29. #include "ldap_log.h"
  30. int
  31. ldap_cancel(
  32. LDAP *ld,
  33. int cancelid,
  34. LDAPControl **sctrls,
  35. LDAPControl **cctrls,
  36. int *msgidp )
  37. {
  38. BerElement *cancelidber = NULL;
  39. struct berval cancelidvalp = { 0, NULL };
  40. int rc;
  41. cancelidber = ber_alloc_t( LBER_USE_DER );
  42. ber_printf( cancelidber, "{i}", cancelid );
  43. ber_flatten2( cancelidber, &cancelidvalp, 0 );
  44. rc = ldap_extended_operation( ld, LDAP_EXOP_CANCEL,
  45. &cancelidvalp, sctrls, cctrls, msgidp );
  46. ber_free( cancelidber, 1 );
  47. return rc;
  48. }
  49. int
  50. ldap_cancel_s(
  51. LDAP *ld,
  52. int cancelid,
  53. LDAPControl **sctrls,
  54. LDAPControl **cctrls )
  55. {
  56. BerElement *cancelidber = NULL;
  57. struct berval cancelidvalp = { 0, NULL };
  58. int rc;
  59. cancelidber = ber_alloc_t( LBER_USE_DER );
  60. ber_printf( cancelidber, "{i}", cancelid );
  61. ber_flatten2( cancelidber, &cancelidvalp, 0 );
  62. rc = ldap_extended_operation_s( ld, LDAP_EXOP_CANCEL,
  63. &cancelidvalp, sctrls, cctrls, NULL, NULL );
  64. ber_free( cancelidber, 1 );
  65. return rc;
  66. }