struct pai_val *pal;
struct smb_filename *smb_fname = NULL;
NTSTATUS status;
+ int ret;
*ppdesc = NULL;
}
/* Get the stat struct for the owner info. */
- if(SMB_VFS_STAT(conn, smb_fname) != 0) {
+ if (lp_posix_pathnames()) {
+ ret = SMB_VFS_LSTAT(conn, smb_fname);
+ } else {
+ ret = SMB_VFS_STAT(conn, smb_fname);
+ }
+
+ if (ret == -1) {
status = map_nt_error_from_unix(errno);
goto out;
}
/* Case (1). */
/* try the direct way first */
- ret = SMB_VFS_CHOWN(conn, smb_fname->base_name, uid, gid);
+ if (lp_posix_pathnames()) {
+ ret = SMB_VFS_LCHOWN(conn, smb_fname->base_name, uid, gid);
+ } else {
+ ret = SMB_VFS_CHOWN(conn, smb_fname->base_name, uid, gid);
+ }
+
if (ret == 0)
return 0;
become_root();
/* Keep the current file gid the same - take ownership doesn't imply group change. */
- ret = SMB_VFS_CHOWN(conn, smb_fname->base_name, uid,
- (gid_t)-1);
+ if (lp_posix_pathnames()) {
+ ret = SMB_VFS_LCHOWN(conn, smb_fname->base_name, uid,
+ (gid_t)-1);
+ } else {
+ ret = SMB_VFS_CHOWN(conn, smb_fname->base_name, uid,
+ (gid_t)-1);
+ }
unbecome_root();
return ret;
}
return -1;
}
- if (SMB_VFS_STAT(conn, smb_fname)) {
+ if (lp_posix_pathnames()) {
+ ret = SMB_VFS_STAT(conn, smb_fname);
+ } else {
+ ret = SMB_VFS_STAT(conn, smb_fname);
+ }
+
+ if (ret == -1) {
return -1;
}
bool set_acl_as_root = false;
bool acl_set_support = false;
bool ret = false;
+ int sret;
DEBUG(10,("set_nt_acl: called for file %s\n",
fsp_str_dbg(fsp)));
*/
if(fsp->is_directory || fsp->fh->fd == -1) {
- if(SMB_VFS_STAT(fsp->conn, fsp->fsp_name) != 0) {
+ if (fsp->posix_open) {
+ sret = SMB_VFS_LSTAT(fsp->conn, fsp->fsp_name);
+ } else {
+ sret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name);
+ }
+ if (sret == -1) {
return map_nt_error_from_unix(errno);
}
} else {
* (suid/sgid bits, for instance)
*/
- if(fsp->is_directory) {
- if(SMB_VFS_STAT(fsp->conn, fsp->fsp_name) != 0) {
- return map_nt_error_from_unix(errno);
+ if(fsp->is_directory || fsp->fh->fd == -1) {
+ if (fsp->posix_open) {
+ sret = SMB_VFS_LSTAT(fsp->conn, fsp->fsp_name);
+ } else {
+ sret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name);
}
} else {
+ sret = SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st);
+ }
- int sret;
-
- if(fsp->fh->fd == -1)
- sret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name);
- else
- sret = SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st);
-
- if(sret != 0)
- return map_nt_error_from_unix(errno);
+ if(sret == -1) {
+ return map_nt_error_from_unix(errno);
}
/* Save the original element we check against. */