Blame SOURCES/0001-Revert-Make-boot.log-world-readable-by-default.patch

ff86aa
From a2c6a448d38a5150c593ca388eea8537ec0489ee Mon Sep 17 00:00:00 2001
ff86aa
From: Ray Strode <rstrode@redhat.com>
ff86aa
Date: Thu, 11 May 2017 11:10:36 -0400
ff86aa
Subject: [PATCH] Revert "Make boot.log world readable by default"
ff86aa
ff86aa
This reverts commit fc5cd88767db61805519fef53182386ba56c6405.
ff86aa
---
ff86aa
 src/libply/ply-logger.c           | 16 ++--------------
ff86aa
 src/libply/ply-logger.h           |  5 ++---
ff86aa
 src/libply/ply-terminal-session.c |  2 +-
ff86aa
 3 files changed, 5 insertions(+), 18 deletions(-)
ff86aa
ff86aa
diff --git a/src/libply/ply-logger.c b/src/libply/ply-logger.c
ff86aa
index dfd5c0a..6f25801 100644
ff86aa
--- a/src/libply/ply-logger.c
ff86aa
+++ b/src/libply/ply-logger.c
ff86aa
@@ -292,84 +292,72 @@ ply_logger_free_filters (ply_logger_t *logger)
ff86aa
       next_node = ply_list_get_next_node (logger->filters, node);
ff86aa
       free (filter);
ff86aa
       node = next_node;
ff86aa
     }
ff86aa
 
ff86aa
   ply_list_free (logger->filters);
ff86aa
 }
ff86aa
 
ff86aa
 void
ff86aa
 ply_logger_free (ply_logger_t *logger)
ff86aa
 {
ff86aa
   if (logger == NULL)
ff86aa
     return;
ff86aa
 
ff86aa
   if (logger->output_fd >= 0)
ff86aa
     {
ff86aa
       if (ply_logger_is_logging (logger))
ff86aa
         ply_logger_flush (logger);
ff86aa
       close (logger->output_fd);
ff86aa
     }
ff86aa
 
ff86aa
   ply_logger_free_filters (logger);
ff86aa
 
ff86aa
   free (logger->filename);
ff86aa
   free (logger->buffer);
ff86aa
   free (logger);
ff86aa
 }
ff86aa
 
ff86aa
 bool
ff86aa
 ply_logger_open_file (ply_logger_t    *logger,
ff86aa
-                      const char      *filename,
ff86aa
-                      bool             world_readable)
ff86aa
+                      const char      *filename)
ff86aa
 {
ff86aa
   int fd;
ff86aa
-  mode_t mode;
ff86aa
 
ff86aa
   assert (logger != NULL);
ff86aa
   assert (filename != NULL);
ff86aa
 
ff86aa
-  if (world_readable)
ff86aa
-    mode = 0644;
ff86aa
-  else
ff86aa
-    mode = 0600;
ff86aa
-
ff86aa
-  fd = open (filename, PLY_LOGGER_OPEN_FLAGS, mode);
ff86aa
+  fd = open (filename, PLY_LOGGER_OPEN_FLAGS, 0600);
ff86aa
 
ff86aa
   if (fd < 0)
ff86aa
     return false;
ff86aa
 
ff86aa
-  if (fchmod (fd, mode) < 0) {
ff86aa
-    close (fd);
ff86aa
-    return false;
ff86aa
-  }
ff86aa
-
ff86aa
   ply_logger_set_output_fd (logger, fd);
ff86aa
 
ff86aa
   free (logger->filename);
ff86aa
 
ff86aa
   logger->filename = strdup (filename);
ff86aa
 
ff86aa
   return true;
ff86aa
 }
ff86aa
 
ff86aa
 void
ff86aa
 ply_logger_close_file (ply_logger_t *logger)
ff86aa
 {
ff86aa
   assert (logger != NULL);
ff86aa
 
ff86aa
   if (logger->output_fd < 0)
ff86aa
       return;
ff86aa
 
ff86aa
   close (logger->output_fd);
ff86aa
   ply_logger_set_output_fd (logger, -1);
ff86aa
 }
ff86aa
 
ff86aa
 void
ff86aa
 ply_logger_set_output_fd (ply_logger_t *logger,
ff86aa
                           int           fd)
ff86aa
 {
ff86aa
   assert (logger != NULL);
ff86aa
 
ff86aa
   logger->output_fd = fd;
ff86aa
 }
ff86aa
 
ff86aa
diff --git a/src/libply/ply-logger.h b/src/libply/ply-logger.h
ff86aa
index 596bed5..fc25db9 100644
ff86aa
--- a/src/libply/ply-logger.h
ff86aa
+++ b/src/libply/ply-logger.h
ff86aa
@@ -19,120 +19,119 @@
ff86aa
  */
ff86aa
 #ifndef PLY_LOGGER_H
