]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
selinux_utils: fix coding style
authorSami Kerola <kerolasa@iki.fi>
Sun, 13 Nov 2011 18:46:03 +0000 (19:46 +0100)
committerSami Kerola <sami.kerola@tomtom.com>
Tue, 29 Nov 2011 16:58:00 +0000 (17:58 +0100)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
login-utils/selinux_utils.c

index caceaf4fda347a2fe8dcee0b8f25c6678e06ca36..e709d0030214873bceb99548e8355fe2cbc62a87 100644 (file)
@@ -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;
 }