SecBSD's official ports repository

This commit is contained in:
purplerain 2023-08-16 22:26:55 +00:00
commit 2c0afcbbf3
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
64331 changed files with 5339189 additions and 0 deletions

30
devel/adb/Makefile Normal file
View file

@ -0,0 +1,30 @@
COMMENT = Android Debug Bridge
V = 5.1.1_r4
DISTNAME = adb-${V}
PKGNAME = ${DISTNAME:S/_r/./}
REVISION = 2
GH_ACCOUNT = android
GH_PROJECT = platform_system_core
GH_TAGNAME = android-${V}
CATEGORIES = devel
HOMEPAGE = https://developer.android.com/tools/help/adb.html
# Apache License v2.0
PERMIT_PACKAGE = Yes
WANTLIB = c crypto pthread usb-1.0 z
LIB_DEPENDS = devel/libusb1
NO_TEST = Yes
USE_GMAKE = Yes
WRKBUILD = $(WRKSRC)/adb
do-install:
${INSTALL_PROGRAM} ${WRKBUILD}/adb ${PREFIX}/bin
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/adb
${INSTALL_DATA} ${WRKBUILD}/NOTICE ${PREFIX}/share/doc/adb/NOTICE
.include <bsd.port.mk>

2
devel/adb/distinfo Normal file
View file

@ -0,0 +1,2 @@
SHA256 (adb-5.1.1_r4.tar.gz) = B2Qhp0LvmBWNXqKQuK7QB/IRVSHx45gy2L41YOmQ6hM=
SIZE (adb-5.1.1_r4.tar.gz) = 1210714

View file

@ -0,0 +1,51 @@
--- adb/Makefile.orig Thu May 28 11:38:32 2015
+++ adb/Makefile Thu May 28 11:38:46 2015
@@ -0,0 +1,48 @@
+SRCS += adb.c
+SRCS += adb_auth_host.c
+SRCS += adb_client.c
+SRCS += commandline.c
+SRCS += console.c
+SRCS += fdevent.c
+SRCS += file_sync_client.c
+SRCS += services.c
+SRCS += sockets.c
+SRCS += transport.c
+SRCS += transport_local.c
+SRCS += transport_usb.c
+SRCS += usb_libusb.c
+SRCS += usb_vendors.c
+SRCS += get_my_path_generic.c
+
+VPATH += ../libcutils
+SRCS += load_file.c
+SRCS += socket_inaddr_any_server.c
+SRCS += socket_local_client.c
+SRCS += socket_local_server.c
+SRCS += socket_loopback_client.c
+SRCS += socket_loopback_server.c
+SRCS += socket_network_client.c
+
+VPATH += ../libzipfile
+SRCS += centraldir.c
+SRCS += zipfile.c
+
+CPPFLAGS += -DADB_HOST=1
+CPPFLAGS += -DHAVE_FORKEXEC=1
+CPPFLAGS += -DHAVE_OFF64_T=1
+CPPFLAGS += -DHAVE_TERMIO_H
+CPPFLAGS += -I.
+CPPFLAGS += -I../include
+CPPFLAGS += $(shell pkg-config --cflags libusb-1.0)
+
+LIBS += -lcrypto -lpthread -lz $(shell pkg-config --libs libusb-1.0)
+
+OBJS= $(SRCS:.c=.o)
+
+all: adb
+
+adb: $(OBJS)
+ $(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS)
+
+clean:
+ rm -f $(OBJS)

View file

@ -0,0 +1,23 @@
Fix build with opaque RSA in LibreSSL 3.5.
Index: adb/adb_auth_host.c
--- adb/adb_auth_host.c.orig
+++ adb/adb_auth_host.c
@@ -82,7 +82,7 @@ static int RSA_to_RSAPublicKey(RSA *rsa, RSAPublicKey
}
BN_set_bit(r32, 32);
- BN_copy(n, rsa->n);
+ BN_copy(n, RSA_get0_n(rsa));
BN_set_bit(r, RSANUMWORDS * 32);
BN_mod_sqr(rr, r, n, ctx);
BN_div(NULL, rem, n, r32, ctx);
@@ -96,7 +96,7 @@ static int RSA_to_RSAPublicKey(RSA *rsa, RSAPublicKey
BN_div(n, rem, n, r32, ctx);
pkey->n[i] = BN_get_word(rem);
}
- pkey->exponent = BN_get_word(rsa->e);
+ pkey->exponent = BN_get_word(RSA_get0_e(rsa));
out:
BN_free(n0inv);

