net/openrsync: import openrsync-0.20190221

Implementation of rsync with a BSD (ISC) license.
This commit is contained in:
kamil 2019-03-11 16:27:03 +00:00
parent 7945db9595
commit f1ed1a2dff
9 changed files with 216 additions and 0 deletions

1
net/openrsync/DESCR Normal file
View file

@ -0,0 +1 @@
Implementation of rsync with a BSD (ISC) license.

19
net/openrsync/Makefile Normal file
View file

@ -0,0 +1,19 @@
# $NetBSD: Makefile,v 1.1 2019/03/11 16:27:03 kamil Exp $
GITHUB_PROJECT= openrsync
GITHUB_TAG= f18392f58d1f0bc72917e3ac3a46be74c194688d
DISTNAME= openrsync-0.20190221
CATEGORIES= net
MASTER_SITES= ${MASTER_SITE_GITHUB:=kristapsdz/}
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= https://github.com/kristapsdz/openrsync
COMMENT= BSD-licensed implementation of rsync
LICENSE= isc
WRKSRC= ${WRKDIR}/openrsync-${GITHUB_TAG}
INSTALL_MAKE_FLAGS+= PREFIX=${PREFIX}
INSTALL_MAKE_FLAGS+= MANDIR=${PREFIX}/${PKGMANDIR}
.include "../../mk/bsd.pkg.mk"

5
net/openrsync/PLIST Normal file
View file

@ -0,0 +1,5 @@
@comment $NetBSD: PLIST,v 1.1 2019/03/11 16:27:03 kamil Exp $
bin/openrsync
man/man1/openrsync.1
man/man5/rsync.5
man/man5/rsyncd.5

11
net/openrsync/distinfo Normal file
View file

@ -0,0 +1,11 @@
$NetBSD: distinfo,v 1.1 2019/03/11 16:27:03 kamil Exp $
SHA1 (openrsync-0.20190221-f18392f58d1f0bc72917e3ac3a46be74c194688d.tar.gz) = 5439cc9d8854c36fc7f7cc2db49d5ced4d73f4a5
RMD160 (openrsync-0.20190221-f18392f58d1f0bc72917e3ac3a46be74c194688d.tar.gz) = d6fd986bbec6c01a5967ab5083a409c1373302e4
SHA512 (openrsync-0.20190221-f18392f58d1f0bc72917e3ac3a46be74c194688d.tar.gz) = 4c4a5ddda02e577f812a9832b6afb63104f65f76446037ddb30bf40aa0a269e919e100c7a688b5717ed6a10aa0f7698114e5a77021df2d1deb44b87b9aa36a82
Size (openrsync-0.20190221-f18392f58d1f0bc72917e3ac3a46be74c194688d.tar.gz) = 73171 bytes
SHA1 (patch-Makefile) = ed03f7c75fb958ffa5cb7b046f1871a74711fce0
SHA1 (patch-extern.h) = c479848ab9741ad563b715c9f10786b22854766f
SHA1 (patch-pledge.c) = 940beb1c5f339221b0252f6fd228fcf848b51042
SHA1 (patch-recallocarray.c) = 4ba079d9d368680aff56fc0d4a04fcd6778a3aed
SHA1 (patch-unveil.c) = e40ec3d6cd9e2ff032a9704baaa7da9993351fd1

View file

@ -0,0 +1,32 @@
$NetBSD: patch-Makefile,v 1.1 2019/03/11 16:27:03 kamil Exp $
Add fallback files with functions missing on !OpenBSD.
Specify -D_OPENBSD_SOURCE to enable OpenBSD APIs on NetBSD.
--- Makefile.orig 2019-02-21 15:41:00.000000000 +0000
+++ Makefile
@@ -12,12 +12,15 @@ OBJS = blocks.o \
md4.o \
mkpath.o \
mktemp.o \
+ pledge.o \
+ recallocarray.o \
receiver.o \
sender.o \
server.o \
session.o \
socket.o \
symlinks.o \
+ unveil.o \
uploader.o
ALLOBJS = $(OBJS) \
main.o
@@ -27,7 +30,7 @@ MANDIR = $(PREFIX)/man
BINDIR = $(PREFIX)/bin
# The -O0 is to help with debugging coredumps.
-CFLAGS += -O0 -g -W -Wall -Wextra -Wno-unused-parameter
+CFLAGS += -O0 -g -W -Wall -Wextra -Wno-unused-parameter -D_OPENBSD_SOURCE
all: openrsync

