version 1.9, 2019/02/12 14:09:59 |
version 1.10, 2019/02/12 17:58:35 |
|
|
|
|
/* Global pledge. */ |
/* 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) |
NULL) == -1) |
err(EXIT_FAILURE, "pledge"); |
err(EXIT_FAILURE, "pledge"); |
|
|
memset(&opts, 0, sizeof(struct opts)); |
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) { |
switch (c) { |
case 'e': |
case 'e': |
opts.ssh_prog = optarg; |
opts.ssh_prog = optarg; |
/* Ignore. */ |
/* Ignore. */ |
break; |
break; |
|
case 'g': |
|
opts.preserve_gids = 1; |
|
break; |
case 'l': |
case 'l': |
opts.preserve_links = 1; |
opts.preserve_links = 1; |
break; |
break; |
|
|
|
|
if (fargs->remote) { |
if (fargs->remote) { |
assert(fargs->mode == FARGS_RECEIVER); |
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) |
NULL) == -1) |
err(EXIT_FAILURE, "pledge"); |
err(EXIT_FAILURE, "pledge"); |
c = rsync_socket(&opts, fargs); |
c = rsync_socket(&opts, fargs); |
|
|
|
|
/* Drop the dns/inet possibility. */ |
/* 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) |
NULL) == -1) |
err(EXIT_FAILURE, "pledge"); |
err(EXIT_FAILURE, "pledge"); |
|
|
|
|
|
|
/* Drop the fork possibility. */ |
/* 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"); |
err(EXIT_FAILURE, "pledge"); |
|
|
if (child == 0) { |
if (child == 0) { |
|
|
|
|
close(fds[1]); |
close(fds[1]); |
fds[1] = -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"); |
err(EXIT_FAILURE, "pledge"); |
c = rsync_client(&opts, fds[0], fargs); |
c = rsync_client(&opts, fds[0], fargs); |
fargs_free(fargs); |
fargs_free(fargs); |
|
|
close(fds[0]); |
close(fds[0]); |
return c ? EXIT_SUCCESS : EXIT_FAILURE; |
return c ? EXIT_SUCCESS : EXIT_FAILURE; |
usage: |
usage: |
fprintf(stderr, "usage: %s [-lnprtv] " |
fprintf(stderr, "usage: %s [-glnprtv] " |
"[-e ssh-prog] [--delete] [--rsync-path=prog] src ... dst\n", |
"[-e ssh-prog] [--delete] [--rsync-path=prog] src ... dst\n", |
getprogname()); |
getprogname()); |
return EXIT_FAILURE; |
return EXIT_FAILURE; |