From bac7367d5d3b3140ccc12a908cc763e9b299f424 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Fri, 11 Nov 2016 21:06:02 +0100 Subject: get_service_dn: Get the service dn from service name This is not really working, because the base_dn of the service accounts is missing. This will be added later. --- service_passwords.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/service_passwords.c b/service_passwords.c index 522b468..bde1906 100644 --- a/service_passwords.c +++ b/service_passwords.c @@ -445,6 +445,31 @@ static char *get_virtual_service(const char *dn) return service; } +/** The DN of the service specified by name. + * + * This function builds the \c DN of a service from the service name and + * the base dn for the services. + * + * @param[in] service The name of the service. + * @return Pointer to the service dn. The caller is responsible for freeing + * it with \c slapi_ch_free_string. + */ +static char *get_service_dn(const char *service) +{ + char *new_dn = NULL; + char *base_dn = NULL; + Slapi_RDN *rdn = NULL; + + /* TODO: Get base_dn */ + + rdn = slapi_rdn_new(); + slapi_rdn_add(rdn, "cn", service); + new_dn = slapi_dn_plus_rdn(base_dn, slapi_rdn_get_rdn(rdn)); + slapi_rdn_free(&rdn); + + return new_dn; +} + /** \c PRE_BIND plugin to allow password fallback. * * This function is called before a bind operation. If the BIND_DN is a user -- cgit v1.2.3-1-g7c22