Compare commits

..

6 Commits

Author SHA1 Message Date
Jaime Casanova
e04ba8bea5 Add "--checksum" in rsync when using "--force"
If the user don't put that option in rsync_options using of "--force"
could be unsafe.
While the probability of failures because of this are low they aren't
zero.
2015-02-10 20:46:06 -05:00
Jaime Casanova
031f9aedcc Options -F -I -v doesn't accept arguments, which means that on
getopt_long shouldn't be marked with the colon (:) character.

This has been wrong since day one, so backpatching all the way until
1.1
2013-01-13 16:42:04 -05:00
Jaime Casanova
8ee715b657 Make repmgr compatible with FreeBSD.
We need to #include <sys/wait.h> to get WEXITSTATUS()
2012-09-15 17:45:38 -05:00
Jaime Casanova
c2344fe843 When we have more command-line arguments than we should have we
need to show that last value and we should use only optind for that
instead of optind+1
2012-09-15 17:41:49 -05:00
Jaime Casanova
30b124e91f STANDBY CLONE should be run by a SUPERUSER, otherwise we won't be able
to retrieve data_directory and the other parameters we need by
querying the database.
2012-06-12 09:40:38 -05:00
Jaime Casanova
c00fa9f9ba Fix a switch in which a "break" was missing that makes always that --force option
was used end up in the default section and error.
2012-04-19 12:18:21 -05:00

View File

@@ -28,6 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <time.h>
#include <unistd.h>
@@ -117,7 +118,7 @@ main(int argc, char **argv)
}
while ((c = getopt_long(argc, argv, "d:h:p:U:D:f:R:w:F:I:v", long_options,
while ((c = getopt_long(argc, argv, "d:h:p:U:D:f:R:w:FIv", long_options,
&optindex)) != -1)
{
switch (c)
@@ -232,7 +233,7 @@ main(int argc, char **argv)
break;
default:
log_err(_("%s: too many command-line arguments (first extra is \"%s\")\n"),
progname, argv[optind + 1]);
progname, argv[optind]);
usage();
exit(ERR_BAD_CONFIG);
}
@@ -861,6 +862,7 @@ do_standby_clone(void)
PQfinish(conn);
exit(ERR_BAD_CONFIG);
}
break;
default:
/* Trouble accessing directory */
log_err(_("%s: could not access directory \"%s\": %s\n"),
@@ -887,6 +889,16 @@ do_standby_clone(void)
PQfinish(conn);
exit(ERR_BAD_CONFIG);
}
/* We need all 4 parameters, and they can be retrieved only by superusers */
if (PQntuples(res) != 4)
{
log_err("%s: STANDBY CLONE should be run by a SUPERUSER\n", progname);
PQclear(res);
PQfinish(conn);
exit(ERR_BAD_CONFIG);
}
for (i = 0; i < PQntuples(res); i++)
{
if (strcmp(PQgetvalue(res, i, 0), "data_directory") == 0)
@@ -1476,7 +1488,7 @@ copy_remote_files(char *host, char *remote_user, char *remote_path,
maxlen_snprintf(rsync_flags, "%s", options.rsync_options);
if (runtime_options.force)
strcat(rsync_flags, " --delete");
strcat(rsync_flags, " --delete --checksum");
if (!remote_user[0])
{