summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbenno <benno@openbsd.org>2019-02-12 17:58:35 +0000
committerbenno <benno@openbsd.org>2019-02-12 17:58:35 +0000
commit4fd63c866fe726290d0df51d2d95c16cecc38125 (patch)
tree8dc18c279434153905be7d02cf51f4fd1b837f64
parentRestructure code to simplifiy imsg communications, further separating (diff)
downloadwireguard-openbsd-4fd63c866fe726290d0df51d2d95c16cecc38125.tar.xz
wireguard-openbsd-4fd63c866fe726290d0df51d2d95c16cecc38125.zip
sync, this also adds the -g option to the option parser.
commit c7818bfb17195fcd7b723889bb8652b9ea024b01 Author: kristaps <> Date: Mon Feb 11 23:26:55 2019 +0000 Add getpw pledge for -g work.
-rw-r--r--usr.bin/rsync/main.c19
-rw-r--r--usr.bin/rsync/receiver.c4
-rw-r--r--usr.bin/rsync/sender.c4
3 files changed, 15 insertions, 12 deletions
diff --git a/usr.bin/rsync/main.c b/usr.bin/rsync/main.c
index 4e96c826926..9d861782c7c 100644
--- a/usr.bin/rsync/main.c
+++ b/usr.bin/rsync/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.9 2019/02/12 14:09:59 deraadt Exp $ */
+/* $Id: main.c,v 1.10 2019/02/12 17:58:35 benno Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -301,18 +301,21 @@ main(int argc, char *argv[])
/* Global pledge. */
- if (pledge("stdio rpath wpath cpath inet fattr dns proc exec unveil",
+ if (pledge("stdio rpath wpath cpath inet fattr dns getpw proc exec unveil",
NULL) == -1)
err(EXIT_FAILURE, "pledge");
memset(&opts, 0, sizeof(struct opts));
- while ((c = getopt_long(argc, argv, "e:lnprtv", lopts, NULL)) != -1) {
+ while ((c = getopt_long(argc, argv, "e:glnprtv", lopts, NULL)) != -1) {
switch (c) {
case 'e':
opts.ssh_prog = optarg;
/* Ignore. */
break;
+ case 'g':
+ opts.preserve_gids = 1;
+ break;
case 'l':
opts.preserve_links = 1;
break;
@@ -384,7 +387,7 @@ main(int argc, char *argv[])
if (fargs->remote) {
assert(fargs->mode == FARGS_RECEIVER);
- if (pledge("stdio rpath wpath cpath inet fattr dns unveil",
+ if (pledge("stdio rpath wpath cpath inet fattr dns getpw unveil",
NULL) == -1)
err(EXIT_FAILURE, "pledge");
c = rsync_socket(&opts, fargs);
@@ -394,7 +397,7 @@ main(int argc, char *argv[])
/* Drop the dns/inet possibility. */
- if (pledge("stdio rpath wpath cpath fattr proc exec unveil",
+ if (pledge("stdio rpath wpath cpath fattr getpw proc exec unveil",
NULL) == -1)
err(EXIT_FAILURE, "pledge");
@@ -411,7 +414,7 @@ main(int argc, char *argv[])
/* Drop the fork possibility. */
- if (pledge("stdio rpath wpath cpath fattr exec unveil", NULL) == -1)
+ if (pledge("stdio rpath wpath cpath fattr getpw exec unveil", NULL) == -1)
err(EXIT_FAILURE, "pledge");
if (child == 0) {
@@ -425,7 +428,7 @@ main(int argc, char *argv[])
close(fds[1]);
fds[1] = -1;
- if (pledge("stdio rpath wpath cpath fattr unveil", NULL) == -1)
+ if (pledge("stdio rpath wpath cpath fattr getpw unveil", NULL) == -1)
err(EXIT_FAILURE, "pledge");
c = rsync_client(&opts, fds[0], fargs);
fargs_free(fargs);
@@ -450,7 +453,7 @@ main(int argc, char *argv[])
close(fds[0]);
return c ? EXIT_SUCCESS : EXIT_FAILURE;
usage:
- fprintf(stderr, "usage: %s [-lnprtv] "
+ fprintf(stderr, "usage: %s [-glnprtv] "
"[-e ssh-prog] [--delete] [--rsync-path=prog] src ... dst\n",
getprogname());
return EXIT_FAILURE;
diff --git a/usr.bin/rsync/receiver.c b/usr.bin/rsync/receiver.c
index de6ab04310f..5b1446265d5 100644
--- a/usr.bin/rsync/receiver.c
+++ b/usr.bin/rsync/receiver.c
@@ -1,4 +1,4 @@
-/* $Id: receiver.c,v 1.5 2019/02/11 21:41:22 deraadt Exp $ */
+/* $Id: receiver.c,v 1.6 2019/02/12 17:58:35 benno Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -58,7 +58,7 @@ rsync_receiver(struct sess *sess,
struct upload *ul = NULL;
mode_t oumask;
- if (pledge("stdio rpath wpath cpath fattr unveil", NULL) == -1) {
+ if (pledge("stdio rpath wpath cpath fattr getpw unveil", NULL) == -1) {
ERR(sess, "pledge");
goto out;
}
diff --git a/usr.bin/rsync/sender.c b/usr.bin/rsync/sender.c
index 09cdc30fb45..a881d4cd085 100644
--- a/usr.bin/rsync/sender.c
+++ b/usr.bin/rsync/sender.c
@@ -1,4 +1,4 @@
-/* $Id: sender.c,v 1.5 2019/02/11 21:41:22 deraadt Exp $ */
+/* $Id: sender.c,v 1.6 2019/02/12 17:58:35 benno Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -43,7 +43,7 @@ rsync_sender(struct sess *sess, int fdin,
int32_t idx;
struct blkset *blks = NULL;
- if (pledge("stdio rpath unveil", NULL) == -1) {
+ if (pledge("stdio getpw rpath unveil", NULL) == -1) {
ERR(sess, "pledge");
return 0;
}