diff options
author | Simo Sorce <ssorce@redhat.com> | 2011-12-22 09:59:20 -0500 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2012-01-05 09:38:04 -0500 |
commit | de0444defea0868bc2b3ec1ee8624a514c67a04e (patch) | |
tree | 6d5cd7e1b397742ad5b68b8a8adb2e09857c9260 /daemons/ipa-slapi-plugins | |
parent | d0648f1fd4ee708cfa4ea6fdc29dc99ae44521e2 (diff) | |
download | freeipa-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.c | 22 |
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; |