diff options
Diffstat (limited to 'security/selinux/ss/mls.c')
-rw-r--r-- | security/selinux/ss/mls.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c index b4eff7a60c50..1ef8e4e89880 100644 --- a/security/selinux/ss/mls.c +++ b/security/selinux/ss/mls.c | |||
@@ -45,7 +45,7 @@ int mls_compute_context_len(struct context *context) | |||
45 | len = 1; /* for the beginning ":" */ | 45 | len = 1; /* for the beginning ":" */ |
46 | for (l = 0; l < 2; l++) { | 46 | for (l = 0; l < 2; l++) { |
47 | int index_sens = context->range.level[l].sens; | 47 | int index_sens = context->range.level[l].sens; |
48 | len += strlen(policydb.p_sens_val_to_name[index_sens - 1]); | 48 | len += strlen(sym_name(&policydb, SYM_LEVELS, index_sens - 1)); |
49 | 49 | ||
50 | /* categories */ | 50 | /* categories */ |
51 | head = -2; | 51 | head = -2; |
@@ -55,17 +55,17 @@ int mls_compute_context_len(struct context *context) | |||
55 | if (i - prev > 1) { | 55 | if (i - prev > 1) { |
56 | /* one or more negative bits are skipped */ | 56 | /* one or more negative bits are skipped */ |
57 | if (head != prev) { | 57 | if (head != prev) { |
58 | nm = policydb.p_cat_val_to_name[prev]; | 58 | nm = sym_name(&policydb, SYM_CATS, prev); |
59 | len += strlen(nm) + 1; | 59 | len += strlen(nm) + 1; |
60 | } | 60 | } |
61 | nm = policydb.p_cat_val_to_name[i]; | 61 | nm = sym_name(&policydb, SYM_CATS, i); |
62 | len += strlen(nm) + 1; | 62 | len += strlen(nm) + 1; |
63 | head = i; | 63 | head = i; |
64 | } | 64 | } |
65 | prev = i; | 65 | prev = i; |
66 | } | 66 | } |
67 | if (prev != head) { | 67 | if (prev != head) { |
68 | nm = policydb.p_cat_val_to_name[prev]; | 68 | nm = sym_name(&policydb, SYM_CATS, prev); |
69 | len += strlen(nm) + 1; | 69 | len += strlen(nm) + 1; |
70 | } | 70 | } |
71 | if (l == 0) { | 71 | if (l == 0) { |
@@ -102,8 +102,8 @@ void mls_sid_to_context(struct context *context, | |||
102 | scontextp++; | 102 | scontextp++; |
103 | 103 | ||
104 | for (l = 0; l < 2; l++) { | 104 | for (l = 0; l < 2; l++) { |
105 | strcpy(scontextp, | 105 | strcpy(scontextp, sym_name(&policydb, SYM_LEVELS, |
106 | policydb.p_sens_val_to_name[context->range.level[l].sens - 1]); | 106 | context->range.level[l].sens - 1)); |
107 | scontextp += strlen(scontextp); | 107 | scontextp += strlen(scontextp); |
108 | 108 | ||
109 | /* categories */ | 109 | /* categories */ |
@@ -118,7 +118,7 @@ void mls_sid_to_context(struct context *context, | |||
118 | *scontextp++ = '.'; | 118 | *scontextp++ = '.'; |
119 | else | 119 | else |
120 | *scontextp++ = ','; | 120 | *scontextp++ = ','; |
121 | nm = policydb.p_cat_val_to_name[prev]; | 121 | nm = sym_name(&policydb, SYM_CATS, prev); |
122 | strcpy(scontextp, nm); | 122 | strcpy(scontextp, nm); |
123 | scontextp += strlen(nm); | 123 | scontextp += strlen(nm); |
124 | } | 124 | } |
@@ -126,7 +126,7 @@ void mls_sid_to_context(struct context *context, | |||
126 | *scontextp++ = ':'; | 126 | *scontextp++ = ':'; |
127 | else | 127 | else |
128 | *scontextp++ = ','; | 128 | *scontextp++ = ','; |
129 | nm = policydb.p_cat_val_to_name[i]; | 129 | nm = sym_name(&policydb, SYM_CATS, i); |
130 | strcpy(scontextp, nm); | 130 | strcpy(scontextp, nm); |
131 | scontextp += strlen(nm); | 131 | scontextp += strlen(nm); |
132 | head = i; | 132 | head = i; |
@@ -139,7 +139,7 @@ void mls_sid_to_context(struct context *context, | |||
139 | *scontextp++ = '.'; | 139 | *scontextp++ = '.'; |
140 | else | 140 | else |
141 | *scontextp++ = ','; | 141 | *scontextp++ = ','; |
142 | nm = policydb.p_cat_val_to_name[prev]; | 142 | nm = sym_name(&policydb, SYM_CATS, prev); |
143 | strcpy(scontextp, nm); | 143 | strcpy(scontextp, nm); |
144 | scontextp += strlen(nm); | 144 | scontextp += strlen(nm); |
145 | } | 145 | } |
@@ -166,7 +166,7 @@ int mls_level_isvalid(struct policydb *p, struct mls_level *l) | |||
166 | if (!l->sens || l->sens > p->p_levels.nprim) | 166 | if (!l->sens || l->sens > p->p_levels.nprim) |
167 | return 0; | 167 | return 0; |
168 | levdatum = hashtab_search(p->p_levels.table, | 168 | levdatum = hashtab_search(p->p_levels.table, |
169 | p->p_sens_val_to_name[l->sens - 1]); | 169 | sym_name(p, SYM_LEVELS, l->sens - 1)); |
170 | if (!levdatum) | 170 | if (!levdatum) |
171 | return 0; | 171 | return 0; |
172 | 172 | ||
@@ -482,7 +482,8 @@ int mls_convert_context(struct policydb *oldp, | |||
482 | 482 | ||
483 | for (l = 0; l < 2; l++) { | 483 | for (l = 0; l < 2; l++) { |
484 | levdatum = hashtab_search(newp->p_levels.table, | 484 | levdatum = hashtab_search(newp->p_levels.table, |
485 | oldp->p_sens_val_to_name[c->range.level[l].sens - 1]); | 485 | sym_name(oldp, SYM_LEVELS, |
486 | c->range.level[l].sens - 1)); | ||
486 | 487 | ||
487 | if (!levdatum) | 488 | if (!levdatum) |
488 | return -EINVAL; | 489 | return -EINVAL; |
@@ -493,7 +494,7 @@ int mls_convert_context(struct policydb *oldp, | |||
493 | int rc; | 494 | int rc; |
494 | 495 | ||
495 | catdatum = hashtab_search(newp->p_cats.table, | 496 | catdatum = hashtab_search(newp->p_cats.table, |
496 | oldp->p_cat_val_to_name[i]); | 497 | sym_name(oldp, SYM_CATS, i)); |
497 | if (!catdatum) | 498 | if (!catdatum) |
498 | return -EINVAL; | 499 | return -EINVAL; |
499 | rc = ebitmap_set_bit(&bitmap, catdatum->value - 1, 1); | 500 | rc = ebitmap_set_bit(&bitmap, catdatum->value - 1, 1); |