|
Lucio Andrés Illanes Albornoz |
470950 |
diff -Nru libbsd-0.9.1.orig/include/bsd/sys/cdefs.h libbsd-0.9.1/include/bsd/sys/cdefs.h
|
|
Lucio Andrés Illanes Albornoz |
470950 |
--- libbsd-0.9.1.orig/include/bsd/sys/cdefs.h 2018-05-22 15:56:14.000000000 +0200
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+++ libbsd-0.9.1/include/bsd/sys/cdefs.h 2018-05-30 15:27:07.067975364 +0200
|
|
Lucio Andrés Illanes Albornoz |
470950 |
@@ -93,7 +93,7 @@
|
|
Lucio Andrés Illanes Albornoz |
470950 |
#define LIBBSD_DEPRECATED(x)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
#endif
|
|
Lucio Andrés Illanes Albornoz |
470950 |
|
|
Lucio Andrés Illanes Albornoz |
470950 |
-#if LIBBSD_GCC_VERSION >= 0x0200
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#if 0
|
|
Lucio Andrés Illanes Albornoz |
470950 |
#define LIBBSD_REDIRECT(name, proto, alias) name proto __asm__(LIBBSD_ASMNAME(#alias))
|
|
Lucio Andrés Illanes Albornoz |
470950 |
#endif
|
|
Lucio Andrés Illanes Albornoz |
470950 |
#define LIBBSD_ASMNAME(cname) LIBBSD_ASMNAME_PREFIX(__USER_LABEL_PREFIX__, cname)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
diff -Nru libbsd-0.9.1.orig/include/bsd/vis.h libbsd-0.9.1/include/bsd/vis.h
|
|
Lucio Andrés Illanes Albornoz |
470950 |
--- libbsd-0.9.1.orig/include/bsd/vis.h 2018-05-22 16:07:42.000000000 +0200
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+++ libbsd-0.9.1/include/bsd/vis.h 2018-05-30 15:37:23.466013504 +0200
|
|
Lucio Andrés Illanes Albornoz |
470950 |
@@ -113,14 +113,9 @@
|
|
Lucio Andrés Illanes Albornoz |
470950 |
|
|
Lucio Andrés Illanes Albornoz |
470950 |
int strvis(char *, const char *, int);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
int stravis(char **, const char *, int);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
-#ifdef LIBBSD_NETBSD_VIS
|
|
Lucio Andrés Illanes Albornoz |
470950 |
-/* NetBSD prototype. */
|
|
Lucio Andrés Illanes Albornoz |
470950 |
-int LIBBSD_REDIRECT(strnvis, (char *, size_t, const char *, int),
|
|
Lucio Andrés Illanes Albornoz |
470950 |
- strnvis_netbsd);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
-#else
|
|
Lucio Andrés Illanes Albornoz |
470950 |
-/* OpenBSD prototype (current default). */
|
|
Lucio Andrés Illanes Albornoz |
470950 |
-int strnvis(char *, const char *, size_t, int);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
-#endif
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+/* NetBSD prototype */
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+int strnvis(char *, size_t, const char *, int);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
|
|
Lucio Andrés Illanes Albornoz |
470950 |
int strsvis(char *, const char *, int, const char *);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
int strsnvis(char *, size_t, const char *, int, const char *);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
@@ -135,14 +130,9 @@
|
|
Lucio Andrés Illanes Albornoz |
470950 |
int *);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
|
|
Lucio Andrés Illanes Albornoz |
470950 |
int strunvis(char *, const char *);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
-#ifdef LIBBSD_NETBSD_VIS
|
|
Lucio Andrés Illanes Albornoz |
470950 |
-/* NetBSD prototype. */
|
|
Lucio Andrés Illanes Albornoz |
470950 |
-int LIBBSD_REDIRECT(strnunvis, (char *, size_t, const char *),
|
|
Lucio Andrés Illanes Albornoz |
470950 |
- strnunvis_netbsd);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
-#else
|
|
Lucio Andrés Illanes Albornoz |
470950 |
-/* OpenBSD prototype (current default). */
|
|
Lucio Andrés Illanes Albornoz |
470950 |
-ssize_t strnunvis(char *, const char *, size_t);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
-#endif
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+/* NetBSD prototype */
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+int strnunvis(char *, size_t, const char *);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
|
|
Lucio Andrés Illanes Albornoz |
470950 |
int strunvisx(char *, const char *, int);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
int strnunvisx(char *, size_t, const char *, int);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
diff -Nru libbsd-0.9.1.orig/src/flopen.c libbsd-0.9.1/src/flopen.c
|
|
Lucio Andrés Illanes Albornoz |
470950 |
--- libbsd-0.9.1.orig/src/flopen.c 2018-05-21 04:33:33.000000000 +0200
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+++ libbsd-0.9.1/src/flopen.c 2018-05-30 15:09:48.789934331 +0200
|
|
Lucio Andrés Illanes Albornoz |
470950 |
@@ -32,6 +32,7 @@
|
|
Lucio Andrés Illanes Albornoz |
470950 |
#include <sys/stat.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
|
|
Lucio Andrés Illanes Albornoz |
470950 |
#include <errno.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <fcntl.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
#include <stdarg.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
#include <unistd.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
|
|
Lucio Andrés Illanes Albornoz |
470950 |
diff -Nru libbsd-0.9.1.orig/src/getentropy.c libbsd-0.9.1/src/getentropy.c
|
|
Lucio Andrés Illanes Albornoz |
470950 |
--- libbsd-0.9.1.orig/src/getentropy.c 2018-05-21 04:48:37.000000000 +0200
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+++ libbsd-0.9.1/src/getentropy.c 2018-05-30 15:44:15.596626881 +0200
|
|
Lucio Andrés Illanes Albornoz |
470950 |
@@ -26,6 +26,8 @@
|
|
Lucio Andrés Illanes Albornoz |
470950 |
|
|
Lucio Andrés Illanes Albornoz |
470950 |
#if defined(__linux__)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
#include "getentropy_linux.c"
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#elif defined(__midipix__)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include "getentropy_midipix.c"
|
|
Lucio Andrés Illanes Albornoz |
470950 |
#elif defined(__GNU__)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
#include "getentropy_hurd.c"
|
|
Lucio Andrés Illanes Albornoz |
470950 |
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
diff -Nru libbsd-0.9.1.orig/src/getentropy_midipix.c libbsd-0.9.1/src/getentropy_midipix.c
|
|
Lucio Andrés Illanes Albornoz |
470950 |
--- libbsd-0.9.1.orig/src/getentropy_midipix.c 1970-01-01 01:00:00.000000000 +0100
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+++ libbsd-0.9.1/src/getentropy_midipix.c 2018-05-30 15:43:30.744779217 +0200
|
|
Lucio Andrés Illanes Albornoz |
470950 |
@@ -0,0 +1,153 @@
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+/* $OpenBSD: getentropy_linux.c,v 1.45 2018/03/13 22:53:28 bcook Exp $ */
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+/*
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ * Copyright (c) 2014 Bob Beck <beck@obtuse.com>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ *
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ * Permission to use, copy, modify, and distribute this software for any
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ * purpose with or without fee is hereby granted, provided that the above
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ * copyright notice and this permission notice appear in all copies.
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ *
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ *
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ * Emulation of getentropy(2) as documented at:
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ * http://man.openbsd.org/getentropy.2
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ */
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#define _POSIX_C_SOURCE 199309L
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#define _GNU_SOURCE 1
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <sys/types.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <sys/param.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <sys/ioctl.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <sys/resource.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <sys/syscall.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <sys/statvfs.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <sys/socket.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <sys/mount.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <sys/mman.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <sys/stat.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <sys/time.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <stdlib.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <stdint.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <stdio.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <link.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <termios.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <fcntl.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <signal.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <string.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <errno.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <unistd.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <time.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include "hash/sha512.h"
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#ifdef HAVE_GETAUXVAL
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <sys/auxv.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#endif
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#include <sys/vfs.h>
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+int getentropy(void *buf, size_t len);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+static int gotdata(char *buf, size_t len);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+static int getentropy_urandom(void *buf, size_t len);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+int
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+getentropy(void *buf, size_t len)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+{
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ int ret = -1;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ if (len > 256) {
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ errno = EIO;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ return (-1);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ }
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ /*
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ * Try to get entropy with /dev/urandom
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ *
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ * This can fail if the process is inside a chroot or if file
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ * descriptors are exhausted.
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ */
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ ret = getentropy_urandom(buf, len);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ if (ret != -1)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ return (ret);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ errno = EIO;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ return (ret);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+}
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+/*
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ * Basic sanity checking; wish we could do better.
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ */
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+static int
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+gotdata(char *buf, size_t len)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+{
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ char any_set = 0;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ size_t i;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ for (i = 0; i < len; ++i)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ any_set |= buf[i];
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ if (any_set == 0)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ return (-1);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ return (0);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+}
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+static int
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+getentropy_urandom(void *buf, size_t len)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+{
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ struct stat st;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ size_t i;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ int fd, cnt, flags;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ int save_errno = errno;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+start:
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ flags = O_RDONLY;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#ifdef O_NOFOLLOW
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ flags |= O_NOFOLLOW;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#endif
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#ifdef O_CLOEXEC
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ flags |= O_CLOEXEC;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#endif
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ fd = open("/dev/urandom", flags, 0);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ if (fd == -1) {
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ if (errno == EINTR)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ goto start;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ goto nodevrandom;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ }
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#ifndef O_CLOEXEC
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#endif
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ /* Lightly verify that the device node looks sane */
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ if (fstat(fd, &st) == -1 || !S_ISCHR(st.st_mode)) {
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ close(fd);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ goto nodevrandom;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ }
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ for (i = 0; i < len; ) {
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ size_t wanted = len - i;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ ssize_t ret = read(fd, (char *)buf + i, wanted);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ if (ret == -1) {
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ if (errno == EAGAIN || errno == EINTR)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ continue;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ close(fd);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ goto nodevrandom;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ }
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ i += ret;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ }
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ close(fd);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ if (gotdata(buf, len) == 0) {
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ errno = save_errno;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ return (0); /* satisfied */
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ }
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+nodevrandom:
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ errno = EIO;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ return (-1);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+}
|
|
Lucio Andrés Illanes Albornoz |
470950 |
diff -Nru libbsd-0.9.1.orig/src/getpeereid.c libbsd-0.9.1/src/getpeereid.c
|
|
Lucio Andrés Illanes Albornoz |
470950 |
--- libbsd-0.9.1.orig/src/getpeereid.c 2017-06-06 04:06:45.000000000 +0200
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+++ libbsd-0.9.1/src/getpeereid.c 2018-05-30 15:10:23.777937764 +0200
|
|
Lucio Andrés Illanes Albornoz |
470950 |
@@ -40,7 +40,7 @@
|
|
Lucio Andrés Illanes Albornoz |
470950 |
getpeereid(int s, uid_t *euid, gid_t *egid)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
{
|
|
Lucio Andrés Illanes Albornoz |
470950 |
/* XXX: This should be autodetected at build time instead. */
|
|
Lucio Andrés Illanes Albornoz |
470950 |
-#if defined(__linux__)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#if defined(__linux__) || defined(__midipix__)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
struct ucred cred;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
#elif defined(__OpenBSD__)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
struct sockpeercred cred;
|
|
Lucio Andrés Illanes Albornoz |
470950 |
diff -Nru libbsd-0.9.1.orig/src/setproctitle.c libbsd-0.9.1/src/setproctitle.c
|
|
Lucio Andrés Illanes Albornoz |
470950 |
--- libbsd-0.9.1.orig/src/setproctitle.c 2018-04-21 23:30:22.000000000 +0200
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+++ libbsd-0.9.1/src/setproctitle.c 2018-05-30 15:13:25.245835004 +0200
|
|
Lucio Andrés Illanes Albornoz |
470950 |
@@ -221,8 +221,13 @@
|
|
Lucio Andrés Illanes Albornoz |
470950 |
#define SPT_MAXTITLE 255
|
|
Lucio Andrés Illanes Albornoz |
470950 |
#endif
|
|
Lucio Andrés Illanes Albornoz |
470950 |
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#ifdef __midipix__
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+void
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+setproctitle(const char *fmt, ...)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#else
|
|
Lucio Andrés Illanes Albornoz |
470950 |
void
|
|
Lucio Andrés Illanes Albornoz |
470950 |
setproctitle_impl(const char *fmt, ...)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#endif
|
|
Lucio Andrés Illanes Albornoz |
470950 |
{
|
|
Lucio Andrés Illanes Albornoz |
470950 |
/* Use buffer in case argv[0] is passed. */
|
|
Lucio Andrés Illanes Albornoz |
470950 |
char buf[SPT_MAXTITLE + 1];
|
|
Lucio Andrés Illanes Albornoz |
470950 |
@@ -280,6 +285,7 @@
|
|
Lucio Andrés Illanes Albornoz |
470950 |
*++nul = '\0';
|
|
Lucio Andrés Illanes Albornoz |
470950 |
}
|
|
Lucio Andrés Illanes Albornoz |
470950 |
}
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#ifndef __midipix__
|
|
Lucio Andrés Illanes Albornoz |
470950 |
__asm__(".symver setproctitle_impl,setproctitle@@LIBBSD_0.5");
|
|
Lucio Andrés Illanes Albornoz |
470950 |
|
|
Lucio Andrés Illanes Albornoz |
470950 |
/* The original function introduced in 0.2 was a stub, it only got implemented
|
|
Lucio Andrés Illanes Albornoz |
470950 |
@@ -293,3 +299,4 @@
|
|
Lucio Andrés Illanes Albornoz |
470950 |
__attribute__((alias("setproctitle_impl")));
|
|
Lucio Andrés Illanes Albornoz |
470950 |
#endif
|
|
Lucio Andrés Illanes Albornoz |
470950 |
__asm__(".symver setproctitle_stub,setproctitle@LIBBSD_0.2");
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#endif /* !__midipix__ */
|
|
Lucio Andrés Illanes Albornoz |
470950 |
diff -Nru libbsd-0.9.1.orig/src/unvis.c libbsd-0.9.1/src/unvis.c
|
|
Lucio Andrés Illanes Albornoz |
470950 |
--- libbsd-0.9.1.orig/src/unvis.c 2018-05-22 16:07:42.000000000 +0200
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+++ libbsd-0.9.1/src/unvis.c 2018-05-30 15:20:12.613101869 +0200
|
|
Lucio Andrés Illanes Albornoz |
470950 |
@@ -560,6 +560,8 @@
|
|
Lucio Andrés Illanes Albornoz |
470950 |
* OpenBSD, 2001: strnunvis(char *dst, const char *src, size_t dlen);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
* NetBSD: 2012, strnunvis(char *dst, size_t dlen, const char *src);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
*/
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#ifndef __midipix__ /* Temporary fix until upstream resolves this in a later version, */
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ /* do not upstream */
|
|
Lucio Andrés Illanes Albornoz |
470950 |
ssize_t
|
|
Lucio Andrés Illanes Albornoz |
470950 |
strnunvis_openbsd(char *dst, const char *src, size_t dlen)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
{
|
|
Lucio Andrés Illanes Albornoz |
470950 |
@@ -573,3 +575,9 @@
|
|
Lucio Andrés Illanes Albornoz |
470950 |
return strnunvisx(dst, dlen, src, 0);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
}
|
|
Lucio Andrés Illanes Albornoz |
470950 |
__asm__(".symver strnunvis_netbsd,strnunvis@LIBBSD_0.9.1");
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#else
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+int strnunvis(char *dst, size_t dlen, const char *src)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+{
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ return strnunvisx(dst, dlen, src, 0);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+}
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#endif /* __midipix__ */
|
|
Lucio Andrés Illanes Albornoz |
470950 |
diff -Nru libbsd-0.9.1.orig/src/vis.c libbsd-0.9.1/src/vis.c
|
|
Lucio Andrés Illanes Albornoz |
470950 |
--- libbsd-0.9.1.orig/src/vis.c 2018-05-22 16:07:42.000000000 +0200
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+++ libbsd-0.9.1/src/vis.c 2018-05-30 15:34:26.362596310 +0200
|
|
Lucio Andrés Illanes Albornoz |
470950 |
@@ -718,6 +718,7 @@
|
|
Lucio Andrés Illanes Albornoz |
470950 |
* OpenBSD, 2001: strnvis(char *dst, const char *src, size_t dlen, int flag);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
* NetBSD: 2012, strnvis(char *dst, size_t dlen, const char *src, int flag);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
*/
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#ifndef __midipix__ /* see src/unvis.c */
|
|
Lucio Andrés Illanes Albornoz |
470950 |
int
|
|
Lucio Andrés Illanes Albornoz |
470950 |
strnvis_openbsd(char *mbdst, const char *mbsrc, size_t dlen, int flags)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
{
|
|
Lucio Andrés Illanes Albornoz |
470950 |
@@ -731,6 +732,13 @@
|
|
Lucio Andrés Illanes Albornoz |
470950 |
return istrsenvisxl(&mbdst, &dlen, mbsrc, flags, "", NULL);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
}
|
|
Lucio Andrés Illanes Albornoz |
470950 |
__asm__(".symver strnvis_netbsd,strnvis@LIBBSD_0.9.1");
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#else
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+int
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+strnvis(char *mbdst, size_t dlen, const char *mbsrc, int flags)
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+{
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+ return istrsenvisxl(&mbdst, &dlen, mbsrc, flags, "", NULL);
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+}
|
|
Lucio Andrés Illanes Albornoz |
470950 |
+#endif
|
|
Lucio Andrés Illanes Albornoz |
470950 |
|
|
Lucio Andrés Illanes Albornoz |
470950 |
int
|
|
Lucio Andrés Illanes Albornoz |
470950 |
stravis(char **mbdstp, const char *mbsrc, int flags)
|