summaryrefslogtreecommitdiff
path: root/src/db
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-05-29 00:56:18 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-06-07 00:14:13 +0200
commit02d1cb8935d5c9b57cd05dfdbfe6ed38e0d61c28 (patch)
tree99eba160bfb608f08dc3f38e3524a3badff3ed67 /src/db
parentc51f7a064b0d7ef86110bdeb6dc09fa6c08be7d3 (diff)
downloadsssd-02d1cb8935d5c9b57cd05dfdbfe6ed38e0d61c28.tar.gz
sssd-02d1cb8935d5c9b57cd05dfdbfe6ed38e0d61c28.tar.bz2
sssd-02d1cb8935d5c9b57cd05dfdbfe6ed38e0d61c28.zip
New utility function sss_get_domain_name
Instead of copying a block of code that checks whether domain is a subdomain and uses only name of FQDN as appropriate, wrap the logic into a function.
Diffstat (limited to 'src/db')
-rw-r--r--src/db/sysdb_search.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/db/sysdb_search.c b/src/db/sysdb_search.c
index 344ff6fa..d70d0cc3 100644
--- a/src/db/sysdb_search.c
+++ b/src/db/sysdb_search.c
@@ -55,14 +55,9 @@ int sysdb_getpwnam(TALLOC_CTX *mem_ctx,
/* If this is a subomain we need to use fully qualified names for the
* search as well by default */
- if (IS_SUBDOMAIN(domain) && domain->fqnames) {
- ret = ENOMEM;
- src_name = sss_tc_fqname(tmp_ctx, domain->names, domain, name);
- } else {
- ret = EINVAL;
- src_name = name;
- }
+ src_name = sss_get_domain_name(tmp_ctx, name, domain);
if (!src_name) {
+ ret = ENOMEM;
goto done;
}
@@ -242,14 +237,9 @@ int sysdb_getgrnam(TALLOC_CTX *mem_ctx,
/* If this is a subomain we need to use fully qualified names for the
* search as well by default */
- if (IS_SUBDOMAIN(domain) && domain->fqnames) {
- ret = ENOMEM;
- src_name = sss_tc_fqname(tmp_ctx, domain->names, domain, name);
- } else {
- ret = EINVAL;
- src_name = name;
- }
+ src_name = sss_get_domain_name(tmp_ctx, name, domain);
if (!src_name) {
+ ret = ENOMEM;
goto done;
}