From: Daniel Wagner <[email protected]>
ident is not shared anymore between the session policy and
the file policy. Let's make this clear be renaming this member.
---
plugins/session_policy_local.c | 44 +++++++++++++++++++++---------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/plugins/session_policy_local.c b/plugins/session_policy_local.c
index 3401e35..8aebd53 100644
--- a/plugins/session_policy_local.c
+++ b/plugins/session_policy_local.c
@@ -56,7 +56,7 @@ struct create_data {
struct policy_data {
int refcount;
- char *ident;
+ char *filename;
struct connman_session *session;
struct connman_session_config *config;
@@ -71,7 +71,7 @@ static void free_policy(gpointer user_data)
if (policy->config != NULL)
g_slist_free(policy->config->allowed_bearers);
- g_free(policy->ident);
+ g_free(policy->filename);
g_free(policy->config);
g_free(policy);
}
@@ -128,7 +128,7 @@ static struct policy_data *create_policy(void)
static struct policy_data *policy_ref(struct policy_data *policy)
{
- DBG("%p %s ref %d", policy, policy->ident, policy->refcount + 1);
+ DBG("%p %s ref %d", policy, policy->filename, policy->refcount + 1);
__sync_fetch_and_add(&policy->refcount, 1);
@@ -137,7 +137,7 @@ static struct policy_data *policy_ref(struct policy_data
*policy)
static void policy_unref(struct policy_data *policy)
{
- DBG(" %p %s ref %d", policy, policy->ident, policy->refcount - 1);
+ DBG(" %p %s ref %d", policy, policy->filename, policy->refcount - 1);
if (__sync_fetch_and_sub(&policy->refcount, 1) != 1)
return;
@@ -178,7 +178,7 @@ static void selinux_context_reply(int error,
policy = g_hash_table_lookup(file_hash, ident);
if (policy == NULL) {
policy = create_policy();
- policy->ident = g_strdup(ident);
+ policy->filename = g_strdup(ident);
} else
policy_ref(policy);
policy->session = data->session;
@@ -286,7 +286,7 @@ static int load_policy(struct policy_data *policy)
char *str, **tokens;
int i, err = 0;
- pathname = g_strdup_printf("%s/%s", POLICYDIR, policy->ident);
+ pathname = g_strdup_printf("%s/%s", POLICYDIR, policy->filename);
err = load_keyfile(pathname, &keyfile);
if (err < 0) {
@@ -371,7 +371,7 @@ static void remove_policy(struct policy_data *policy)
if (policy->session != NULL)
update = TRUE;
- g_hash_table_remove(file_hash, policy->ident);
+ g_hash_table_remove(file_hash, policy->filename);
policy_unref(policy);
if (update == FALSE)
@@ -381,7 +381,7 @@ static void remove_policy(struct policy_data *policy)
update_session(policy);
}
-static struct policy_data *find_policy(const char *ident)
+static struct policy_data *find_policy(const char *filename)
{
GSList *list;
struct policy_data *policy;
@@ -389,7 +389,7 @@ static struct policy_data *find_policy(const char *ident)
for (list = policy_list; list != NULL; list = list->next) {
policy = list->data;
- if (g_strcmp0(policy->ident, ident) != 0)
+ if (g_strcmp0(policy->filename, filename) != 0)
continue;
return policy;
@@ -399,61 +399,61 @@ static struct policy_data *find_policy(const char *ident)
}
static void notify_handler(struct inotify_event *event,
- const char *ident)
+ const char *filename)
{
struct policy_data *policy;
int err;
- DBG("event %x file %s", event->mask, ident);
+ DBG("event %x file %s", event->mask, filename);
- if (ident == NULL)
+ if (filename == NULL)
return;
- policy = g_hash_table_lookup(file_hash, ident);
+ policy = g_hash_table_lookup(file_hash, filename);
if (event->mask & (IN_CREATE | IN_MOVED_TO)) {
- connman_info("Policy added for '%s'", ident);
+ connman_info("Policy added for '%s'", filename);
/* policy != NULL can happen if the file is overwritten */
if (policy == NULL) {
- policy = find_policy(ident);
+ policy = find_policy(filename);
if (policy == NULL)
policy = create_policy();
else
policy_ref(policy);
- policy->ident = g_strdup(ident);
+ policy->filename = g_strdup(filename);
}
err = load_policy(policy);
if (err < 0) {
connman_warn("Loading policy file '%s' failed with %s",
- ident, strerror(-err));
+ filename, strerror(-err));
policy_unref(policy);
return;
}
g_hash_table_replace(file_hash,
- g_strdup(ident), policy);
+ g_strdup(filename), policy);
}
if (policy == NULL)
return;
if (event->mask & IN_MODIFY) {
- connman_info("Policy modifed for '%s'", ident);
+ connman_info("Policy modifed for '%s'", filename);
err = load_policy(policy);
if (err < 0) {
connman_warn("Loading policy file '%s' failed with %s",
- ident, strerror(-err));
+ filename, strerror(-err));
remove_policy(policy);
return;
}
}
if (event->mask & (IN_DELETE | IN_MOVED_FROM)) {
- connman_info("Policy deleted for '%s'", ident);
+ connman_info("Policy deleted for '%s'", filename);
remove_policy(policy);
return;
@@ -477,7 +477,7 @@ static void read_policies(void)
struct policy_data *policy;
policy = create_policy();
- policy->ident = g_strdup(file);
+ policy->filename = g_strdup(file);
err = load_policy(policy);
if (err < 0) {
connman_warn("Loading policy file '%s' failed
with %s",
--
1.8.2.rc3.16.gce432ca
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman