From 1d9a3481446e99911aaa1d55561886f1970db316 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Sat, 18 Sep 2010 21:44:26 +0200 Subject: s4:rootdse LDB module - introduce dynamic "ldapServiceName" Signed-off-by: Andrew Bartlett --- source4/dsdb/samdb/ldb_modules/rootdse.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'source4/dsdb/samdb/ldb_modules/rootdse.c') diff --git a/source4/dsdb/samdb/ldb_modules/rootdse.c b/source4/dsdb/samdb/ldb_modules/rootdse.c index 041e85840e..a786a70ce3 100644 --- a/source4/dsdb/samdb/ldb_modules/rootdse.c +++ b/source4/dsdb/samdb/ldb_modules/rootdse.c @@ -206,6 +206,31 @@ static int rootdse_add_dynamic(struct ldb_module *module, struct ldb_message *ms } } + if (do_attribute(attrs, "ldapServiceName")) { + struct loadparm_context *lp_ctx + = talloc_get_type(ldb_get_opaque(ldb, "loadparm"), + struct loadparm_context); + char *ldap_service_name, *hostname; + + hostname = talloc_strdup(msg, lpcfg_netbios_name(lp_ctx)); + if (hostname == NULL) { + goto failed; + } + strlower_m(hostname); + + ldap_service_name = talloc_asprintf(msg, "%s:%s$@%s", + samdb_forest_name(ldb, msg), + hostname, lpcfg_realm(lp_ctx)); + if (ldap_service_name == NULL) { + goto failed; + } + + if (ldb_msg_add_string(msg, "ldapServiceName", + ldap_service_name) != LDB_SUCCESS) { + goto failed; + } + } + if (do_attribute(attrs, "currentTime")) { if (ldb_msg_add_steal_string(msg, "currentTime", ldb_timestring(msg, time(NULL))) != LDB_SUCCESS) { -- cgit