Fix handling of subset labeling that is causing segfault in restorecon
This commit is contained in:
parent
10e77a8370
commit
c03bd38197
@ -56,7 +56,7 @@ index b245364..7c47222 100644
|
|||||||
rc = vfprintf(stderr, fmt, ap);
|
rc = vfprintf(stderr, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
diff --git a/libselinux/src/label_file.c b/libselinux/src/label_file.c
|
diff --git a/libselinux/src/label_file.c b/libselinux/src/label_file.c
|
||||||
index 3b8346d..0d89dcb 100644
|
index 3b8346d..ead3b0b 100644
|
||||||
--- a/libselinux/src/label_file.c
|
--- a/libselinux/src/label_file.c
|
||||||
+++ b/libselinux/src/label_file.c
|
+++ b/libselinux/src/label_file.c
|
||||||
@@ -27,6 +27,7 @@
|
@@ -27,6 +27,7 @@
|
||||||
@ -116,7 +116,7 @@ index 3b8346d..0d89dcb 100644
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
FILE *localfp = NULL;
|
FILE *localfp = NULL;
|
||||||
FILE *homedirfp = NULL;
|
FILE *homedirfp = NULL;
|
||||||
@@ -421,8 +434,17 @@ static int init(struct selabel_handle *rec, struct selinux_opt *opts,
|
@@ -421,8 +434,19 @@ static int init(struct selabel_handle *rec, struct selinux_opt *opts,
|
||||||
path = opts[n].value;
|
path = opts[n].value;
|
||||||
break;
|
break;
|
||||||
case SELABEL_OPT_SUBSET:
|
case SELABEL_OPT_SUBSET:
|
||||||
@ -124,10 +124,12 @@ index 3b8346d..0d89dcb 100644
|
|||||||
+ {
|
+ {
|
||||||
+ char *ptr;
|
+ char *ptr;
|
||||||
+ i = 0;
|
+ i = 0;
|
||||||
+ prefix_array[i] = strtok_r((char *)opts[n].value, ";", &ptr);
|
+ if (opts[n].value) {
|
||||||
+ while ((prefix_array[i] != NULL) && i < MAX_PREFIX - 1) {
|
+ prefix_array[i] = strtok_r((char *)opts[n].value, ";", &ptr);
|
||||||
+ i++;
|
+ while ((prefix_array[i] != NULL) && i < MAX_PREFIX - 1) {
|
||||||
+ prefix_array[i] = strtok_r(NULL, ";", &ptr);
|
+ i++;
|
||||||
|
+ prefix_array[i] = strtok_r(NULL, ";", &ptr);
|
||||||
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
break;
|
break;
|
||||||
@ -135,7 +137,7 @@ index 3b8346d..0d89dcb 100644
|
|||||||
case SELABEL_OPT_BASEONLY:
|
case SELABEL_OPT_BASEONLY:
|
||||||
baseonly = !!opts[n].value;
|
baseonly = !!opts[n].value;
|
||||||
break;
|
break;
|
||||||
@@ -481,7 +503,7 @@ static int init(struct selabel_handle *rec, struct selinux_opt *opts,
|
@@ -481,7 +505,7 @@ static int init(struct selabel_handle *rec, struct selinux_opt *opts,
|
||||||
data->ncomp = 0;
|
data->ncomp = 0;
|
||||||
while (getline(&line_buf, &line_len, fp) > 0
|
while (getline(&line_buf, &line_len, fp) > 0
|
||||||
&& data->nspec < maxnspec) {
|
&& data->nspec < maxnspec) {
|
||||||
@ -144,7 +146,7 @@ index 3b8346d..0d89dcb 100644
|
|||||||
pass, ++lineno) != 0)
|
pass, ++lineno) != 0)
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
@@ -495,7 +517,7 @@ static int init(struct selabel_handle *rec, struct selinux_opt *opts,
|
@@ -495,7 +519,7 @@ static int init(struct selabel_handle *rec, struct selinux_opt *opts,
|
||||||
while (getline(&line_buf, &line_len, homedirfp) > 0
|
while (getline(&line_buf, &line_len, homedirfp) > 0
|
||||||
&& data->nspec < maxnspec) {
|
&& data->nspec < maxnspec) {
|
||||||
if (process_line
|
if (process_line
|
||||||
@ -153,7 +155,7 @@ index 3b8346d..0d89dcb 100644
|
|||||||
line_buf, pass, ++lineno) != 0)
|
line_buf, pass, ++lineno) != 0)
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
@@ -505,7 +527,7 @@ static int init(struct selabel_handle *rec, struct selinux_opt *opts,
|
@@ -505,7 +529,7 @@ static int init(struct selabel_handle *rec, struct selinux_opt *opts,
|
||||||
while (getline(&line_buf, &line_len, localfp) > 0
|
while (getline(&line_buf, &line_len, localfp) > 0
|
||||||
&& data->nspec < maxnspec) {
|
&& data->nspec < maxnspec) {
|
||||||
if (process_line
|
if (process_line
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
Summary: SELinux library and simple utilities
|
Summary: SELinux library and simple utilities
|
||||||
Name: libselinux
|
Name: libselinux
|
||||||
Version: 2.1.5
|
Version: 2.1.5
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
License: Public Domain
|
License: Public Domain
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
Source: %{name}-%{version}.tgz
|
Source: %{name}-%{version}.tgz
|
||||||
@ -233,6 +233,9 @@ exit 0
|
|||||||
%{ruby_sitearch}/selinux.so
|
%{ruby_sitearch}/selinux.so
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Sep 6 2011 Dan Walsh <dwalsh@redhat.com> - 2.1.5-3
|
||||||
|
- Fix handling of subset labeling that is causing segfault in restorecon
|
||||||
|
|
||||||
* Fri Sep 2 2011 Dan Walsh <dwalsh@redhat.com> - 2.1.5-2
|
* Fri Sep 2 2011 Dan Walsh <dwalsh@redhat.com> - 2.1.5-2
|
||||||
- Change matchpathcon_init_prefix and selabel_open to allow multiple initial
|
- Change matchpathcon_init_prefix and selabel_open to allow multiple initial
|
||||||
prefixes. Now you can specify a ";" separated list of prefixes and the
|
prefixes. Now you can specify a ";" separated list of prefixes and the
|
||||||
|
Loading…
Reference in New Issue
Block a user