ff86aa
 #define PLY_LOGGER_H
ff86aa
 
ff86aa
 #include <errno.h>
ff86aa
 #include <stdbool.h>
ff86aa
 #include <stdint.h>
ff86aa
 #include <string.h>
ff86aa
 #include <sys/types.h>
ff86aa
 #include <unistd.h>
ff86aa
 
ff86aa
 typedef struct _ply_logger ply_logger_t;
ff86aa
 
ff86aa
 typedef enum
ff86aa
 {
ff86aa
   PLY_LOGGER_FLUSH_POLICY_WHEN_ASKED = 0,
ff86aa
   PLY_LOGGER_FLUSH_POLICY_EVERY_TIME
ff86aa
 } ply_logger_flush_policy_t;
ff86aa
 
ff86aa
 typedef void (* ply_logger_filter_handler_t) (void          *user_data,
ff86aa
                                               const void    *in_bytes,
ff86aa
                                               size_t         in_size,
ff86aa
                                               void         **out_bytes,
ff86aa
                                               size_t        *out_size,
ff86aa
                                               ply_logger_t  *logger);
ff86aa
 
ff86aa
 #ifndef PLY_HIDE_FUNCTION_DECLARATIONS
ff86aa
 ply_logger_t *ply_logger_new (void);
ff86aa
 void ply_logger_free (ply_logger_t *logger);
ff86aa
 bool ply_logger_open_file (ply_logger_t *logger,
ff86aa
-                           const char   *filename,
ff86aa
-                           bool          world_readable);
ff86aa
+                           const char   *filename);
ff86aa
 void ply_logger_close_file (ply_logger_t    *logger);
ff86aa
 void ply_logger_set_output_fd (ply_logger_t *logger,
ff86aa
                                int           fd);
ff86aa
 int ply_logger_get_output_fd (ply_logger_t *logger);
ff86aa
 bool ply_logger_flush (ply_logger_t *logger);
ff86aa
 void ply_logger_set_flush_policy (ply_logger_t              *logger,
ff86aa
                                   ply_logger_flush_policy_t  policy);
ff86aa
 ply_logger_flush_policy_t ply_logger_get_flush_policy (ply_logger_t *logger);
ff86aa
 void ply_logger_toggle_logging (ply_logger_t *logger);
ff86aa
 bool ply_logger_is_logging (ply_logger_t *logger);
ff86aa
 void ply_logger_inject_bytes (ply_logger_t *logger,
ff86aa
                               const void   *bytes,
ff86aa
                               size_t number_of_bytes);
ff86aa
 void ply_logger_add_filter (ply_logger_t                *logger,
ff86aa
                             ply_logger_filter_handler_t  filter_handler,
ff86aa
                             void                        *user_data);
ff86aa
 #define ply_logger_inject(logger, format, args...)                             \
