- Don't allow some crafty user to try to force us to update a
server-excluded file.
- If get_tmpname() fails we need to discard the update using
receive_data().
diff --git a/receiver.c b/receiver.c
index 2eca4f6..94850fa 100644
--- a/receiver.c
+++ b/receiver.c
@@ -50,6 +50,9 @@
extern int checksum_seed;
extern int inplace;
+extern struct exclude_list_struct server_exclude_list;
+
+
static void delete_one(char *fn, int is_dir)
{
if (!is_dir) {
@@ -334,6 +337,7 @@
if (i == -1) {
if (phase)
break;
+
phase = 1;
csum_length = SUM_LENGTH;
if (verbose > 2)
@@ -375,6 +379,18 @@
fnamecmp = fname;
+ if (server_exclude_list.head
+ && check_exclude(&server_exclude_list, fname,
+ S_ISDIR(file->mode)) < 0) {
+ if (verbose) {
+ rprintf(FINFO,
+ "skipping server-excluded update for \"%s\"\n",
+ fname);
+ }
+ receive_data(f_in,NULL,-1,NULL,file->length);
+ continue;
+ }
+
/* open the file */
fd1 = do_open(fnamecmp, O_RDONLY, 0);
@@ -444,6 +460,7 @@
}
} else {
if (!get_tmpname(fnametmp,fname)) {
+ receive_data(f_in,mapbuf,-1,NULL,file->length);
if (mapbuf)
unmap_file(mapbuf);
if (fd1 != -1)