chiark / gitweb /
journalctl: add --local switch
[elogind.git] / src / journal / journald.c
index d27cb60ac7e7791b137c4c9a7c44859e544272dd..f0f5103bf038b485d8e9963874a331a54a7a886a 100644 (file)
@@ -29,7 +29,6 @@
 #include <sys/ioctl.h>
 #include <linux/sockios.h>
 #include <sys/statvfs.h>
-#include <sys/user.h>
 
 #include <systemd/sd-journal.h>
 #include <systemd/sd-login.h>
@@ -1259,6 +1258,7 @@ static void process_native_message(
                         p = e + 1;
                         continue;
                 } else {
+                        le64_t l_le;
                         uint64_t l;
                         char *k;
 
@@ -1267,8 +1267,8 @@ static void process_native_message(
                                 break;
                         }
 
-                        memcpy(&l, e + 1, sizeof(uint64_t));
-                        l = le64toh(l);
+                        memcpy(&l_le, e + 1, sizeof(uint64_t));
+                        l = le64toh(l_le);
 
                         if (remaining < e - p + 1 + sizeof(uint64_t) + l + 1 ||
                             e[1+sizeof(uint64_t)+l] != '\n') {
@@ -2149,10 +2149,20 @@ static int process_event(Server *s, struct epoll_event *ev) {
                         size_t label_len = 0;
                         union {
                                 struct cmsghdr cmsghdr;
+
+                                /* We use NAME_MAX space for the
+                                 * SELinux label here. The kernel
+                                 * currently enforces no limit, but
+                                 * according to suggestions from the
+                                 * SELinux people this will change and
+                                 * it will probably be identical to
+                                 * NAME_MAX. For now we use that, but
+                                 * this should be updated one day when
+                                 * the final limit is known.*/
                                 uint8_t buf[CMSG_SPACE(sizeof(struct ucred)) +
                                             CMSG_SPACE(sizeof(struct timeval)) +
-                                            CMSG_SPACE(sizeof(int)) +
-                                            CMSG_SPACE(PAGE_SIZE)]; /* selinux label */
+                                            CMSG_SPACE(sizeof(int)) + /* fd */
+                                            CMSG_SPACE(NAME_MAX)]; /* selinux label */
                         } control;
                         ssize_t n;
                         int v;