summaryrefslogtreecommitdiffstats
path: root/daemons/ipa-slapi-plugins
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2011-12-22 09:59:20 -0500
committerSimo Sorce <ssorce@redhat.com>2012-01-05 09:38:04 -0500
commitde0444defea0868bc2b3ec1ee8624a514c67a04e (patch)
tree6d5cd7e1b397742ad5b68b8a8adb2e09857c9260 /daemons/ipa-slapi-plugins
parentd0648f1fd4ee708cfa4ea6fdc29dc99ae44521e2 (diff)
downloadfreeipa-de0444defea0868bc2b3ec1ee8624a514c67a04e.tar.gz
freeipa-de0444defea0868bc2b3ec1ee8624a514c67a04e.tar.xz
freeipa-de0444defea0868bc2b3ec1ee8624a514c67a04e.zip
ipa-cldap: Support clients asking for default domain
Diffstat (limited to 'daemons/ipa-slapi-plugins')
-rw-r--r--daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_netlogon.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_netlogon.c b/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_netlogon.c
index 6eb7eb9b1..180a067ff 100644
--- a/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_netlogon.c
+++ b/daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_netlogon.c
@@ -215,6 +215,7 @@ int ipa_cldap_netlogon(struct ipa_cldap_ctx *ctx,
struct berval *reply)
{
char hostname[MAXHOSTNAMELEN + 1]; /* NOTE: lenght hardcoded in kernel */
+ char domname[MAXHOSTNAMELEN + 1]; /* NOTE: lenght hardcoded in kernel */
char *domain = NULL;
char *guid = NULL;
char *sid = NULL;
@@ -289,11 +290,30 @@ int ipa_cldap_netlogon(struct ipa_cldap_ctx *ctx,
req->kvps.pairs[i].attr.bv_val);
}
- if (!domain || !ntver) {
+ if (!ntver) {
ret = EINVAL;
goto done;
}
+ /* If no domain is provide the client is asking for our own domain,
+ * read our own domain name from the system */
+ if (!domain) {
+ ret = getdomainname(domname, MAXHOSTNAMELEN);
+ if (ret == -1) {
+ ret = errno;
+ goto done;
+ }
+ domname[MAXHOSTNAMELEN] = '\0';
+ p = strchr(hostname, '.');
+ if (p) {
+ domain = strdup(p + 1);
+ if (!domain) {
+ ret = ENOMEM;
+ goto done;
+ }
+ }
+ }
+
/* FIXME: we support only NETLOGON_NT_VERSION_5EX for now */
if (!(ntver & NETLOGON_NT_VERSION_5EX)) {
ret = EINVAL;