files_struct *fsp,
const SMB_STRUCT_STAT *psbuf);
+NTSTATUS check_access_fsp(const struct files_struct *fsp,
+ uint32_t access_mask)
+{
+ if (!(fsp->access_mask & access_mask)) {
+ return NT_STATUS_ACCESS_DENIED;
+ }
+ return NT_STATUS_OK;
+}
+
/********************************************************************
The canonical "check access" based on object handle or path function.
********************************************************************/
const struct smb_filename *smb_fname,
uint32_t access_mask)
{
+ NTSTATUS status;
+
if (fsp) {
- if (!(fsp->access_mask & access_mask)) {
- return NT_STATUS_ACCESS_DENIED;
- }
+ status = check_access_fsp(fsp, access_mask);
} else {
- NTSTATUS status = smbd_check_access_rights(conn,
- smb_fname,
- false,
- access_mask);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
+ status = smbd_check_access_rights(conn, smb_fname,
+ false, access_mask);
}
- return NT_STATUS_OK;
+
+ return status;
}
/********************************************************************
char *params = *pparams;
char *pdata = *ppdata;
int deny_mode;
- int32 open_attr;
+ int32_t open_attr;
bool oplock_request;
#if 0
bool return_additional_info;
ppdata,
end_data,
&last_entry_off);
+ if (NT_STATUS_EQUAL(status, NT_STATUS_ILLEGAL_CHARACTER)) {
+ DEBUG(1,("Conversion error: illegal character: %s\n",
+ smb_fname_str_dbg(smb_fname)));
+ }
TALLOC_FREE(fname);
TALLOC_FREE(smb_fname);
if (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) {
struct smbd_server_connection *sconn = req->sconn;
uint32_t ucf_flags = (UCF_SAVE_LCOMP | UCF_ALWAYS_ALLOW_WCARD_LCOMP);
bool backup_priv = false;
+ bool as_root = false;
if (total_params < 13) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
if (backup_priv) {
become_root();
+ as_root = true;
ntstatus = filename_convert_with_privilege(ctx,
conn,
req,
}
pdata = *ppdata;
data_end = pdata + max_data_bytes + DIR_ENTRY_SAFETY_MARGIN - 1;
-
+ /*
+ * squash valgrind "writev(vector[...]) points to uninitialised byte(s)"
+ * error.
+ */
+ memset(pdata + total_data, 0, ((max_data_bytes + DIR_ENTRY_SAFETY_MARGIN) - total_data));
/* Realloc the params space */
*pparams = (char *)SMB_REALLOC(*pparams, 10);
if (*pparams == NULL) {
}
out:
- if (backup_priv) {
+ if (as_root) {
unbecome_root();
}
struct dptr_struct *dirptr;
struct smbd_server_connection *sconn = req->sconn;
bool backup_priv = false;
+ bool as_root = false;
if (total_params < 13) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
pdata = *ppdata;
data_end = pdata + max_data_bytes + DIR_ENTRY_SAFETY_MARGIN - 1;
+ /*
+ * squash valgrind "writev(vector[...]) points to uninitialised byte(s)"
+ * error.
+ */
+ memset(pdata + total_data, 0, (max_data_bytes + DIR_ENTRY_SAFETY_MARGIN) - total_data);
/* Realloc the params space */
*pparams = (char *)SMB_REALLOC(*pparams, 6*SIZEOFWORD);
if(*pparams == NULL ) {
if (backup_priv) {
become_root();
+ as_root = true;
}
/*
dptr_close(sconn, &dptr_num); /* This frees up the saved mask */
}
- if (backup_priv) {
+ if (as_root) {
unbecome_root();
}
case SMB_SIGNING_OFF:
encrypt_caps = 0;
break;
+ case SMB_SIGNING_DESIRED:
case SMB_SIGNING_IF_REQUIRED:
case SMB_SIGNING_DEFAULT:
encrypt_caps = CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP;
&conn->session_info->security_token->sids[i],
0);
- sid_linearize(pdata + data_len, sid_len,
+ sid_linearize((uint8_t *)(pdata + data_len),
+ sid_len,
&conn->session_info->security_token->sids[i]);
data_len += sid_len;
}