- Fixed stat's 'C' format specifier (bug #216676).

- Resolves: rhbz#216676
This commit is contained in:
Tim Waugh 2006-11-23 17:41:19 +00:00
parent dfe7b9b323
commit a30626f98b
2 changed files with 21 additions and 16 deletions

View File

@ -1782,7 +1782,7 @@
+} +}
+#endif +#endif
--- coreutils-5.97/src/stat.c.selinux 2005-12-15 21:25:53.000000000 +0000 --- coreutils-5.97/src/stat.c.selinux 2005-12-15 21:25:53.000000000 +0000
+++ coreutils-5.97/src/stat.c 2006-11-17 13:56:55.000000000 +0000 +++ coreutils-5.97/src/stat.c 2006-11-23 17:33:50.000000000 +0000
@@ -42,6 +42,13 @@ @@ -42,6 +42,13 @@
# endif # endif
#endif #endif
@ -1867,7 +1867,7 @@
break; break;
} }
break; break;
@@ -690,9 +706,17 @@ @@ -690,9 +706,21 @@
/* Stat the file system and print what we find. */ /* Stat the file system and print what we find. */
static bool static bool
@ -1877,16 +1877,20 @@
STRUCT_STATVFS statfsbuf; STRUCT_STATVFS statfsbuf;
+ SECURITY_ID_T scontext = NULL; + SECURITY_ID_T scontext = NULL;
+#ifdef WITH_SELINUX +#ifdef WITH_SELINUX
+ if(secure) + if(is_selinux_enabled()) {
+ if (getfilecon(filename,&scontext)<0) { + if (getfilecon(filename,&scontext)<0) {
+ perror (filename); + if (secure) {
+ return false; + perror (filename);
+ return false;
+ }
+ scontext = NULL;
+ } + }
+ }
+#endif +#endif
if (STATFS (filename, &statfsbuf) != 0) if (STATFS (filename, &statfsbuf) != 0)
{ {
@@ -703,25 +727,46 @@ @@ -703,25 +731,46 @@
if (format == NULL) if (format == NULL)
{ {
@ -1942,18 +1946,18 @@
if ((follow_links ? stat : lstat) (filename, &statbuf) != 0) if ((follow_links ? stat : lstat) (filename, &statbuf) != 0)
{ {
@@ -729,11 +774,29 @@ @@ -729,11 +778,29 @@
return false; return false;
} }
+#ifdef WITH_SELINUX +#ifdef WITH_SELINUX
+ if(secure) { + if(is_selinux_enabled()) {
+ int i; + int i;
+ if (!follow_links) + if (!follow_links)
+ i=lgetfilecon(filename, &scontext); + i=lgetfilecon(filename, &scontext);
+ else + else
+ i=getfilecon(filename, &scontext); + i=getfilecon(filename, &scontext);
+ if (i == -1) + if (i == -1 && secure)
+ { + {
+ perror (filename); + perror (filename);
+ return false; + return false;
@ -1973,7 +1977,7 @@
} }
else else
{ {
@@ -751,16 +814,30 @@ @@ -751,16 +818,30 @@
} }
else else
{ {
@ -2011,7 +2015,7 @@
return true; return true;
} }
@@ -777,6 +854,7 @@ @@ -777,6 +858,7 @@
Display file or file system status.\n\ Display file or file system status.\n\
\n\ \n\
-L, --dereference follow links\n\ -L, --dereference follow links\n\
@ -2019,7 +2023,7 @@
-f, --file-system display file system status instead of file status\n\ -f, --file-system display file system status instead of file status\n\
"), stdout); "), stdout);
fputs (_("\ fputs (_("\
@@ -836,6 +914,7 @@ @@ -836,6 +918,7 @@
%c Total file nodes in file system\n\ %c Total file nodes in file system\n\
%d Free file nodes in file system\n\ %d Free file nodes in file system\n\
%f Free blocks in file system\n\ %f Free blocks in file system\n\
@ -2027,7 +2031,7 @@
"), stdout); "), stdout);
fputs (_("\ fputs (_("\
%i File System ID in hex\n\ %i File System ID in hex\n\
@@ -860,6 +939,7 @@ @@ -860,6 +943,7 @@
bool follow_links = false; bool follow_links = false;
bool fs = false; bool fs = false;
bool terse = false; bool terse = false;
@ -2035,7 +2039,7 @@
char *format = NULL; char *format = NULL;
bool ok = true; bool ok = true;
@@ -871,7 +951,7 @@ @@ -871,7 +955,7 @@
atexit (close_stdout); atexit (close_stdout);
@ -2044,7 +2048,7 @@
{ {
switch (c) switch (c)
{ {
@@ -898,6 +978,14 @@ @@ -898,6 +982,14 @@
case 't': case 't':
terse = true; terse = true;
break; break;
@ -2059,7 +2063,7 @@
case_GETOPT_HELP_CHAR; case_GETOPT_HELP_CHAR;
@@ -916,8 +1004,8 @@ @@ -916,8 +1008,8 @@
for (i = optind; i < argc; i++) for (i = optind; i < argc; i++)
ok &= (fs ok &= (fs

View File

@ -286,6 +286,7 @@ fi
%changelog %changelog
* Thu Nov 23 2006 Tim Waugh <twaugh@redhat.com> * Thu Nov 23 2006 Tim Waugh <twaugh@redhat.com>
- Fixed stat's 'C' format specifier (bug #216676).
- Misleading 'id -Z root' error message (bug #211089). - Misleading 'id -Z root' error message (bug #211089).
* Fri Nov 10 2006 Tim Waugh <twaugh@redhat.com> 5.97-14 * Fri Nov 10 2006 Tim Waugh <twaugh@redhat.com> 5.97-14