- Don't allow some crafty user to try to force us to update a
authorWayne Davison <wayned@samba.org>
Mon, 19 Jul 2004 16:37:30 +0000 (16:37 +0000)
committerWayne Davison <wayned@samba.org>
Mon, 19 Jul 2004 16:37:30 +0000 (16:37 +0000)
  server-excluded file.
- If get_tmpname() fails we need to discard the update using
  receive_data().

receiver.c

index 2eca4f6..94850fa 100644 (file)
@@ -50,6 +50,9 @@ extern int keep_partial;
 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 @@ int recv_files(int f_in, struct file_list *flist, char *local_name)
                if (i == -1) {
                        if (phase)
                                break;
+
                        phase = 1;
                        csum_length = SUM_LENGTH;
                        if (verbose > 2)
@@ -375,6 +379,18 @@ int recv_files(int f_in, struct file_list *flist, char *local_name)
 
                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 @@ int recv_files(int f_in, struct file_list *flist, char *local_name)
                        }
                } else {
                        if (!get_tmpname(fnametmp,fname)) {
+                               receive_data(f_in,mapbuf,-1,NULL,file->length);
                                if (mapbuf)
                                        unmap_file(mapbuf);
                                if (fd1 != -1)