diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2019-02-16 10:44:02 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2019-02-16 10:44:02 +0000 |
commit | ffb81903474e9f6ce0fe506577905da85f07f179 (patch) | |
tree | 446b4276543e146dbd6a3806cfb1d1f2f77c1923 /usr.bin/rsync | |
parent | 786936f9a842833c4b7dc1d44fb46657ff81311f (diff) |
Add chown pledge so that root can gift files to other uids.
"you snooze, you get collisions" deraadt@
Diffstat (limited to 'usr.bin/rsync')
-rw-r--r-- | usr.bin/rsync/client.c | 6 | ||||
-rw-r--r-- | usr.bin/rsync/main.c | 14 | ||||
-rw-r--r-- | usr.bin/rsync/receiver.c | 8 | ||||
-rw-r--r-- | usr.bin/rsync/socket.c | 10 |
4 files changed, 19 insertions, 19 deletions
diff --git a/usr.bin/rsync/client.c b/usr.bin/rsync/client.c index b1ee457dc27..bc23eeef304 100644 --- a/usr.bin/rsync/client.c +++ b/usr.bin/rsync/client.c @@ -1,4 +1,4 @@ -/* $Id: client.c,v 1.5 2019/02/16 05:06:30 deraadt Exp $ */ +/* $Id: client.c,v 1.6 2019/02/16 10:44:01 florian Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -30,9 +30,9 @@ * In the former, it synchronises local files from a remote sink. * In the latter, the remote sink synchronses to the local files. * - * Pledges: stdio, rpath, wpath, cpath, unveil, fattr. + * Pledges: stdio, rpath, wpath, cpath, unveil, fattr, chown. * - * Pledges (dry-run): -cpath, -wpath, -fattr. + * Pledges (dry-run): -cpath, -wpath, -fattr, chown. * Pledges (!preserve_times): -fattr. */ int diff --git a/usr.bin/rsync/main.c b/usr.bin/rsync/main.c index 8fe0da402b3..e43152e2e89 100644 --- a/usr.bin/rsync/main.c +++ b/usr.bin/rsync/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.17 2019/02/16 05:36:07 deraadt Exp $ */ +/* $Id: main.c,v 1.18 2019/02/16 10:44:01 florian Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -304,7 +304,7 @@ main(int argc, char *argv[]) /* Global pledge. */ - if (pledge("stdio rpath wpath cpath inet fattr dns getpw proc exec unveil", + if (pledge("stdio rpath wpath cpath inet fattr chown dns getpw proc exec unveil", NULL) == -1) err(EXIT_FAILURE, "pledge"); @@ -370,7 +370,7 @@ main(int argc, char *argv[]) */ if (opts.server) { - if (pledge("stdio rpath wpath cpath fattr getpw unveil", NULL) == -1) + if (pledge("stdio rpath wpath cpath fattr chown getpw unveil", NULL) == -1) err(EXIT_FAILURE, "pledge"); c = rsync_server(&opts, (size_t)argc, argv); return c ? EXIT_SUCCESS : EXIT_FAILURE; @@ -397,7 +397,7 @@ main(int argc, char *argv[]) if (fargs->remote) { assert(fargs->mode == FARGS_RECEIVER); - if (pledge("stdio rpath wpath cpath inet fattr dns getpw unveil", + if (pledge("stdio rpath wpath cpath inet fattr chown dns getpw unveil", NULL) == -1) err(EXIT_FAILURE, "pledge"); c = rsync_socket(&opts, fargs); @@ -407,7 +407,7 @@ main(int argc, char *argv[]) /* Drop the dns/inet possibility. */ - if (pledge("stdio rpath wpath cpath fattr getpw proc exec unveil", + if (pledge("stdio rpath wpath cpath fattr chown getpw proc exec unveil", NULL) == -1) err(EXIT_FAILURE, "pledge"); @@ -424,7 +424,7 @@ main(int argc, char *argv[]) /* Drop the fork possibility. */ - if (pledge("stdio rpath wpath cpath fattr getpw exec unveil", NULL) == -1) + if (pledge("stdio rpath wpath cpath fattr chown getpw exec unveil", NULL) == -1) err(EXIT_FAILURE, "pledge"); if (child == 0) { @@ -438,7 +438,7 @@ main(int argc, char *argv[]) close(fds[1]); fds[1] = -1; - if (pledge("stdio rpath wpath cpath fattr getpw unveil", NULL) == -1) + if (pledge("stdio rpath wpath cpath fattr chown getpw unveil", NULL) == -1) err(EXIT_FAILURE, "pledge"); c = rsync_client(&opts, fds[0], fargs); fargs_free(fargs); diff --git a/usr.bin/rsync/receiver.c b/usr.bin/rsync/receiver.c index 935432beb58..93ec4cb3fc5 100644 --- a/usr.bin/rsync/receiver.c +++ b/usr.bin/rsync/receiver.c @@ -1,4 +1,4 @@ -/* $Id: receiver.c,v 1.11 2019/02/16 05:30:28 deraadt Exp $ */ +/* $Id: receiver.c,v 1.12 2019/02/16 10:44:01 florian Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> @@ -92,8 +92,8 @@ rsync_set_metadata(struct sess *sess, int newfile, } /* - * Pledges: unveil, rpath, cpath, wpath, stdio, fattr. - * Pledges (dry-run): -cpath, -wpath, -fattr. + * Pledges: unveil, rpath, cpath, wpath, stdio, fattr, chown. + * Pledges (dry-run): -cpath, -wpath, -fattr, -chown. */ int rsync_receiver(struct sess *sess, int fdin, int fdout, const char *root) @@ -108,7 +108,7 @@ rsync_receiver(struct sess *sess, int fdin, int fdout, const char *root) struct upload *ul = NULL; mode_t oumask; - if (pledge("stdio rpath wpath cpath fattr getpw unveil", NULL) == -1) { + if (pledge("stdio rpath wpath cpath fattr chown getpw unveil", NULL) == -1) { ERR(sess, "pledge"); goto out; } diff --git a/usr.bin/rsync/socket.c b/usr.bin/rsync/socket.c index 3848eaa1d1d..6e67b49861c 100644 --- a/usr.bin/rsync/socket.c +++ b/usr.bin/rsync/socket.c @@ -1,4 +1,4 @@ -/* $Id: socket.c,v 1.7 2019/02/16 05:06:30 deraadt Exp $ */ +/* $Id: socket.c,v 1.8 2019/02/16 10:44:01 florian Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -228,9 +228,9 @@ protocol_line(struct sess *sess, const char *host, const char *cp) } /* - * Pledges: dns, inet, unveil, rpath, cpath, wpath, stdio, fattr. + * Pledges: dns, inet, unveil, rpath, cpath, wpath, stdio, fattr, chown. * - * Pledges (dry-run): -cpath, -wpath, -fattr. + * Pledges (dry-run): -cpath, -wpath, -fattr, -chown. * Pledges (!preserve_times): -fattr. */ int @@ -265,7 +265,7 @@ rsync_socket(const struct opts *opts, const struct fargs *f) /* Drop the DNS pledge. */ - if (pledge("stdio rpath wpath cpath fattr getpw inet unveil", NULL) == -1) { + if (pledge("stdio rpath wpath cpath fattr chown getpw inet unveil", NULL) == -1) { ERR(&sess, "pledge"); goto out; } @@ -286,7 +286,7 @@ rsync_socket(const struct opts *opts, const struct fargs *f) } /* Drop the inet pledge. */ - if (pledge("stdio rpath wpath cpath fattr getpw unveil", NULL) == -1) { + if (pledge("stdio rpath wpath cpath fattr chown getpw unveil", NULL) == -1) { ERR(&sess, "pledge"); goto out; } |