3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2003-2012 The OpenLDAP Foundation.
6 * Copyright 2003-2004 PADL Software Pty Ltd.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted only as authorized by the OpenLDAP
13 * A copy of this license is available in the file LICENSE in the
14 * top-level directory of the distribution or, alternatively, at
15 * <http://www.OpenLDAP.org/license.html>.
18 * This work was initially developed by Luke Howard of PADL Software
19 * for inclusion in OpenLDAP Software.
28 #include <slapi-plugin.h>
30 int addrdnvalues_preop_init(Slapi_PBlock *pb);
32 static Slapi_PluginDesc pluginDescription = {
33 "addrdnvalues-plugin",
36 "RDN values addition plugin"
39 static int addrdnvalues_preop_add(Slapi_PBlock *pb)
44 if (slapi_pblock_get(pb, SLAPI_ADD_ENTRY, &e) != 0) {
45 slapi_log_error(SLAPI_LOG_PLUGIN, "addrdnvalues_preop_add",
46 "Error retrieving target entry\n");
50 rc = slapi_entry_add_rdn_values(e);
51 if (rc != LDAP_SUCCESS) {
52 slapi_send_ldap_result(pb, LDAP_OTHER, NULL,
53 "Failed to parse distinguished name", 0, NULL);
54 slapi_log_error(SLAPI_LOG_PLUGIN, "addrdnvalues_preop_add",
55 "Failed to parse distinguished name: %s\n",
63 int addrdnvalues_preop_init(Slapi_PBlock *pb)
65 if (slapi_pblock_set(pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_03) != 0 ||
66 slapi_pblock_set(pb, SLAPI_PLUGIN_DESCRIPTION, &pluginDescription) != 0 ||
67 slapi_pblock_set(pb, SLAPI_PLUGIN_PRE_ADD_FN, (void *)addrdnvalues_preop_add) != 0) {
68 slapi_log_error(SLAPI_LOG_PLUGIN, "addrdnvalues_preop_init",
69 "Error registering %s\n", pluginDescription.spd_description);