summaryrefslogtreecommitdiff
path: root/source3
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
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')
-rw-r--r--source3/client/client.c28
-rw-r--r--source3/client/clitar.c6
-rw-r--r--source3/include/smb.h1
-rw-r--r--source3/include/smb_macros.h2
-rw-r--r--source3/lib/util.c2
-rw-r--r--source3/libgpo/gpo_filesync.c4
-rw-r--r--source3/libsmb/clifile.c4
-rw-r--r--source3/libsmb/libsmb_dir.c6
-rw-r--r--source3/modules/onefs_acl.c2
-rw-r--r--source3/modules/onefs_open.c2
-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
-rw-r--r--source3/torture/masktest.c6
-rw-r--r--source3/torture/nbio.c6
-rw-r--r--source3/torture/torture.c18
-rw-r--r--source3/utils/net_rpc.c4
-rw-r--r--source3/utils/smbcacls.c2
21 files changed, 86 insertions, 87 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index fed5b70bb1..dadaf44394 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -505,7 +505,7 @@ static bool do_this_one(struct file_info *finfo)
return false;
}
- if (finfo->mode & aDIR) {
+ if (finfo->mode & FILE_ATTRIBUTE_DIRECTORY) {
return true;
}
@@ -752,7 +752,7 @@ static NTSTATUS do_list_helper(const char *mntpoint, struct file_info *f,
*dir_end = '\0';
}
- if (f->mode & aDIR) {
+ if (f->mode & FILE_ATTRIBUTE_DIRECTORY) {
if (do_list_dirs && do_this_one(f)) {
status = do_list_fn(cli_state, f, dir);
if (!NT_STATUS_IS_OK(status)) {
@@ -924,7 +924,7 @@ NTSTATUS do_list(const char *mask,
static int cmd_dir(void)
{
TALLOC_CTX *ctx = talloc_tos();
- uint16 attribute = aDIR | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN;
+ uint16 attribute = FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN;
char *mask = NULL;
char *buf = NULL;
int rc = 1;
@@ -974,7 +974,7 @@ static int cmd_dir(void)
static int cmd_du(void)
{
TALLOC_CTX *ctx = talloc_tos();
- uint16 attribute = aDIR | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN;
+ uint16 attribute = FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN;
char *mask = NULL;
char *buf = NULL;
NTSTATUS status;
@@ -1233,7 +1233,7 @@ static NTSTATUS do_mget(struct cli_state *cli_state, struct file_info *finfo,
return NT_STATUS_UNSUCCESSFUL;
}
- if (finfo->mode & aDIR) {
+ if (finfo->mode & FILE_ATTRIBUTE_DIRECTORY) {
if (asprintf(&quest,
"Get directory %s? ",finfo->name) < 0) {
return NT_STATUS_NO_MEMORY;
@@ -1251,7 +1251,7 @@ static NTSTATUS do_mget(struct cli_state *cli_state, struct file_info *finfo,
}
SAFE_FREE(quest);
- if (!(finfo->mode & aDIR)) {
+ if (!(finfo->mode & FILE_ATTRIBUTE_DIRECTORY)) {
rname = talloc_asprintf(ctx,
"%s%s",
client_get_cur_dir(),
@@ -1306,7 +1306,7 @@ static NTSTATUS do_mget(struct cli_state *cli_state, struct file_info *finfo,
return NT_STATUS_NO_MEMORY;
}
- status = do_list(mget_mask, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | aDIR,do_mget,false, true);
+ status = do_list(mget_mask, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY,do_mget,false, true);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -1401,7 +1401,7 @@ static int cmd_mget(void)
NTSTATUS status = NT_STATUS_OK;
if (recurse) {
- attribute |= aDIR;
+ attribute |= FILE_ATTRIBUTE_DIRECTORY;
}
abort_mget = false;
@@ -2306,7 +2306,7 @@ static NTSTATUS do_del(struct cli_state *cli_state, struct file_info *finfo,
return NT_STATUS_NO_MEMORY;
}
- if (finfo->mode & aDIR) {
+ if (finfo->mode & FILE_ATTRIBUTE_DIRECTORY) {
TALLOC_FREE(mask);
return NT_STATUS_OK;
}
@@ -2333,7 +2333,7 @@ static int cmd_del(void)
uint16 attribute = FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN;
if (recurse) {
- attribute |= aDIR;
+ attribute |= FILE_ATTRIBUTE_DIRECTORY;
}
mask = talloc_strdup(ctx, client_get_cur_dir());
@@ -4516,7 +4516,7 @@ static NTSTATUS completion_remote_filter(const char *mnt,
return NT_STATUS_OK;
}
- if ((info->dirmask[0] == 0) && !(f->mode & aDIR))
+ if ((info->dirmask[0] == 0) && !(f->mode & FILE_ATTRIBUTE_DIRECTORY))
info->matches[info->count] = SMB_STRDUP(f->name);
else {
TALLOC_CTX *ctx = talloc_stackframe();
@@ -4532,7 +4532,7 @@ static NTSTATUS completion_remote_filter(const char *mnt,
TALLOC_FREE(ctx);
return NT_STATUS_NO_MEMORY;
}
- if (f->mode & aDIR) {
+ if (f->mode & FILE_ATTRIBUTE_DIRECTORY) {
tmp = talloc_asprintf_append(tmp, "%s",
CLI_DIRSEP_STR);
}
@@ -4546,7 +4546,7 @@ static NTSTATUS completion_remote_filter(const char *mnt,
if (info->matches[info->count] == NULL) {
return NT_STATUS_OK;
}
- if (f->mode & aDIR) {
+ if (f->mode & FILE_ATTRIBUTE_DIRECTORY) {
smb_readline_ca_char(0);
}
if (info->count == 1) {
@@ -4629,7 +4629,7 @@ static char **remote_completion(const char *text, int len)
if (!cli_resolve_path(ctx, "", auth_info, cli, dirmask, &targetcli, &targetpath)) {
goto cleanup;
}
- status = cli_list(targetcli, targetpath, aDIR | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN,
+ status = cli_list(targetcli, targetpath, FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN,
completion_remote_filter, (void *)&info);
if (!NT_STATUS_IS_OK(status)) {
goto cleanup;
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index c389cfa776..ebda5af5e3 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -70,7 +70,7 @@ extern struct cli_state *cli;
#define ATTRSET 1
#define ATTRRESET 0
-static uint16 attribute = aDIR | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN;
+static uint16 attribute = FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN;
#ifndef CLIENT_TIMEOUT
#define CLIENT_TIMEOUT (30*1000)
@@ -294,7 +294,7 @@ of link other than a GNUtar Longlink - ignoring\n"));
if ((unoct(hb->dbuf.mode, sizeof(hb->dbuf.mode)) & S_IFDIR) ||
(*(finfo->name+strlen(finfo->name)-1) == '\\')) {
- finfo->mode=aDIR;
+ finfo->mode=FILE_ATTRIBUTE_DIRECTORY;
} else {
finfo->mode=0; /* we don't care about mode at the moment, we'll
* just make it a regular file */
@@ -852,7 +852,7 @@ static NTSTATUS do_tar(struct cli_state *cli_state, struct file_info *finfo,
TALLOC_FREE(exclaim);
}
- if (finfo->mode & aDIR) {
+ if (finfo->mode & FILE_ATTRIBUTE_DIRECTORY) {
char *saved_curdir = NULL;
char *new_cd = NULL;
char *mtar_mask = NULL;
diff --git a/source3/include/smb.h b/source3/include/smb.h
index bb192cd5e8..12b089442b 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -86,7 +86,6 @@ enum smb_read_errors {
#define DIR_STRUCT_SIZE 43
/* these define the attribute byte as seen by DOS */
-#define aDIR (1L<<4) /* 0x10 */
#define aARCH (1L<<5) /* 0x20 */
/* deny modes */
diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h
index a60ccedeef..1a6ef3b318 100644
--- a/source3/include/smb_macros.h
+++ b/source3/include/smb_macros.h
@@ -29,7 +29,7 @@
/* for readability... */
#define IS_DOS_READONLY(test_mode) (((test_mode) & FILE_ATTRIBUTE_READONLY) != 0)
-#define IS_DOS_DIR(test_mode) (((test_mode) & aDIR) != 0)
+#define IS_DOS_DIR(test_mode) (((test_mode) & FILE_ATTRIBUTE_DIRECTORY) != 0)
#define IS_DOS_ARCHIVE(test_mode) (((test_mode) & aARCH) != 0)
#define IS_DOS_SYSTEM(test_mode) (((test_mode) & FILE_ATTRIBUTE_SYSTEM) != 0)
#define IS_DOS_HIDDEN(test_mode) (((test_mode) & FILE_ATTRIBUTE_HIDDEN) != 0)
diff --git a/source3/lib/util.c b/source3/lib/util.c
index ac79b994c9..bec279e3bd 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -305,7 +305,7 @@ char *attrib_string(uint16 mode)
attrstr[0] = 0;
if (mode & FILE_ATTRIBUTE_VOLUME) fstrcat(attrstr,"V");
- if (mode & aDIR) fstrcat(attrstr,"D");
+ if (mode & FILE_ATTRIBUTE_DIRECTORY) fstrcat(attrstr,"D");
if (mode & aARCH) fstrcat(attrstr,"A");
if (mode & FILE_ATTRIBUTE_HIDDEN) fstrcat(attrstr,"H");
if (mode & FILE_ATTRIBUTE_SYSTEM) fstrcat(attrstr,"S");
diff --git a/source3/libgpo/gpo_filesync.c b/source3/libgpo/gpo_filesync.c
index c88b12c20e..e3d3ae6c04 100644
--- a/source3/libgpo/gpo_filesync.c
+++ b/source3/libgpo/gpo_filesync.c
@@ -150,7 +150,7 @@ static NTSTATUS gpo_sync_func(const char *mnt,
DEBUG(5,("gpo_sync_func: got mask: [%s], name: [%s]\n",
mask, info->name));
- if (info->mode & aDIR) {
+ if (info->mode & FILE_ATTRIBUTE_DIRECTORY) {
DEBUG(3,("got dir: [%s]\n", info->name));
@@ -228,7 +228,7 @@ NTSTATUS gpo_sync_directories(TALLOC_CTX *mem_ctx,
ctx.cli = cli;
ctx.remote_path = CONST_DISCARD(char *, nt_path);
ctx.local_path = CONST_DISCARD(char *, local_path);
- ctx.attribute = (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | aDIR);
+ ctx.attribute = (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY);
ctx.mask = talloc_asprintf(mem_ctx,
"%s\\*",
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index 13ffeaa72f..c86355237e 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -1134,7 +1134,7 @@ struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
return NULL;
}
- SSVAL(state->vwv+0, 0, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | aDIR);
+ SSVAL(state->vwv+0, 0, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY);
bytes = talloc_array(state, uint8_t, 1);
if (tevent_req_nomem(bytes, req)) {
@@ -1259,7 +1259,7 @@ static struct tevent_req *cli_ntrename_internal_send(TALLOC_CTX *mem_ctx,
return NULL;
}
- SSVAL(state->vwv+0, 0 ,FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | aDIR);
+ SSVAL(state->vwv+0, 0 ,FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY);
SSVAL(state->vwv+1, 0, rename_flag);
bytes = talloc_array(state, uint8_t, 1);
diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c
index 9b0f10f52d..f07ddf199a 100644
--- a/source3/libsmb/libsmb_dir.c
+++ b/source3/libsmb/libsmb_dir.c
@@ -245,7 +245,7 @@ dir_list_fn(const char *mnt,
{
if (add_dirent((SMBCFILE *)state, finfo->name, "",
- (finfo->mode&aDIR?SMBC_DIR:SMBC_FILE)) < 0) {
+ (finfo->mode&FILE_ATTRIBUTE_DIRECTORY?SMBC_DIR:SMBC_FILE)) < 0) {
SMBCFILE *dir = (SMBCFILE *)state;
return map_nt_error_from_unix(dir->dir_error);
}
@@ -816,7 +816,7 @@ SMBC_opendir_ctx(SMBCCTX *context,
}
status = cli_list(targetcli, targetpath,
- aDIR | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN,
+ FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN,
dir_list_fn, (void *)dir);
if (!NT_STATUS_IS_OK(status)) {
if (dir) {
@@ -1345,7 +1345,7 @@ SMBC_rmdir_ctx(SMBCCTX *context,
}
status = cli_list(targetcli, lpath,
- aDIR | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN,
+ FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN,
rmdir_list_fn,
&smbc_rmdir_dirempty);
diff --git a/source3/modules/onefs_acl.c b/source3/modules/onefs_acl.c
index e986b2a978..f78d1f0e2e 100644
--- a/source3/modules/onefs_acl.c
+++ b/source3/modules/onefs_acl.c
@@ -554,7 +554,7 @@ static bool add_sfs_aces(files_struct *fsp, struct ifs_security_descriptor *sd)
/* Use existing samba logic to derive the mode bits. */
file_mode = unix_mode(fsp->conn, 0, fsp->fsp_name, NULL);
- dir_mode = unix_mode(fsp->conn, aDIR, fsp->fsp_name, NULL);
+ dir_mode = unix_mode(fsp->conn, FILE_ATTRIBUTE_DIRECTORY, fsp->fsp_name, NULL);
/* Initialize ACEs. */
new_aces[0] = onefs_init_ace(fsp->conn, file_mode, false, USR);
diff --git a/source3/modules/onefs_open.c b/source3/modules/onefs_open.c
index 80f799ca6f..9cd831ce2d 100644
--- a/source3/modules/onefs_open.c
+++ b/source3/modules/onefs_open.c
@@ -1482,7 +1482,7 @@ static NTSTATUS onefs_open_directory(connection_struct *conn,
mode = (mode_t)(file_attributes & ~FILE_FLAG_POSIX_SEMANTICS);
file_attributes = 0;
} else {
- mode = unix_mode(conn, aDIR, smb_dname, parent_dir);
+ mode = unix_mode(conn, FILE_ATTRIBUTE_DIRECTORY, smb_dname, parent_dir);
}
/*
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;
}
}
diff --git a/source3/torture/masktest.c b/source3/torture/masktest.c
index a523560fd9..818fef1330 100644
--- a/source3/torture/masktest.c
+++ b/source3/torture/masktest.c
@@ -313,11 +313,11 @@ static void get_real_name(struct cli_state *cli,
*pp_long_name = NULL;
/* nasty hack to force level 260 listings - tridge */
if (max_protocol <= PROTOCOL_LANMAN1) {
- cli_list_trans(cli, "\\masktest\\*.*", FILE_ATTRIBUTE_HIDDEN | aDIR,
+ cli_list_trans(cli, "\\masktest\\*.*", FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY,
SMB_FIND_FILE_BOTH_DIRECTORY_INFO, listfn,
&state);
} else {
- cli_list_trans(cli, "\\masktest\\*", FILE_ATTRIBUTE_HIDDEN | aDIR,
+ cli_list_trans(cli, "\\masktest\\*", FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY,
SMB_FIND_FILE_BOTH_DIRECTORY_INFO,
listfn, &state);
}
@@ -359,7 +359,7 @@ static void testpair(struct cli_state *cli, const char *mask, const char *file)
return;
}
fstrcpy(res1, "---");
- cli_list(cli, mask, FILE_ATTRIBUTE_HIDDEN | aDIR, listfn, NULL);
+ cli_list(cli, mask, FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY, listfn, NULL);
res2 = reg_test(cli, mask, long_name, short_name);
diff --git a/source3/torture/nbio.c b/source3/torture/nbio.c
index 96584455e4..085d206a75 100644
--- a/source3/torture/nbio.c
+++ b/source3/torture/nbio.c
@@ -305,13 +305,13 @@ static NTSTATUS delete_fn(const char *mnt, struct file_info *finfo,
printf("asprintf failed\n");
return NT_STATUS_NO_MEMORY;
}
- if (finfo->mode & aDIR) {
+ if (finfo->mode & FILE_ATTRIBUTE_DIRECTORY) {
char *s2;
if (asprintf(&s2, "%s\\*", s) == -1) {
printf("asprintf failed\n");
return NT_STATUS_NO_MEMORY;
}
- status = cli_list(c, s2, aDIR, delete_fn, NULL);
+ status = cli_list(c, s2, FILE_ATTRIBUTE_DIRECTORY, delete_fn, NULL);
if (!NT_STATUS_IS_OK(status)) {
free(n);
free(s2);
@@ -336,7 +336,7 @@ void nb_deltree(const char *dname)
}
total_deleted = 0;
- cli_list(c, mask, aDIR, delete_fn, NULL);
+ cli_list(c, mask, FILE_ATTRIBUTE_DIRECTORY, delete_fn, NULL);
free(mask);
cli_rmdir(c, dname);
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 4238627a0f..090f838105 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -5385,7 +5385,7 @@ static NTSTATUS del_fn(const char *mnt, struct file_info *finfo, const char *mas
if (strcmp(finfo->name, ".") == 0 || strcmp(finfo->name, "..") == 0)
return NT_STATUS_OK;
- if (finfo->mode & aDIR) {
+ if (finfo->mode & FILE_ATTRIBUTE_DIRECTORY) {
if (!NT_STATUS_IS_OK(cli_rmdir(pcli, fname)))
printf("del_fn: failed to rmdir %s\n,", fname );
} else {
@@ -5678,7 +5678,7 @@ static bool run_dirtest1(int dummy)
cli_sockopt(cli, sockops);
cli_list(cli, "\\LISTDIR\\*", 0, del_fn, cli);
- cli_list(cli, "\\LISTDIR\\*", aDIR, del_fn, cli);
+ cli_list(cli, "\\LISTDIR\\*", FILE_ATTRIBUTE_DIRECTORY, del_fn, cli);
cli_rmdir(cli, "\\LISTDIR");
cli_mkdir(cli, "\\LISTDIR");
@@ -5704,7 +5704,7 @@ static bool run_dirtest1(int dummy)
/* Now ensure that doing an old list sees both files and directories. */
num_seen = 0;
- cli_list_old(cli, "\\LISTDIR\\*", aDIR, list_fn, &num_seen);
+ cli_list_old(cli, "\\LISTDIR\\*", FILE_ATTRIBUTE_DIRECTORY, list_fn, &num_seen);
printf("num_seen = %d\n", num_seen );
/* We should see 100 files + 1000 directories + . and .. */
if (num_seen != 2002)
@@ -5714,20 +5714,20 @@ static bool run_dirtest1(int dummy)
* relevent entries.
*/
num_seen = 0;
- cli_list_old(cli, "\\LISTDIR\\*", (aDIR<<8)|aDIR, list_fn, &num_seen);
+ cli_list_old(cli, "\\LISTDIR\\*", (FILE_ATTRIBUTE_DIRECTORY<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, &num_seen);
printf("num_seen = %d\n", num_seen );
if (num_seen != 1002)
correct = False;
num_seen = 0;
- cli_list_old(cli, "\\LISTDIR\\*", (aARCH<<8)|aDIR, list_fn, &num_seen);
+ cli_list_old(cli, "\\LISTDIR\\*", (aARCH<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, &num_seen);
printf("num_seen = %d\n", num_seen );
if (num_seen != 1000)
correct = False;
/* Delete everything. */
cli_list(cli, "\\LISTDIR\\*", 0, del_fn, cli);
- cli_list(cli, "\\LISTDIR\\*", aDIR, del_fn, cli);
+ cli_list(cli, "\\LISTDIR\\*", FILE_ATTRIBUTE_DIRECTORY, del_fn, cli);
cli_rmdir(cli, "\\LISTDIR");
#if 0
@@ -6714,7 +6714,7 @@ static NTSTATUS shortname_del_fn(const char *mnt, struct file_info *finfo,
if (strcmp(finfo->name, ".") == 0 || strcmp(finfo->name, "..") == 0)
return NT_STATUS_OK;
- if (finfo->mode & aDIR) {
+ if (finfo->mode & FILE_ATTRIBUTE_DIRECTORY) {
status = cli_rmdir(pcli, fname);
if (!NT_STATUS_IS_OK(status)) {
printf("del_fn: failed to rmdir %s\n,", fname );
@@ -6779,7 +6779,7 @@ static bool run_shortname_test(int dummy)
cli_sockopt(cli, sockops);
cli_list(cli, "\\shortname\\*", 0, shortname_del_fn, cli);
- cli_list(cli, "\\shortname\\*", aDIR, shortname_del_fn, cli);
+ cli_list(cli, "\\shortname\\*", FILE_ATTRIBUTE_DIRECTORY, shortname_del_fn, cli);
cli_rmdir(cli, "\\shortname");
if (!NT_STATUS_IS_OK(cli_mkdir(cli, "\\shortname"))) {
@@ -6840,7 +6840,7 @@ static bool run_shortname_test(int dummy)
out:
cli_list(cli, "\\shortname\\*", 0, shortname_del_fn, cli);
- cli_list(cli, "\\shortname\\*", aDIR, shortname_del_fn, cli);
+ cli_list(cli, "\\shortname\\*", FILE_ATTRIBUTE_DIRECTORY, shortname_del_fn, cli);
cli_rmdir(cli, "\\shortname");
torture_close_connection(cli);
return correct;
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 6f9ef8c107..a3657262c4 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -3730,7 +3730,7 @@ static NTSTATUS copy_fn(const char *mnt, struct file_info *f,
DEBUG(3,("got mask: %s, name: %s\n", mask, f->name));
/* DIRECTORY */
- if (f->mode & aDIR) {
+ if (f->mode & FILE_ATTRIBUTE_DIRECTORY) {
DEBUG(3,("got dir: %s\n", f->name));
@@ -3968,7 +3968,7 @@ static NTSTATUS rpc_share_migrate_files_internals(struct net_context *c,
cp_clistate.cli_share_src = NULL;
cp_clistate.cli_share_dst = NULL;
cp_clistate.cwd = NULL;
- cp_clistate.attribute = FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | aDIR;
+ cp_clistate.attribute = FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY;
cp_clistate.c = c;
/* open share source */
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index 45b4163c96..efadaee4c6 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -1044,7 +1044,7 @@ static int inherit(struct cli_state *cli, const char *filename,
/* Add inherited flag to all aces */
ace->flags=ace->flags|
SEC_ACE_FLAG_INHERITED_ACE;
- if ((oldattr & aDIR) == aDIR) {
+ if ((oldattr & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) {
if ((ace->flags & SEC_ACE_FLAG_CONTAINER_INHERIT) ==
SEC_ACE_FLAG_CONTAINER_INHERIT) {
add_ace(&old->dacl, ace);