diff options
author | Sami Kerola | 2011-11-13 19:46:03 +0100 |
---|---|---|
committer | Sami Kerola | 2011-11-29 17:58:00 +0100 |
commit | fd2940f58d5874fc5de32f89840fad8dd9b5eb14 (patch) | |
tree | aeaafed5a74dfa3e6891365fa7a2a891f05d1ad4 /login-utils/selinux_utils.c | |
parent | newgrp: fix coding style (diff) | |
download | kernel-qcow2-util-linux-fd2940f58d5874fc5de32f89840fad8dd9b5eb14.tar.gz kernel-qcow2-util-linux-fd2940f58d5874fc5de32f89840fad8dd9b5eb14.tar.xz kernel-qcow2-util-linux-fd2940f58d5874fc5de32f89840fad8dd9b5eb14.zip |
selinux_utils: fix coding style
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'login-utils/selinux_utils.c')
-rw-r--r-- | login-utils/selinux_utils.c | 91 |
1 files changed, 44 insertions, 47 deletions
diff --git a/login-utils/selinux_utils.c b/login-utils/selinux_utils.c index caceaf4fd..e709d0030 100644 --- a/login-utils/selinux_utils.c +++ b/login-utils/selinux_utils.c @@ -1,54 +1,51 @@ -#include <sys/types.h> -#include <stdio.h> -#include <string.h> -#include <selinux/selinux.h> -#include <selinux/flask.h> #include <selinux/av_permissions.h> #include <selinux/context.h> +#include <selinux/flask.h> +#include <selinux/selinux.h> +#include <stdio.h> +#include <string.h> +#include <sys/types.h> + #include "selinux_utils.h" -int checkAccess(char *chuser, int access) { - int status=-1; - security_context_t user_context; - const char *user=NULL; - if( getprevcon(&user_context)==0 ) { - context_t c=context_new(user_context); - user=context_user_get(c); - if (strcmp(chuser, user) == 0) { - status=0; - } else { - struct av_decision avd; - int retval = security_compute_av(user_context, - user_context, - SECCLASS_PASSWD, - access, - &avd); - - if ((retval == 0) && - ((access & avd.allowed) == (unsigned) access)) { - status=0; - } - } - context_free(c); - freecon(user_context); - } - return status; +int checkAccess(char *chuser, int access) +{ + int status = -1; + security_context_t user_context; + const char *user = NULL; + if (getprevcon(&user_context) == 0) { + context_t c = context_new(user_context); + user = context_user_get(c); + if (strcmp(chuser, user) == 0) { + status = 0; + } else { + struct av_decision avd; + int retval = security_compute_av(user_context, + user_context, + SECCLASS_PASSWD, + access, + &avd); + if ((retval == 0) && + ((access & avd.allowed) == (unsigned)access)) + status = 0; + } + context_free(c); + freecon(user_context); + } + return status; } -int setupDefaultContext(char *orig_file) { - if (is_selinux_enabled() > 0) { - security_context_t scontext; - - if (getfilecon(orig_file,&scontext)<0) { - return 1; - } - - if (setfscreatecon(scontext) < 0) - { - freecon(scontext); - return 1; - } - freecon(scontext); - } - return 0; +int setupDefaultContext(char *orig_file) +{ + if (is_selinux_enabled() > 0) { + security_context_t scontext; + if (getfilecon(orig_file, &scontext) < 0) + return 1; + if (setfscreatecon(scontext) < 0) { + freecon(scontext); + return 1; + } + freecon(scontext); + } + return 0; } |