From 8612366a96d21f2de84e78a2c844f02ef68e9376 Mon Sep 17 00:00:00 2001 From: Lubos Dolezel Date: Sat, 29 Apr 2017 19:53:14 +0200 Subject: [PATCH 01/11] Fix kqueue on i386 --- src/external/libkqueue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/external/libkqueue b/src/external/libkqueue index 0e5c51eea..284c5896a 160000 --- a/src/external/libkqueue +++ b/src/external/libkqueue @@ -1 +1 @@ -Subproject commit 0e5c51eeae29831843d81c89f58e5040f72e14b5 +Subproject commit 284c5896a65c81dbfb3a490a5560e124373f1fab -- 2.51.2 From 984bee8733e6acae4906590b7173cbe29acaa072 Mon Sep 17 00:00:00 2001 From: Lubos Dolezel Date: Tue, 2 May 2017 20:04:09 +0200 Subject: [PATCH 02/11] Add libtelnet --- .gitmodules | 3 +++ src/CMakeLists.txt | 1 + src/external/libtelnet | 1 + 3 files changed, 5 insertions(+) create mode 160000 src/external/libtelnet diff --git a/.gitmodules b/.gitmodules index 01a03b914..d43b03e9e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -242,3 +242,6 @@ [submodule "src/external/Heimdal"] path = src/external/Heimdal url = ../darling-Heimdal.git +[submodule "src/external/libtelnet"] + path = src/external/libtelnet + url = ../darling-libtelnet.git diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 90f0e69e7..ef85eb2a8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -127,6 +127,7 @@ add_subdirectory(external/liblzma) add_subdirectory(external/pcre) add_subdirectory(external/sqlite) add_subdirectory(external/openpam) +add_subdirectory(external/libtelnet) add_subdirectory(SystemConfiguration) add_subdirectory(CoreServices) #add_subdirectory(ApplicationServices) diff --git a/src/external/libtelnet b/src/external/libtelnet new file mode 160000 index 000000000..05cefce4c --- /dev/null +++ b/src/external/libtelnet @@ -0,0 +1 @@ +Subproject commit 05cefce4c8893ef0239dcb3979b26852bfa3937e -- 2.51.2 From 4818bbd65cff2a68d21706b45ab70de725669096 Mon Sep 17 00:00:00 2001 From: Lubos Dolezel Date: Tue, 2 May 2017 20:26:19 +0200 Subject: [PATCH 03/11] Add remote_cmds. Build domainname, telnet and telnetd --- .gitmodules | 3 +++ src/CMakeLists.txt | 1 + src/external/remote_cmds | 1 + 3 files changed, 5 insertions(+) create mode 160000 src/external/remote_cmds diff --git a/.gitmodules b/.gitmodules index d43b03e9e..59cbde925 100644 --- a/.gitmodules +++ b/.gitmodules @@ -245,3 +245,6 @@ [submodule "src/external/libtelnet"] path = src/external/libtelnet url = ../darling-libtelnet.git +[submodule "src/external/remote_cmds"] + path = src/external/remote_cmds + url = ../darling-remote_cmds.git diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ef85eb2a8..7e80361e5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -128,6 +128,7 @@ add_subdirectory(external/pcre) add_subdirectory(external/sqlite) add_subdirectory(external/openpam) add_subdirectory(external/libtelnet) +add_subdirectory(external/remote_cmds) add_subdirectory(SystemConfiguration) add_subdirectory(CoreServices) #add_subdirectory(ApplicationServices) diff --git a/src/external/remote_cmds b/src/external/remote_cmds new file mode 160000 index 000000000..be1819683 --- /dev/null +++ b/src/external/remote_cmds @@ -0,0 +1 @@ +Subproject commit be181968345392b76a6ee2fbd4d1d93293350dfb -- 2.51.2 From bb34fcfd2275199fb0042f0a43cab0caf247cc42 Mon Sep 17 00:00:00 2001 From: Lubos Dolezel Date: Tue, 2 May 2017 21:21:48 +0200 Subject: [PATCH 04/11] Translate cmsg_level in recvmsg()/sendmsg() - needed for passing fds over Unix sockets --- src/kernel/emulation/linux/network/recvmsg.c | 25 +++++++++++++++++++- src/kernel/emulation/linux/network/recvmsg.h | 3 +++ src/kernel/emulation/linux/network/sendmsg.c | 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/kernel/emulation/linux/network/recvmsg.c b/src/kernel/emulation/linux/network/recvmsg.c index d2abaeb9c..6130e61b8 100644 --- a/src/kernel/emulation/linux/network/recvmsg.c +++ b/src/kernel/emulation/linux/network/recvmsg.c @@ -4,6 +4,7 @@ #include #include #include "duct.h" +#include "getsockopt.h" extern void *malloc(__SIZE_TYPE__ size); extern void free(void* ptr); @@ -70,7 +71,7 @@ long sys_recvmsg_nocancel(int socket, struct bsd_msghdr* msg, int flags) if (lmsg.msg_controllen > 0) { bchdr->cmsg_len = lchdr->cmsg_len; - bchdr->cmsg_level = lchdr->cmsg_level; + bchdr->cmsg_level = socket_level_linux_to_bsd(lchdr->cmsg_level); bchdr->cmsg_type = lchdr->cmsg_type; // __simple_printf("Copy %p to %p, %d bytes (of %d)\n", lchdr->cmsg_data, bchdr->cmsg_data, lchdr->cmsg_len - sizeof(struct linux_cmsghdr), lchdr->cmsg_len); @@ -98,3 +99,25 @@ long sys_recvmsg_nocancel(int socket, struct bsd_msghdr* msg, int flags) } +int socket_level_bsd_to_linux(int level) +{ + switch (level) + { + case BSD_SOL_SOCKET: + return LINUX_SOL_SOCKET; + default: + return level; + } +} + +int socket_level_linux_to_bsd(int level) +{ + switch (level) + { + case LINUX_SOL_SOCKET: + return BSD_SOL_SOCKET; + default: + return level; + } +} + diff --git a/src/kernel/emulation/linux/network/recvmsg.h b/src/kernel/emulation/linux/network/recvmsg.h index 0effc4610..0ac78eed8 100644 --- a/src/kernel/emulation/linux/network/recvmsg.h +++ b/src/kernel/emulation/linux/network/recvmsg.h @@ -44,6 +44,9 @@ struct linux_cmsghdr long sys_recvmsg(int socket, struct bsd_msghdr* msg, int flags); long sys_recvmsg_nocancel(int socket, struct bsd_msghdr* msg, int flags); +int socket_level_bsd_to_linux(int level); +int socket_level_linux_to_bsd(int level); + #define LINUX_SYS_RECVMSG 17 #endif diff --git a/src/kernel/emulation/linux/network/sendmsg.c b/src/kernel/emulation/linux/network/sendmsg.c index 457b9e628..6ab375ecf 100644 --- a/src/kernel/emulation/linux/network/sendmsg.c +++ b/src/kernel/emulation/linux/network/sendmsg.c @@ -41,7 +41,7 @@ long sys_sendmsg_nocancel(int socket, const struct bsd_msghdr* msg, int flags) lmsg.msg_controllen = msg->msg_controllen + 4; lchdr->cmsg_len = bchdr->cmsg_len; - lchdr->cmsg_level = bchdr->cmsg_level; + lchdr->cmsg_level = socket_level_bsd_to_linux(bchdr->cmsg_level); lchdr->cmsg_type = bchdr->cmsg_type; memcpy(lchdr->cmsg_data, bchdr->cmsg_data, -- 2.51.2 From 939a8da24fa407d511f03a210bd30ac5ee82872d Mon Sep 17 00:00:00 2001 From: Lubos Dolezel Date: Tue, 2 May 2017 22:53:29 +0200 Subject: [PATCH 05/11] telnetd build fix --- src/external/remote_cmds | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/external/remote_cmds b/src/external/remote_cmds index be1819683..a38ff35e8 160000 --- a/src/external/remote_cmds +++ b/src/external/remote_cmds @@ -1 +1 @@ -Subproject commit be181968345392b76a6ee2fbd4d1d93293350dfb +Subproject commit a38ff35e854f12aa63b5c85cf502a0cab229d66f -- 2.51.2 From 049848cc93d7057eafbec7a90a432bef5e5804af Mon Sep 17 00:00:00 2001 From: Lubos Dolezel Date: Tue, 2 May 2017 22:55:28 +0200 Subject: [PATCH 06/11] Build notifyd and notifyutil --- src/libnotify/CMakeLists.txt | 5 +++++ src/libnotify/notifyd/CMakeLists.txt | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/libnotify/notifyd/CMakeLists.txt diff --git a/src/libnotify/CMakeLists.txt b/src/libnotify/CMakeLists.txt index 66ad43fc3..e1d840c43 100644 --- a/src/libnotify/CMakeLists.txt +++ b/src/libnotify/CMakeLists.txt @@ -43,5 +43,10 @@ add_circular(system_notify FAT #target_link_libraries(system_notify system_c system_kernel system_blocks libdispatch_shared launch system_dyld system_malloc system_pthread) #make_fat(system_notify) +add_darling_executable(notifyutil notifyutil/notifyutil.c) + install(TARGETS system_notify DESTINATION libexec/darling/usr/lib/system) +install(TARGETS notifyutil DESTINATION libexec/darling/usr/bin) +install(FILES notifyutil.1 DESTINATION libexec/darling/usr/share/man/man1) +add_subdirectory(notifyd) diff --git a/src/libnotify/notifyd/CMakeLists.txt b/src/libnotify/notifyd/CMakeLists.txt new file mode 100644 index 000000000..76e6f5568 --- /dev/null +++ b/src/libnotify/notifyd/CMakeLists.txt @@ -0,0 +1,24 @@ +project(notifyd) + +include_directories( + ${CMAKE_SOURCE_DIR}/src/external/syslog/libsystem_asl.tproj/include + ${CMAKE_SOURCE_DIR}/src/libc/stdtime/FreeBSD +) + +set(notifyd_sources + notifyd.c + notify_proc.c + pathwatch.c + service.c + timer.c + ${CMAKE_CURRENT_BINARY_DIR}/../notify_ipcServer.c +) + +add_darling_executable(notifyd ${notifyd_sources}) +target_link_libraries(notifyd system) + +install(TARGETS notifyd DESTINATION libexec/darling/usr/sbin) +install(FILES com.apple.notifyd.plist DESTINATION libexec/darling/System/Library/LaunchDaemons) +install(FILES notifyd.8 DESTINATION libexec/darling/usr/share/man/man8) +install(FILES notify.conf.MacOSX RENAME notify.conf DESTINATION libexec/darling/etc) + -- 2.51.2 From 5ffd6023fad56c9c8eade23f8a0a8582ef93f21d Mon Sep 17 00:00:00 2001 From: Lubos Dolezel Date: Tue, 2 May 2017 23:28:28 +0200 Subject: [PATCH 07/11] Add some qtn_proc dummies in libquarantine --- src/quarantine/quarantine.c | 28 ++++++++++++++++++++++++++++ src/quarantine/quarantine.h | 7 +++++++ 2 files changed, 35 insertions(+) diff --git a/src/quarantine/quarantine.c b/src/quarantine/quarantine.c index 79fe49fc1..3de97e411 100644 --- a/src/quarantine/quarantine.c +++ b/src/quarantine/quarantine.c @@ -115,3 +115,31 @@ int __esp_notify_ns(const char *a, void *b) { return QTN_NOT_QUARANTINED; } + +struct _qtn_proc_t +{ + int dummy; +}; + +qtn_proc_t qtn_proc_alloc(void) +{ + return (qtn_proc_t) malloc(sizeof(qtn_proc_t)); +} + +void qtn_proc_set_identifier(qtn_proc_t proc, const char* ident) +{ +} + +void qtn_proc_set_flags(qtn_proc_t proc, unsigned int flags) +{ +} + +void qtn_proc_apply_to_self(qtn_proc_t proc) +{ +} + +void qtn_proc_free(qtn_proc_t proc) +{ + free(proc); +} + diff --git a/src/quarantine/quarantine.h b/src/quarantine/quarantine.h index d1bc33836..5e1b01e49 100644 --- a/src/quarantine/quarantine.h +++ b/src/quarantine/quarantine.h @@ -53,6 +53,13 @@ extern int __esp_enabled(); extern int __esp_check_ns(const char *a, void *b); extern int __esp_notify_ns(const char *a, void *b); +typedef struct _qtn_proc_t* qtn_proc_t; +qtn_proc_t qtn_proc_alloc(void); +void qtn_proc_set_identifier(qtn_proc_t proc, const char* ident); +void qtn_proc_set_flags(qtn_proc_t proc, unsigned int flags); +void qtn_proc_apply_to_self(qtn_proc_t proc); +void qtn_proc_free(qtn_proc_t proc); + #define QTN_SERIALIZED_DATA_MAX 4096 #define qtn_file_alloc _qtn_file_alloc -- 2.51.2 From 30057f1d2fe56c4997958819baeedcae494bb462 Mon Sep 17 00:00:00 2001 From: Lubos Dolezel Date: Tue, 2 May 2017 23:36:31 +0200 Subject: [PATCH 08/11] Fix notifyutil man page install --- src/libnotify/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libnotify/CMakeLists.txt b/src/libnotify/CMakeLists.txt index e1d840c43..1727c2a30 100644 --- a/src/libnotify/CMakeLists.txt +++ b/src/libnotify/CMakeLists.txt @@ -47,6 +47,6 @@ add_darling_executable(notifyutil notifyutil/notifyutil.c) install(TARGETS system_notify DESTINATION libexec/darling/usr/lib/system) install(TARGETS notifyutil DESTINATION libexec/darling/usr/bin) -install(FILES notifyutil.1 DESTINATION libexec/darling/usr/share/man/man1) +install(FILES notifyutil/notifyutil.1 DESTINATION libexec/darling/usr/share/man/man1) add_subdirectory(notifyd) -- 2.51.2 From 9ace875930650c14f7d9d1a8ff090f2bf577edc3 Mon Sep 17 00:00:00 2001 From: Lubos Dolezel Date: Tue, 2 May 2017 23:50:43 +0200 Subject: [PATCH 09/11] Add syslogd build + try to fix build problems --- src/CMakeLists.txt | 2 +- src/external/libxpc | 2 +- src/external/remote_cmds | 2 +- src/external/syslog | 2 +- src/libinfo/gen.subproj/CMakeLists.txt | 2 +- src/libnotify/notifyd/CMakeLists.txt | 1 + 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7e80361e5..96c777d93 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -110,7 +110,7 @@ add_subdirectory(libffi) add_subdirectory(xtrace) add_subdirectory(dyld) add_subdirectory(external/objc4/runtime) -add_subdirectory(external/syslog/libsystem_asl.tproj) +add_subdirectory(external/syslog) add_subdirectory(external/libdispatch) add_subdirectory(external/zlib) add_subdirectory(external/bzip2) diff --git a/src/external/libxpc b/src/external/libxpc index 1d45b0579..b0d590f7f 160000 --- a/src/external/libxpc +++ b/src/external/libxpc @@ -1 +1 @@ -Subproject commit 1d45b0579297dfcd81b947165b08d6dbf20d094c +Subproject commit b0d590f7f6e9f0b7f7707bccef1547faa4c11b88 diff --git a/src/external/remote_cmds b/src/external/remote_cmds index a38ff35e8..80711adaf 160000 --- a/src/external/remote_cmds +++ b/src/external/remote_cmds @@ -1 +1 @@ -Subproject commit a38ff35e854f12aa63b5c85cf502a0cab229d66f +Subproject commit 80711adafae7bb9a77dbbbd25b23cc7fe0122104 diff --git a/src/external/syslog b/src/external/syslog index d1aa222eb..dc71f2fb3 160000 --- a/src/external/syslog +++ b/src/external/syslog @@ -1 +1 @@ -Subproject commit d1aa222ebd06b6604f3aeb5e103dd591810c0268 +Subproject commit dc71f2fb3c73243496fb51df9446e1eb5811beb7 diff --git a/src/libinfo/gen.subproj/CMakeLists.txt b/src/libinfo/gen.subproj/CMakeLists.txt index 307aca83a..cbabf2bfe 100644 --- a/src/libinfo/gen.subproj/CMakeLists.txt +++ b/src/libinfo/gen.subproj/CMakeLists.txt @@ -10,7 +10,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../external/libdispatch/) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../lookup.subproj) set(info-gen_sources - #configuration_profile.c + configuration_profile.c ether_addr.c getifaddrs.c getifmaddrs.c diff --git a/src/libnotify/notifyd/CMakeLists.txt b/src/libnotify/notifyd/CMakeLists.txt index 76e6f5568..390635db8 100644 --- a/src/libnotify/notifyd/CMakeLists.txt +++ b/src/libnotify/notifyd/CMakeLists.txt @@ -5,6 +5,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/libc/stdtime/FreeBSD ) +mig(../notify_ipc.defs) set(notifyd_sources notifyd.c notify_proc.c -- 2.51.2 From aa796d9f0ef0eaea19f86e375a9961e6c9af4ec1 Mon Sep 17 00:00:00 2001 From: Lubos Dolezel Date: Tue, 2 May 2017 23:54:51 +0200 Subject: [PATCH 10/11] Fix syslog build problems --- src/external/syslog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/external/syslog b/src/external/syslog index dc71f2fb3..9ffb5e4d7 160000 --- a/src/external/syslog +++ b/src/external/syslog @@ -1 +1 @@ -Subproject commit dc71f2fb3c73243496fb51df9446e1eb5811beb7 +Subproject commit 9ffb5e4d7d93a3cd0879e95bd0b2abfb9b7bad38 -- 2.51.2 From b3b2c8448d162dd24896b6d015456304ae950b17 Mon Sep 17 00:00:00 2001 From: Lubos Dolezel Date: Wed, 3 May 2017 00:10:28 +0200 Subject: [PATCH 11/11] Build aslmanager and the syslog tool --- src/external/syslog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/external/syslog b/src/external/syslog index 9ffb5e4d7..35cbdc269 160000 --- a/src/external/syslog +++ b/src/external/syslog @@ -1 +1 @@ -Subproject commit 9ffb5e4d7d93a3cd0879e95bd0b2abfb9b7bad38 +Subproject commit 35cbdc269f5f351581552c69d9750ea280d5f1cf -- 2.51.2