summaryrefslogtreecommitdiff
path: root/source3/libsmb/libsmb_xattr.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-04-30 15:26:43 -0700
committerJeremy Allison <jra@samba.org>2009-04-30 15:26:43 -0700
commit8cf78ff55312768d0b454b1d7e0560e04e6296da (patch)
tree0a2180f063e3bb9872c2565c92075dfb5dccac81 /source3/libsmb/libsmb_xattr.c
parentab4b8c9c0438bc5afca17e3ebf05dde6f98bc0aa (diff)
downloadsamba-8cf78ff55312768d0b454b1d7e0560e04e6296da.tar.gz
Get medieval on our ass about SMB1 file descriptors being 16 bits, not an int.
Convert all uses of cli_open(), cli_nt_createXXX to NTSTATUS versions. This is smaller than it looks, it just fixes a lot of old code. Next up, ensure all cli_XX functions return NTSTATUS. Jeremy.
Diffstat (limited to 'source3/libsmb/libsmb_xattr.c')
-rw-r--r--source3/libsmb/libsmb_xattr.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/source3/libsmb/libsmb_xattr.c b/source3/libsmb/libsmb_xattr.c
index e4a0a055863..a152830c5de 100644
--- a/source3/libsmb/libsmb_xattr.c
+++ b/source3/libsmb/libsmb_xattr.c
@@ -730,7 +730,7 @@ cacl_get(SMBCCTX *context,
bool exclude_dos_inode = False;
bool numeric = True;
bool determine_size = (bufsize == 0);
- int fnum = -1;
+ uint16_t fnum;
SEC_DESC *sd;
fstring sidstr;
fstring name_sandbox;
@@ -901,9 +901,8 @@ cacl_get(SMBCCTX *context,
}
/* ... then obtain any NT attributes which were requested */
- fnum = cli_nt_create(targetcli, targetpath, CREATE_ACCESS_READ);
-
- if (fnum == -1) {
+ if (!NT_STATUS_IS_OK(cli_ntcreate(targetcli, targetpath, 0, CREATE_ACCESS_READ, 0,
+ FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN, 0x0, 0x0, &fnum))) {
DEBUG(5, ("cacl_get failed to open %s: %s\n",
targetpath, cli_errstr(targetcli)));
errno = 0;
@@ -1507,7 +1506,7 @@ cacl_set(SMBCCTX *context,
int mode,
int flags)
{
- int fnum;
+ uint16_t fnum = (uint16_t)-1;
int err = 0;
SEC_DESC *sd = NULL, *old;
SEC_ACL *dacl = NULL;
@@ -1560,9 +1559,8 @@ cacl_set(SMBCCTX *context,
/* The desired access below is the only one I could find that works
with NT4, W2KP and Samba */
- fnum = cli_nt_create(targetcli, targetpath, CREATE_ACCESS_READ);
-
- if (fnum == -1) {
+ if (!NT_STATUS_IS_OK(cli_ntcreate(targetcli, targetpath, 0, CREATE_ACCESS_READ, 0,
+ FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN, 0x0, 0x0, &fnum))) {
DEBUG(5, ("cacl_set failed to open %s: %s\n",
targetpath, cli_errstr(targetcli)));
errno = 0;
@@ -1666,10 +1664,9 @@ cacl_set(SMBCCTX *context,
sd = make_sec_desc(ctx, old->revision, SEC_DESC_SELF_RELATIVE,
owner_sid, group_sid, NULL, dacl, &sd_size);
- fnum = cli_nt_create(targetcli, targetpath,
- WRITE_DAC_ACCESS | WRITE_OWNER_ACCESS);
-
- if (fnum == -1) {
+ if (!NT_STATUS_IS_OK(cli_ntcreate(targetcli, targetpath, 0,
+ WRITE_DAC_ACCESS | WRITE_OWNER_ACCESS, 0,
+ FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN, 0x0, 0x0, &fnum))) {
DEBUG(5, ("cacl_set failed to open %s: %s\n",
targetpath, cli_errstr(targetcli)));
errno = 0;