aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2005-09-16 22:27:56 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-17 14:50:01 -0400
commitd15c5749eb81dee94d40fe12584ca8461858b4cb (patch)
treeb265834c83b80c25bf140d918edf0838405dc3d5 /security
parent73a0b538ee573a76cba59cdc9f177a71776d4678 (diff)
[PATCH] seclvl-use-securityfs tidy
We don't put braces around single statements, thanks. Cc: Serge Hallyn <serue@us.ibm.com> Cc: James Morris <jmorris@namei.org> Cc: Chris Wright <chrisw@osdl.org> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'security')
-rw-r--r--security/seclvl.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/security/seclvl.c b/security/seclvl.c
index dc4e17b6eaf6..241093d6f0b8 100644
--- a/security/seclvl.c
+++ b/security/seclvl.c
@@ -253,9 +253,8 @@ passwd_write_file(struct file * file, const char __user * buf,
253 253
254 if (count < 0 || count >= PAGE_SIZE) 254 if (count < 0 || count >= PAGE_SIZE)
255 return -ENOMEM; 255 return -ENOMEM;
256 if (*ppos != 0) { 256 if (*ppos != 0)
257 return -EINVAL; 257 return -EINVAL;
258 }
259 page = (char *)get_zeroed_page(GFP_KERNEL); 258 page = (char *)get_zeroed_page(GFP_KERNEL);
260 if (!page) 259 if (!page)
261 return -ENOMEM; 260 return -ENOMEM;
@@ -265,9 +264,8 @@ passwd_write_file(struct file * file, const char __user * buf,
265 264
266 len = strlen(page); 265 len = strlen(page);
267 /* ``echo "secret" > seclvl/passwd'' includes a newline */ 266 /* ``echo "secret" > seclvl/passwd'' includes a newline */
268 if (page[len - 1] == '\n') { 267 if (page[len - 1] == '\n')
269 len--; 268 len--;
270 }
271 /* Hash the password, then compare the hashed values */ 269 /* Hash the password, then compare the hashed values */
272 if ((rc = plaintext_to_sha1(tmp, page, len))) { 270 if ((rc = plaintext_to_sha1(tmp, page, len))) {
273 seclvl_printk(0, KERN_ERR, "Error hashing password: rc = " 271 seclvl_printk(0, KERN_ERR, "Error hashing password: rc = "
@@ -275,9 +273,8 @@ passwd_write_file(struct file * file, const char __user * buf,
275 return rc; 273 return rc;
276 } 274 }
277 for (i = 0; i < SHA1_DIGEST_SIZE; i++) { 275 for (i = 0; i < SHA1_DIGEST_SIZE; i++) {
278 if (hashedPassword[i] != tmp[i]) { 276 if (hashedPassword[i] != tmp[i])
279 return -EPERM; 277 return -EPERM;
280 }
281 } 278 }
282 seclvl_printk(0, KERN_INFO, 279 seclvl_printk(0, KERN_INFO,
283 "Password accepted; seclvl reduced to 0.\n"); 280 "Password accepted; seclvl reduced to 0.\n");
@@ -482,9 +479,8 @@ static void seclvl_file_free_security(struct file *filp)
482 */ 479 */
483static int seclvl_umount(struct vfsmount *mnt, int flags) 480static int seclvl_umount(struct vfsmount *mnt, int flags)
484{ 481{
485 if (current->pid == 1) { 482 if (current->pid == 1)
486 return 0; 483 return 0;
487 }
488 if (seclvl == 2) { 484 if (seclvl == 2) {
489 seclvl_printk(1, KERN_WARNING, "Attempt to unmount in secure " 485 seclvl_printk(1, KERN_WARNING, "Attempt to unmount in secure "
490 "level %d\n", seclvl); 486 "level %d\n", seclvl);
@@ -638,9 +634,8 @@ static int __init seclvl_init(void)
638static void __exit seclvl_exit(void) 634static void __exit seclvl_exit(void)
639{ 635{
640 securityfs_remove(seclvl_ino); 636 securityfs_remove(seclvl_ino);
641 if (*passwd || *sha1_passwd) { 637 if (*passwd || *sha1_passwd)
642 securityfs_remove(passwd_ino); 638 securityfs_remove(passwd_ino);
643 }
644 securityfs_remove(dir_ino); 639 securityfs_remove(dir_ino);
645 if (secondary == 1) { 640 if (secondary == 1) {
646 mod_unreg_security(MY_NAME, &seclvl_ops); 641 mod_unreg_security(MY_NAME, &seclvl_ops);