-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This patch refers to the SBUS communication for getAccountInfo.

Previously it was a string being passed and converted into an
integer. It will be more efficient this way (and simpler for other
implementers)

- -- 
Stephen Gallagher
RHCE 804006346421761

Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkt1eNoACgkQeiVVYja6o6NApwCeKHhfWCwu24iBDBl/2zbJeIn7
KyMAn26Ab1iS8930+hJwc7w5hYBuYvlB
=TkF+
-----END PGP SIGNATURE-----
From 732d51cb416490dc8d11c05a4eafc96095c4427a Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgall...@redhat.com>
Date: Fri, 12 Feb 2010 10:25:11 -0500
Subject: [PATCH] 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)
---
 server/providers/data_provider_be.c    |   28 +++++++++++-----------------
 server/responder/common/responder_dp.c |    4 ++--
 2 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/server/providers/data_provider_be.c b/server/providers/data_provider_be.c
index 135a3ef..15afa55 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 9d54558..6fec6cd 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;
 
@@ -449,7 +449,7 @@ static int sss_dp_send_acct_req_create(struct resp_ctx *rctx,
 
     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) {
-- 
1.6.6

Attachment: 0001-Make-attr_type-an-integer.patch.sig
Description: PGP signature

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to