summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-04-29 11:57:02 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-04-29 16:38:13 +1000
commit0eca33bbf620678759bbe39efaa74f33f96efb74 (patch)
tree69f8d8cff78cdcd8ee93280d9b88563bc7331cf3 /source3/smbd
parent08c90d6f2df85499f43c5766a62839e80437290f (diff)
downloadsamba-0eca33bbf620678759bbe39efaa74f33f96efb74.tar.gz
samba-0eca33bbf620678759bbe39efaa74f33f96efb74.tar.bz2
samba-0eca33bbf620678759bbe39efaa74f33f96efb74.zip
s3-smb Use FILE_ATTRIBUTE_DIRECTORY intead of aDIR
This means we use just one constant for this file attribute. Andrew Bartlett
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/dir.c8
-rw-r--r--source3/smbd/dosmode.c18
-rw-r--r--source3/smbd/open.c4
-rw-r--r--source3/smbd/reply.c30
-rw-r--r--source3/smbd/smb2_find.c2
-rw-r--r--source3/smbd/trans2.c18
6 files changed, 40 insertions, 40 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 56104ee8ca..83b6225aad 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -92,7 +92,7 @@ bool make_dir_struct(TALLOC_CTX *ctx,
return False;
}
- if ((mode & aDIR) != 0) {
+ if ((mode & FILE_ATTRIBUTE_DIRECTORY) != 0) {
size = 0;
}
@@ -872,15 +872,15 @@ bool dir_check_ftype(connection_struct *conn, uint32 mode, uint32 dirtype)
uint32 mask;
/* Check the "may have" search bits. */
- if (((mode & ~dirtype) & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM | aDIR)) != 0)
+ if (((mode & ~dirtype) & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_DIRECTORY)) != 0)
return False;
/* Check the "must have" bits, which are the may have bits shifted eight */
/* If must have bit is set, the file/dir can not be returned in search unless the matching
file attribute is set */
- mask = ((dirtype >> 8) & (aDIR|aARCH|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM)); /* & 0x37 */
+ mask = ((dirtype >> 8) & (FILE_ATTRIBUTE_DIRECTORY|aARCH|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM)); /* & 0x37 */
if(mask) {
- if((mask & (mode & (aDIR|aARCH|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM))) == mask) /* check if matching attribute present */
+ if((mask & (mode & (FILE_ATTRIBUTE_DIRECTORY|aARCH|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM))) == mask) /* check if matching attribute present */
return True;
else
return False;
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index a92ed1c8c9..260909ec19 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -192,7 +192,7 @@ static uint32 dos_mode_from_sbuf(connection_struct *conn,
result |= FILE_ATTRIBUTE_HIDDEN;
if (S_ISDIR(smb_fname->st.st_ex_mode))
- result = aDIR | (result & FILE_ATTRIBUTE_READONLY);
+ result = FILE_ATTRIBUTE_DIRECTORY | (result & FILE_ATTRIBUTE_READONLY);
result |= set_link_read_only_flag(&smb_fname->st);
@@ -201,7 +201,7 @@ static uint32 dos_mode_from_sbuf(connection_struct *conn,
if (result & FILE_ATTRIBUTE_HIDDEN) DEBUG(8, ("h"));
if (result & FILE_ATTRIBUTE_READONLY ) DEBUG(8, ("r"));
if (result & FILE_ATTRIBUTE_SYSTEM) DEBUG(8, ("s"));
- if (result & aDIR ) DEBUG(8, ("d"));
+ if (result & FILE_ATTRIBUTE_DIRECTORY ) DEBUG(8, ("d"));
if (result & aARCH ) DEBUG(8, ("a"));
DEBUG(8,("\n"));
@@ -318,7 +318,7 @@ static bool get_ea_dos_attribute(connection_struct *conn,
}
if (S_ISDIR(smb_fname->st.st_ex_mode)) {
- dosattr |= aDIR;
+ dosattr |= FILE_ATTRIBUTE_DIRECTORY;
}
/* FILE_ATTRIBUTE_SPARSE is valid on get but not on set. */
*pattr = (uint32)(dosattr & (SAMBA_ATTRIBUTES_MASK|FILE_ATTRIBUTE_SPARSE));
@@ -328,7 +328,7 @@ static bool get_ea_dos_attribute(connection_struct *conn,
if (dosattr & FILE_ATTRIBUTE_HIDDEN) DEBUG(8, ("h"));
if (dosattr & FILE_ATTRIBUTE_READONLY ) DEBUG(8, ("r"));
if (dosattr & FILE_ATTRIBUTE_SYSTEM) DEBUG(8, ("s"));
- if (dosattr & aDIR ) DEBUG(8, ("d"));
+ if (dosattr & FILE_ATTRIBUTE_DIRECTORY ) DEBUG(8, ("d"));
if (dosattr & aARCH ) DEBUG(8, ("a"));
DEBUG(8,("\n"));
@@ -489,7 +489,7 @@ uint32 dos_mode_msdfs(connection_struct *conn,
if (result & FILE_ATTRIBUTE_HIDDEN) DEBUG(8, ("h"));
if (result & FILE_ATTRIBUTE_READONLY ) DEBUG(8, ("r"));
if (result & FILE_ATTRIBUTE_SYSTEM) DEBUG(8, ("s"));
- if (result & aDIR ) DEBUG(8, ("d"));
+ if (result & FILE_ATTRIBUTE_DIRECTORY ) DEBUG(8, ("d"));
if (result & aARCH ) DEBUG(8, ("a"));
if (result & FILE_ATTRIBUTE_SPARSE ) DEBUG(8, ("[sparse]"));
@@ -552,7 +552,7 @@ static bool get_stat_dos_flags(connection_struct *conn,
if (smb_fname->st.st_ex_flags & FILE_ATTRIBUTE_SPARSE)
*dosmode |= FILE_ATTRIBUTE_SPARSE;
if (S_ISDIR(smb_fname->st.st_ex_mode))
- *dosmode |= aDIR;
+ *dosmode |= FILE_ATTRIBUTE_DIRECTORY;
*dosmode |= set_link_read_only_flag(&smb_fname->st);
@@ -674,7 +674,7 @@ uint32 dos_mode(connection_struct *conn, struct smb_filename *smb_fname)
if (result & FILE_ATTRIBUTE_HIDDEN) DEBUG(8, ("h"));
if (result & FILE_ATTRIBUTE_READONLY ) DEBUG(8, ("r"));
if (result & FILE_ATTRIBUTE_SYSTEM) DEBUG(8, ("s"));
- if (result & aDIR ) DEBUG(8, ("d"));
+ if (result & FILE_ATTRIBUTE_DIRECTORY ) DEBUG(8, ("d"));
if (result & aARCH ) DEBUG(8, ("a"));
if (result & FILE_ATTRIBUTE_SPARSE ) DEBUG(8, ("[sparse]"));
@@ -712,9 +712,9 @@ int file_set_dosmode(connection_struct *conn, struct smb_filename *smb_fname,
&smb_fname->st.st_ex_mode);
if (S_ISDIR(smb_fname->st.st_ex_mode))
- dosmode |= aDIR;
+ dosmode |= FILE_ATTRIBUTE_DIRECTORY;
else
- dosmode &= ~aDIR;
+ dosmode &= ~FILE_ATTRIBUTE_DIRECTORY;
new_create_timespec = smb_fname->st.st_ex_btime;
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 14e6bf9b4e..d1ac91c9c5 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -2496,7 +2496,7 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
posix_open = true;
mode = (mode_t)(file_attributes & ~FILE_FLAG_POSIX_SEMANTICS);
} else {
- mode = unix_mode(conn, aDIR, smb_dname, parent_dir);
+ mode = unix_mode(conn, FILE_ATTRIBUTE_DIRECTORY, smb_dname, parent_dir);
}
if (SMB_VFS_MKDIR(conn, smb_dname->base_name, mode) != 0) {
@@ -2521,7 +2521,7 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
if (lp_store_dos_attributes(SNUM(conn))) {
if (!posix_open) {
file_set_dosmode(conn, smb_dname,
- file_attributes | aDIR,
+ file_attributes | FILE_ATTRIBUTE_DIRECTORY,
parent_dir, true);
}
}
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index ad72e4b7a9..cabf92d7af 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -1108,7 +1108,7 @@ void reply_getatr(struct smb_request *req)
/* dos smetimes asks for a stat of "" - it returns a "hidden directory"
under WfWg - weird! */
if (*fname == '\0') {
- mode = FILE_ATTRIBUTE_HIDDEN | aDIR;
+ mode = FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY;
if (!CAN_WRITE(conn)) {
mode |= FILE_ATTRIBUTE_READONLY;
}
@@ -1156,7 +1156,7 @@ void reply_getatr(struct smb_request *req)
}
mtime = convert_timespec_to_time_t(smb_fname->st.st_ex_mtime);
- if (mode & aDIR) {
+ if (mode & FILE_ATTRIBUTE_DIRECTORY) {
size = 0;
}
}
@@ -1257,9 +1257,9 @@ void reply_setatr(struct smb_request *req)
if (mode != FILE_ATTRIBUTE_NORMAL) {
if (VALID_STAT_OF_DIR(smb_fname->st))
- mode |= aDIR;
+ mode |= FILE_ATTRIBUTE_DIRECTORY;
else
- mode &= ~aDIR;
+ mode &= ~FILE_ATTRIBUTE_DIRECTORY;
if (file_set_dosmode(conn, smb_fname, mode, NULL,
false) != 0) {
@@ -1428,7 +1428,7 @@ void reply_search(struct smb_request *req)
status_len = SVAL(p, 0);
p += 2;
- /* dirtype &= ~aDIR; */
+ /* dirtype &= ~FILE_ATTRIBUTE_DIRECTORY; */
if (status_len == 0) {
nt_status = filename_convert(ctx, conn,
@@ -1820,7 +1820,7 @@ void reply_open(struct smb_request *req)
mtime = convert_timespec_to_time_t(smb_fname->st.st_ex_mtime);
- if (fattr & aDIR) {
+ if (fattr & FILE_ATTRIBUTE_DIRECTORY) {
DEBUG(3,("attempt to open a directory %s\n",
fsp_str_dbg(fsp)));
close_file(req, fsp, ERROR_CLOSE);
@@ -2004,7 +2004,7 @@ void reply_open_and_X(struct smb_request *req)
fattr = dos_mode(conn, fsp->fsp_name);
mtime = convert_timespec_to_time_t(fsp->fsp_name->st.st_ex_mtime);
- if (fattr & aDIR) {
+ if (fattr & FILE_ATTRIBUTE_DIRECTORY) {
close_file(req, fsp, ERROR_CLOSE);
reply_nterror(req, NT_STATUS_ACCESS_DENIED);
goto out;
@@ -2449,16 +2449,16 @@ static NTSTATUS do_unlink(connection_struct *conn,
fattr = dos_mode(conn, smb_fname);
if (dirtype & FILE_ATTRIBUTE_NORMAL) {
- dirtype = aDIR|aARCH|FILE_ATTRIBUTE_READONLY;
+ dirtype = FILE_ATTRIBUTE_DIRECTORY|aARCH|FILE_ATTRIBUTE_READONLY;
}
- dirtype &= (aDIR|aARCH|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM);
+ dirtype &= (FILE_ATTRIBUTE_DIRECTORY|aARCH|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM);
if (!dirtype) {
return NT_STATUS_NO_SUCH_FILE;
}
if (!dir_check_ftype(conn, fattr, dirtype)) {
- if (fattr & aDIR) {
+ if (fattr & FILE_ATTRIBUTE_DIRECTORY) {
return NT_STATUS_FILE_IS_A_DIRECTORY;
}
return NT_STATUS_NO_SUCH_FILE;
@@ -2489,13 +2489,13 @@ static NTSTATUS do_unlink(connection_struct *conn,
}
/* Can't delete a directory. */
- if (fattr & aDIR) {
+ if (fattr & FILE_ATTRIBUTE_DIRECTORY) {
return NT_STATUS_FILE_IS_A_DIRECTORY;
}
#endif
#if 0 /* JRATEST */
- else if (dirtype & aDIR) /* Asked for a directory and it isn't. */
+ else if (dirtype & FILE_ATTRIBUTE_DIRECTORY) /* Asked for a directory and it isn't. */
return NT_STATUS_OBJECT_NAME_INVALID;
#endif /* JRATEST */
@@ -2632,7 +2632,7 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req,
const char *dname = NULL;
char *talloced = NULL;
- if ((dirtype & SAMBA_ATTRIBUTES_MASK) == aDIR) {
+ if ((dirtype & SAMBA_ATTRIBUTES_MASK) == FILE_ATTRIBUTE_DIRECTORY) {
status = NT_STATUS_OBJECT_NAME_INVALID;
goto out;
}
@@ -6405,7 +6405,7 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
/* Quick check for "." and ".." */
if (ISDOT(dname) || ISDOTDOT(dname)) {
- if (attrs & aDIR) {
+ if (attrs & FILE_ATTRIBUTE_DIRECTORY) {
sysdir_entry = True;
} else {
TALLOC_FREE(talloced);
@@ -7971,7 +7971,7 @@ void reply_getattrE(struct smb_request *req)
srv_put_dos_date2((char *)req->outbuf, smb_vwv4,
convert_timespec_to_time_t(fsp->fsp_name->st.st_ex_mtime));
- if (mode & aDIR) {
+ if (mode & FILE_ATTRIBUTE_DIRECTORY) {
SIVAL(req->outbuf, smb_vwv6, 0);
SIVAL(req->outbuf, smb_vwv8, 0);
} else {
diff --git a/source3/smbd/smb2_find.c b/source3/smbd/smb2_find.c
index 8ac0f6e01c..eeb1f45e51 100644
--- a/source3/smbd/smb2_find.c
+++ b/source3/smbd/smb2_find.c
@@ -228,7 +228,7 @@ static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx,
int last_entry_off = 0;
int off = 0;
uint32_t num = 0;
- uint32_t dirtype = FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM | aDIR;
+ uint32_t dirtype = FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_DIRECTORY;
bool dont_descend = false;
bool ask_sharemode = true;
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 830504c657..abab3879f6 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -1148,7 +1148,7 @@ static void call_trans2open(connection_struct *conn,
fattr = dos_mode(conn, smb_fname);
mtime = convert_timespec_to_time_t(smb_fname->st.st_ex_mtime);
inode = smb_fname->st.st_ex_ino;
- if (fattr & aDIR) {
+ if (fattr & FILE_ATTRIBUTE_DIRECTORY) {
close_file(req, fsp, ERROR_CLOSE);
reply_nterror(req, NT_STATUS_ACCESS_DENIED);
goto out;
@@ -1524,7 +1524,7 @@ static bool smbd_marshall_dir_entry(TALLOC_CTX *ctx,
ZERO_STRUCT(create_date_ts);
ZERO_STRUCT(cdate_ts);
- if (!(mode & aDIR)) {
+ if (!(mode & FILE_ATTRIBUTE_DIRECTORY)) {
file_size = get_file_size_stat(&smb_fname->st);
}
allocation_size = SMB_VFS_GET_ALLOC_SIZE(conn, NULL, &smb_fname->st);
@@ -4227,7 +4227,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
mode = dos_mode(conn, smb_fname);
nlink = psbuf->st_ex_nlink;
- if (nlink && (mode&aDIR)) {
+ if (nlink && (mode&FILE_ATTRIBUTE_DIRECTORY)) {
nlink = 1;
}
@@ -4308,7 +4308,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
}
}
- if (!(mode & aDIR)) {
+ if (!(mode & FILE_ATTRIBUTE_DIRECTORY)) {
file_size = get_file_size_stat(psbuf);
}
@@ -4478,7 +4478,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
SOFF_T(pdata,8,file_size);
SIVAL(pdata,16,nlink);
SCVAL(pdata,20,delete_pending?1:0);
- SCVAL(pdata,21,(mode&aDIR)?1:0);
+ SCVAL(pdata,21,(mode&FILE_ATTRIBUTE_DIRECTORY)?1:0);
SSVAL(pdata,22,0); /* Padding. */
break;
@@ -4561,7 +4561,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
SOFF_T(pdata,8,file_size);
SIVAL(pdata,16,nlink);
SCVAL(pdata,20,delete_pending);
- SCVAL(pdata,21,(mode&aDIR)?1:0);
+ SCVAL(pdata,21,(mode&FILE_ATTRIBUTE_DIRECTORY)?1:0);
SSVAL(pdata,22,0);
pdata += 24;
SIVAL(pdata,0,ea_size);
@@ -4592,7 +4592,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
SBVAL(pdata, 0x30, file_size);
SIVAL(pdata, 0x38, nlink);
SCVAL(pdata, 0x3C, delete_pending);
- SCVAL(pdata, 0x3D, (mode&aDIR)?1:0);
+ SCVAL(pdata, 0x3D, (mode&FILE_ATTRIBUTE_DIRECTORY)?1:0);
SSVAL(pdata, 0x3E, 0); /* padding */
SBVAL(pdata, 0x40, file_index);
SIVAL(pdata, 0x48, ea_size);
@@ -5554,9 +5554,9 @@ static NTSTATUS smb_set_file_dosmode(connection_struct *conn,
if (dosmode) {
if (S_ISDIR(smb_fname_base->st.st_ex_mode)) {
- dosmode |= aDIR;
+ dosmode |= FILE_ATTRIBUTE_DIRECTORY;
} else {
- dosmode &= ~aDIR;
+ dosmode &= ~FILE_ATTRIBUTE_DIRECTORY;
}
}