=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rsync/receiver.c,v retrieving revision 1.26 retrieving revision 1.27 diff -c -r1.26 -r1.27 *** src/usr.bin/rsync/receiver.c 2021/05/06 07:29:59 1.26 --- src/usr.bin/rsync/receiver.c 2021/05/17 11:59:09 1.27 *************** *** 1,4 **** ! /* $Id: receiver.c,v 1.26 2021/05/06 07:29:59 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons --- 1,4 ---- ! /* $Id: receiver.c,v 1.27 2021/05/17 11:59:09 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons *************** *** 20,25 **** --- 20,26 ---- #include #include + #include #include #include #include *************** *** 180,194 **** struct upload *ul = NULL; mode_t oumask; ! if (pledge("stdio unix rpath wpath cpath dpath fattr chown getpw unveil", NULL) == -1) { ! ERR("pledge"); ! goto out; ! } /* Client sends zero-length exclusions. */ ! if (!sess->opts->server && ! !io_write_int(sess, fdout, 0)) { ERRX1("io_write_int"); goto out; } --- 181,192 ---- struct upload *ul = NULL; mode_t oumask; ! if (pledge("stdio unix rpath wpath cpath dpath fattr chown getpw unveil", NULL) == -1) ! err(ERR_IPC, "pledge"); /* Client sends zero-length exclusions. */ ! if (!sess->opts->server && !io_write_int(sess, fdout, 0)) { ERRX1("io_write_int"); goto out; } *************** *** 240,253 **** */ if (!sess->opts->dry_run) { ! if ((tofree = strdup(root)) == NULL) { ! ERR("strdup"); ! goto out; ! } else if (mkpath(tofree) < 0) { ! ERRX1("%s: mkpath", root); ! free(tofree); ! goto out; ! } free(tofree); } --- 238,247 ---- */ if (!sess->opts->dry_run) { ! if ((tofree = strdup(root)) == NULL) ! err(ERR_NOMEM, NULL); ! if (mkpath(tofree) < 0) ! err(ERR_FILE_IO, "%s: mkpath", tofree); free(tofree); } *************** *** 260,269 **** if (!sess->opts->dry_run) { dfd = open(root, O_RDONLY | O_DIRECTORY, 0); ! if (dfd == -1) { ! ERR("%s: open", root); ! goto out; ! } } /* --- 254,261 ---- if (!sess->opts->dry_run) { dfd = open(root, O_RDONLY | O_DIRECTORY, 0); ! if (dfd == -1) ! err(ERR_FILE_IO, "%s: open", root); } /* *************** *** 285,297 **** * writing into other parts of the file-system. */ ! if (unveil(root, "rwc") == -1) { ! ERR("%s: unveil", root); ! goto out; ! } else if (unveil(NULL, NULL) == -1) { ! ERR("%s: unveil", root); ! goto out; ! } /* If we have a local set, go for the deletion. */ --- 277,286 ---- * writing into other parts of the file-system. */ ! if (unveil(root, "rwc") == -1) ! err(ERR_IPC, "%s: unveil", root); ! if (unveil(NULL, NULL) == -1) ! err(ERR_IPC, "unveil"); /* If we have a local set, go for the deletion. */