ff86aa
         ply_logger_inject_with_non_literal_format_string (logger,              \
ff86aa
                                                           format "", ##args)
ff86aa
 __attribute__((__format__ (__printf__, 2, 3)))
ff86aa
 void ply_logger_inject_with_non_literal_format_string (ply_logger_t   *logger,
ff86aa
 		                                       const char *format, ...);
ff86aa
 
ff86aa
 ply_logger_t *ply_logger_get_default (void);
ff86aa
 ply_logger_t *ply_logger_get_error_default (void);
ff86aa
 
ff86aa
 /* tracing is a debugging facility that incurs a hefty performance hit on the
ff86aa
  * program, so we conditionally compile support for it
ff86aa
  */
ff86aa
 #ifdef PLY_ENABLE_TRACING
ff86aa
 void ply_logger_toggle_tracing (ply_logger_t *logger);
ff86aa
 bool ply_logger_is_tracing_enabled (ply_logger_t *logger);
ff86aa
 
ff86aa
 #define ply_logger_trace(logger, format, args...)                              \
ff86aa
 do                                                                             \
ff86aa
   {                                                                            \
ff86aa
     int _old_errno;                                                            \
ff86aa
     _old_errno = errno;                                                        \
ff86aa
     if (ply_logger_is_tracing_enabled (logger))                                \
ff86aa
       {                                                                        \
ff86aa
         ply_logger_flush (logger);                                             \
ff86aa
         errno = _old_errno;                                                    \
ff86aa
         ply_logger_inject (logger,                                             \
ff86aa
                            "[%s:%d] %45.45s:" format "\r\n",                   \
ff86aa
                            __FILE__, __LINE__, __func__, ##args);              \
ff86aa
         ply_logger_flush (logger);                                             \
ff86aa
         errno = _old_errno;                                                    \
ff86aa
       }                                                                        \
ff86aa
   }                                                                            \
ff86aa
 while (0)
ff86aa
 #else
ff86aa
 #define ply_logger_trace(logger, format, args...)
ff86aa
 #define ply_logger_toggle_tracing(logger)
ff86aa
 #define ply_logger_is_tracing_enabled(logger) (false)
ff86aa
 #endif /* PLY_ENABLE_TRACING */
ff86aa
 
ff86aa
 /* convenience macros
ff86aa
  */
ff86aa
 #define ply_open_log_file(filename)                                            \
ff86aa
-        ply_logger_open_file (ply_logger_get_default (), filename, false)
ff86aa
+        ply_logger_open_file (ply_logger_get_default (), filename)
ff86aa
 #define ply_close_log_file()                                                   \
ff86aa
         ply_logger_close_file (ply_logger_get_default ())
ff86aa
 #define ply_flush_log()                                                        \
ff86aa
         ply_logger_flush (ply_logger_get_default ())
ff86aa
 #define ply_free_log()                                                         \
ff86aa
         ply_logger_free (ply_logger_get_default ())
ff86aa
 #define ply_log(format, args...)                                               \
ff86aa
         ply_logger_inject (ply_logger_get_default (), format "\n", ##args)
ff86aa
 #define ply_log_without_new_line(format, args...)                              \
ff86aa
         ply_logger_inject (ply_logger_get_default (), format, ##args)
ff86aa
 #define ply_error(format, args...)                                             \
ff86aa
         ply_logger_inject (ply_logger_get_error_default (), format "\n", ##args)
ff86aa
 #define ply_error_without_new_line(format, args...)                            \
ff86aa
         ply_logger_inject (ply_logger_get_error_default (), format, ##args)
ff86aa
 #define ply_free_error_log()                                                   \
ff86aa
         ply_logger_free (ply_logger_get_error_default ())
ff86aa
 
ff86aa
 #define ply_toggle_tracing()                                                   \
ff86aa
         ply_logger_toggle_tracing (ply_logger_get_error_default ())
ff86aa
 #define ply_is_tracing()                                                       \
ff86aa
         ply_logger_is_tracing_enabled (ply_logger_get_error_default ())
ff86aa
 #define ply_trace(format, args...)                                             \
ff86aa
         ply_logger_trace (ply_logger_get_error_default (), format, ##args)
ff86aa
 
ff86aa
 #endif
ff86aa
 
ff86aa
 #endif /* PLY_LOGGER_H */
ff86aa
 /* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */
ff86aa
diff --git a/src/libply/ply-terminal-session.c b/src/libply/ply-terminal-session.c
ff86aa
index 143eed6..50ddd28 100644
ff86aa
--- a/src/libply/ply-terminal-session.c
ff86aa
+++ b/src/libply/ply-terminal-session.c
ff86aa
@@ -542,48 +542,48 @@ ply_terminal_session_start_logging (ply_terminal_session_t *session)
ff86aa
 }
ff86aa
 
ff86aa
 static void
ff86aa
 ply_terminal_session_stop_logging (ply_terminal_session_t *session)
ff86aa
 {
ff86aa
   assert (session != NULL);
ff86aa
   assert (session->logger != NULL);
ff86aa
 
ff86aa
   ply_trace ("stopping logging of incoming console messages");
ff86aa
   if (ply_logger_is_logging (session->logger))
ff86aa
     ply_logger_toggle_logging (session->logger);
ff86aa
 
ff86aa
   if (session->loop != NULL &&
ff86aa
       session->fd_watch != NULL)
ff86aa
     ply_event_loop_stop_watching_fd (session->loop,
ff86aa
                                      session->fd_watch);
ff86aa
   session->fd_watch = NULL;
ff86aa
 }
ff86aa
 
ff86aa
 bool
ff86aa
 ply_terminal_session_open_log (ply_terminal_session_t *session,
ff86aa
                                const char             *filename)
ff86aa
 {
ff86aa
   bool log_is_opened;
ff86aa
 
ff86aa
   assert (session != NULL);
ff86aa
   assert (filename != NULL);
ff86aa
   assert (session->logger != NULL);
ff86aa
 
ff86aa
   ply_save_errno ();
ff86aa
-  log_is_opened = ply_logger_open_file (session->logger, filename, true);
ff86aa
+  log_is_opened = ply_logger_open_file (session->logger, filename);
ff86aa
   if (log_is_opened)
ff86aa
     ply_logger_flush (session->logger);
ff86aa
   ply_restore_errno ();
ff86aa
 
ff86aa
   return log_is_opened;
ff86aa
 }
ff86aa
 
ff86aa
 void
ff86aa
 ply_terminal_session_close_log (ply_terminal_session_t *session)
ff86aa
 {
ff86aa
   assert (session != NULL);
ff86aa
   assert (session->logger != NULL);
ff86aa
 
ff86aa
   return ply_logger_close_file (session->logger);
ff86aa
 }
ff86aa
 
ff86aa
 /* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */
ff86aa
-- 
ff86aa
2.12.2
ff86aa