#define RESOLVE_DFSPATH(name, conn, inbuf, outbuf) \
{ if ((SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES) && \
lp_host_msdfs() && lp_msdfs_root(SNUM(conn)) && \
- dfs_redirect(name,conn,False)) \
+ dfs_redirect(name, conn, False, False)) \
return ERROR_BOTH(NT_STATUS_PATH_NOT_COVERED, \
ERRSRV, ERRbadpath);; }
-#define RESOLVE_DFSPATH_WCARD(name, conn, inbuf, outbuf) \
+#define RESOLVE_FINDFIRST_DFSPATH(name, conn, inbuf, outbuf) \
{ if ((SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES) && \
lp_host_msdfs() && lp_msdfs_root(SNUM(conn)) && \
- dfs_redirect(name,conn,True)) \
+ dfs_redirect(name, conn, True, True)) \
+ return ERROR_BOTH(NT_STATUS_PATH_NOT_COVERED, \
+ ERRSRV, ERRbadpath);; }
+
+#define RESOLVE_DFSPATH_WCARD(name, conn, inbuf, outbuf) \
+{ if ((SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES) && \
+ lp_host_msdfs() && lp_msdfs_root(SNUM(conn)) && \
+ dfs_redirect(name,conn, False, True)) \
return ERROR_BOTH(NT_STATUS_PATH_NOT_COVERED, \
ERRSRV, ERRbadpath);; }
Used by other functions to decide if a dfs path is remote,
and to get the list of referred locations for that remote path.
-allow_wcards: Should we allow wildcards when parsing paths.
+findfirst_flag: For findfirsts, dfs links themselves are not
+redirected, but paths beyond the links are. For normal smb calls,
+even dfs links need to be redirected.
self_referralp: clients expect a dfs referral for the same share when
they request referrals for dfs roots on a server.
static BOOL resolve_dfs_path(pstring dfspath, struct dfs_path* dp,
connection_struct* conn,
- BOOL allow_wcards,
+ BOOL findfirst_flag, BOOL allow_wcards,
struct referral** reflistpp, int* refcntp,
BOOL* self_referralp, int* consumedcntp)
{
/* check if need to redirect */
if (is_msdfs_link(conn, localpath, reflistpp, refcntp, NULL)) {
+ if (findfirst_flag) {
+ DEBUG(6,("resolve_dfs_path (FindFirst) No redirection "
+ "for dfs link %s.\n", dfspath));
+ return False;
+ }
+
DEBUG(6,("resolve_dfs_path: %s resolves to a valid Dfs link.\n", dfspath));
if (consumedcntp)
*consumedcntp = strlen(dfspath);
*p = '\0';
pstrcpy(localpath, reqpath);
if (is_msdfs_link(conn, localpath, reflistpp, refcntp, NULL)) {
+
DEBUG(4, ("resolve_dfs_path: Redirecting %s because parent %s is dfs link\n", dfspath, localpath));
/* To find the path consumed, we truncate the original
component. The length of the resulting string is
the path consumed
*/
+
if (consumedcntp) {
char *q;
pstring buf;
If not, the pathname is converted to a tcon-relative local unix path
*****************************************************************/
-BOOL dfs_redirect(pstring pathname, connection_struct* conn, BOOL allow_wcards)
+BOOL dfs_redirect( pstring pathname, connection_struct* conn,
+ BOOL findfirst_flag, BOOL allow_wcards )
{
struct dfs_path dp;
if (!strequal(dp.servicename, lp_servicename(SNUM(conn)) ))
return False;
- if (resolve_dfs_path(pathname, &dp, conn, allow_wcards,
+ if (resolve_dfs_path(pathname, &dp, conn, findfirst_flag, allow_wcards,
NULL, NULL, NULL, NULL)) {
DEBUG(3,("dfs_redirect: Redirecting %s\n", pathname));
return True;
return False;
/* If not remote & not a self referral, return False */
- if (!resolve_dfs_path(pathname, &dp, conn, False,
+ if (!resolve_dfs_path(pathname, &dp, conn, False, False,
&jucn->referral_list, &jucn->referral_count,
self_referralp, consumedcntp)) {
if (!*self_referralp) {