SMB_ACL_T posix_acl = NULL;
SMB_ACL_T def_acl = NULL;
struct pai_val *pal;
+ int ret;
*ppdesc = NULL;
DEBUG(10,("posix_get_nt_acl: called for file %s\n", name ));
/* Get the stat struct for the owner info. */
- if(SMB_VFS_STAT(conn, name, &sbuf) != 0) {
+ if (lp_posix_pathnames()) {
+ ret = SMB_VFS_LSTAT(conn, name, &sbuf);
+ } else {
+ ret = SMB_VFS_STAT(conn, name, &sbuf);
+ }
+ if(ret != 0) {
return map_nt_error_from_unix(errno);
}
int ret;
files_struct *fsp;
SMB_STRUCT_STAT st;
+ bool posix_paths = lp_posix_pathnames();
if(!CAN_WRITE(conn)) {
return -1;
/* Case (1). */
/* try the direct way first */
- ret = SMB_VFS_CHOWN(conn, fname, uid, gid);
+ if (posix_paths) {
+ ret = SMB_VFS_LCHOWN(conn, fname, uid, gid);
+ } else {
+ ret = SMB_VFS_CHOWN(conn, fname, uid, gid);
+ }
if (ret == 0)
return 0;
return -1;
}
- if (SMB_VFS_STAT(conn,fname,&st)) {
+ if (posix_paths) {
+ ret = SMB_VFS_LSTAT(conn,fname,&st);
+ } else {
+ ret = SMB_VFS_STAT(conn,fname,&st);
+ }
+ if (ret != 0) {
return -1;
}
bool set_acl_as_root = false;
bool acl_set_support = false;
bool ret = false;
+ bool posix_paths = lp_posix_pathnames();
+ int sret;
DEBUG(10,("set_nt_acl: called for file %s\n", fsp->fsp_name ));
*/
if(fsp->is_directory || fsp->fh->fd == -1) {
- if(SMB_VFS_STAT(fsp->conn,fsp->fsp_name, &sbuf) != 0)
+ if (posix_paths) {
+ sret = SMB_VFS_LSTAT(fsp->conn,fsp->fsp_name, &sbuf);
+ } else {
+ sret = SMB_VFS_STAT(fsp->conn,fsp->fsp_name, &sbuf);
+ }
+ if (sret != 0) {
return map_nt_error_from_unix(errno);
+ }
} else {
if(SMB_VFS_FSTAT(fsp, &sbuf) != 0)
return map_nt_error_from_unix(errno);
*/
if(fsp->is_directory) {
- if(SMB_VFS_STAT(fsp->conn, fsp->fsp_name, &sbuf) != 0) {
+ if (posix_paths) {
+ sret = SMB_VFS_LSTAT(fsp->conn, fsp->fsp_name, &sbuf);
+ } else {
+ sret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name, &sbuf);
+ }
+ if (sret != 0) {
return map_nt_error_from_unix(errno);
}
} else {
-
- int sret;
-
- if(fsp->fh->fd == -1)
- sret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name, &sbuf);
- else
+ if(fsp->fh->fd == -1) {
+ if (posix_paths) {
+ sret = SMB_VFS_LSTAT(fsp->conn, fsp->fsp_name, &sbuf);
+ } else {
+ sret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name, &sbuf);
+ }
+ } else {
sret = SMB_VFS_FSTAT(fsp, &sbuf);
+ }
if(sret != 0)
return map_nt_error_from_unix(errno);
return map_nt_error_from_unix(errno);
}
} else {
- int sret = -1;
-
/*
* No default ACL - delete one if it exists.
*/
}
if (orig_mode != posix_perms) {
- int sret = -1;
-
DEBUG(3,("set_nt_acl: chmod %s. perms = 0%o.\n",
fsp->fsp_name, (unsigned int)posix_perms ));
goto path_err;
}
- if (!VALID_STAT(sbuf) && (SMB_VFS_STAT(conn,name,&sbuf) != 0)) {
- DEBUG(3,("reply_checkpath: stat of %s failed (%s)\n",name,strerror(errno)));
- status = map_nt_error_from_unix(errno);
- goto path_err;
+ if (!VALID_STAT(sbuf)) {
+ int ret;
+
+ if (lp_posix_pathnames()) {
+ ret = SMB_VFS_LSTAT(conn,name,&sbuf);
+ } else {
+ ret = SMB_VFS_STAT(conn,name,&sbuf);
+ }
+ if (ret != 0) {
+ DEBUG(3,("reply_checkpath: stat of %s failed (%s)\n",name,strerror(errno)));
+ status = map_nt_error_from_unix(errno);
+ goto path_err;
+ }
}
if (!S_ISDIR(sbuf.st_mode)) {
END_PROFILE(SMBgetatr);
return;
}
- if (!VALID_STAT(sbuf) && (SMB_VFS_STAT(conn,fname,&sbuf) != 0)) {
- DEBUG(3,("reply_getatr: stat of %s failed (%s)\n",fname,strerror(errno)));
- reply_unixerror(req, ERRDOS,ERRbadfile);
- END_PROFILE(SMBgetatr);
- return;
+ if (!VALID_STAT(sbuf)) {
+ int ret;
+
+ if (lp_posix_pathnames()) {
+ ret = SMB_VFS_LSTAT(conn,fname,&sbuf);
+ } else {
+ ret = SMB_VFS_STAT(conn,fname,&sbuf);
+ }
+ if (ret != 0) {
+ DEBUG(3,("reply_getatr: stat of %s failed (%s)\n",fname,strerror(errno)));
+ reply_unixerror(req, ERRDOS,ERRbadfile);
+ END_PROFILE(SMBgetatr);
+ return;
+ }
}
mode = dos_mode(conn,fname,&sbuf);
uint32 fattr;
files_struct *fsp;
uint32 dirtype_orig = dirtype;
+ bool posix_paths = lp_posix_pathnames();
+ int ret;
NTSTATUS status;
DEBUG(10,("do_unlink: %s, dirtype = %d\n", fname, dirtype ));
return NT_STATUS_MEDIA_WRITE_PROTECTED;
}
- if (SMB_VFS_LSTAT(conn,fname,&sbuf) != 0) {
+ if (posix_paths) {
+ ret = SMB_VFS_LSTAT(conn,fname,&sbuf);
+ } else {
+ ret = SMB_VFS_STAT(conn,fname,&sbuf);
+ }
+ if (ret != 0) {
return map_nt_error_from_unix(errno);
}
FILE_SHARE_NONE, /* share_access */
FILE_OPEN, /* create_disposition*/
FILE_NON_DIRECTORY_FILE, /* create_options */
- FILE_ATTRIBUTE_NORMAL, /* file_attributes */
+ /* file_attributes */
+ posix_paths ? FILE_FLAG_POSIX_SEMANTICS|0777 :
+ FILE_ATTRIBUTE_NORMAL,
0, /* oplock_request */
0, /* allocation_size */
NULL, /* sd */