Skip to contentSkip to conversation

Reworked patch for restorecon

PATCH In review Karl MacMillan 2 participants 3 messages Oct 6, 2006 – Oct 17, 2006 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Reworked patch for restorecon

This patch makes the following changes to restorecon:

-i flag to tell restorecon to ignore missing files

-o now takes "-" to allow it to output file list to stdout

Check to make sure restorecon has at least one input file

This patch is based on Dan's patch from Sep. 26 but only includes the restorecon changes (see
http://marc.theaimsgroup.com/?l=selinux&m=115928447719072&w=2). Please apply.

---

 restorecon.8 |    3 ++
 restorecon.c |   55 +++++++++++++++++++++++++++++++++++++------------
 2 files changed, 45 insertions(+), 13 deletions(-)
policycoreutils/restorecon/restorecon.8 +3 -0
index f228407..172f6ef 100644
@@ -23,6 +23,9 @@ contexts are all as you expect.
 
 .SH "OPTIONS"
 .TP 
+.B \-i
+ignore files that do not exist
+.TP 
 .B \-f infilename
 infilename contains a list of files to be processed by application. Use \- for stdin.
 .TP 
policycoreutils/restorecon/restorecon.c +42 -13

144 lines not on this page · raw message

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#1 lore raw
Quoted 31 lines · Karl MacMillan

This patch makes the following changes to restorecon:

(quoted diff) +0 -2
-i flag to tell restorecon to ignore missing files
 
-o now takes "-" to allow it to output file list to stdout

Check to make sure restorecon has at least one input file

This patch is based on Dan's patch from Sep. 26 but only includes the restorecon changes (see
http://marc.theaimsgroup.com/?l=selinux&m=115928447719072&w=2). Please apply.

---

 restorecon.8 |    3 ++
 restorecon.c |   55 +++++++++++++++++++++++++++++++++++++------------
 2 files changed, 45 insertions(+), 13 deletions(-)
policycoreutils/restorecon/restorecon.c +1 -0
index 022a453..c1352aa 100644
@@ -41,12 +42,14 @@ #define __USE_XOPEN_EXTENDED 1	/* nftw *
 #include <ftw.h>
 
 static int change = 1;
+static int change_ctr = 0;

<snip>

Quoted 11 lines
policycoreutils/restorecon/restorecon.c +3 -1
@@ -249,7 +260,9 @@ int restore(const char *filename)
 						freecon(scontext);
 						return 1;
 					}
-				}
+				} else
+					change_ctr++;
+
 				if (verbose)
 					printf("%s reset %s context %s->%s\n",
 					       progname, filename,

<snip>

policycoreutils/restorecon/restorecon.c int main(int argc, char **argv) · line 461

Quoted 9 lines
policycoreutils/restorecon/restorecon.c +3 -0
@@ -428,5 +454,8 @@ int main(int argc, char **argv)
 	if (outfile)
 		fclose(outfile);
 
+	if (!change)
+		return change_ctr;
+
 	return errors;
 }

This was rejected earlier as an interface change (change in exit code of restorecon -n, with a non-zero exit status on a successful completion).

Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#2 lore raw
Quoted 49 lines · Stephen Smalley
Quoted 31 lines · Karl MacMillan

This patch makes the following changes to restorecon:

(quoted diff) +0 -2
-i flag to tell restorecon to ignore missing files
 
-o now takes "-" to allow it to output file list to stdout

Check to make sure restorecon has at least one input file

This patch is based on Dan's patch from Sep. 26 but only includes the restorecon changes (see
http://marc.theaimsgroup.com/?l=selinux&m=115928447719072&w=2). Please apply.

---

 restorecon.8 |    3 ++
 restorecon.c |   55 +++++++++++++++++++++++++++++++++++++------------
 2 files changed, 45 insertions(+), 13 deletions(-)
policycoreutils/restorecon/restorecon.c +1 -0
index 022a453..c1352aa 100644
@@ -41,12 +42,14 @@ #define __USE_XOPEN_EXTENDED 1	/* nftw *
 #include <ftw.h>
 
 static int change = 1;
+static int change_ctr = 0;

<snip>

Quoted 11 lines
policycoreutils/restorecon/restorecon.c +3 -1
@@ -249,7 +260,9 @@ int restore(const char *filename)
 						freecon(scontext);
 						return 1;
 					}
-				}
+				} else
+					change_ctr++;
+
 				if (verbose)
 					printf("%s reset %s context %s->%s\n",
 					       progname, filename,

<snip>

Quoted 4 lines
policycoreutils/restorecon/restorecon.c +0 -0
@@ -428,5 +454,8 @@ int main(int argc, char **argv)
 	if (outfile)
 		fclose(outfile);
 
Quoted 8 lines

policycoreutils/restorecon/restorecon.c int main(int argc, char **argv) · line 461

Quoted 5 lines
policycoreutils/restorecon/restorecon.c +3 -0
+	if (!change)
+		return change_ctr;
+
 	return errors;
 }

This was rejected earlier as an interface change (change in exit code of restorecon -n, with a non-zero exit status on a successful completion).

Merged with the change_ctr changes removed.

Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.