View file

@ -0,0 +1,20 @@
--- adb/adb.c.orig Mon Feb 9 09:10:55 2015
+++ adb/adb.c Tue May 5 07:56:50 2015
@@ -1191,7 +1191,7 @@ int launch_server(int server_port)
char str_port[30];
snprintf(str_port, sizeof(str_port), "%d", server_port);
// child process
- int result = execl(path, "adb", "-P", str_port, "fork-server", "server", NULL);
+ int result = execlp(path, "adb", "-P", str_port, "fork-server", "server", NULL);
// this should not return
fprintf(stderr, "OOPS! execl returned %d, errno: %d\n", result, errno);
} else {
@@ -1687,6 +1687,8 @@ int handle_host_request(char *service, transport_type
int main(int argc, char **argv)
{
+ init_my_path(argv[0]);
+
#if ADB_HOST
adb_sysdeps_init();
adb_trace_init();

View file

@ -0,0 +1,10 @@
--- adb/adb.h.orig Mon Feb 9 09:10:55 2015
+++ adb/adb.h Tue May 5 07:56:50 2015
@@ -260,6 +260,7 @@ void fatal_errno(const char *fmt, ...);
void handle_packet(apacket *p, atransport *t);
void send_packet(apacket *p, atransport *t);
+void init_my_path(const char* exe);
void get_my_path(char *s, size_t maxLen);
int launch_server(int server_port);
int adb_main(int is_daemon, int server_port);

View file

@ -0,0 +1,39 @@
--- adb/get_my_path_generic.c.orig Tue May 5 07:56:50 2015
+++ adb/get_my_path_generic.c Tue May 5 07:56:50 2015
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string.h>
+#include <unistd.h>
+
+static char const* exe_buf;
+
+void init_my_path(const char* exe)
+{
+ exe_buf = exe;
+}
+
+void get_my_path(char *exe, size_t maxLen)
+{
+ if(exe_buf == NULL) {
+ exe[0] = '\0';
+ return;
+ }
+
+ strlcpy(exe, exe_buf, maxLen);
+}
+

View file

@ -0,0 +1,10 @@
--- adb/sysdeps.h.orig Mon Feb 9 09:10:55 2015
+++ adb/sysdeps.h Tue May 5 07:56:50 2015
@@ -268,6 +268,7 @@ extern char* adb_strtok_r(char *str, const char *deli
#include <signal.h>
#include <sys/wait.h>
#include <sys/stat.h>
+#include <sys/socket.h>
#include <fcntl.h>
#include <pthread.h>

View file

@ -0,0 +1,24 @@
Add error checking and avoid %n
Index: adb/transport.c
--- adb/transport.c.orig
+++ adb/transport.c
@@ -910,13 +910,15 @@ static const char *statename(atransport *t)
static void add_qual(char **buf, size_t *buf_size,
const char *prefix, const char *qual, int sanitize_qual)
{
- size_t len;
- int prefix_len;
+ size_t len, prefix_len;
if (!buf || !*buf || !buf_size || !*buf_size || !qual || !*qual)
return;
- len = snprintf(*buf, *buf_size, "%s%n%s", prefix, &prefix_len, qual);
+ prefix_len = strlen(prefix);
+ if (prefix_len + strlen(qual) >= *buf_size)
+ return;
+ len = snprintf(*buf, *buf_size, "%s%s", prefix, qual);
if (sanitize_qual) {
char *cp;

View file

@ -0,0 +1,75 @@
--- adb/usb_libusb.c.orig Mon Feb 9 09:10:55 2015
+++ adb/usb_libusb.c Tue May 5 07:56:50 2015
@@ -17,11 +17,6 @@
* limitations under the License.
*/
-#include <sys/endian.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-
#include <err.h>
#include <errno.h>
#include <poll.h>
@@ -37,7 +32,7 @@
#define TRACE_TAG TRACE_USB
#include "adb.h"
-static adb_mutex_t usb_lock = ADB_MUTEX_INITIALIZER;
+adb_mutex_t usb_lock = ADB_MUTEX_INITIALIZER;
static libusb_context *ctx = NULL;
struct usb_handle
@@ -246,8 +241,8 @@ void usb_kick(struct usb_handle *h)
}
int
-check_usb_interface(libusb_interface *interface,
- libusb_device_descriptor *desc,
+check_usb_interface(struct libusb_interface const *interface,
+ struct libusb_device_descriptor const *desc,
struct usb_handle *uh)
{
int e;
@@ -257,7 +252,7 @@ check_usb_interface(libusb_interface *interface,
return -1;
}
- libusb_interface_descriptor *idesc = &interface->altsetting[0];
+ struct libusb_interface_descriptor const *idesc = &interface->altsetting[0];
if (idesc->bNumEndpoints != 2) {
D("check_usb_interface(): Interface have not 2 endpoints, ignoring\n");
@@ -265,7 +260,7 @@ check_usb_interface(libusb_interface *interface,
}
for (e = 0; e < idesc->bNumEndpoints; e++) {
- libusb_endpoint_descriptor *edesc = &idesc->endpoint[e];
+ struct libusb_endpoint_descriptor const *edesc = &idesc->endpoint[e];
if (edesc->bmAttributes != LIBUSB_TRANSFER_TYPE_BULK) {
D("check_usb_interface(): Endpoint (%u) is not bulk (%u), ignoring\n",
@@ -304,8 +299,9 @@ check_usb_interface(libusb_interface *interface,
}
int
-check_usb_interfaces(libusb_config_descriptor *config,
- libusb_device_descriptor *desc, struct usb_handle *uh)
+check_usb_interfaces(struct libusb_config_descriptor *config,
+ struct libusb_device_descriptor *desc,
+ struct usb_handle *uh)
{
int i;
@@ -382,8 +378,8 @@ check_device(libusb_device *dev)
int found = -1;
char serial[256] = {0};
- libusb_device_descriptor desc;
- libusb_config_descriptor *config = NULL;
+ struct libusb_device_descriptor desc;
+ struct libusb_config_descriptor *config = NULL;
int r = libusb_get_device_descriptor(dev, &desc);

View file

@ -0,0 +1,13 @@
--- libsparse/defs.h.orig Mon Feb 9 09:10:55 2015
+++ libsparse/defs.h Tue May 5 07:56:50 2015
@@ -20,4 +20,10 @@
#define __unused __attribute__((__unused__))
#endif
+#ifdef __OpenBSD__
+typedef off_t off64_t;
+#define lseek64 lseek
+#define ftruncate64 ftruncate
+#endif
+
#endif /* _LIBSPARSE_DEFS_H_ */

View file

@ -0,0 +1,11 @@
--- libsparse/output_file.c.orig Mon Feb 9 09:10:55 2015
+++ libsparse/output_file.c Tue May 5 07:56:50 2015
@@ -41,7 +41,7 @@
#define ftruncate64 ftruncate
#endif
-#if defined(__APPLE__) && defined(__MACH__)
+#if defined(__OpenBSD__) || defined(__APPLE__) && defined(__MACH__)
#define lseek64 lseek
#define ftruncate64 ftruncate
#define mmap64 mmap

2
devel/adb/pkg/DESCR Normal file
View file

@ -0,0 +1,2 @@
Android Debug Bridge (adb) is a command line tool for communicating with Android
emulators and devices.

3
devel/adb/pkg/PLIST Normal file
View file

@ -0,0 +1,3 @@
@bin bin/adb
share/doc/adb/
share/doc/adb/NOTICE