summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2012-11-28 03:24:58 +0000
committerJakub Hrozek <jhrozek@redhat.com>2012-12-04 12:58:22 +0100
commite11c7dc43f4ff9897e37cc0d793f8e1fb3b8453a (patch)
treea58bc8619ce98a8231e436e281f81daf43142ebb /src
parent6ff0d2242fe93d694b81b29ab12289db4859e1dc (diff)
downloadsssd-e11c7dc43f4ff9897e37cc0d793f8e1fb3b8453a.tar.gz
sssd-e11c7dc43f4ff9897e37cc0d793f8e1fb3b8453a.tar.bz2
sssd-e11c7dc43f4ff9897e37cc0d793f8e1fb3b8453a.zip
Use an entry type mask macro to filter entry types
Avoids hardcoding magic numbers everywhere and self documents why a mask is being applied.
Diffstat (limited to 'src')
-rw-r--r--src/providers/data_provider.h1
-rw-r--r--src/providers/ipa/ipa_id.c4
-rw-r--r--src/providers/ipa/ipa_subdomains_id.c2
-rw-r--r--src/providers/ldap/ldap_id.c2
-rw-r--r--src/providers/proxy/proxy_id.c2
5 files changed, 6 insertions, 5 deletions
diff --git a/src/providers/data_provider.h b/src/providers/data_provider.h
index d49fcd52..bb944509 100644
--- a/src/providers/data_provider.h
+++ b/src/providers/data_provider.h
@@ -142,6 +142,7 @@
#define BE_REQ_SUDO_RULES 0x0007
#define BE_REQ_AUTOFS 0x0009
#define BE_REQ_HOST 0x0010
+#define BE_REQ_TYPE_MASK 0x00FF
#define BE_REQ_FAST 0x1000
/* AUTH related common data and functions */
diff --git a/src/providers/ipa/ipa_id.c b/src/providers/ipa/ipa_id.c
index 6b3e40ef..afe0a636 100644
--- a/src/providers/ipa/ipa_id.c
+++ b/src/providers/ipa/ipa_id.c
@@ -84,7 +84,7 @@ void ipa_account_info_handler(struct be_req *breq)
/* if domain names do not match, this is a subdomain case */
req = ipa_get_subdom_acct_send(breq, breq->be_ctx->ev, ctx, ar);
- } else if ((ar->entry_type & 0xFFF) == BE_REQ_NETGROUP) {
+ } else if ((ar->entry_type & BE_REQ_TYPE_MASK) == BE_REQ_NETGROUP) {
/* netgroups are handled by a separate request function */
if (ar->filter_type != BE_FILTER_NAME) {
return sdap_handler_done(breq, DP_ERR_FATAL,
@@ -113,7 +113,7 @@ static void ipa_account_info_done(struct tevent_req *req)
const char *error_text;
int ret, dp_error;
- if ((ar->entry_type & 0xFFF) == BE_REQ_NETGROUP) {
+ if ((ar->entry_type & BE_REQ_TYPE_MASK) == BE_REQ_NETGROUP) {
ret = ipa_id_get_netgroup_recv(req, &dp_error);
} else {
ret = ipa_get_subdom_acct_recv(req, &dp_error);
diff --git a/src/providers/ipa/ipa_subdomains_id.c b/src/providers/ipa/ipa_subdomains_id.c
index 518ff85d..481b9980 100644
--- a/src/providers/ipa/ipa_subdomains_id.c
+++ b/src/providers/ipa/ipa_subdomains_id.c
@@ -85,7 +85,7 @@ struct tevent_req *ipa_get_subdom_acct_send(TALLOC_CTX *memctx,
}
state->sysdb = state->domain->sysdb;
- state->entry_type = (ar->entry_type & 0xFFF);
+ state->entry_type = (ar->entry_type & BE_REQ_TYPE_MASK);
state->filter = ar->filter_value;
state->filter_type = ar->filter_type;
diff --git a/src/providers/ldap/ldap_id.c b/src/providers/ldap/ldap_id.c
index 13a8212b..a258e827 100644
--- a/src/providers/ldap/ldap_id.c
+++ b/src/providers/ldap/ldap_id.c
@@ -929,7 +929,7 @@ void sdap_handle_account_info(struct be_req *breq, struct sdap_id_ctx *ctx)
ar = talloc_get_type(breq->req_data, struct be_acct_req);
- switch (ar->entry_type & 0xFFF) {
+ switch (ar->entry_type & BE_REQ_TYPE_MASK) {
case BE_REQ_USER: /* user */
/* skip enumerations on demand */
diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c
index ce66fa12..87eb91b1 100644
--- a/src/providers/proxy/proxy_id.c
+++ b/src/providers/proxy/proxy_id.c
@@ -1347,7 +1347,7 @@ void proxy_get_account_info(struct be_req *breq)
return proxy_reply(breq, DP_ERR_FATAL, EINVAL, "Invalid attr type");
}
- switch (ar->entry_type & 0xFFF) {
+ switch (ar->entry_type & BE_REQ_TYPE_MASK) {
case BE_REQ_USER: /* user */
switch (ar->filter_type) {
case BE_FILTER_ENUM: