2010-12-21 21:29:19 +00:00
|
|
|
diff --git a/libselinux/src/callbacks.c b/libselinux/src/callbacks.c
|
|
|
|
index b245364..7c47222 100644
|
|
|
|
--- a/libselinux/src/callbacks.c
|
|
|
|
+++ b/libselinux/src/callbacks.c
|
|
|
|
@@ -16,6 +16,7 @@ default_selinux_log(int type __attribute__((unused)), const char *fmt, ...)
|
2008-07-09 20:57:21 +00:00
|
|
|
{
|
2008-07-29 13:22:45 +00:00
|
|
|
int rc;
|
|
|
|
va_list ap;
|
|
|
|
+ if (is_selinux_enabled() == 0) return 0;
|
|
|
|
va_start(ap, fmt);
|
|
|
|
rc = vfprintf(stderr, fmt, ap);
|
|
|
|
va_end(ap);
|
2010-12-21 21:29:19 +00:00
|
|
|
diff --git a/libselinux/src/matchpathcon.c b/libselinux/src/matchpathcon.c
|
2011-08-30 15:08:49 +00:00
|
|
|
index 9717b14..df83b30 100644
|
2010-12-21 21:29:19 +00:00
|
|
|
--- a/libselinux/src/matchpathcon.c
|
|
|
|
+++ b/libselinux/src/matchpathcon.c
|
2011-08-30 15:08:49 +00:00
|
|
|
@@ -2,6 +2,7 @@
|
2009-03-27 18:25:16 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
+#include <syslog.h>
|
|
|
|
#include "selinux_internal.h"
|
|
|
|
#include "label_internal.h"
|
|
|
|
#include "callbacks.h"
|
2011-08-30 15:08:49 +00:00
|
|
|
@@ -62,7 +63,7 @@ static void
|
2009-03-27 18:25:16 +00:00
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
va_start(ap, fmt);
|
|
|
|
- vfprintf(stderr, fmt, ap);
|
|
|
|
+ vsyslog(LOG_ERR, fmt, ap);
|
|
|
|
va_end(ap);
|
|
|
|
}
|
2009-01-27 20:00:47 +00:00
|
|
|
|
2011-08-30 15:08:49 +00:00
|
|
|
@@ -353,7 +354,7 @@ static int symlink_realpath(const char *name, char *resolved_path)
|
2010-06-16 13:23:15 +00:00
|
|
|
|
2011-08-30 15:08:49 +00:00
|
|
|
tmp_path = strdup(name);
|
|
|
|
if (!tmp_path) {
|
|
|
|
- fprintf(stderr, "symlink_realpath(%s) strdup() failed: %s\n",
|
|
|
|
+ myprintf("symlink_realpath(%s) strdup() failed: %s\n",
|
|
|
|
name, strerror(errno));
|
|
|
|
rc = -1;
|
|
|
|
goto out;
|
|
|
|
@@ -374,21 +375,24 @@ static int symlink_realpath(const char *name, char *resolved_path)
|
|
|
|
}
|
2011-02-01 22:40:11 +00:00
|
|
|
|
2011-08-30 15:08:49 +00:00
|
|
|
if (!p) {
|
|
|
|
- fprintf(stderr, "symlink_realpath(%s) realpath() failed: %s\n",
|
|
|
|
+ myprintf("symlink_realpath(%s) realpath() failed: %s\n",
|
|
|
|
name, strerror(errno));
|
|
|
|
rc = -1;
|
|
|
|
goto out;
|
2011-08-18 11:09:51 +00:00
|
|
|
}
|
|
|
|
|
2011-08-30 15:08:49 +00:00
|
|
|
len = strlen(p);
|
|
|
|
- if (len + strlen(last_component) + 1 > PATH_MAX) {
|
|
|
|
- fprintf(stderr, "symlink_realpath(%s) failed: Filename too long \n",
|
|
|
|
+ if (len + strlen(last_component) + 2 > PATH_MAX) {
|
|
|
|
+ myprintf("symlink_realpath(%s) failed: Filename too long \n",
|
|
|
|
name);
|
|
|
|
+ errno=ENAMETOOLONG;
|
|
|
|
rc = -1;
|
|
|
|
goto out;
|
|
|
|
}
|
2011-02-01 22:40:11 +00:00
|
|
|
|
2011-08-30 15:08:49 +00:00
|
|
|
resolved_path += len;
|
|
|
|
+ strcpy(resolved_path, "/");
|
|
|
|
+ resolved_path += 1;
|
|
|
|
strcpy(resolved_path, last_component);
|
|
|
|
out:
|
|
|
|
free(tmp_path);
|
2011-05-25 18:25:56 +00:00
|
|
|
diff --git a/libselinux/utils/matchpathcon.c b/libselinux/utils/matchpathcon.c
|
2011-08-30 15:08:49 +00:00
|
|
|
index 2fa21bc..5f0a4c2 100644
|
2011-05-25 18:25:56 +00:00
|
|
|
--- a/libselinux/utils/matchpathcon.c
|
|
|
|
+++ b/libselinux/utils/matchpathcon.c
|
2011-08-30 15:08:49 +00:00
|
|
|
@@ -45,7 +45,7 @@ int printmatchpathcon(char *path, int header, int mode)
|
2011-05-25 18:25:56 +00:00
|
|
|
|
2011-08-18 11:09:51 +00:00
|
|
|
int main(int argc, char **argv)
|
2011-05-25 18:25:56 +00:00
|
|
|
{
|
2011-08-30 15:08:49 +00:00
|
|
|
- int i, init = 0, rc = 0;
|
|
|
|
+ int i, init = 0;
|
|
|
|
int header = 1, opt;
|
|
|
|
int verify = 0;
|
|
|
|
int notrans = 0;
|