View file

@ -0,0 +1,19 @@
$NetBSD: patch-extern.h,v 1.1 2019/03/11 16:27:03 kamil Exp $
Add fallback declarations of functions missing on !OpenBSD.
--- extern.h.orig 2019-02-21 15:41:00.000000000 +0000
+++ extern.h
@@ -383,6 +383,12 @@ int idents_recv(struct sess *, int, s
void idents_remap(struct sess *, int, struct ident *, size_t);
int idents_send(struct sess *, int, const struct ident *, size_t);
+#ifndef __OpenBSD__
+void *recallocarray(void *ptr, size_t oldnmemb, size_t nmemb, size_t size);
+int pledge(const char *promises, const char *execpromises);
+int unveil(const char *path, const char *permissions);
+#endif
+
__END_DECLS
#endif /*!EXTERN_H*/

View file

@ -0,0 +1,15 @@
$NetBSD: patch-pledge.c,v 1.1 2019/03/11 16:27:03 kamil Exp $
Add a fallback implementation of OpenBSD specific function.
--- pledge.c.orig 2019-03-11 16:01:37.907598032 +0000
+++ pledge.c
@@ -0,0 +1,8 @@
+#ifndef __OpenBSD__
+int
+pledge(const char *promises, const char *execpromises)
+{
+
+ return 0;
+}
+#endif

View file

@ -0,0 +1,99 @@
$NetBSD: patch-recallocarray.c,v 1.1 2019/03/11 16:27:03 kamil Exp $
Add a fallback implementation of OpenBSD specific function.
--- recallocarray.c.orig 2019-03-11 16:01:37.907728248 +0000
+++ recallocarray.c
@@ -0,0 +1,92 @@
+#ifndef __OpenBSD__
+
+/* $OpenBSD: recallocarray.c,v 1.1 2017/03/06 18:44:21 otto Exp $ */
+/*
+ * Copyright (c) 2008, 2017 Otto Moerbeek <otto@drijf.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <unistd.h>
+
+void *(* volatile __internal_explicit_memset_impl)(void *, int, size_t) = memset;
+
+static void *
+__internal_explicit_bzero(void *b, size_t len)
+{
+
+ return (*__internal_explicit_memset_impl)(b, 0, len);
+}
+
+/*
+ * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
+ * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
+ */
+#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4))
+
+void *
+recallocarray(void *ptr, size_t oldnmemb, size_t newnmemb, size_t size)
+{
+ size_t oldsize, newsize;
+ void *newptr;
+
+ if (ptr == NULL)
+ return calloc(newnmemb, size);
+
+ if ((newnmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
+ newnmemb > 0 && SIZE_MAX / newnmemb < size) {
+ errno = ENOMEM;
+ return NULL;
+ }
+ newsize = newnmemb * size;
+
+ if ((oldnmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
+ oldnmemb > 0 && SIZE_MAX / oldnmemb < size) {
+ errno = EINVAL;
+ return NULL;
+ }
+ oldsize = oldnmemb * size;
+
+ /*
+ * Don't bother too much if we're shrinking just a bit,
+ * we do not shrink for series of small steps, oh well.
+ */
+ if (newsize <= oldsize) {
+ size_t d = oldsize - newsize;
+
+ if (d < oldsize / 2 && d < (size_t)getpagesize()) {
+ memset((char *)ptr + newsize, 0, d);
+ return ptr;
+ }
+ }
+
+ newptr = malloc(newsize);
+ if (newptr == NULL)
+ return NULL;
+
+ if (newsize > oldsize) {
+ memcpy(newptr, ptr, oldsize);
+ memset((char *)newptr + oldsize, 0, newsize - oldsize);
+ } else
+ memcpy(newptr, ptr, newsize);
+
+ __internal_explicit_bzero(ptr, oldsize);
+ free(ptr);
+
+ return newptr;
+}
+#endif

View file

@ -0,0 +1,15 @@
$NetBSD: patch-unveil.c,v 1.1 2019/03/11 16:27:03 kamil Exp $
Add a fallback implementation of OpenBSD specific function.
--- unveil.c.orig 2019-03-11 16:01:37.907822028 +0000
+++ unveil.c
@@ -0,0 +1,8 @@
+#ifndef __OpenBSD__
+int
+unveil(const char *path, const char *permissions)
+{
+
+ return 0;
+}
+#endif