From 5ea77a75dd2d2158401331879f3c8f47940a732c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 18:35:32 +0200 Subject: Adding upstream version 2.5.13+dfsg. Signed-off-by: Daniel Baumann --- contrib/slapi-plugins/addrdnvalues/README | 29 +++++++++ contrib/slapi-plugins/addrdnvalues/addrdnvalues.c | 75 +++++++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 contrib/slapi-plugins/addrdnvalues/README create mode 100644 contrib/slapi-plugins/addrdnvalues/addrdnvalues.c (limited to 'contrib/slapi-plugins') diff --git a/contrib/slapi-plugins/addrdnvalues/README b/contrib/slapi-plugins/addrdnvalues/README new file mode 100644 index 0000000..da699c8 --- /dev/null +++ b/contrib/slapi-plugins/addrdnvalues/README @@ -0,0 +1,29 @@ +This directory contains a SLAPI plugin, addrdnvalues, which will add to +an entry any attribute values that appear in the entry's RDN but not in +the entry. This is necessary for compliance with some "broken" clients. + +To use the plugin, add: + +plugin preoperation libaddrdnvalues-plugin.so addrdnvalues_preop_init + +to your slapd configuration file. + +No Makefile is provided. Use a command line similar to: + +gcc -shared -I../../../include -Wall -g -o libaddrdnvalues-plugin.so addrdnvalues.c + +to compile this plugin. + +--- +This work is part of OpenLDAP Software . + +Copyright 2003-2022 The OpenLDAP Foundation. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted only as authorized by the OpenLDAP +Public License. + +A copy of this license is available in the file LICENSE in the +top-level directory of the distribution or, alternatively, at +. + diff --git a/contrib/slapi-plugins/addrdnvalues/addrdnvalues.c b/contrib/slapi-plugins/addrdnvalues/addrdnvalues.c new file mode 100644 index 0000000..8dd305e --- /dev/null +++ b/contrib/slapi-plugins/addrdnvalues/addrdnvalues.c @@ -0,0 +1,75 @@ +/* addrdnvalues.c */ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software . + * + * Copyright 2003-2022 The OpenLDAP Foundation. + * Copyright 2003-2004 PADL Software Pty Ltd. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in the file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * . + */ +/* ACKNOWLEDGEMENTS: + * This work was initially developed by Luke Howard of PADL Software + * for inclusion in OpenLDAP Software. + */ + +#include +#include + +#include +#include + +#include + +int addrdnvalues_preop_init(Slapi_PBlock *pb); + +static Slapi_PluginDesc pluginDescription = { + "addrdnvalues-plugin", + "PADL", + "1.0", + "RDN values addition plugin" +}; + +static int addrdnvalues_preop_add(Slapi_PBlock *pb) +{ + int rc; + Slapi_Entry *e; + + if (slapi_pblock_get(pb, SLAPI_ADD_ENTRY, &e) != 0) { + slapi_log_error(SLAPI_LOG_PLUGIN, "addrdnvalues_preop_add", + "Error retrieving target entry\n"); + return -1; + } + + rc = slapi_entry_add_rdn_values(e); + if (rc != LDAP_SUCCESS) { + slapi_send_ldap_result(pb, LDAP_OTHER, NULL, + "Failed to parse distinguished name", 0, NULL); + slapi_log_error(SLAPI_LOG_PLUGIN, "addrdnvalues_preop_add", + "Failed to parse distinguished name: %s\n", + ldap_err2string(rc)); + return -1; + } + + return 0; +} + +int addrdnvalues_preop_init(Slapi_PBlock *pb) +{ + if (slapi_pblock_set(pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_03) != 0 || + slapi_pblock_set(pb, SLAPI_PLUGIN_DESCRIPTION, &pluginDescription) != 0 || + slapi_pblock_set(pb, SLAPI_PLUGIN_PRE_ADD_FN, (void *)addrdnvalues_preop_add) != 0) { + slapi_log_error(SLAPI_LOG_PLUGIN, "addrdnvalues_preop_init", + "Error registering %s\n", pluginDescription.spd_description); + return -1; + } + + return 0; +} + -- cgit v1.2.3