summaryrefslogtreecommitdiffstats
path: root/server/infopipe
diff options
context:
space:
mode:
Diffstat (limited to 'server/infopipe')
-rw-r--r--server/infopipe/infopipe.c24
-rw-r--r--server/infopipe/infopipe_groups.c21
-rw-r--r--server/infopipe/infopipe_private.h2
-rw-r--r--server/infopipe/infopipe_users.c35
4 files changed, 36 insertions, 46 deletions
diff --git a/server/infopipe/infopipe.c b/server/infopipe/infopipe.c
index 535d41e3d..729983019 100644
--- a/server/infopipe/infopipe.c
+++ b/server/infopipe/infopipe.c
@@ -36,8 +36,6 @@
#define INFP_CONF_ENTRY "config/services/info"
-struct infp_ctx;
-
static int service_identity(DBusMessage *message, struct sbus_conn_ctx *sconn)
{
dbus_uint16_t version = INFOPIPE_VERSION;
@@ -366,23 +364,13 @@ static int infp_process_init(TALLOC_CTX *mem_ctx,
}
/* Read in the domain map */
- ret = confdb_get_domains(cdb, infp_ctx, &infp_ctx->domain_map);
+ ret = confdb_get_domains(cdb, infp_ctx, &infp_ctx->domains);
if (ret != EOK) {
DEBUG(0, ("Failed to populate the domain map\n"));
talloc_free(infp_ctx);
return EIO;
}
- if (infp_ctx->domain_map == NULL) {
- /* No domains configured!
- * Note: this should never happen, since LOCAL
- * should always be configured
- */
- DEBUG(0, ("No domains configured on this client!\n"));
- talloc_free(infp_ctx);
- return EIO;
- }
-
infp_ctx->cache_timeout = 600; /* FIXME: read from confdb */
/* Add the infp_ctx to the sbus_conn_ctx private data
@@ -482,9 +470,15 @@ bool infp_get_permissions(const char *caller,
return false;
}
-struct sss_domain_info *infp_get_domain_obj(struct infp_ctx *infp, const char *domain_name)
+struct sss_domain_info *infp_get_domain_obj(struct infp_ctx *infp,
+ const char *domain_name)
{
- return talloc_get_type(btreemap_get_value(infp->domain_map, (const void *) domain_name), struct sss_domain_info);
+ struct sss_domain_info *dom;
+
+ for (dom = infp->domains; dom; dom = dom->next) {
+ if (strcasecmp(dom->name, domain_name) == 0) break;
+ }
+ return dom;
}
/* CheckPermissions(STRING domain, STRING object, STRING instance
diff --git a/server/infopipe/infopipe_groups.c b/server/infopipe/infopipe_groups.c
index 4b2c881c2..34e789581 100644
--- a/server/infopipe/infopipe_groups.c
+++ b/server/infopipe/infopipe_groups.c
@@ -150,9 +150,8 @@ int infp_groups_create(DBusMessage *message, struct sbus_conn_ctx *sconn)
}
grcreate_req->infp_req->domain =
- btreemap_get_value(grcreate_req->infp_req->infp->domain_map,
- (const void *)arg_domain);
- if(grcreate_req->infp_req->domain == NULL) {
+ infp_get_domain_obj(grcreate_req->infp_req->infp, arg_domain);
+ if (grcreate_req->infp_req->domain == NULL) {
einval_msg = talloc_strdup(grcreate_req, "Invalid domain.");
goto einval;
}
@@ -319,9 +318,8 @@ int infp_groups_delete(DBusMessage *message, struct sbus_conn_ctx *sconn)
}
grdel_req->infp_req->domain =
- btreemap_get_value(grdel_req->infp_req->infp->domain_map,
- (const void *)arg_domain);
- if(grdel_req->infp_req->domain == NULL) {
+ infp_get_domain_obj(grdel_req->infp_req->infp, arg_domain);
+ if (grdel_req->infp_req->domain == NULL) {
einval_msg = talloc_strdup(grdel_req, "Invalid domain.");
goto einval;
}
@@ -546,10 +544,9 @@ static int infp_groups_modify_members(DBusMessage *message,
}
grmod_req->infp_req->domain =
- btreemap_get_value(grmod_req->infp_req->infp->domain_map,
- (const void *)arg_domain);
+ infp_get_domain_obj(grmod_req->infp_req->infp, arg_domain);
/* Check for a valid domain */
- if(grmod_req->infp_req->domain == NULL) {
+ if (grmod_req->infp_req->domain == NULL) {
einval_msg = talloc_strdup(grmod_req, "Invalid domain.");
goto einval;
}
@@ -772,11 +769,9 @@ int infp_groups_set_gid(DBusMessage *message, struct sbus_conn_ctx *sconn)
}
grmod_req->infp_req->domain =
- btreemap_get_value(grmod_req->infp_req->infp->domain_map,
- (const void *)arg_domain);
-
+ infp_get_domain_obj(grmod_req->infp_req->infp, arg_domain);
/* Check for a valid domain */
- if(grmod_req->infp_req->domain == NULL) {
+ if (grmod_req->infp_req->domain == NULL) {
einval_msg = talloc_strdup(grmod_req, "Invalid domain.");
goto einval;
}
diff --git a/server/infopipe/infopipe_private.h b/server/infopipe/infopipe_private.h
index 066f11e90..7317f7a62 100644
--- a/server/infopipe/infopipe_private.h
+++ b/server/infopipe/infopipe_private.h
@@ -28,7 +28,7 @@ struct infp_ctx {
struct service_sbus_ctx *ss_ctx;
struct sysbus_ctx *sysbus;
struct sysdb_ctx *sysdb;
- struct btreemap *domain_map;
+ struct sss_domain_info *domains;
char *introspect_xml;
int cache_timeout;
diff --git a/server/infopipe/infopipe_users.c b/server/infopipe/infopipe_users.c
index 656d15250..14037774d 100644
--- a/server/infopipe/infopipe_users.c
+++ b/server/infopipe/infopipe_users.c
@@ -144,10 +144,9 @@ int infp_users_get_cached(DBusMessage *message, struct sbus_conn_ctx *sconn)
infp_getcached_req->min_last_login = arg_minlastlogin;
infp_getcached_req->infp_req->domain =
- btreemap_get_value(infp_getcached_req->infp_req->infp->domain_map,
- (const void *)arg_domain);
+ infp_get_domain_obj(infp_getcached_req->infp_req->infp, arg_domain);
/* Check for a valid domain */
- if(infp_getcached_req->infp_req->domain == NULL) {
+ if (infp_getcached_req->infp_req->domain == NULL) {
einval_msg = talloc_strdup(infp_getcached_req, "Invalid domain.");
goto einval;
}
@@ -320,10 +319,10 @@ int infp_users_create(DBusMessage *message, struct sbus_conn_ctx *sconn)
goto denied;
}
- infp_createuser_req->infp_req->domain = btreemap_get_value(infp_createuser_req->infp_req->infp->domain_map,
- (const void *)arg_domain);
+ infp_createuser_req->infp_req->domain =
+ infp_get_domain_obj(infp_createuser_req->infp_req->infp, arg_domain);
/* Check for a valid domain */
- if(infp_createuser_req->infp_req->domain == NULL) {
+ if (infp_createuser_req->infp_req->domain == NULL) {
einval_msg = talloc_strdup(infp_createuser_req, "Invalid domain.");
goto einval;
}
@@ -523,10 +522,9 @@ int infp_users_delete(DBusMessage *message, struct sbus_conn_ctx *sconn)
}
infp_deleteuser_req->infp_req->domain =
- btreemap_get_value(infp_deleteuser_req->infp_req->infp->domain_map,
- (const void *)arg_domain);
+ infp_get_domain_obj(infp_deleteuser_req->infp_req->infp, arg_domain);
/* Check for a valid domain */
- if(infp_deleteuser_req->infp_req->domain == NULL) {
+ if (infp_deleteuser_req->infp_req->domain == NULL) {
einval_msg = talloc_strdup(infp_deleteuser_req, "Invalid domain.");
goto einval;
}
@@ -1213,8 +1211,11 @@ int infp_users_get_attr(DBusMessage *message, struct sbus_conn_ctx *sconn)
goto end;
}
- infp_getattr_req->infp_req->domain = btreemap_get_value(infp_getattr_req->infp_req->infp->domain_map, (const void *)domain);
- infp_getattr_req->check_provider = strcasecmp(domain, "LOCAL");
+ infp_getattr_req->infp_req->domain =
+ infp_get_domain_obj(infp_getattr_req->infp_req->infp, domain);
+ if (infp_getattr_req->infp_req->domain->provider) {
+ infp_getattr_req->check_provider = true;
+ }
/* Copy the username list */
infp_getattr_req->usernames = talloc_array(infp_getattr_req, char *, username_count);
@@ -1469,9 +1470,9 @@ int infp_users_set_attr(DBusMessage *message, struct sbus_conn_ctx *sconn)
}
dbus_message_iter_get_basic(&iter, &domain_name);
- infp_setattr_req->infp_req->domain = btreemap_get_value(infp_setattr_req->infp_req->infp->domain_map,
- (const void *)domain_name);
- if(infp_setattr_req->infp_req->domain == NULL) {
+ infp_setattr_req->infp_req->domain =
+ infp_get_domain_obj(infp_setattr_req->infp_req->infp, domain_name);
+ if (infp_setattr_req->infp_req->domain == NULL) {
einval_msg = talloc_strdup(infp_setattr_req, "Invalid domain.");
goto einval;
}
@@ -1770,10 +1771,10 @@ int infp_users_set_uid(DBusMessage *message, struct sbus_conn_ctx *sconn)
infp_setuid_req->username = talloc_strdup(infp_setuid_req, arg_username);
- infp_setuid_req->infp_req->domain = btreemap_get_value(infp_setuid_req->infp_req->infp->domain_map,
- (const void *)arg_domain);
+ infp_setuid_req->infp_req->domain =
+ infp_get_domain_obj(infp_setuid_req->infp_req->infp, arg_domain);
/* Check for a valid domain */
- if(infp_setuid_req->infp_req->domain == NULL) {
+ if (infp_setuid_req->infp_req->domain == NULL) {
einval_msg = talloc_strdup(infp_setuid_req, "Invalid domain.");
goto einval;
}