diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-04-29 12:00:57 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-04-29 16:38:13 +1000 |
commit | 0520da2bbe246c45d89bfdec0d399862ecb867ba (patch) | |
tree | 7789cb1fdf01844b6b27efa33e370354eb4d2735 | |
parent | 0eca33bbf620678759bbe39efaa74f33f96efb74 (diff) | |
download | samba-0520da2bbe246c45d89bfdec0d399862ecb867ba.tar.gz samba-0520da2bbe246c45d89bfdec0d399862ecb867ba.tar.bz2 samba-0520da2bbe246c45d89bfdec0d399862ecb867ba.zip |
s3-smb Use FILE_ATTRIBUTE_ARCHIVE intead of aARCH
This means we use just one constant for this file attribute.
Andrew Bartlett
-rw-r--r-- | source3/client/client.c | 6 | ||||
-rw-r--r-- | source3/client/clitar.c | 6 | ||||
-rw-r--r-- | source3/include/smb.h | 3 | ||||
-rw-r--r-- | source3/include/smb_macros.h | 2 | ||||
-rw-r--r-- | source3/lib/util.c | 2 | ||||
-rw-r--r-- | source3/libsmb/libsmb_dir.c | 2 | ||||
-rw-r--r-- | source3/modules/onefs_open.c | 6 | ||||
-rw-r--r-- | source3/smbd/dir.c | 4 | ||||
-rw-r--r-- | source3/smbd/dosmode.c | 14 | ||||
-rw-r--r-- | source3/smbd/fileio.c | 2 | ||||
-rw-r--r-- | source3/smbd/nttrans.c | 2 | ||||
-rw-r--r-- | source3/smbd/open.c | 6 | ||||
-rw-r--r-- | source3/smbd/reply.c | 4 | ||||
-rw-r--r-- | source3/torture/torture.c | 2 |
14 files changed, 29 insertions, 32 deletions
diff --git a/source3/client/client.c b/source3/client/client.c index dadaf44394..4c90716c48 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -520,7 +520,7 @@ static bool do_this_one(struct file_info *finfo) return false; } - if ((archive_level==1 || archive_level==2) && !(finfo->mode & aARCH)) { + if ((archive_level==1 || archive_level==2) && !(finfo->mode & FILE_ATTRIBUTE_ARCHIVE)) { DEBUG(3,("archive %s failed\n", finfo->name)); return false; } @@ -1147,8 +1147,8 @@ static int do_get(const char *rname, const char *lname_in, bool reget) close(handle); } - if (archive_level >= 2 && (attr & aARCH)) { - cli_setatr(cli, rname, attr & ~(uint16)aARCH, 0); + if (archive_level >= 2 && (attr & FILE_ATTRIBUTE_ARCHIVE)) { + cli_setatr(cli, rname, attr & ~(uint16)FILE_ATTRIBUTE_ARCHIVE, 0); } { diff --git a/source3/client/clitar.c b/source3/client/clitar.c index ebda5af5e3..289e57801b 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -686,7 +686,7 @@ static NTSTATUS do_atar(const char *rname_in, char *lname, DEBUG(3,("file %s attrib 0x%X\n",finfo.name,finfo.mode)); - if (tar_inc && !(finfo.mode & aARCH)) { + if (tar_inc && !(finfo.mode & FILE_ATTRIBUTE_ARCHIVE)) { DEBUG(4, ("skipping %s - archive bit not set\n", finfo.name)); shallitime=0; } else if (!tar_system && (finfo.mode & FILE_ATTRIBUTE_SYSTEM)) { @@ -784,7 +784,7 @@ static NTSTATUS do_atar(const char *rname_in, char *lname, /* if shallitime is true then we didn't skip */ if (tar_reset && !dry_run) - (void) do_setrattr(finfo.name, aARCH, ATTRRESET); + (void) do_setrattr(finfo.name, FILE_ATTRIBUTE_ARCHIVE, ATTRRESET); clock_gettime_mono(&tp_end); this_time = (tp_end.tv_sec - tp_start.tv_sec)*1000 + (tp_end.tv_nsec - tp_start.tv_nsec)/1000000; @@ -1414,7 +1414,7 @@ int cmd_setmode(void) attra[direct]|=FILE_ATTRIBUTE_SYSTEM; break; case 'a': - attra[direct]|=aARCH; + attra[direct]|=FILE_ATTRIBUTE_ARCHIVE; break; default: DEBUG(0, ("setmode <filename> <perm=[+|-]rsha>\n")); diff --git a/source3/include/smb.h b/source3/include/smb.h index 12b089442b..8885ef2d14 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -85,9 +85,6 @@ enum smb_read_errors { #define DIR_STRUCT_SIZE 43 -/* these define the attribute byte as seen by DOS */ -#define aARCH (1L<<5) /* 0x20 */ - /* deny modes */ #define DENY_DOS 0 #define DENY_ALL 1 diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h index 1a6ef3b318..79aa4c5406 100644 --- a/source3/include/smb_macros.h +++ b/source3/include/smb_macros.h @@ -30,7 +30,7 @@ /* for readability... */ #define IS_DOS_READONLY(test_mode) (((test_mode) & FILE_ATTRIBUTE_READONLY) != 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_ARCHIVE(test_mode) (((test_mode) & FILE_ATTRIBUTE_ARCHIVE) != 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 bec279e3bd..f592a0f778 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -306,7 +306,7 @@ char *attrib_string(uint16 mode) if (mode & FILE_ATTRIBUTE_VOLUME) fstrcat(attrstr,"V"); if (mode & FILE_ATTRIBUTE_DIRECTORY) fstrcat(attrstr,"D"); - if (mode & aARCH) fstrcat(attrstr,"A"); + if (mode & FILE_ATTRIBUTE_ARCHIVE) fstrcat(attrstr,"A"); if (mode & FILE_ATTRIBUTE_HIDDEN) fstrcat(attrstr,"H"); if (mode & FILE_ATTRIBUTE_SYSTEM) fstrcat(attrstr,"S"); if (mode & FILE_ATTRIBUTE_READONLY) fstrcat(attrstr,"R"); diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c index f07ddf199a..3d50107f60 100644 --- a/source3/libsmb/libsmb_dir.c +++ b/source3/libsmb/libsmb_dir.c @@ -1612,7 +1612,7 @@ SMBC_chmod_ctx(SMBCCTX *context, mode = 0; if (!(newmode & (S_IWUSR | S_IWGRP | S_IWOTH))) mode |= FILE_ATTRIBUTE_READONLY; - if ((newmode & S_IXUSR) && lp_map_archive(-1)) mode |= aARCH; + if ((newmode & S_IXUSR) && lp_map_archive(-1)) mode |= FILE_ATTRIBUTE_ARCHIVE; if ((newmode & S_IXGRP) && lp_map_system(-1)) mode |= FILE_ATTRIBUTE_SYSTEM; if ((newmode & S_IXOTH) && lp_map_hidden(-1)) mode |= FILE_ATTRIBUTE_HIDDEN; diff --git a/source3/modules/onefs_open.c b/source3/modules/onefs_open.c index 9cd831ce2d..6ab47d739b 100644 --- a/source3/modules/onefs_open.c +++ b/source3/modules/onefs_open.c @@ -498,9 +498,9 @@ NTSTATUS onefs_open_file_ntcreate(connection_struct *conn, unx_mode = (mode_t)(new_dos_attributes & ~FILE_FLAG_POSIX_SEMANTICS); new_dos_attributes = 0; } else { - /* We add aARCH to this as this mode is only used if the file is + /* We add FILE_ATTRIBUTE_ARCHIVE to this as this mode is only used if the file is * created new. */ - unx_mode = unix_mode(conn, new_dos_attributes | aARCH, + unx_mode = unix_mode(conn, new_dos_attributes | FILE_ATTRIBUTE_ARCHIVE, smb_fname, parent_dir); } @@ -587,7 +587,7 @@ NTSTATUS onefs_open_file_ntcreate(connection_struct *conn, /* Setup dos_attributes to be set by ifs_createfile */ if (lp_store_dos_attributes(SNUM(conn))) { - createfile_attributes = (new_dos_attributes | aARCH) & + createfile_attributes = (new_dos_attributes | FILE_ATTRIBUTE_ARCHIVE) & ~(FILE_ATTRIBUTE_NONINDEXED | FILE_ATTRIBUTE_COMPRESSED); } diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 83b6225aad..9969693e7b 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -878,9 +878,9 @@ bool dir_check_ftype(connection_struct *conn, uint32 mode, uint32 dirtype) /* 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) & (FILE_ATTRIBUTE_DIRECTORY|aARCH|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM)); /* & 0x37 */ + mask = ((dirtype >> 8) & (FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM)); /* & 0x37 */ if(mask) { - if((mask & (mode & (FILE_ATTRIBUTE_DIRECTORY|aARCH|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM))) == mask) /* check if matching attribute present */ + if((mask & (mode & (FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_ARCHIVE|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 260909ec19..823d44d0aa 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -183,7 +183,7 @@ static uint32 dos_mode_from_sbuf(connection_struct *conn, } /* Else never set the readonly bit. */ if (MAP_ARCHIVE(conn) && ((smb_fname->st.st_ex_mode & S_IXUSR) != 0)) - result |= aARCH; + result |= FILE_ATTRIBUTE_ARCHIVE; if (MAP_SYSTEM(conn) && ((smb_fname->st.st_ex_mode & S_IXGRP) != 0)) result |= FILE_ATTRIBUTE_SYSTEM; @@ -202,7 +202,7 @@ static uint32 dos_mode_from_sbuf(connection_struct *conn, if (result & FILE_ATTRIBUTE_READONLY ) DEBUG(8, ("r")); if (result & FILE_ATTRIBUTE_SYSTEM) DEBUG(8, ("s")); if (result & FILE_ATTRIBUTE_DIRECTORY ) DEBUG(8, ("d")); - if (result & aARCH ) DEBUG(8, ("a")); + if (result & FILE_ATTRIBUTE_ARCHIVE ) DEBUG(8, ("a")); DEBUG(8,("\n")); return result; @@ -329,7 +329,7 @@ static bool get_ea_dos_attribute(connection_struct *conn, if (dosattr & FILE_ATTRIBUTE_READONLY ) DEBUG(8, ("r")); if (dosattr & FILE_ATTRIBUTE_SYSTEM) DEBUG(8, ("s")); if (dosattr & FILE_ATTRIBUTE_DIRECTORY ) DEBUG(8, ("d")); - if (dosattr & aARCH ) DEBUG(8, ("a")); + if (dosattr & FILE_ATTRIBUTE_ARCHIVE ) DEBUG(8, ("a")); DEBUG(8,("\n")); @@ -490,7 +490,7 @@ uint32 dos_mode_msdfs(connection_struct *conn, if (result & FILE_ATTRIBUTE_READONLY ) DEBUG(8, ("r")); if (result & FILE_ATTRIBUTE_SYSTEM) DEBUG(8, ("s")); if (result & FILE_ATTRIBUTE_DIRECTORY ) DEBUG(8, ("d")); - if (result & aARCH ) DEBUG(8, ("a")); + if (result & FILE_ATTRIBUTE_ARCHIVE ) DEBUG(8, ("a")); if (result & FILE_ATTRIBUTE_SPARSE ) DEBUG(8, ("[sparse]")); DEBUG(8,("\n")); @@ -507,7 +507,7 @@ int dos_attributes_to_stat_dos_flags(uint32_t dosmode) { uint32_t dos_stat_flags = 0; - if (dosmode & aARCH) + if (dosmode & FILE_ATTRIBUTE_ARCHIVE) dos_stat_flags |= UF_DOS_ARCHIVE; if (dosmode & FILE_ATTRIBUTE_HIDDEN) dos_stat_flags |= UF_DOS_HIDDEN; @@ -540,7 +540,7 @@ static bool get_stat_dos_flags(connection_struct *conn, smb_fname_str_dbg(smb_fname))); if (smb_fname->st.st_ex_flags & UF_DOS_ARCHIVE) - *dosmode |= aARCH; + *dosmode |= FILE_ATTRIBUTE_ARCHIVE; if (smb_fname->st.st_ex_flags & UF_DOS_HIDDEN) *dosmode |= FILE_ATTRIBUTE_HIDDEN; if (smb_fname->st.st_ex_flags & UF_DOS_RO) @@ -675,7 +675,7 @@ uint32 dos_mode(connection_struct *conn, struct smb_filename *smb_fname) if (result & FILE_ATTRIBUTE_READONLY ) DEBUG(8, ("r")); if (result & FILE_ATTRIBUTE_SYSTEM) DEBUG(8, ("s")); if (result & FILE_ATTRIBUTE_DIRECTORY ) DEBUG(8, ("d")); - if (result & aARCH ) DEBUG(8, ("a")); + if (result & FILE_ATTRIBUTE_ARCHIVE ) DEBUG(8, ("a")); if (result & FILE_ATTRIBUTE_SPARSE ) DEBUG(8, ("[sparse]")); DEBUG(8,("\n")); diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c index 16d8853b54..ea607d3d5d 100644 --- a/source3/smbd/fileio.c +++ b/source3/smbd/fileio.c @@ -322,7 +322,7 @@ ssize_t write_file(struct smb_request *req, int dosmode = dos_mode(fsp->conn, fsp->fsp_name); if (!IS_DOS_ARCHIVE(dosmode)) { file_set_dosmode(fsp->conn, fsp->fsp_name, - dosmode | aARCH, NULL, false); + dosmode | FILE_ATTRIBUTE_ARCHIVE, NULL, false); } } diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 858e19aeb3..f4bd969300 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -1450,7 +1450,7 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx, status = close_file(NULL, fsp2, NORMAL_CLOSE); - /* Grrr. We have to do this as open_file_ntcreate adds aARCH when it + /* Grrr. We have to do this as open_file_ntcreate adds FILE_ATTRIBUTE_ARCHIVE when it creates the file. This isn't the correct thing to do in the copy case. JRA */ if (!parent_dirname(talloc_tos(), smb_fname_dst->base_name, &parent, diff --git a/source3/smbd/open.c b/source3/smbd/open.c index d1ac91c9c5..076ae1ff69 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1622,9 +1622,9 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn, unx_mode = (mode_t)(new_dos_attributes & ~FILE_FLAG_POSIX_SEMANTICS); new_dos_attributes = 0; } else { - /* We add aARCH to this as this mode is only used if the file is + /* We add FILE_ATTRIBUTE_ARCHIVE to this as this mode is only used if the file is * created new. */ - unx_mode = unix_mode(conn, new_dos_attributes | aARCH, + unx_mode = unix_mode(conn, new_dos_attributes | FILE_ATTRIBUTE_ARCHIVE, smb_fname, parent_dir); } @@ -2361,7 +2361,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn, lp_store_dos_attributes(SNUM(conn))) { if (!posix_open) { if (file_set_dosmode(conn, smb_fname, - new_dos_attributes | aARCH, + new_dos_attributes | FILE_ATTRIBUTE_ARCHIVE, parent_dir, true) == 0) { unx_mode = smb_fname->st.st_ex_mode; } diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index cabf92d7af..db40539620 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -2449,10 +2449,10 @@ static NTSTATUS do_unlink(connection_struct *conn, fattr = dos_mode(conn, smb_fname); if (dirtype & FILE_ATTRIBUTE_NORMAL) { - dirtype = FILE_ATTRIBUTE_DIRECTORY|aARCH|FILE_ATTRIBUTE_READONLY; + dirtype = FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_READONLY; } - dirtype &= (FILE_ATTRIBUTE_DIRECTORY|aARCH|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM); + dirtype &= (FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM); if (!dirtype) { return NT_STATUS_NO_SUCH_FILE; } diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 090f838105..b887e2965b 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -5720,7 +5720,7 @@ static bool run_dirtest1(int dummy) correct = False; num_seen = 0; - cli_list_old(cli, "\\LISTDIR\\*", (aARCH<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, &num_seen); + cli_list_old(cli, "\\LISTDIR\\*", (FILE_ATTRIBUTE_ARCHIVE<<8)|FILE_ATTRIBUTE_DIRECTORY, list_fn, &num_seen); printf("num_seen = %d\n", num_seen ); if (num_seen != 1000) correct = False; |