policycoreutils: mcstrans: use string_to_av_perm() to calculate permission access vector
PATCH 1/1 policycoreutils: mcstrans: use string_to_av_perm() to calculate permission access vector
mcstrans still uses CONTEXT__CONTAINS from av_permissions.h to calculate a permission access vector. However, av_permissions.h was deprecated, so it does not have access to the constant. This updates mcstrans to use string_to_av_perm() to get the value for context contains.
--- policycoreutils/mcstrans/src/mcscolor.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
policycoreutils/mcstrans/src/mcscolor.c +4 -3
@@ -78,11 +78,12 @@ void finish_context_colors(void) {static int check_dominance (const char *pattern,const char *raw) {security_context_t ctx;context_t con; -unsigned int bit =CONTEXT__CONTAINS ;struct av_decision avd;int rc =-1 ;context_t my_tmp;const char *raw_range; +security_class_t context_class =string_to_security_class ("context" ); +access_vector_t context_contains_perm =string_to_av_perm (context_class,"contains" ); con =context_new (raw);if (!con)
@@ -108,11 +109,11 @@ static int check_dominance(const char *pattern, const char *raw) {if (!raw) goto out; - rc =security_compute_av_raw (ctx, (security_context_t )raw,string_to_security_class ("context" ), bit, &avd); + rc =security_compute_av_raw (ctx, (security_context_t )raw, context_class, context_contains_perm, &avd);if (rc) goto out; - rc = (bit & avd.allowed) != bit; + rc = (context_contains_perm & avd.allowed) != context_contains_perm; out:free (ctx);context_free (my_tmp);
Signature · 1 line
1.9.3
Quoted 7 lines · Steve Lawrence
mcstrans still uses
CONTEXT__CONTAINSfromav_permissions.hto calculate a permission access vector. However,av_permissions.hwas deprecated, so it does not have access to the constant. This updates mcstrans to usestring_to_av_perm()to get the value for context contains.Reported-by Sven Vermeulen <[email protected]>Signed-off-by Steve Lawrence <[email protected]>
I guess we don't build mcstrans by default and thus this wasn't noticed earlier?
Quoted 37 lines
--- policycoreutils/mcstrans/src/mcscolor.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)policycoreutils/mcstrans/src/mcscolor.c +4
-3@@ -78,11 +78,12 @@ void finish_context_colors(void) {static int check_dominance (const char *pattern,const char *raw) {security_context_t ctx;context_t con; -unsigned int bit =CONTEXT__CONTAINS ;struct av_decision avd;int rc =-1 ;context_t my_tmp;const char *raw_range; +security_class_t context_class =string_to_security_class ("context" ); +access_vector_t context_contains_perm =string_to_av_perm (context_class,"contains" ); con =context_new (raw);if (!con)@@ -108,11 +109,11 @@ static int check_dominance(const char *pattern, const char *raw) {if (!raw) goto out; - rc =security_compute_av_raw (ctx, (security_context_t )raw,string_to_security_class ("context" ), bit, &avd); + rc =security_compute_av_raw (ctx, (security_context_t )raw, context_class, context_contains_perm, &avd);if (rc) goto out; - rc = (bit & avd.allowed) != bit; + rc = (context_contains_perm & avd.allowed) != context_contains_perm; out:free (ctx);context_free (my_tmp);
Quoted 6 lines · Stephen Smalley
Quoted 5 lines · Steve Lawrence
mcstrans still uses
CONTEXT__CONTAINSfromav_permissions.hto calculate a permission access vector. However,av_permissions.hwas deprecated, so it does not have access to the constant. This updates mcstrans to usestring_to_av_perm()to get the value for context contains.
Quoted 8 lines
Quoted 2 lines
Reported-by Sven Vermeulen <[email protected]>Signed-off-by Steve Lawrence <[email protected]>Acked-by Stephen Smalley <[email protected]>I guess we don't build mcstrans by default and thus this wasn't noticed earlier?
Yep. Any reason not to include it by default?
Quoted 38 lines
Quoted 37 lines
--- policycoreutils/mcstrans/src/mcscolor.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)policycoreutils/mcstrans/src/mcscolor.c +4
-3@@ -78,11 +78,12 @@ void finish_context_colors(void) {static int check_dominance (const char *pattern,const char *raw) {security_context_t ctx;context_t con; -unsigned int bit =CONTEXT__CONTAINS ;struct av_decision avd;int rc =-1 ;context_t my_tmp;const char *raw_range; +security_class_t context_class =string_to_security_class ("context" ); +access_vector_t context_contains_perm =string_to_av_perm (context_class,"contains" ); con =context_new (raw);if (!con)@@ -108,11 +109,11 @@ static int check_dominance(const char *pattern, const char *raw) {if (!raw) goto out; - rc =security_compute_av_raw (ctx, (security_context_t )raw,string_to_security_class ("context" ), bit, &avd); + rc =security_compute_av_raw (ctx, (security_context_t )raw, context_class, context_contains_perm, &avd);if (rc) goto out; - rc = (bit & avd.allowed) != bit; + rc = (context_contains_perm & avd.allowed) != context_contains_perm; out:free (ctx);context_free (my_tmp);
Quoted 10 lines · Steve Lawrence
Quoted 9 lines · Stephen Smalley
Quoted 7 lines · Steve Lawrence
mcstrans still uses
CONTEXT__CONTAINSfromav_permissions.hto calculate a permission access vector. However,av_permissions.hwas deprecated, so it does not have access to the constant. This updates mcstrans to usestring_to_av_perm()to get the value for context contains.Reported-by Sven Vermeulen <[email protected]>Signed-off-by Steve Lawrence <[email protected]>
Quoted 7 lines
Quoted 5 lines
Acked-by Stephen Smalley <[email protected]>I guess we don't build mcstrans by default and thus this wasn't noticed earlier?
Yep. Any reason not to include it by default?
Not that I know of. Possibly just historical since it was originally separate from policycoreutils and Fedora packages it separately?
Quoted 47 lines
Quoted 32 lines
Quoted 32 lines
--- policycoreutils/mcstrans/src/mcscolor.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)policycoreutils/mcstrans/src/mcscolor.c +3
-2@@ -78,11 +78,12 @@ void finish_context_colors(void) {static int check_dominance (const char *pattern,const char *raw) {security_context_t ctx;context_t con; -unsigned int bit =CONTEXT__CONTAINS ;struct av_decision avd;int rc =-1 ;context_t my_tmp;const char *raw_range; +security_class_t context_class =string_to_security_class ("context" ); +access_vector_t context_contains_perm =string_to_av_perm (context_class,"contains" ); con =context_new (raw);if (!con)@@ -108,11 +109,11 @@ static int check_dominance(const char *pattern, const char *raw) {if (!raw) goto out; - rc =security_compute_av_raw (ctx, (security_context_t )raw,string_to_security_class ("context" ), bit, &avd); + rc =security_compute_av_raw (ctx, (security_context_t )raw, context_class, context_contains_perm, &avd);if (rc) goto out;Quoted 7 lines
policycoreutils/mcstrans/src/mcscolor.c static int check_dominance(const char *pattern, const char *raw) { · line 119
Quoted 6 lines
policycoreutils/mcstrans/src/mcscolor.c +1
-1- rc = (bit & avd.allowed) != bit; + rc = (context_contains_perm & avd.allowed) != context_contains_perm; out:free (ctx);context_free (my_tmp);_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].