Changeset 745 for trunk/server/source3/modules/vfs_scannedonly.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source3/modules/vfs_scannedonly.c
r596 r745 2 2 * scannedonly VFS module for Samba 3.5 3 3 * 4 * Copyright 2007,2008,2009 (C) Olivier Sessink4 * Copyright 2007,2008,2009,2010 (C) Olivier Sessink 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify … … 49 49 50 50 #include "includes.h" 51 #include "smbd/smbd.h" 52 #include "system/filesys.h" 51 53 52 54 #include "config.h" … … 378 380 TALLOC_CTX *ctx=talloc_tos(); 379 381 char *cachefile; 380 int retval ;382 int retval = -1; 381 383 int didloop; 382 384 DEBUG(SCANNEDONLY_DEBUG, … … 477 479 while (retval != 0 /*&& errno == ENOENT */ 478 480 && i < recheck_tries) { 479 struct timespec req = { 0, recheck_time * 10000 };480 481 DEBUG(SCANNEDONLY_DEBUG, 481 482 ("scannedonly_allow_access, wait (try=%d " … … 483 484 i, recheck_tries, 484 485 recheck_time, cache_smb_fname->base_name)); 485 nanosleep(&req, NULL);486 smb_msleep(recheck_time); 486 487 retval = SMB_VFS_NEXT_STAT(handle, cache_smb_fname); 487 488 i++; … … 527 528 return (SMB_STRUCT_DIR *) sDIR; 528 529 } 530 531 static SMB_STRUCT_DIR *scannedonly_fdopendir(vfs_handle_struct * handle, 532 files_struct *fsp, 533 const char *mask, uint32 attr) 534 { 535 SMB_STRUCT_DIR *DIRp; 536 struct scannedonly_DIR *sDIR; 537 const char *fname; 538 539 DIRp = SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr); 540 if (!DIRp) { 541 return NULL; 542 } 543 544 fname = (const char *)fsp->fsp_name->base_name; 545 546 sDIR = TALLOC_P(NULL, struct scannedonly_DIR); 547 if (fname[0] != '/') { 548 sDIR->base = construct_full_path(sDIR,handle, fname, true); 549 } else { 550 sDIR->base = name_w_ending_slash(sDIR, fname); 551 } 552 DEBUG(SCANNEDONLY_DEBUG, 553 ("scannedonly_fdopendir, fname=%s, base=%s\n",fname,sDIR->base)); 554 sDIR->DIR = DIRp; 555 sDIR->notify_loop_done = 0; 556 return (SMB_STRUCT_DIR *) sDIR; 557 } 558 529 559 530 560 static SMB_STRUCT_DIRENT *scannedonly_readdir(vfs_handle_struct *handle, … … 767 797 struct smb_filename *smb_fname_dst_tmp = NULL; 768 798 char *cachefile_src, *cachefile_dst; 799 bool needscandst=false; 800 int ret; 769 801 TALLOC_CTX *ctx = talloc_tos(); 770 802 … … 778 810 smb_fname_dst->base_name, 779 811 STRUCTSCANO(handle->data)->p_scanned); 780 781 812 create_synthetic_smb_fname(ctx, cachefile_src,NULL,NULL, 782 813 &smb_fname_src_tmp); … … 784 815 &smb_fname_dst_tmp); 785 816 786 if (SMB_VFS_NEXT_RENAME(handle, smb_fname_src_tmp, smb_fname_dst_tmp) 787 != 0) { 817 ret = SMB_VFS_NEXT_RENAME(handle, smb_fname_src_tmp, smb_fname_dst_tmp); 818 if (ret == ENOENT) { 819 needscandst=true; 820 } else if (ret != 0) { 788 821 DEBUG(SCANNEDONLY_DEBUG, 789 ("failed to rename %s into %s\n", cachefile_src, 790 cachefile_dst)); 791 } 792 return SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst); 822 ("failed to rename %s into %s error %d: %s\n", cachefile_src, 823 cachefile_dst, ret, strerror(ret))); 824 needscandst=true; 825 } 826 ret = SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst); 827 if (ret == 0 && needscandst) { 828 notify_scanner(handle, smb_fname_dst->base_name); 829 flush_sendbuffer(handle); 830 } 831 return ret; 793 832 } 794 833 … … 979 1018 static struct vfs_fn_pointers vfs_scannedonly_fns = { 980 1019 .opendir = scannedonly_opendir, 1020 .fdopendir = scannedonly_fdopendir, 981 1021 .readdir = scannedonly_readdir, 982 1022 .seekdir = scannedonly_seekdir, … … 987 1027 .stat = scannedonly_stat, 988 1028 .lstat = scannedonly_lstat, 989 .open = scannedonly_open,1029 .open_fn = scannedonly_open, 990 1030 .close_fn = scannedonly_close, 991 1031 .rename = scannedonly_rename,
Note:
See TracChangeset
for help on using the changeset viewer.