summaryrefslogtreecommitdiff
path: root/source3/include/msdfs.h
blob: 0748577b0b9acb499ff572c34beb1d3d8b84d9eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* 
   Unix SMB/Netbios implementation.
   Version 3.0
   MSDfs services for Samba
   Copyright (C) Shirish Kalele 2000

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef _MSDFS_H
#define _MSDFS_H

#define REFERRAL_TTL 600

/* Flags used in trans2 Get Referral reply */
#define DFSREF_REFERRAL_SERVER 0x1
#define DFSREF_STORAGE_SERVER  0x2

/* Referral sizes */
#define VERSION2_REFERRAL_SIZE 0x16
#define VERSION3_REFERRAL_SIZE 0x22
#define REFERRAL_HEADER_SIZE 0x08

/* Maximum number of referrals for each Dfs volume */
#define MAX_REFERRAL_COUNT   256

struct referral
{
	pstring alternate_path; /* contains the path referred */
	uint32 proximity;
	uint32 ttl; /* how long should client cache referral */
};

struct junction_map
{
  pstring service_name;
  pstring volume_name;
  int referral_count;
  struct referral* referral_list;
};

struct dfs_path
{
  pstring hostname;
  pstring servicename;
  pstring volumename;
  pstring restofthepath;
};

#ifdef WITH_MSDFS

#define RESOLVE_DFSPATH(name, conn, inbuf, outbuf) \
{ if(((SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES)) && \
     dfs_redirect(name,conn)) \
     return ERROR_NT(NT_STATUS_PATH_NOT_COVERED); }

#define RESOLVE_FINDFIRST_DFSPATH(name, conn, inbuf, outbuf) \
{ if((SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES) || \
     get_remote_arch()==RA_WIN95) \
      if(dfs_findfirst_redirect(directory,conn)) \
	 return ERROR_NT(NT_STATUS_PATH_NOT_COVERED); }
 
#define init_dfsroot(conn, inbuf, outbuf) \
{ if(lp_msdfs_root(SNUM(conn)) && lp_host_msdfs())  \
	SSVAL(outbuf, smb_vwv2, SMB_SHARE_IN_DFS | SMB_SUPPORT_SEARCH_BITS); \
}

#else
/* Stub macros */
#define RESOLVE_DFSPATH(name, conn, inbuf, outbuf) ;
#define RESOLVE_FINDFIRST_DFSPATH(name, conn, inbuf, outbuf) ;
#define init_dfsroot(conn, inbuf, outbuf) ;

#endif

#endif /* _MSDFS_H */