summaryrefslogtreecommitdiff
path: root/source3/msdfs
diff options
context:
space:
mode:
authorShirish Kalele <kalele@samba.org>2002-12-29 23:29:08 +0000
committerShirish Kalele <kalele@samba.org>2002-12-29 23:29:08 +0000
commitab42271cd6d17b09409d5c8e5a2c80cf5ae4c1cf (patch)
treee71beec66780a4400ebdb0c0e58ff09ea594cf3b /source3/msdfs
parent561a6634b25dad6c8225ce630cc4a25466f5f6f8 (diff)
downloadsamba-ab42271cd6d17b09409d5c8e5a2c80cf5ae4c1cf.tar.gz
samba-ab42271cd6d17b09409d5c8e5a2c80cf5ae4c1cf.tar.bz2
samba-ab42271cd6d17b09409d5c8e5a2c80cf5ae4c1cf.zip
Add msdfs proxy functionality to HEAD.
(This used to be commit 9df93b1ffc9ce98302540cc3d2cbd66787abc4fd)
Diffstat (limited to 'source3/msdfs')
-rw-r--r--source3/msdfs/msdfs.c72
1 files changed, 48 insertions, 24 deletions
diff --git a/source3/msdfs/msdfs.c b/source3/msdfs/msdfs.c
index 3e66c1c10c..613382961b 100644
--- a/source3/msdfs/msdfs.c
+++ b/source3/msdfs/msdfs.c
@@ -381,6 +381,26 @@ BOOL get_referred_path(char *pathname, struct junction_map* jn,
return False;
}
+ if (*lp_msdfs_proxy(snum) != '\0') {
+ struct referral* ref;
+ jn->referral_count = 1;
+ if ((ref = (struct referral*) malloc(sizeof(struct referral)))
+ == NULL) {
+ DEBUG(0, ("malloc failed for referral\n"));
+ return False;
+ }
+
+ pstrcpy(ref->alternate_path, lp_msdfs_proxy(snum));
+ if (dp.reqpath[0] != '\0')
+ pstrcat(ref->alternate_path, dp.reqpath);
+ ref->proximity = 0;
+ ref->ttl = REFERRAL_TTL;
+ jn->referral_list = ref;
+ if (consumedcntp)
+ *consumedcntp = strlen(pathname);
+ return True;
+ }
+
/* If not remote & not a self referral, return False */
if (!resolve_dfs_path(pathname, &dp, conn, False,
&jn->referral_list, &jn->referral_count,
@@ -630,7 +650,7 @@ int setup_dfs_referral(char* pathname, int max_referral_level, char** ppdata)
dbgtext(".\n");
}
}
-
+
/* create the referral depeding on version */
DEBUG(10,("max_referral_level :%d\n",max_referral_level));
if(max_referral_level<2 || max_referral_level>3)
@@ -798,6 +818,7 @@ static BOOL form_junctions(int snum, struct junction_map* jn, int* jn_count)
char* service_name = lp_servicename(snum);
connection_struct conns;
connection_struct *conn = &conns;
+ struct referral *ref = NULL;
pstrcpy(connect_path,lp_pathname(snum));
@@ -811,31 +832,34 @@ static BOOL form_junctions(int snum, struct junction_map* jn, int* jn_count)
if (!create_conn_struct(conn, snum, connect_path))
return False;
- {
- /* form a junction for the msdfs root - convention
- DO NOT REMOVE THIS: NT clients will not work with us
- if this is not present
- */
- struct referral *ref = NULL;
- pstring alt_path;
- pstrcpy(jn[cnt].service_name, service_name);
- jn[cnt].volume_name[0] = '\0';
- jn[cnt].referral_count = 1;
-
- slprintf(alt_path,sizeof(alt_path)-1,"\\\\%s\\%s",
- local_machine, service_name);
- ref = jn[cnt].referral_list = (struct referral*) malloc(sizeof(struct referral));
- if (jn[cnt].referral_list == NULL) {
- DEBUG(0, ("Malloc failed!\n"));
- return False;
- }
-
- safe_strcpy(ref->alternate_path, alt_path, sizeof(pstring));
- ref->proximity = 0;
- ref->ttl = REFERRAL_TTL;
- cnt++;
+ /* form a junction for the msdfs root - convention
+ DO NOT REMOVE THIS: NT clients will not work with us
+ if this is not present
+ */
+ pstrcpy(jn[cnt].service_name, service_name);
+ jn[cnt].volume_name[0] = '\0';
+ jn[cnt].referral_count = 1;
+
+ ref = jn[cnt].referral_list
+ = (struct referral*) malloc(sizeof(struct referral));
+ if (jn[cnt].referral_list == NULL) {
+ DEBUG(0, ("Malloc failed!\n"));
+ return False;
}
+ ref->proximity = 0;
+ ref->ttl = REFERRAL_TTL;
+ if (*lp_msdfs_proxy(snum) != '\0') {
+ pstrcpy(ref->alternate_path, lp_msdfs_proxy(snum));
+ *jn_count = 1;
+ return True;
+ }
+
+ slprintf(ref->alternate_path, sizeof(pstring)-1,
+ "\\\\%s\\%s", local_machine, service_name);
+ cnt++;
+
+ /* Now enumerate all dfs links */
dirp = conn->vfs_ops.opendir(conn, connect_path);
if(!dirp)
return False;