diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2010-02-12 10:25:11 -0500 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2010-02-15 08:20:05 -0500 |
commit | 824c1e4d7e0ab9da7ad3f16f9c2e37bce7858132 (patch) | |
tree | 80e5ce9cc612001af9f104f450ad899c306761d3 /server | |
parent | 15dc6ed9ecdea095b041190aeb8f67ed71efd0e7 (diff) | |
download | sssd-824c1e4d7e0ab9da7ad3f16f9c2e37bce7858132.tar.gz sssd-824c1e4d7e0ab9da7ad3f16f9c2e37bce7858132.tar.xz sssd-824c1e4d7e0ab9da7ad3f16f9c2e37bce7858132.zip |
Make attr_type an integer
Previously it was a string being passed and converted into an
integer. It will be more efficient this way (and simpler for other
implementers)
Diffstat (limited to 'server')
-rw-r--r-- | server/providers/data_provider_be.c | 28 | ||||
-rw-r--r-- | server/responder/common/responder_dp.c | 6 |
2 files changed, 14 insertions, 20 deletions
diff --git a/server/providers/data_provider_be.c b/server/providers/data_provider_be.c index 135a3eff0..15afa55ae 100644 --- a/server/providers/data_provider_be.c +++ b/server/providers/data_provider_be.c @@ -309,8 +309,9 @@ static int be_get_account_info(DBusMessage *message, struct sbus_connection *con dbus_bool_t dbret; void *user_data; uint32_t type; - char *attrs, *filter; - int attr_type, filter_type; + char *filter; + int filter_type; + uint32_t attr_type; char *filter_val; int ret; dbus_uint16_t err_maj; @@ -328,7 +329,7 @@ static int be_get_account_info(DBusMessage *message, struct sbus_connection *con ret = dbus_message_get_args(message, &dbus_error, DBUS_TYPE_UINT32, &type, - DBUS_TYPE_STRING, &attrs, + DBUS_TYPE_UINT32, &attr_type, DBUS_TYPE_STRING, &filter, DBUS_TYPE_INVALID); if (!ret) { @@ -337,7 +338,7 @@ static int be_get_account_info(DBusMessage *message, struct sbus_connection *con return EIO; } - DEBUG(4, ("Got request for [%u][%s][%s]\n", type, attrs, filter)); + DEBUG(4, ("Got request for [%u][%d][%s]\n", type, attr_type, filter)); reply = dbus_message_new_method_return(message); if (!reply) return ENOMEM; @@ -372,20 +373,13 @@ static int be_get_account_info(DBusMessage *message, struct sbus_connection *con */ } - if (attrs) { - if (strcmp(attrs, "core") == 0) attr_type = BE_ATTR_CORE; - else if (strcmp(attrs, "membership") == 0) attr_type = BE_ATTR_MEM; - else if (strcmp(attrs, "all") == 0) attr_type = BE_ATTR_ALL; - else { - err_maj = DP_ERR_FATAL; - err_min = EINVAL; - err_msg = "Invalid Attrs Parameter"; - goto done; - } - } else { + if ((attr_type != BE_ATTR_CORE) && + (attr_type != BE_ATTR_MEM) && + (attr_type != BE_ATTR_ALL)) { + /* Unrecognized attr type */ err_maj = DP_ERR_FATAL; err_min = EINVAL; - err_msg = "Missing Attrs Parameter"; + err_msg = "Invalid Attrs Parameter"; goto done; } @@ -430,7 +424,7 @@ static int be_get_account_info(DBusMessage *message, struct sbus_connection *con goto done; } req->entry_type = type; - req->attr_type = attr_type; + req->attr_type = (int)attr_type; req->filter_type = filter_type; req->filter_value = talloc_strdup(req, filter_val); diff --git a/server/responder/common/responder_dp.c b/server/responder/common/responder_dp.c index 9d54558fa..782befb17 100644 --- a/server/responder/common/responder_dp.c +++ b/server/responder/common/responder_dp.c @@ -418,7 +418,7 @@ static int sss_dp_send_acct_req_create(struct resp_ctx *rctx, dbus_bool_t dbret; struct sss_dp_callback *cb; struct sss_dp_req *sdp_req; - const char *attrs = "core"; + uint32_t attrs = BE_ATTR_CORE; struct be_conn *be_conn; int ret; @@ -444,12 +444,12 @@ static int sss_dp_send_acct_req_create(struct resp_ctx *rctx, return ENOMEM; } - DEBUG(4, ("Sending request for [%s][%u][%s][%s]\n", + DEBUG(4, ("Sending request for [%s][%u][%d][%s]\n", domain, be_type, attrs, filter)); dbret = dbus_message_append_args(msg, DBUS_TYPE_UINT32, &be_type, - DBUS_TYPE_STRING, &attrs, + DBUS_TYPE_UINT32, &attrs, DBUS_TYPE_STRING, &filter, DBUS_TYPE_INVALID); if (!dbret) { |