repl_bind.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /** BEGIN COPYRIGHT BLOCK
  2. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  3. * Copyright (C) 2005 Red Hat, Inc.
  4. * All rights reserved.
  5. *
  6. * License: GPL (version 3 or any later version).
  7. * See LICENSE for details.
  8. * END COPYRIGHT BLOCK **/
  9. #ifdef HAVE_CONFIG_H
  10. # include <config.h>
  11. #endif
  12. #include "slapi-plugin.h"
  13. #include "repl.h"
  14. #include "repl5.h"
  15. int
  16. legacy_preop_bind( Slapi_PBlock *pb )
  17. {
  18. int return_value = 0;
  19. const char *dn = NULL;
  20. Slapi_DN *sdn = NULL;
  21. struct berval *cred = NULL;
  22. ber_tag_t method;
  23. slapi_pblock_get(pb, SLAPI_BIND_METHOD, &method);
  24. slapi_pblock_get(pb, SLAPI_BIND_TARGET_SDN, &sdn);
  25. slapi_pblock_get(pb, SLAPI_BIND_CREDENTIALS, &cred);
  26. dn = slapi_sdn_get_dn(sdn);
  27. if (LDAP_AUTH_SIMPLE == method)
  28. {
  29. if (legacy_consumer_is_replicationdn(dn) && legacy_consumer_is_replicationpw(cred))
  30. {
  31. /* Successful bind as replicationdn */
  32. void *conn = NULL;
  33. consumer_connection_extension *connext = NULL;
  34. #ifdef DEBUG
  35. slapi_log_error(SLAPI_LOG_REPL, LOG_DEBUG, REPLICATION_SUBSYSTEM, "legacy_preop_bind: begin\n");
  36. #endif
  37. slapi_pblock_get( pb, SLAPI_CONNECTION, &conn );
  38. /* TEL 20120529 - Is there any reason we must protect this connext access? */
  39. connext = (consumer_connection_extension*) repl_con_get_ext (REPL_CON_EXT_CONN, conn);
  40. if (NULL != connext)
  41. {
  42. connext->is_legacy_replication_dn = 1;
  43. }
  44. slapi_send_ldap_result(pb, LDAP_SUCCESS, NULL, NULL, 0, NULL);
  45. return_value = 1; /* Prevent further processing in front end */
  46. }
  47. }
  48. return return_value;
  49. }