From df7b562de25ccd35ed72ea0e429c41133001739f Mon Sep 17 00:00:00 2001 From: Shirish Kalele Date: Sat, 28 Dec 2002 00:18:23 +0000 Subject: Modify DfsEnum to handle 'msdfs proxy' shares. No NETDFS editing support for the proxy target. (This used to be commit 560bb8a115049cd5de1c16087dfecb5b2b75293c) --- source3/msdfs/msdfs.c | 50 +++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 23 deletions(-) (limited to 'source3/msdfs/msdfs.c') diff --git a/source3/msdfs/msdfs.c b/source3/msdfs/msdfs.c index ef7a472011..613382961b 100644 --- a/source3/msdfs/msdfs.c +++ b/source3/msdfs/msdfs.c @@ -818,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)); @@ -831,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; -- cgit