repl_bind.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. #include "repl5.h"
  9. int
  10. legacy_preop_bind( Slapi_PBlock *pb )
  11. {
  12. int return_value = 0;
  13. char *dn = NULL;
  14. struct berval *cred = NULL;
  15. int method;
  16. int one = 1;
  17. slapi_pblock_get(pb, SLAPI_BIND_METHOD, &method);
  18. slapi_pblock_get(pb, SLAPI_BIND_TARGET, &dn);
  19. slapi_pblock_get(pb, SLAPI_BIND_CREDENTIALS, &cred);
  20. if (LDAP_AUTH_SIMPLE == method)
  21. {
  22. if (legacy_consumer_is_replicationdn(dn) && legacy_consumer_is_replicationpw(cred))
  23. {
  24. /* Successful bind as replicationdn */
  25. void *conn = NULL;
  26. consumer_connection_extension *connext = NULL;
  27. #ifdef DEBUG
  28. slapi_log_error(SLAPI_LOG_REPL, REPLICATION_SUBSYSTEM, "legacy_preop_bind: begin\n");
  29. #endif
  30. slapi_pblock_get( pb, SLAPI_CONNECTION, &conn );
  31. connext = (consumer_connection_extension*) repl_con_get_ext (REPL_CON_EXT_CONN, conn);
  32. if (NULL != connext)
  33. {
  34. connext->is_legacy_replication_dn = 1;
  35. }
  36. slapi_send_ldap_result(pb, LDAP_SUCCESS, NULL, NULL, 0, NULL);
  37. return_value = 1; /* Prevent further processing in front end */
  38. }
  39. }
  40. return return_value;
  41. }