4
4
*
5
5
* Author : Stephen Smalley, <[email protected] >
6
6
*/
7
+
7
8
/*
8
9
* Updated: Trusted Computer Solutions, Inc. <[email protected] >
10
+ * Support for enhanced MLS infrastructure.
11
+ * Copyright (C) 2004-2006 Trusted Computer Solutions, Inc.
9
12
*
10
- * Support for enhanced MLS infrastructure.
11
- *
12
- * Copyright (C) 2004-2006 Trusted Computer Solutions, Inc.
13
- */
14
- /*
15
13
* Updated: Hewlett-Packard <[email protected] >
16
- *
17
- * Added support to import/export the MLS label from NetLabel
18
- *
19
- * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
14
+ * Added support to import/export the MLS label from NetLabel
15
+ * Copyright (C) Hewlett-Packard Development Company, L.P., 2006
20
16
*/
21
17
22
18
#include <linux/kernel.h>
@@ -52,7 +48,8 @@ int mls_compute_context_len(struct policydb *p, struct context *context)
52
48
head = -2 ;
53
49
prev = -2 ;
54
50
e = & context -> range .level [l ].cat ;
55
- ebitmap_for_each_positive_bit (e , node , i ) {
51
+ ebitmap_for_each_positive_bit (e , node , i )
52
+ {
56
53
if (i - prev > 1 ) {
57
54
/* one or more negative bits are skipped */
58
55
if (head != prev ) {
@@ -86,8 +83,7 @@ int mls_compute_context_len(struct policydb *p, struct context *context)
86
83
* the MLS fields of `context' into the string `*scontext'.
87
84
* Update `*scontext' to point to the end of the MLS fields.
88
85
*/
89
- void mls_sid_to_context (struct policydb * p ,
90
- struct context * context ,
86
+ void mls_sid_to_context (struct policydb * p , struct context * context ,
91
87
char * * scontext )
92
88
{
93
89
char * scontextp , * nm ;
@@ -112,7 +108,8 @@ void mls_sid_to_context(struct policydb *p,
112
108
head = -2 ;
113
109
prev = -2 ;
114
110
e = & context -> range .level [l ].cat ;
115
- ebitmap_for_each_positive_bit (e , node , i ) {
111
+ ebitmap_for_each_positive_bit (e , node , i )
112
+ {
116
113
if (i - prev > 1 ) {
117
114
/* one or more negative bits are skipped */
118
115
if (prev != head ) {
@@ -230,12 +227,8 @@ int mls_context_isvalid(struct policydb *p, struct context *c)
230
227
* Policy read-lock must be held for sidtab lookup.
231
228
*
232
229
*/
233
- int mls_context_to_sid (struct policydb * pol ,
234
- char oldc ,
235
- char * scontext ,
236
- struct context * context ,
237
- struct sidtab * s ,
238
- u32 def_sid )
230
+ int mls_context_to_sid (struct policydb * pol , char oldc , char * scontext ,
231
+ struct context * context , struct sidtab * s , u32 def_sid )
239
232
{
240
233
char * sensitivity , * cur_cat , * next_cat , * rngptr ;
241
234
struct level_datum * levdatum ;
@@ -333,7 +326,8 @@ int mls_context_to_sid(struct policydb *pol,
333
326
return - EINVAL ;
334
327
335
328
for (i = catdatum -> value ; i < rngdatum -> value ; i ++ ) {
336
- rc = ebitmap_set_bit (& context -> range .level [l ].cat , i , 1 );
329
+ rc = ebitmap_set_bit (
330
+ & context -> range .level [l ].cat , i , 1 );
337
331
if (rc )
338
332
return rc ;
339
333
}
@@ -371,8 +365,8 @@ int mls_from_string(struct policydb *p, char *str, struct context *context,
371
365
if (!tmpstr ) {
372
366
rc = - ENOMEM ;
373
367
} else {
374
- rc = mls_context_to_sid (p , ':' , tmpstr , context ,
375
- NULL , SECSID_NULL );
368
+ rc = mls_context_to_sid (p , ':' , tmpstr , context , NULL ,
369
+ SECSID_NULL );
376
370
kfree (tmpstr );
377
371
}
378
372
@@ -382,8 +376,7 @@ int mls_from_string(struct policydb *p, char *str, struct context *context,
382
376
/*
383
377
* Copies the MLS range `range' into `context'.
384
378
*/
385
- int mls_range_set (struct context * context ,
386
- struct mls_range * range )
379
+ int mls_range_set (struct context * context , struct mls_range * range )
387
380
{
388
381
int l , rc = 0 ;
389
382
@@ -399,9 +392,8 @@ int mls_range_set(struct context *context,
399
392
return rc ;
400
393
}
401
394
402
- int mls_setup_user_range (struct policydb * p ,
403
- struct context * fromcon , struct user_datum * user ,
404
- struct context * usercon )
395
+ int mls_setup_user_range (struct policydb * p , struct context * fromcon ,
396
+ struct user_datum * user , struct context * usercon )
405
397
{
406
398
if (p -> mls_enabled ) {
407
399
struct mls_level * fromcon_sen = & (fromcon -> range .level [0 ]);
@@ -444,10 +436,8 @@ int mls_setup_user_range(struct policydb *p,
444
436
* policy `oldp' to the values specified in the policy `newp',
445
437
* storing the resulting context in `newc'.
446
438
*/
447
- int mls_convert_context (struct policydb * oldp ,
448
- struct policydb * newp ,
449
- struct context * oldc ,
450
- struct context * newc )
439
+ int mls_convert_context (struct policydb * oldp , struct policydb * newp ,
440
+ struct context * oldc , struct context * newc )
451
441
{
452
442
struct level_datum * levdatum ;
453
443
struct cat_datum * catdatum ;
@@ -468,8 +458,9 @@ int mls_convert_context(struct policydb *oldp,
468
458
return - EINVAL ;
469
459
newc -> range .level [l ].sens = levdatum -> level -> sens ;
470
460
471
- ebitmap_for_each_positive_bit (& oldc -> range .level [l ].cat ,
472
- node , i ) {
461
+ ebitmap_for_each_positive_bit (& oldc -> range .level [l ].cat , node ,
462
+ i )
463
+ {
473
464
int rc ;
474
465
475
466
catdatum = symtab_search (& newp -> p_cats ,
@@ -486,13 +477,9 @@ int mls_convert_context(struct policydb *oldp,
486
477
return 0 ;
487
478
}
488
479
489
- int mls_compute_sid (struct policydb * p ,
490
- struct context * scontext ,
491
- struct context * tcontext ,
492
- u16 tclass ,
493
- u32 specified ,
494
- struct context * newcontext ,
495
- bool sock )
480
+ int mls_compute_sid (struct policydb * p , struct context * scontext ,
481
+ struct context * tcontext , u16 tclass , u32 specified ,
482
+ struct context * newcontext , bool sock )
496
483
{
497
484
struct range_trans rtr ;
498
485
struct mls_range * r ;
@@ -532,8 +519,8 @@ int mls_compute_sid(struct policydb *p,
532
519
case DEFAULT_TARGET_LOW_HIGH :
533
520
return mls_context_cpy (newcontext , tcontext );
534
521
case DEFAULT_GLBLUB :
535
- return mls_context_glblub (newcontext ,
536
- scontext , tcontext );
522
+ return mls_context_glblub (newcontext , scontext ,
523
+ tcontext );
537
524
}
538
525
539
526
fallthrough ;
@@ -563,8 +550,7 @@ int mls_compute_sid(struct policydb *p,
563
550
* NetLabel MLS sensitivity level field.
564
551
*
565
552
*/
566
- void mls_export_netlbl_lvl (struct policydb * p ,
567
- struct context * context ,
553
+ void mls_export_netlbl_lvl (struct policydb * p , struct context * context ,
568
554
struct netlbl_lsm_secattr * secattr )
569
555
{
570
556
if (!p -> mls_enabled )
@@ -585,8 +571,7 @@ void mls_export_netlbl_lvl(struct policydb *p,
585
571
* NetLabel MLS sensitivity level into the context.
586
572
*
587
573
*/
588
- void mls_import_netlbl_lvl (struct policydb * p ,
589
- struct context * context ,
574
+ void mls_import_netlbl_lvl (struct policydb * p , struct context * context ,
590
575
struct netlbl_lsm_secattr * secattr )
591
576
{
592
577
if (!p -> mls_enabled )
@@ -607,8 +592,7 @@ void mls_import_netlbl_lvl(struct policydb *p,
607
592
* MLS category field. Returns zero on success, negative values on failure.
608
593
*
609
594
*/
610
- int mls_export_netlbl_cat (struct policydb * p ,
611
- struct context * context ,
595
+ int mls_export_netlbl_cat (struct policydb * p , struct context * context ,
612
596
struct netlbl_lsm_secattr * secattr )
613
597
{
614
598
int rc ;
@@ -637,8 +621,7 @@ int mls_export_netlbl_cat(struct policydb *p,
637
621
* negative values on failure.
638
622
*
639
623
*/
640
- int mls_import_netlbl_cat (struct policydb * p ,
641
- struct context * context ,
624
+ int mls_import_netlbl_cat (struct policydb * p , struct context * context ,
642
625
struct netlbl_lsm_secattr * secattr )
643
626
{
644
627
int rc ;
0 commit comments