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:19 +0000
committerJeremy Allison <jra@samba.org>2003-10-28 00:51:19 +0000
commit3638769e02ca8d1ab9cb17d7b10e6e9cdb6ea2e5 (patch)
treeef492304b579ad03db86ea3e2e0cfdd3bf918187 /source3/rpc_server/srv_dfs_nt.c
parent0b86dcc634fb3dab1abc8a1f56b281093af12969 (diff)
downloadsamba-3638769e02ca8d1ab9cb17d7b10e6e9cdb6ea2e5.tar.gz
samba-3638769e02ca8d1ab9cb17d7b10e6e9cdb6ea2e5.tar.bz2
samba-3638769e02ca8d1ab9cb17d7b10e6e9cdb6ea2e5.zip
Fix for bug #667. DFS filenames can now have arbitrary case.
Jeremy. (This used to be commit cbefb5c4f983ca49fcc563111d8704d3770daf81)
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;
}