diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2016-11-19 18:58:04 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2016-11-19 21:40:52 +0100 |
commit | cc6761cf1f424f27a03ee92275f26713b82942cd (patch) | |
tree | e5a030e3edc9a104499db3477fd4406e50bbfe78 /service_passwords.c | |
parent | c9dd6bc3b4273395878d559ecec72cd02c154d54 (diff) | |
download | ldap-plugin-cc6761cf1f424f27a03ee92275f26713b82942cd.tar.gz ldap-plugin-cc6761cf1f424f27a03ee92275f26713b82942cd.tar.bz2 ldap-plugin-cc6761cf1f424f27a03ee92275f26713b82942cd.zip |
POST_BIND: Remove hook.
post_bind is not exected, if the pre_bind method has completed the
bind operation. Additionally the post_bind method does not have
access to the SLAPI_CONN_DN (bind dn). So we have to find another
method to save the extension data.
Diffstat (limited to 'service_passwords.c')
-rw-r--r-- | service_passwords.c | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/service_passwords.c b/service_passwords.c index 1f27600..6be182f 100644 --- a/service_passwords.c +++ b/service_passwords.c @@ -618,93 +618,6 @@ static int pre_bind(Slapi_PBlock *pb) return SLAPI_BIND_FAIL; } -/** \c POST_BIND plugin to save the extra connection data after bind. - * - * This method is called after a bind operation and try to detect if the - * \c BIND_DN contains a service name. The \c BIND_DN either be a service dn or - * a virtual service entry of a user. If it is a virtual entry of the user, than - * the service prefix is used to build the service dn. - * - * If the service dn is found, the method checks whether that entry is a gold - * service or not. The service name and the gold service status is saved in the - * private connection extension data, so that it can be used by the other - * methods of this plugin. - * - * @param[in,out] pb Parameter block of the operation. - * @return - * * <tt>0</tt> on success - * * <tt>!= 0</tt> in case of error - */ -static int post_bind(Slapi_PBlock *pb) -{ - Slapi_Connection *conn; - char *bind_dn; - - private_connection_data *conn_ext = NULL; - int gold_service = 0; - char *service = NULL; - char *service_dn = NULL; - char *parent_dn = NULL; - - int rc = 0; - char fn[] = "post_bind in service_passwords plug-in"; - - rc |= slapi_pblock_get(pb, SLAPI_CONNECTION, &conn); - rc |= slapi_pblock_get(pb, SLAPI_CONN_DN, &bind_dn); - - if (rc != 0) { - slapi_log_error( - SLAPI_LOG_PLUGIN, fn, - "Could not get parameters (error %d).\n", rc); - return rc; - } - - if (is_service(bind_dn, &service, &gold_service) != 0) { - parent_dn = slapi_dn_parent(bind_dn); - rc |= is_user(parent_dn, NULL); - slapi_ch_free_string(&parent_dn); - - if (rc != 0) { - return 0; - } - - service = get_virtual_service(bind_dn); - - service_dn = get_service_dn(service); - rc |= is_service(service_dn, NULL, &gold_service); - slapi_ch_free_string(&service_dn); - - if (rc != 0) { - slapi_log_error( - SLAPI_LOG_PLUGIN, fn, - "Invalid service '%s' in bind dn '%s'.\n", - service, bind_dn); - goto fail1; - } - } - - /* set the connection private data */ - conn_ext = (private_connection_data*)slapi_get_object_extension( - private.conn_ext.obj_type, conn, private.conn_ext.handle); - if (conn_ext == NULL) { - slapi_log_error( - SLAPI_LOG_PLUGIN, fn, - "Failed to get connection private data.\n"); - - rc = LDAP_OPERATIONS_ERROR; - goto fail1; - } - - conn_ext->gold_service = gold_service; - conn_ext->service_name = service; - return 0; - -fail1: - slapi_ch_free_string(&service); - return rc; -} - - /** \c POST_UNBIND plugin to reset the connection data after unbind. * * @param[in,out] pb Parameter block of the operation. @@ -1076,7 +989,6 @@ int service_passwords_init(Slapi_PBlock *pb) rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_PRE_BIND_FN, (void *) pre_bind); rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_PRE_ENTRY_FN, (void *) pre_entry); rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_PRE_SEARCH_FN, (void *) pre_search); - rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_POST_BIND_FN, (void *) post_bind); rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_POST_UNBIND_FN, (void *) post_unbind); rc |= slapi_pblock_get(pb, SLAPI_PLUGIN_IDENTITY, &private.plugin_id); if (rc != 0) { |