diff options
author | Simo Sorce <simo@redhat.com> | 2013-01-08 00:59:32 -0500 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-01-15 10:53:03 +0100 |
commit | 681742138b2afbbefa7f14de937beb438409208e (patch) | |
tree | 8261b14012f0d994cfdd91005a237581ae8a400a /src/db | |
parent | 740870643f337ce70d85f25f9ed057cd1f91028c (diff) | |
download | sssd-681742138b2afbbefa7f14de937beb438409208e.tar.gz sssd-681742138b2afbbefa7f14de937beb438409208e.tar.bz2 sssd-681742138b2afbbefa7f14de937beb438409208e.zip |
Add domain arguments to sysdb services functions
also fix sysdb_svc_add declarations
Diffstat (limited to 'src/db')
-rw-r--r-- | src/db/sysdb_services.c | 38 | ||||
-rw-r--r-- | src/db/sysdb_services.h | 16 |
2 files changed, 34 insertions, 20 deletions
diff --git a/src/db/sysdb_services.c b/src/db/sysdb_services.c index 2ac8d9a4..b8ac9ef7 100644 --- a/src/db/sysdb_services.c +++ b/src/db/sysdb_services.c @@ -26,15 +26,6 @@ #include "db/sysdb_private.h" #include "db/sysdb_services.h" -errno_t -sysdb_svc_add(TALLOC_CTX *mem_ctx, - struct sysdb_ctx *sysdb, - const char *primary_name, - int port, - const char **aliases, - const char **protocols, - struct ldb_dn **dn); - static errno_t sysdb_svc_update(struct sysdb_ctx *sysdb, struct ldb_dn *dn, @@ -50,6 +41,7 @@ sysdb_svc_remove_alias(struct sysdb_ctx *sysdb, errno_t sysdb_getservbyname(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *name, const char *proto, struct ldb_result **_res) @@ -89,7 +81,7 @@ sysdb_getservbyname(TALLOC_CTX *mem_ctx, goto done; } - ret = sysdb_search_services(mem_ctx, sysdb, subfilter, + ret = sysdb_search_services(mem_ctx, sysdb, domain, subfilter, attrs, &msgs_count, &msgs); if (ret == EOK) { res = talloc_zero(mem_ctx, struct ldb_result); @@ -111,6 +103,7 @@ done: errno_t sysdb_getservbyport(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, int port, const char *proto, struct ldb_result **_res) @@ -148,7 +141,7 @@ sysdb_getservbyport(TALLOC_CTX *mem_ctx, goto done; } - ret = sysdb_search_services(mem_ctx, sysdb, subfilter, + ret = sysdb_search_services(mem_ctx, sysdb, domain, subfilter, attrs, &msgs_count, &msgs); if (ret == EOK) { res = talloc_zero(mem_ctx, struct ldb_result); @@ -208,7 +201,7 @@ sysdb_store_service(struct sysdb_ctx *sysdb, * properly. Last entry saved to the cache should * always "win". */ - ret = sysdb_getservbyport(tmp_ctx, sysdb, port, NULL, &res); + ret = sysdb_getservbyport(tmp_ctx, sysdb, domain, port, NULL, &res); if (ret != EOK && ret != ENOENT) { goto done; } else if (ret != ENOENT) { @@ -274,7 +267,7 @@ sysdb_store_service(struct sysdb_ctx *sysdb, * need to update existing entries or modify * aliases. */ - ret = sysdb_getservbyname(tmp_ctx, sysdb, primary_name, NULL, &res); + ret = sysdb_getservbyname(tmp_ctx, sysdb, domain, primary_name, NULL, &res); if (ret != EOK && ret != ENOENT) { goto done; } else if (ret != ENOENT) { /* Found entries */ @@ -358,7 +351,7 @@ sysdb_store_service(struct sysdb_ctx *sysdb, ret = sysdb_svc_update(sysdb, update_dn, port, aliases, protocols); } else { /* Add a new entry */ - ret = sysdb_svc_add(tmp_ctx, sysdb, primary_name, port, + ret = sysdb_svc_add(tmp_ctx, sysdb, domain, primary_name, port, aliases, protocols, &update_dn); } if (ret != EOK) goto done; @@ -438,6 +431,7 @@ sysdb_svc_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, errno_t sysdb_svc_add(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *primary_name, int port, const char **aliases, @@ -460,7 +454,7 @@ sysdb_svc_add(TALLOC_CTX *mem_ctx, } /* svc dn */ - msg->dn = sysdb_svc_dn(sysdb, msg, sysdb->domain->name, primary_name); + msg->dn = sysdb_svc_dn(sysdb, msg, domain->name, primary_name); if (!msg->dn) { ret = ENOMEM; goto done; @@ -643,6 +637,7 @@ done: errno_t sysdb_svc_delete(struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *name, int port, const char *proto) @@ -667,7 +662,7 @@ sysdb_svc_delete(struct sysdb_ctx *sysdb, in_transaction = true; if (name) { - ret = sysdb_getservbyname(tmp_ctx, sysdb, name, proto, &res); + ret = sysdb_getservbyname(tmp_ctx, sysdb, domain, name, proto, &res); if (ret != EOK && ret != ENOENT) goto done; if (ret == ENOENT) { /* Doesn't exist in the DB. Nothing to do */ @@ -675,7 +670,7 @@ sysdb_svc_delete(struct sysdb_ctx *sysdb, goto done; } } else { - ret = sysdb_getservbyport(tmp_ctx, sysdb, port, proto, &res); + ret = sysdb_getservbyport(tmp_ctx, sysdb, domain, port, proto, &res); if (ret != EOK && ret != ENOENT) goto done; if (ret == ENOENT) { /* Doesn't exist in the DB. Nothing to do */ @@ -721,6 +716,7 @@ done: errno_t sysdb_enumservent(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, struct ldb_result **_res) { errno_t ret; @@ -735,7 +731,7 @@ sysdb_enumservent(TALLOC_CTX *mem_ctx, return ENOMEM; } - ret = sysdb_search_services(mem_ctx, sysdb, "", + ret = sysdb_search_services(mem_ctx, sysdb, domain, "", attrs, &msgs_count, &msgs); if (ret == EOK) { res = talloc_zero(mem_ctx, struct ldb_result); @@ -756,6 +752,7 @@ done: errno_t sysdb_set_service_attr(struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *name, struct sysdb_attrs *attrs, int mod_op) @@ -769,7 +766,7 @@ sysdb_set_service_attr(struct sysdb_ctx *sysdb, return ENOMEM; } - dn = sysdb_svc_dn(sysdb, tmp_ctx, sysdb->domain->name, name); + dn = sysdb_svc_dn(sysdb, tmp_ctx, domain->name, name); if (!dn) { ret = ENOMEM; goto done; @@ -784,6 +781,7 @@ done: errno_t sysdb_search_services(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *sub_filter, const char **attrs, size_t *msgs_count, @@ -800,7 +798,7 @@ errno_t sysdb_search_services(TALLOC_CTX *mem_ctx, } basedn = ldb_dn_new_fmt(tmp_ctx, sysdb->ldb, - SYSDB_TMPL_SVC_BASE, sysdb->domain->name); + SYSDB_TMPL_SVC_BASE, domain->name); if (!basedn) { DEBUG(SSSDBG_OP_FAILURE, ("Failed to build base dn\n")); ret = ENOMEM; diff --git a/src/db/sysdb_services.h b/src/db/sysdb_services.h index 467a6584..2ec9a3b6 100644 --- a/src/db/sysdb_services.h +++ b/src/db/sysdb_services.h @@ -48,6 +48,7 @@ errno_t sysdb_getservbyname(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *name, const char *proto, struct ldb_result **_res); @@ -55,6 +56,7 @@ sysdb_getservbyname(TALLOC_CTX *mem_ctx, errno_t sysdb_getservbyport(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, int port, const char *proto, struct ldb_result **_res); @@ -62,6 +64,7 @@ sysdb_getservbyport(TALLOC_CTX *mem_ctx, errno_t sysdb_enumservent(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, struct ldb_result **_res); errno_t @@ -81,19 +84,32 @@ sysdb_svc_dn(struct sysdb_ctx *sysdb, TALLOC_CTX *mem_ctx, const char *domain, const char *name); errno_t +sysdb_svc_add(TALLOC_CTX *mem_ctx, + struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, + const char *primary_name, + int port, + const char **aliases, + const char **protocols, + struct ldb_dn **dn); + +errno_t sysdb_svc_delete(struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *name, int port, const char *proto); errno_t sysdb_set_service_attr(struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *name, struct sysdb_attrs *attrs, int mod_op); errno_t sysdb_search_services(TALLOC_CTX *mem_ctx, struct sysdb_ctx *sysdb, + struct sss_domain_info *domain, const char *sub_filter, const char **attrs, size_t *msgs_count, |