summaryrefslogtreecommitdiff
path: root/source3/rpc_server/srv_dfs_nt.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-10-28 00:51:21 +0000
committerJeremy Allison <jra@samba.org>2003-10-28 00:51:21 +0000
commit0ce2c6ecb8f6e88a42ab44e07a0b89344c922f0e (patch)
tree6d27ef698ef58a6848741437f4f2b0880c4a8d88 /source3/rpc_server/srv_dfs_nt.c
parent4ebe9f916716e5dbe13b460d846046ee8ee59940 (diff)
downloadsamba-0ce2c6ecb8f6e88a42ab44e07a0b89344c922f0e.tar.gz
samba-0ce2c6ecb8f6e88a42ab44e07a0b89344c922f0e.tar.bz2
samba-0ce2c6ecb8f6e88a42ab44e07a0b89344c922f0e.zip
Fix for bug #667. DFS filenames can now have arbitrary case.
Jeremy. (This used to be commit 74148111e16a863d5a33511e5b15632a736d7e99)
Diffstat (limited to 'source3/rpc_server/srv_dfs_nt.c')
-rw-r--r--source3/rpc_server/srv_dfs_nt.c58
1 files changed, 39 insertions, 19 deletions
diff --git a/source3/rpc_server/srv_dfs_nt.c b/source3/rpc_server/srv_dfs_nt.c
index 751cb6e642..ac3ed9c394 100644
--- a/source3/rpc_server/srv_dfs_nt.c
+++ b/source3/rpc_server/srv_dfs_nt.c
@@ -70,6 +70,7 @@ WERROR _dfs_add(pipes_struct *p, DFS_Q_DFS_ADD* q_u, DFS_R_DFS_ADD *r_u)
pstrcat(altpath, "\\");
pstrcat(altpath, sharename);
+ /* The following call can change the cwd. */
if(get_referred_path(dfspath, &jn, NULL, NULL))
{
exists = True;
@@ -79,6 +80,8 @@ WERROR _dfs_add(pipes_struct *p, DFS_Q_DFS_ADD* q_u, DFS_R_DFS_ADD *r_u)
else
jn.referral_count = 1;
+ vfs_ChDir(p->conn,p->conn->connectpath);
+
jn.referral_list = (struct referral*) talloc(p->mem_ctx, jn.referral_count
* sizeof(struct referral));
@@ -100,8 +103,11 @@ WERROR _dfs_add(pipes_struct *p, DFS_Q_DFS_ADD* q_u, DFS_R_DFS_ADD *r_u)
pstrcpy(jn.referral_list[jn.referral_count-1].alternate_path, altpath);
- if(!create_msdfs_link(&jn, exists))
+ if(!create_msdfs_link(&jn, exists)) {
+ vfs_ChDir(p->conn,p->conn->connectpath);
return WERR_DFS_CANT_CREATE_JUNCT;
+ }
+ vfs_ChDir(p->conn,p->conn->connectpath);
return WERR_OK;
}
@@ -147,8 +153,11 @@ WERROR _dfs_remove(pipes_struct *p, DFS_Q_DFS_REMOVE *q_u,
/* if no server-share pair given, remove the msdfs link completely */
if(!q_u->ptr_ServerName && !q_u->ptr_ShareName)
{
- if(!remove_msdfs_link(&jn))
+ if(!remove_msdfs_link(&jn)) {
+ vfs_ChDir(p->conn,p->conn->connectpath);
return WERR_DFS_NO_SUCH_VOL;
+ }
+ vfs_ChDir(p->conn,p->conn->connectpath);
}
else
{
@@ -175,13 +184,19 @@ WERROR _dfs_remove(pipes_struct *p, DFS_Q_DFS_REMOVE *q_u,
/* Only one referral, remove it */
if(jn.referral_count == 1)
{
- if(!remove_msdfs_link(&jn))
+ if(!remove_msdfs_link(&jn)) {
+ vfs_ChDir(p->conn,p->conn->connectpath);
return WERR_DFS_NO_SUCH_VOL;
+ }
+ vfs_ChDir(p->conn,p->conn->connectpath);
}
else
{
- if(!create_msdfs_link(&jn, True))
+ if(!create_msdfs_link(&jn, True)) {
+ vfs_ChDir(p->conn,p->conn->connectpath);
return WERR_DFS_CANT_CREATE_JUNCT;
+ }
+ vfs_ChDir(p->conn,p->conn->connectpath);
}
}
@@ -325,7 +340,8 @@ WERROR _dfs_enum(pipes_struct *p, DFS_Q_DFS_ENUM *q_u, DFS_R_DFS_ENUM *r_u)
int num_jn = 0;
num_jn = enum_msdfs_links(jn);
-
+ vfs_ChDir(p->conn,p->conn->connectpath);
+
DEBUG(5,("make_reply_dfs_enum: %d junctions found in Dfs, doing level %d\n", num_jn, level));
r_u->ptr_buffer = level;
@@ -351,21 +367,25 @@ WERROR _dfs_enum(pipes_struct *p, DFS_Q_DFS_ENUM *q_u, DFS_R_DFS_ENUM *r_u)
WERROR _dfs_get_info(pipes_struct *p, DFS_Q_DFS_GET_INFO *q_u,
DFS_R_DFS_GET_INFO *r_u)
{
- UNISTR2* uni_path = &q_u->uni_path;
- uint32 level = q_u->level;
- pstring path;
- struct junction_map jn;
-
- unistr2_to_ascii(path, uni_path, sizeof(path)-1);
- if(!create_junction(path, &jn))
- return WERR_DFS_NO_SUCH_SERVER;
+ UNISTR2* uni_path = &q_u->uni_path;
+ uint32 level = q_u->level;
+ pstring path;
+ struct junction_map jn;
+
+ unistr2_to_ascii(path, uni_path, sizeof(path)-1);
+ if(!create_junction(path, &jn))
+ return WERR_DFS_NO_SUCH_SERVER;
- if(!get_referred_path(path, &jn, NULL, NULL))
- return WERR_DFS_NO_SUCH_VOL;
+ /* The following call can change the cwd. */
+ if(!get_referred_path(path, &jn, NULL, NULL)) {
+ vfs_ChDir(p->conn,p->conn->connectpath);
+ return WERR_DFS_NO_SUCH_VOL;
+ }
- r_u->level = level;
- r_u->ptr_ctr = 1;
- r_u->status = init_reply_dfs_ctr(p->mem_ctx, level, &r_u->ctr, &jn, 1);
+ vfs_ChDir(p->conn,p->conn->connectpath);
+ r_u->level = level;
+ r_u->ptr_ctr = 1;
+ r_u->status = init_reply_dfs_ctr(p->mem_ctx, level, &r_u->ctr, &jn, 1);
- return r_u->status;
+ return r_u->status;
}