summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-04-29 11:36:14 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-04-29 16:38:12 +1000
commit7f66ebde2e2975b079f6c135b131d064dab38624 (patch)
treeb6a643754f35274f8d0460f7be014c8c524fa12b
parent9f75b7cbb3d25b3a799f0dc50587260036e40719 (diff)
downloadsamba-7f66ebde2e2975b079f6c135b131d064dab38624.tar.gz
samba-7f66ebde2e2975b079f6c135b131d064dab38624.tar.xz
samba-7f66ebde2e2975b079f6c135b131d064dab38624.zip
s3-smb Use FILE_ATTRIBUTE_READONLY intead of aRONLY
This means we use just one constant for this file attribute. Andrew Bartlett
-rw-r--r--source3/client/clitar.c2
-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/libsmb/libsmb_dir.c2
-rw-r--r--source3/locking/locking.c2
-rw-r--r--source3/smbd/dir.c4
-rw-r--r--source3/smbd/dosmode.c20
-rw-r--r--source3/smbd/reply.c6
-rw-r--r--source3/torture/torture.c2
10 files changed, 21 insertions, 22 deletions
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index 645899a9ffb..c29c084cce5 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -1405,7 +1405,7 @@ int cmd_setmode(void)
direct=0;
break;
case 'r':
- attra[direct]|=aRONLY;
+ attra[direct]|=FILE_ATTRIBUTE_READONLY;
break;
case 'h':
attra[direct]|=aHIDDEN;
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 01866e2e8ac..61a2602fa5c 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 aRONLY (1L<<0) /* 0x01 */
#define aHIDDEN (1L<<1) /* 0x02 */
#define aSYSTEM (1L<<2) /* 0x04 */
#define aVOLID (1L<<3) /* 0x08 */
diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h
index 93bda975bf9..e4dda7cb938 100644
--- a/source3/include/smb_macros.h
+++ b/source3/include/smb_macros.h
@@ -28,7 +28,7 @@
#define BITSETW(ptr,bit) ((SVAL(ptr,0) & (1<<(bit)))!=0)
/* for readability... */
-#define IS_DOS_READONLY(test_mode) (((test_mode) & aRONLY) != 0)
+#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_ARCHIVE(test_mode) (((test_mode) & aARCH) != 0)
#define IS_DOS_SYSTEM(test_mode) (((test_mode) & aSYSTEM) != 0)
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 0bb46db05f6..b71be79f06a 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -309,7 +309,7 @@ char *attrib_string(uint16 mode)
if (mode & aARCH) fstrcat(attrstr,"A");
if (mode & aHIDDEN) fstrcat(attrstr,"H");
if (mode & aSYSTEM) fstrcat(attrstr,"S");
- if (mode & aRONLY) fstrcat(attrstr,"R");
+ if (mode & FILE_ATTRIBUTE_READONLY) fstrcat(attrstr,"R");
return talloc_strdup(talloc_tos(), attrstr);
}
diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c
index c0c6e83bb63..125bd4e2ef1 100644
--- a/source3/libsmb/libsmb_dir.c
+++ b/source3/libsmb/libsmb_dir.c
@@ -1611,7 +1611,7 @@ SMBC_chmod_ctx(SMBCCTX *context,
mode = 0;
- if (!(newmode & (S_IWUSR | S_IWGRP | S_IWOTH))) mode |= aRONLY;
+ 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_IXGRP) && lp_map_system(-1)) mode |= aSYSTEM;
if ((newmode & S_IXOTH) && lp_map_hidden(-1)) mode |= aHIDDEN;
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index f5892ddf0d7..232a8c37029 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -1424,7 +1424,7 @@ NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32 dosmode)
* Only allow delete on close for writable files.
*/
- if ((dosmode & aRONLY) &&
+ if ((dosmode & FILE_ATTRIBUTE_READONLY) &&
!lp_delete_readonly(SNUM(fsp->conn))) {
DEBUG(10,("can_set_delete_on_close: file %s delete on close "
"flag set but file attribute is readonly.\n",
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 5fc87a608fd..78b16ba468e 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) & (aDIR|aARCH|aRONLY|aHIDDEN|aSYSTEM)); /* & 0x37 */
+ mask = ((dirtype >> 8) & (aDIR|aARCH|FILE_ATTRIBUTE_READONLY|aHIDDEN|aSYSTEM)); /* & 0x37 */
if(mask) {
- if((mask & (mode & (aDIR|aARCH|aRONLY|aHIDDEN|aSYSTEM))) == mask) /* check if matching attribute present */
+ if((mask & (mode & (aDIR|aARCH|FILE_ATTRIBUTE_READONLY|aHIDDEN|aSYSTEM))) == mask) /* check if matching attribute present */
return True;
else
return False;
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index a9b6dfef78e..d20d77227a9 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -41,7 +41,7 @@ static int set_link_read_only_flag(const SMB_STRUCT_STAT *const sbuf)
#ifdef S_ISLNK
#if LINKS_READ_ONLY
if (S_ISLNK(sbuf->st_mode) && S_ISDIR(sbuf->st_mode))
- return aRONLY;
+ return FILE_ATTRIBUTE_READONLY;
#endif
#endif
return 0;
@@ -173,12 +173,12 @@ static uint32 dos_mode_from_sbuf(connection_struct *conn,
if (ro_opts == MAP_READONLY_YES) {
/* Original Samba method - map inverse of user "w" bit. */
if ((smb_fname->st.st_ex_mode & S_IWUSR) == 0) {
- result |= aRONLY;
+ result |= FILE_ATTRIBUTE_READONLY;
}
} else if (ro_opts == MAP_READONLY_PERMISSIONS) {
/* Check actual permissions for read-only. */
if (!can_write_to_file(conn, smb_fname)) {
- result |= aRONLY;
+ result |= FILE_ATTRIBUTE_READONLY;
}
} /* Else never set the readonly bit. */
@@ -192,14 +192,14 @@ static uint32 dos_mode_from_sbuf(connection_struct *conn,
result |= aHIDDEN;
if (S_ISDIR(smb_fname->st.st_ex_mode))
- result = aDIR | (result & aRONLY);
+ result = aDIR | (result & FILE_ATTRIBUTE_READONLY);
result |= set_link_read_only_flag(&smb_fname->st);
DEBUG(8,("dos_mode_from_sbuf returning "));
if (result & aHIDDEN) DEBUG(8, ("h"));
- if (result & aRONLY ) DEBUG(8, ("r"));
+ if (result & FILE_ATTRIBUTE_READONLY ) DEBUG(8, ("r"));
if (result & aSYSTEM) DEBUG(8, ("s"));
if (result & aDIR ) DEBUG(8, ("d"));
if (result & aARCH ) DEBUG(8, ("a"));
@@ -326,7 +326,7 @@ static bool get_ea_dos_attribute(connection_struct *conn,
DEBUG(8,("get_ea_dos_attribute returning (0x%x)", dosattr));
if (dosattr & aHIDDEN) DEBUG(8, ("h"));
- if (dosattr & aRONLY ) DEBUG(8, ("r"));
+ if (dosattr & FILE_ATTRIBUTE_READONLY ) DEBUG(8, ("r"));
if (dosattr & aSYSTEM) DEBUG(8, ("s"));
if (dosattr & aDIR ) DEBUG(8, ("d"));
if (dosattr & aARCH ) DEBUG(8, ("a"));
@@ -487,7 +487,7 @@ uint32 dos_mode_msdfs(connection_struct *conn,
DEBUG(8,("dos_mode_msdfs returning "));
if (result & aHIDDEN) DEBUG(8, ("h"));
- if (result & aRONLY ) DEBUG(8, ("r"));
+ if (result & FILE_ATTRIBUTE_READONLY ) DEBUG(8, ("r"));
if (result & aSYSTEM) DEBUG(8, ("s"));
if (result & aDIR ) DEBUG(8, ("d"));
if (result & aARCH ) DEBUG(8, ("a"));
@@ -511,7 +511,7 @@ int dos_attributes_to_stat_dos_flags(uint32_t dosmode)
dos_stat_flags |= UF_DOS_ARCHIVE;
if (dosmode & aHIDDEN)
dos_stat_flags |= UF_DOS_HIDDEN;
- if (dosmode & aRONLY)
+ if (dosmode & FILE_ATTRIBUTE_READONLY)
dos_stat_flags |= UF_DOS_RO;
if (dosmode & aSYSTEM)
dos_stat_flags |= UF_DOS_SYSTEM;
@@ -544,7 +544,7 @@ static bool get_stat_dos_flags(connection_struct *conn,
if (smb_fname->st.st_ex_flags & UF_DOS_HIDDEN)
*dosmode |= aHIDDEN;
if (smb_fname->st.st_ex_flags & UF_DOS_RO)
- *dosmode |= aRONLY;
+ *dosmode |= FILE_ATTRIBUTE_READONLY;
if (smb_fname->st.st_ex_flags & UF_DOS_SYSTEM)
*dosmode |= aSYSTEM;
if (smb_fname->st.st_ex_flags & UF_DOS_NOINDEX)
@@ -672,7 +672,7 @@ uint32 dos_mode(connection_struct *conn, struct smb_filename *smb_fname)
DEBUG(8,("dos_mode returning "));
if (result & aHIDDEN) DEBUG(8, ("h"));
- if (result & aRONLY ) DEBUG(8, ("r"));
+ if (result & FILE_ATTRIBUTE_READONLY ) DEBUG(8, ("r"));
if (result & aSYSTEM) DEBUG(8, ("s"));
if (result & aDIR ) DEBUG(8, ("d"));
if (result & aARCH ) DEBUG(8, ("a"));
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 01d4332b7e7..8dba6be9435 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -1110,7 +1110,7 @@ void reply_getatr(struct smb_request *req)
if (*fname == '\0') {
mode = aHIDDEN | aDIR;
if (!CAN_WRITE(conn)) {
- mode |= aRONLY;
+ mode |= FILE_ATTRIBUTE_READONLY;
}
size = 0;
mtime = 0;
@@ -2449,10 +2449,10 @@ static NTSTATUS do_unlink(connection_struct *conn,
fattr = dos_mode(conn, smb_fname);
if (dirtype & FILE_ATTRIBUTE_NORMAL) {
- dirtype = aDIR|aARCH|aRONLY;
+ dirtype = aDIR|aARCH|FILE_ATTRIBUTE_READONLY;
}
- dirtype &= (aDIR|aARCH|aRONLY|aHIDDEN|aSYSTEM);
+ dirtype &= (aDIR|aARCH|FILE_ATTRIBUTE_READONLY|aHIDDEN|aSYSTEM);
if (!dirtype) {
return NT_STATUS_NO_SUCH_FILE;
}
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 9fcf582724b..0e81f49c712 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -4531,7 +4531,7 @@ static bool run_opentest(int dummy)
return False;
}
- if (!NT_STATUS_IS_OK(cli_setatr(cli1, fname, aRONLY, 0))) {
+ if (!NT_STATUS_IS_OK(cli_setatr(cli1, fname, FILE_ATTRIBUTE_READONLY, 0))) {
printf("cli_setatr failed (%s)\n", cli_errstr(cli1));
return False;
}