return NT_STATUS_OBJECT_NAME_NOT_FOUND;
}
+ if (S_ISLNK(smb_fname->st.st_ex_mode) &&
+ !(fsp->posix_flags & FSP_POSIX_FLAGS_OPEN))
+ {
+ /*
+ * Don't allow stat opens on symlinks directly unless
+ * it's a POSIX open.
+ */
+ return NT_STATUS_OBJECT_PATH_NOT_FOUND;
+ }
+
status = smbd_check_access_rights(conn,
conn->cwd_fsp,
smb_fname,
char *posix_acl_sym = NULL;
size_t posix_acl_len_sym = 0;
struct security_descriptor *sd = NULL;
- struct security_descriptor *sd_sym = NULL;
TALLOC_CTX *frame = NULL;
frame = talloc_stackframe();
goto out;
}
- /* Open a handle on the symlink. */
+ /* Try a stat-open on the symlink, should also fail. */
status = cli_ntcreate(cli,
sname,
0,
&fnum,
NULL);
- if (!NT_STATUS_IS_OK(status)) {
- printf("cli_posix_open of %s failed (%s)\n",
- sname,
- nt_errstr(status));
- goto out;
- }
-
- /* Get the Windows ACL on the symlink handle. Should fail */
- status = cli_query_secdesc(cli,
- fnum,
- frame,
- &sd_sym);
-
- if (!NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
- printf("cli_query_secdesc on a symlink gave %s. "
- "Should be NT_STATUS_ACCESS_DENIED.\n",
- nt_errstr(status));
+ if (NT_STATUS_IS_OK(status)) {
+ printf("Stat-open of symlink succeeded (should fail)\n");
goto out;
}
goto out;
}
- /* Set the Windows ACL on the symlink handle. Should fail */
- status = cli_set_security_descriptor(cli,
- fnum,
- SECINFO_DACL,
- sd);
-
- if (!NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
- printf("cli_query_secdesc on a symlink gave %s. "
- "Should be NT_STATUS_ACCESS_DENIED.\n",
- nt_errstr(status));
- goto out;
- }
-
/* Set the POSIX ACL on the symlink pathname. Should fail. */
status = cli_posix_setacl(cli,
sname,