summaryrefslogtreecommitdiff
path: root/src/responder/sudo
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2013-01-22 14:31:37 +0100
committerJakub Hrozek <jhrozek@redhat.com>2013-01-22 18:21:39 +0100
commit5ff1c3c5a12930692cb6284d14f7fda3a974af8e (patch)
tree68f7d53b9fb9054bb20a58e052634e6b96a98f4a /src/responder/sudo
parent1d262e93850e2be65a774da070600947f1b75153 (diff)
downloadsssd-5ff1c3c5a12930692cb6284d14f7fda3a974af8e.tar.gz
sssd-5ff1c3c5a12930692cb6284d14f7fda3a974af8e.tar.bz2
sssd-5ff1c3c5a12930692cb6284d14f7fda3a974af8e.zip
sudo responder: change num_rules type from size_t to uint32_t
https://fedorahosted.org/sssd/ticket/1779 2^32 should be enough to store sudo rules. size_t type was causing troubles on big endian architectures, because it wasn't used correctly in combination with D-Bus.
Diffstat (limited to 'src/responder/sudo')
-rw-r--r--src/responder/sudo/sudosrv_cmd.c2
-rw-r--r--src/responder/sudo/sudosrv_dp.c10
-rw-r--r--src/responder/sudo/sudosrv_get_sudorules.c14
-rw-r--r--src/responder/sudo/sudosrv_private.h8
-rw-r--r--src/responder/sudo/sudosrv_query.c6
5 files changed, 20 insertions, 20 deletions
diff --git a/src/responder/sudo/sudosrv_cmd.c b/src/responder/sudo/sudosrv_cmd.c
index 9ad1be42..ee25b53d 100644
--- a/src/responder/sudo/sudosrv_cmd.c
+++ b/src/responder/sudo/sudosrv_cmd.c
@@ -98,7 +98,7 @@ errno_t sudosrv_cmd_done(struct sudo_cmd_ctx *cmd_ctx, int ret)
{
uint8_t *response_body = NULL;
size_t response_len = 0;
- size_t num_rules = cmd_ctx->num_rules;
+ uint32_t num_rules = cmd_ctx->num_rules;
struct sysdb_attrs **rules = cmd_ctx->rules;
switch (ret) {
diff --git a/src/responder/sudo/sudosrv_dp.c b/src/responder/sudo/sudosrv_dp.c
index 208606c2..3cd8fe8d 100644
--- a/src/responder/sudo/sudosrv_dp.c
+++ b/src/responder/sudo/sudosrv_dp.c
@@ -37,7 +37,7 @@ struct sss_dp_get_sudoers_info {
bool fast_reply;
enum sss_dp_sudo_type type;
const char *name;
- size_t num_rules;
+ uint32_t num_rules;
struct sysdb_attrs **rules;
};
@@ -51,7 +51,7 @@ sss_dp_get_sudoers_send(TALLOC_CTX *mem_ctx,
bool fast_reply,
enum sss_dp_sudo_type type,
const char *name,
- size_t num_rules,
+ uint32_t num_rules,
struct sysdb_attrs **rules)
{
struct tevent_req *req;
@@ -82,7 +82,7 @@ sss_dp_get_sudoers_send(TALLOC_CTX *mem_ctx,
switch (info->type) {
case SSS_DP_SUDO_REFRESH_RULES:
key = talloc_asprintf(state, "%d:%u:%s@%s", type,
- (unsigned int)num_rules, name, dom->name);
+ num_rules, name, dom->name);
break;
case SSS_DP_SUDO_FULL_REFRESH:
key = talloc_asprintf(state, "%d:%s", type, dom->name);
@@ -122,7 +122,7 @@ sss_dp_get_sudoers_msg(void *pvt)
struct sss_dp_get_sudoers_info *info;
uint32_t be_type = 0;
const char *rule_name = NULL;
- int i;
+ uint32_t i;
info = talloc_get_type(pvt, struct sss_dp_get_sudoers_info);
@@ -151,7 +151,7 @@ sss_dp_get_sudoers_msg(void *pvt)
/* create the message */
DEBUG(SSSDBG_TRACE_FUNC,
("Creating SUDOers request for [%s][%u][%s][%u]\n",
- info->dom->name, be_type, info->name, (unsigned int)info->num_rules));
+ info->dom->name, be_type, info->name, info->num_rules));
dbus_message_iter_init_append(msg, &iter);
diff --git a/src/responder/sudo/sudosrv_get_sudorules.c b/src/responder/sudo/sudosrv_get_sudorules.c
index a8e86666..8d7480be 100644
--- a/src/responder/sudo/sudosrv_get_sudorules.c
+++ b/src/responder/sudo/sudosrv_get_sudorules.c
@@ -320,7 +320,7 @@ done:
static errno_t sudosrv_get_sudorules_from_cache(TALLOC_CTX *mem_ctx,
struct sudo_cmd_ctx *cmd_ctx,
struct sysdb_attrs ***_rules,
- size_t *_num_rules);
+ uint32_t *_num_rules);
static void
sudosrv_get_sudorules_dp_callback(uint16_t err_maj, uint32_t err_min,
const char *err_msg, void *ptr);
@@ -337,7 +337,7 @@ static errno_t sudosrv_get_sudorules_query_cache(TALLOC_CTX *mem_ctx,
uid_t uid,
char **groupnames,
struct sysdb_attrs ***_rules,
- size_t *_count);
+ uint32_t *_count);
errno_t sudosrv_get_rules(struct sudo_cmd_ctx *cmd_ctx)
{
@@ -347,7 +347,7 @@ errno_t sudosrv_get_rules(struct sudo_cmd_ctx *cmd_ctx)
struct sysdb_ctx *user_sysdb = NULL;
struct sysdb_ctx *rules_sysdb = NULL;
char **groupnames = NULL;
- size_t expired_rules_num = 0;
+ uint32_t expired_rules_num = 0;
struct sysdb_attrs **expired_rules = NULL;
errno_t ret;
unsigned int flags = SYSDB_SUDO_FILTER_NONE;
@@ -565,7 +565,7 @@ sudosrv_get_sudorules_dp_callback(uint16_t err_maj, uint32_t err_min,
static errno_t sudosrv_get_sudorules_from_cache(TALLOC_CTX *mem_ctx,
struct sudo_cmd_ctx *cmd_ctx,
struct sysdb_attrs ***_rules,
- size_t *_num_rules)
+ uint32_t *_num_rules)
{
TALLOC_CTX *tmp_ctx;
errno_t ret;
@@ -575,7 +575,7 @@ static errno_t sudosrv_get_sudorules_from_cache(TALLOC_CTX *mem_ctx,
const char *debug_name = NULL;
unsigned int flags = SYSDB_SUDO_FILTER_NONE;
struct sysdb_attrs **rules = NULL;
- size_t num_rules = 0;
+ uint32_t num_rules = 0;
const char *attrs[] = { SYSDB_OBJECTCLASS,
SYSDB_SUDO_CACHE_AT_CN,
SYSDB_SUDO_CACHE_AT_USER,
@@ -676,7 +676,7 @@ static errno_t sudosrv_get_sudorules_query_cache(TALLOC_CTX *mem_ctx,
uid_t uid,
char **groupnames,
struct sysdb_attrs ***_rules,
- size_t *_count)
+ uint32_t *_count)
{
TALLOC_CTX *tmp_ctx;
char *filter;
@@ -727,7 +727,7 @@ static errno_t sudosrv_get_sudorules_query_cache(TALLOC_CTX *mem_ctx,
}
*_rules = talloc_steal(mem_ctx, rules);
- *_count = count;
+ *_count = (uint32_t)count;
ret = EOK;
done:
diff --git a/src/responder/sudo/sudosrv_private.h b/src/responder/sudo/sudosrv_private.h
index 9d3156ca..71a272ab 100644
--- a/src/responder/sudo/sudosrv_private.h
+++ b/src/responder/sudo/sudosrv_private.h
@@ -62,11 +62,11 @@ struct sudo_cmd_ctx {
struct sss_domain_info *domain;
bool check_next;
- size_t expired_rules_num;
+ uint32_t expired_rules_num;
/* output data */
struct sysdb_attrs **rules;
- size_t num_rules;
+ uint32_t num_rules;
};
struct sudo_dom_ctx {
@@ -101,7 +101,7 @@ errno_t sudosrv_parse_query_recv(TALLOC_CTX *mem_ctx,
errno_t sudosrv_build_response(TALLOC_CTX *mem_ctx,
uint32_t error,
- int rules_num,
+ uint32_t rules_num,
struct sysdb_attrs **rules,
uint8_t **_response_body,
size_t *_response_len);
@@ -113,7 +113,7 @@ sss_dp_get_sudoers_send(TALLOC_CTX *mem_ctx,
bool fast_reply,
enum sss_dp_sudo_type type,
const char *name,
- size_t num_rules,
+ uint32_t num_rules,
struct sysdb_attrs **rules);
errno_t
diff --git a/src/responder/sudo/sudosrv_query.c b/src/responder/sudo/sudosrv_query.c
index 1574104c..a8501df5 100644
--- a/src/responder/sudo/sudosrv_query.c
+++ b/src/responder/sudo/sudosrv_query.c
@@ -188,7 +188,7 @@ done:
*/
errno_t sudosrv_build_response(TALLOC_CTX *mem_ctx,
uint32_t error,
- int rules_num,
+ uint32_t rules_num,
struct sysdb_attrs **rules,
uint8_t **_response_body,
size_t *_response_len)
@@ -196,7 +196,7 @@ errno_t sudosrv_build_response(TALLOC_CTX *mem_ctx,
uint8_t *response_body = NULL;
size_t response_len = 0;
TALLOC_CTX *tmp_ctx = NULL;
- int i = 0;
+ uint32_t i = 0;
errno_t ret = EOK;
tmp_ctx = talloc_new(NULL);
@@ -225,7 +225,7 @@ errno_t sudosrv_build_response(TALLOC_CTX *mem_ctx,
}
/* rules count */
- ret = sudosrv_response_append_uint32(tmp_ctx, (uint32_t)rules_num,
+ ret = sudosrv_response_append_uint32(tmp_ctx, rules_num,
&response_body, &response_len);
if (ret != EOK) {
goto fail;