提交 5d55a345 编写于 作者: E Eric Paris 提交者: James Morris

SELinux: services.c whitespace, syntax, and static declaraction cleanups

This patch changes services.c to fix whitespace and syntax issues.  Things that
are fixed may include (does not not have to include)

whitespace at end of lines
spaces followed by tabs
spaces used instead of tabs
spacing around parenthesis
locateion of { around struct and else clauses
location of * in pointer declarations
removal of initialization of static data to keep it in the right section
useless {} in if statemetns
useless checking for NULL before kfree
fixing of the indentation depth of switch statements
and any number of other things I forgot to mention
Signed-off-by: NEric Paris <eparis@redhat.com>
Signed-off-by: NJames Morris <jmorris@namei.org>
上级 1a5e6f87
...@@ -82,7 +82,7 @@ static DEFINE_MUTEX(load_mutex); ...@@ -82,7 +82,7 @@ static DEFINE_MUTEX(load_mutex);
static struct sidtab sidtab; static struct sidtab sidtab;
struct policydb policydb; struct policydb policydb;
int ss_initialized = 0; int ss_initialized;
/* /*
* The largest sequence number that has been used when * The largest sequence number that has been used when
...@@ -90,7 +90,7 @@ int ss_initialized = 0; ...@@ -90,7 +90,7 @@ int ss_initialized = 0;
* The sequence number only changes when a policy change * The sequence number only changes when a policy change
* occurs. * occurs.
*/ */
static u32 latest_granting = 0; static u32 latest_granting;
/* Forward declaration. */ /* Forward declaration. */
static int context_struct_to_string(struct context *context, char **scontext, static int context_struct_to_string(struct context *context, char **scontext,
...@@ -163,10 +163,10 @@ static int constraint_expr_eval(struct context *scontext, ...@@ -163,10 +163,10 @@ static int constraint_expr_eval(struct context *scontext,
val1 - 1); val1 - 1);
continue; continue;
case CEXPR_INCOMP: case CEXPR_INCOMP:
s[++sp] = ( !ebitmap_get_bit(&r1->dominates, s[++sp] = (!ebitmap_get_bit(&r1->dominates,
val2 - 1) && val2 - 1) &&
!ebitmap_get_bit(&r2->dominates, !ebitmap_get_bit(&r2->dominates,
val1 - 1) ); val1 - 1));
continue; continue;
default: default:
break; break;
...@@ -623,9 +623,8 @@ static int context_struct_to_string(struct context *context, char **scontext, u3 ...@@ -623,9 +623,8 @@ static int context_struct_to_string(struct context *context, char **scontext, u3
/* Allocate space for the context; caller must free this space. */ /* Allocate space for the context; caller must free this space. */
scontextp = kmalloc(*scontext_len, GFP_ATOMIC); scontextp = kmalloc(*scontext_len, GFP_ATOMIC);
if (!scontextp) { if (!scontextp)
return -ENOMEM; return -ENOMEM;
}
*scontext = scontextp; *scontext = scontextp;
/* /*
...@@ -678,7 +677,7 @@ int security_sid_to_context(u32 sid, char **scontext, u32 *scontext_len) ...@@ -678,7 +677,7 @@ int security_sid_to_context(u32 sid, char **scontext, u32 *scontext_len)
char *scontextp; char *scontextp;
*scontext_len = strlen(initial_sid_to_string[sid]) + 1; *scontext_len = strlen(initial_sid_to_string[sid]) + 1;
scontextp = kmalloc(*scontext_len,GFP_ATOMIC); scontextp = kmalloc(*scontext_len, GFP_ATOMIC);
if (!scontextp) { if (!scontextp) {
rc = -ENOMEM; rc = -ENOMEM;
goto out; goto out;
...@@ -974,7 +973,7 @@ static int security_compute_sid(u32 ssid, ...@@ -974,7 +973,7 @@ static int security_compute_sid(u32 ssid,
avdatum = avtab_search(&policydb.te_avtab, &avkey); avdatum = avtab_search(&policydb.te_avtab, &avkey);
/* If no permanent rule, also check for enabled conditional rules */ /* If no permanent rule, also check for enabled conditional rules */
if(!avdatum) { if (!avdatum) {
node = avtab_search_node(&policydb.te_cond_avtab, &avkey); node = avtab_search_node(&policydb.te_cond_avtab, &avkey);
for (; node != NULL; node = avtab_search_node_next(node, specified)) { for (; node != NULL; node = avtab_search_node_next(node, specified)) {
if (node->key.specified & AVTAB_ENABLED) { if (node->key.specified & AVTAB_ENABLED) {
...@@ -1289,25 +1288,22 @@ static int convert_context(u32 key, ...@@ -1289,25 +1288,22 @@ static int convert_context(u32 key,
/* Convert the user. */ /* Convert the user. */
usrdatum = hashtab_search(args->newp->p_users.table, usrdatum = hashtab_search(args->newp->p_users.table,
args->oldp->p_user_val_to_name[c->user - 1]); args->oldp->p_user_val_to_name[c->user - 1]);
if (!usrdatum) { if (!usrdatum)
goto bad; goto bad;
}
c->user = usrdatum->value; c->user = usrdatum->value;
/* Convert the role. */ /* Convert the role. */
role = hashtab_search(args->newp->p_roles.table, role = hashtab_search(args->newp->p_roles.table,
args->oldp->p_role_val_to_name[c->role - 1]); args->oldp->p_role_val_to_name[c->role - 1]);
if (!role) { if (!role)
goto bad; goto bad;
}
c->role = role->value; c->role = role->value;
/* Convert the type. */ /* Convert the type. */
typdatum = hashtab_search(args->newp->p_types.table, typdatum = hashtab_search(args->newp->p_types.table,
args->oldp->p_type_val_to_name[c->type - 1]); args->oldp->p_type_val_to_name[c->type - 1]);
if (!typdatum) { if (!typdatum)
goto bad; goto bad;
}
c->type = typdatum->value; c->type = typdatum->value;
rc = mls_convert_context(args->oldp, args->newp, c); rc = mls_convert_context(args->oldp, args->newp, c);
...@@ -1556,8 +1552,8 @@ static int match_ipv6_addrmask(u32 *input, u32 *addr, u32 *mask) ...@@ -1556,8 +1552,8 @@ static int match_ipv6_addrmask(u32 *input, u32 *addr, u32 *mask)
{ {
int i, fail = 0; int i, fail = 0;
for(i = 0; i < 4; i++) for (i = 0; i < 4; i++)
if(addr[i] != (input[i] & mask[i])) { if (addr[i] != (input[i] & mask[i])) {
fail = 1; fail = 1;
break; break;
} }
...@@ -1881,7 +1877,7 @@ int security_get_bools(int *len, char ***names, int **values) ...@@ -1881,7 +1877,7 @@ int security_get_bools(int *len, char ***names, int **values)
goto out; goto out;
} }
*names = kcalloc(*len, sizeof(char*), GFP_ATOMIC); *names = kcalloc(*len, sizeof(char *), GFP_ATOMIC);
if (!*names) if (!*names)
goto err; goto err;
...@@ -1938,12 +1934,11 @@ int security_set_bools(int len, int *values) ...@@ -1938,12 +1934,11 @@ int security_set_bools(int len, int *values)
audit_get_loginuid(current), audit_get_loginuid(current),
audit_get_sessionid(current)); audit_get_sessionid(current));
} }
if (values[i]) { if (values[i])
policydb.bool_val_to_struct[i]->state = 1; policydb.bool_val_to_struct[i]->state = 1;
} else { else
policydb.bool_val_to_struct[i]->state = 0; policydb.bool_val_to_struct[i]->state = 0;
} }
}
for (cur = policydb.cond_list; cur != NULL; cur = cur->next) { for (cur = policydb.cond_list; cur != NULL; cur = cur->next) {
rc = evaluate_cond_node(&policydb, cur); rc = evaluate_cond_node(&policydb, cur);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册