#include "smbd/smbd.h"
#include "system/filesys.h"
#include "transfer_file.h"
-
+#include "smbprofile.h"
#define MODULE "crossrename"
-static SMB_OFF_T module_sizelimit;
+static off_t module_sizelimit;
static int crossrename_connect(
struct vfs_handle_struct * handle,
return ret;
}
- module_sizelimit = (SMB_OFF_T) lp_parm_int(SNUM(handle->conn),
+ module_sizelimit = (off_t) lp_parm_int(SNUM(handle->conn),
MODULE, "sizelimit", 20);
/* convert from MiB to byte: */
module_sizelimit *= 1048576;
return -1;
}
- if((ifd = sys_open (source, O_RDONLY, 0)) < 0)
+ if((ifd = open (source, O_RDONLY, 0)) < 0)
return -1;
- if (unlink (dest) && errno != ENOENT)
+ if (unlink (dest) && errno != ENOENT) {
+ close(ifd);
return -1;
+ }
#ifdef O_NOFOLLOW
- if((ofd = sys_open (dest, O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW, 0600)) < 0 )
+ if((ofd = open (dest, O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW, 0600)) < 0 )
#else
- if((ofd = sys_open (dest, O_WRONLY | O_CREAT | O_TRUNC , 0600)) < 0 )
+ if((ofd = open (dest, O_WRONLY | O_CREAT | O_TRUNC , 0600)) < 0 )
#endif
goto err;
*/
#if defined(HAVE_FCHMOD)
- if (fchmod (ofd, source_stats.st_ex_mode & 07777))
+ if ((fchmod (ofd, source_stats.st_ex_mode & 07777) == -1) &&
+ (errno != EPERM))
#else
- if (chmod (dest, source_stats.st_ex_mode & 07777))
+ if ((chmod (dest, source_stats.st_ex_mode & 07777) == -1) &&
+ (errno != EPERM))
#endif
goto err;
static struct vfs_fn_pointers vfs_crossrename_fns = {
.connect_fn = crossrename_connect,
- .rename = crossrename_rename
+ .rename_fn = crossrename_rename
};
NTSTATUS vfs_crossrename_init(void);