--- samba-3.0.23b/source/libsmb/clidfs.c 2006-08-07 12:46:33.000000000 -0400 +++ samba-local/source/libsmb/clidfs.c 2006-08-26 15:57:13.000000000 -0400 @@ -352,13 +352,13 @@ have_ip = True; } -/******************************************************************** - split a dfs path into the server and share name components -********************************************************************/ +/********************************************************************** + split a dfs path into the server, share name, and extrapath components +**********************************************************************/ -static void split_dfs_path( const char *nodepath, fstring server, fstring share ) +static void split_dfs_path( const char *nodepath, fstring server, fstring share, fstring extrapath ) { - char *p; + char *p, *q; pstring path; pstrcpy( path, nodepath ); @@ -366,7 +366,7 @@ if ( path[0] != '\\' ) return; - p = strrchr_m( path, '\\' ); + p = strchr_m( path + 1, '\\' ); if ( !p ) return; @@ -374,6 +374,16 @@ *p = '\0'; p++; + /* Look for any extra/deep path */ + q = strchr_m(p, '\\'); + if (q != NULL) { + *q = '\0'; + q++; + fstrcpy( extrapath, q ); + } else { + fstrcpy( extrapath, '\0' ); + } + fstrcpy( share, p ); fstrcpy( server, &path[1] ); } @@ -574,13 +584,13 @@ size_t num_refs; uint16 consumed; struct cli_state *cli_ipc; - pstring fullpath, cleanpath; + pstring fullpath, cleanpath, extrapath; int pathlen; fstring server, share; struct cli_state *newcli; pstring newpath; pstring newmount; - char *ppath; + char *ppath, *temppath = NULL; SMB_STRUCT_STAT sbuf; uint32 attributes; @@ -635,8 +645,14 @@ consumed = MIN(pathlen, consumed ); pstrcpy( targetpath, &fullpath[consumed/2] ); - split_dfs_path( refs[0].dfspath, server, share ); + split_dfs_path( refs[0].dfspath, server, share, extrapath ); SAFE_FREE( refs ); + + if (strlen(extrapath) > 0) { + string_append(&temppath, extrapath); + string_append(&temppath, targetpath); + pstrcpy( targetpath, temppath ); + } /* open the connection to the target path */ @@ -688,6 +704,7 @@ pstring fullpath; BOOL res; uint16 cnum; + fstring newextrapath; if ( !cli || !sharename ) return False; @@ -723,7 +740,7 @@ return False; } - split_dfs_path( refs[0].dfspath, newserver, newshare ); + split_dfs_path( refs[0].dfspath, newserver, newshare, newextrapath ); /* check that this is not a self-referral */