repl_compare.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. /** BEGIN COPYRIGHT BLOCK
  2. * Copyright 2001 Sun Microsystems, Inc.
  3. * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
  4. * All rights reserved.
  5. * END COPYRIGHT BLOCK **/
  6. #include "slapi-plugin.h"
  7. #include "repl.h"
  8. int
  9. legacy_preop_compare( Slapi_PBlock *pb )
  10. {
  11. int is_replicated_operation = 0;
  12. char *compare_base = NULL;
  13. struct berval **referral = NULL;
  14. int return_code = 0;
  15. Slapi_DN *basesdn;
  16. slapi_pblock_get(pb, SLAPI_IS_REPLICATED_OPERATION, &is_replicated_operation);
  17. slapi_pblock_get(pb, SLAPI_COMPARE_TARGET, &compare_base);
  18. basesdn= slapi_sdn_new_dn_byref(compare_base);
  19. referral = get_data_source(pb, basesdn, 1, NULL);
  20. slapi_sdn_free(&basesdn);
  21. if (NULL != referral && !is_replicated_operation)
  22. {
  23. /*
  24. * There is a copyingFrom in this entry or an ancestor.
  25. * Return a referral to the supplier, and we're all done.
  26. */
  27. slapi_send_ldap_result(pb, LDAP_REFERRAL, NULL, NULL, 0, referral);
  28. return_code = 1; /* return 1 to prevent further search processing */
  29. }
  30. return return_code;
  31. }