diff options
author | Shirish Kalele <kalele@samba.org> | 2000-04-17 21:25:32 +0000 |
---|---|---|
committer | Shirish Kalele <kalele@samba.org> | 2000-04-17 21:25:32 +0000 |
commit | 483e61b97fea28b397e10881683c5bad822fc912 (patch) | |
tree | f816769100da8877c4424f669c077c23cafba22f /source3/msdfs | |
parent | d99bec71701d611b0d8ee44d92cb8ed28162af56 (diff) | |
download | samba-483e61b97fea28b397e10881683c5bad822fc912.tar.gz samba-483e61b97fea28b397e10881683c5bad822fc912.tar.bz2 samba-483e61b97fea28b397e10881683c5bad822fc912.zip |
When parsing a dfs map for a service, see if the mount points exist that stand
for token junction points in the Dfs. If not, create these mount points as
subdirectories of the service directory.
(This used to be commit 3b79df24687afce4780884b7a784661f69752fe1)
Diffstat (limited to 'source3/msdfs')
-rw-r--r-- | source3/msdfs/parse_dfs_map.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/source3/msdfs/parse_dfs_map.c b/source3/msdfs/parse_dfs_map.c index 3680e627c8..24d8ca8b3d 100644 --- a/source3/msdfs/parse_dfs_map.c +++ b/source3/msdfs/parse_dfs_map.c @@ -111,12 +111,30 @@ static BOOL parse_referral(char* s, struct referral* ref) return True; } +static void create_mount_point(int snum, struct junction_map *jn) +{ + fstring dfsvolumepath; + + fstrcpy(dfsvolumepath, lp_pathname(snum)); + fstrcat(dfsvolumepath, "/"); + fstrcat(dfsvolumepath, jn->volume_name); + + if(!directory_exist(dfsvolumepath, NULL)) + { + DEBUG(10,("create_mount_point: creating msdfs mntpt %s\n", + dfsvolumepath)); + become_root(False); + mkdir(dfsvolumepath, 0700); + unbecome_root(False); + } +} static BOOL load_dfsmap(char* fname, int snum) { struct junction_map* junction = NULL; struct referral tmp_ref_array[MAX_ALTERNATE_PATHS]; int ref_count = 0; FILE* fp; + int line_cnt = 0; if(lp_dfsmap_loaded(snum)) return True; @@ -136,6 +154,7 @@ static BOOL load_dfsmap(char* fname, int snum) pstring rawline; char* line; + line_cnt++; if(!fgets(rawline,PSTRING_LEN,fp)) continue; @@ -149,6 +168,7 @@ static BOOL load_dfsmap(char* fname, int snum) if(line[0]!='\\') { + /* a junction encountered. add the current junction first */ if(junction) { @@ -163,6 +183,9 @@ static BOOL load_dfsmap(char* fname, int snum) DEBUG(6,("Unable to add junction entry %s:%s after parsing\n", junction->service_name,junction->volume_name)); } + + /* create a unix directory as a junction/mount point. */ + create_mount_point(snum, junction); free(junction); } @@ -181,7 +204,7 @@ static BOOL load_dfsmap(char* fname, int snum) /* referral encountered. add to current junction */ if(!junction) { - DEBUG(4,("Invalid entry in Dfs map file.\nAlternate path defined outside of a junction in line:\n%s\n",line)); + DEBUG(4,("Invalid entry in Dfs map file.\nAlternate path defined outside of a junction in %s\nline %d: %s\n",fname, line_cnt, line)); return False; } @@ -198,7 +221,7 @@ static BOOL load_dfsmap(char* fname, int snum) { junction->referral_count = ref_count; junction->referral_list = tmp_ref_array; - DEBUG(4,("Adding Dfs junction: %s\%s Referrals: %u First referral path: %s\n", + DEBUG(4,("Adding Dfs junction: %s\\%s Referrals: %u First referral path: %s\n", junction->service_name,junction->volume_name, junction->referral_count, junction->referral_list[0].alternate_path)); if(!add_junction_entry(junction)) @@ -206,6 +229,7 @@ static BOOL load_dfsmap(char* fname, int snum) DEBUG(6,("Unable to add junction entry %s:%s after parsing\n", junction->service_name,junction->volume_name)); } + create_mount_point(snum, junction); free(junction); } @@ -231,7 +255,7 @@ void load_dfsmaps(void) } else { - DEBUG(0,("handle_dfsmap: Unable to load Dfs map file %s.\nService %s not using MS Dfs",dfsmapfile,lp_servicename(i))); + DEBUG(0,("handle_dfsmap: Unable to load Dfs map file %s.\nService %s not using MS Dfs\n",dfsmapfile,lp_servicename(i))); set_dfsmap_loaded(i,False); } |