diff options
author | 2019-02-12 18:59:34 +0000 | |
---|---|---|
committer | 2019-02-12 18:59:34 +0000 | |
commit | ea2cd662c295ac09fa85dcfe28a3f2f99d141bbf (patch) | |
tree | ca8e01ad7122670064cd257ebb229420e1825dfc | |
parent | sync (diff) | |
download | wireguard-openbsd-ea2cd662c295ac09fa85dcfe28a3f2f99d141bbf.tar.xz wireguard-openbsd-ea2cd662c295ac09fa85dcfe28a3f2f99d141bbf.zip |
sync:
commit 472ad2fab2692579a5773d78d6934b03c1098fb2
Author: kristaps <>
Date: Mon Feb 11 20:45:22 2019 +0000
Enable groupid in the protocol. This is not linked to the system itself yet.
-rw-r--r-- | usr.bin/rsync/flist.c | 32 | ||||
-rw-r--r-- | usr.bin/rsync/rsync.5 | 14 |
2 files changed, 41 insertions, 5 deletions
diff --git a/usr.bin/rsync/flist.c b/usr.bin/rsync/flist.c index c6c8f11b605..5cb91439fab 100644 --- a/usr.bin/rsync/flist.c +++ b/usr.bin/rsync/flist.c @@ -1,4 +1,4 @@ -/* $Id: flist.c,v 1.5 2019/02/11 21:41:22 deraadt Exp $ */ +/* $Id: flist.c,v 1.6 2019/02/12 18:59:34 benno Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -43,6 +43,7 @@ * information that affects subsequent transmissions. */ #define FLIST_MODE_SAME 0x0002 /* mode is repeat */ +#define FLIST_GID_SAME 0x0010 /* gid is repeat */ #define FLIST_NAME_SAME 0x0020 /* name is repeat */ #define FLIST_NAME_LONG 0x0040 /* name >255 bytes */ #define FLIST_TIME_SAME 0x0080 /* time is repeat */ @@ -306,7 +307,15 @@ flist_send(struct sess *sess, int fdin, int fdout, const struct flist *fl, return 0; } - /* Optional link information. */ + /* Conditional part: gid. */ + + if (sess->opts->preserve_gids && + ! io_write_int(sess, fdout, f->st.gid)) { + ERRX1(sess, "io_write_int"); + return 0; + } + + /* Conditional part: link. */ if (S_ISLNK(f->st.mode) && sess->opts->preserve_links) { @@ -575,7 +584,24 @@ flist_recv(struct sess *sess, int fd, struct flist **flp, size_t *sz) } else ff->st.mode = fflast->st.mode; - /* Optionally read the link information. */ + /* Conditional part: gid. */ + + if (sess->opts->preserve_gids) { + if ( ! (FLIST_GID_SAME & flag)) { + if ( ! io_read_int(sess, fd, &ival)) { + ERRX1(sess, "io_read_int"); + goto out; + } + ff->st.gid = ival; + } else if (NULL == fflast) { + ERRX(sess, "same gid " + "without last entry"); + goto out; + } else + ff->st.gid = fflast->st.gid; + } + + /* Conditional part: link. */ if (S_ISLNK(ff->st.mode) && sess->opts->preserve_links) { diff --git a/usr.bin/rsync/rsync.5 b/usr.bin/rsync/rsync.5 index 80bae255785..8c90eacedca 100644 --- a/usr.bin/rsync/rsync.5 +++ b/usr.bin/rsync/rsync.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: rsync.5,v 1.2 2019/02/10 23:24:14 benno Exp $ +.\" $OpenBSD: rsync.5,v 1.3 2019/02/12 18:59:34 benno Exp $ .\" .\" Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: February 10 2019 $ +.Dd $Mdocdate: February 12 2019 $ .Dt RSYNC 5 .Os .Sh NAME @@ -42,6 +42,8 @@ flags. These will be noted as .Fl n for dry-run, +.Fl g +for group ids, .Fl l for links, .Fl r @@ -218,6 +220,10 @@ file modification time (optional, time_t, integer) .It file mode (optional, mode_t, integer) .It +if +.Fl g , +the group id (integer) +.It if a symbolic link and .Fl l , the link target's length (integer) @@ -233,6 +239,10 @@ of the optional fields are transmitted. .Bl -tag -compact -width Ds .It 0x02 Do not send the file mode: it is a repeat of the last file's mode. +.It 0x10 +Like +.Li 0x02 , +but for the group id. .It 0x20 Inherit some of the prior file name. Enables the inherited filename length transmission. |