[SCM] Samba Shared Repository - branch v3-2-test updated -
release-3-2-0pre2-2642-g47e6681
Jeremy Allison
jra at samba.org
Mon Jun 23 18:25:19 GMT 2008
The branch, v3-2-test has been updated
via 47e66814c176d597d9a3c165a7cfa6a5a2fd70be (commit)
from 12d816dc997b1bfc048c5c042945a5e935abf4b4 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test
- Log -----------------------------------------------------------------
commit 47e66814c176d597d9a3c165a7cfa6a5a2fd70be
Author: Jeremy Allison <jra at samba.org>
Date: Mon Jun 23 11:24:52 2008 -0700
Sorry volker, lost your original git-id due to proto.h conflicts.
Remove the "exists" parameter from create_msdfs_link
Jeremy, setting "exists" to True in _dfs_Add prevented the initial creation of
a new symlink for me, because the SMB_VFS_UNLINK failed. This also exists in
3.2. I only check it into 3.3 as I would like you to look at it first.
Thanks,
Volker
-----------------------------------------------------------------------
Summary of changes:
source/rpc_server/srv_dfs_nt.c | 6 ++----
source/smbd/msdfs.c | 22 +++++++++++-----------
2 files changed, 13 insertions(+), 15 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/rpc_server/srv_dfs_nt.c b/source/rpc_server/srv_dfs_nt.c
index 974523d..72b8236 100644
--- a/source/rpc_server/srv_dfs_nt.c
+++ b/source/rpc_server/srv_dfs_nt.c
@@ -44,7 +44,6 @@ WERROR _dfs_Add(pipes_struct *p, struct dfs_Add *r)
struct referral *old_referral_list = NULL;
bool self_ref = False;
int consumedcnt = 0;
- bool exists = False;
char *altpath = NULL;
NTSTATUS status;
TALLOC_CTX *ctx = talloc_tos();
@@ -76,7 +75,6 @@ WERROR _dfs_Add(pipes_struct *p, struct dfs_Add *r)
return ntstatus_to_werror(status);
}
- exists = True;
jn->referral_count += 1;
old_referral_list = jn->referral_list;
@@ -101,7 +99,7 @@ WERROR _dfs_Add(pipes_struct *p, struct dfs_Add *r)
jn->referral_list[jn->referral_count-1].ttl = REFERRAL_TTL;
jn->referral_list[jn->referral_count-1].alternate_path = altpath;
- if(!create_msdfs_link(jn, exists)) {
+ if(!create_msdfs_link(jn)) {
vfs_ChDir(p->conn,p->conn->connectpath);
return WERR_DFS_CANT_CREATE_JUNCT;
}
@@ -184,7 +182,7 @@ WERROR _dfs_Remove(pipes_struct *p, struct dfs_Remove *r)
return WERR_DFS_NO_SUCH_VOL;
}
} else {
- if(!create_msdfs_link(jn, True)) {
+ if(!create_msdfs_link(jn)) {
vfs_ChDir(p->conn,p->conn->connectpath);
return WERR_DFS_CANT_CREATE_JUNCT;
}
diff --git a/source/smbd/msdfs.c b/source/smbd/msdfs.c
index 8c1c9d0..aef4ff6 100644
--- a/source/smbd/msdfs.c
+++ b/source/smbd/msdfs.c
@@ -1306,8 +1306,7 @@ static bool junction_to_local_path(const struct junction_map *jucn,
return True;
}
-bool create_msdfs_link(const struct junction_map *jucn,
- bool exists)
+bool create_msdfs_link(const struct junction_map *jucn)
{
char *path = NULL;
char *msdfs_link = NULL;
@@ -1360,19 +1359,20 @@ bool create_msdfs_link(const struct junction_map *jucn,
DEBUG(5,("create_msdfs_link: Creating new msdfs link: %s -> %s\n",
path, msdfs_link));
- if(exists) {
- if(SMB_VFS_UNLINK(conn,path)!=0) {
+ if(SMB_VFS_SYMLINK(conn, msdfs_link, path) < 0) {
+ if (errno == EEXIST) {
+ if(SMB_VFS_UNLINK(conn,path)!=0) {
+ goto out;
+ }
+ }
+ if (SMB_VFS_SYMLINK(conn, msdfs_link, path) < 0) {
+ DEBUG(1,("create_msdfs_link: symlink failed "
+ "%s -> %s\nError: %s\n",
+ path, msdfs_link, strerror(errno)));
goto out;
}
}
- if(SMB_VFS_SYMLINK(conn, msdfs_link, path) < 0) {
- DEBUG(1,("create_msdfs_link: symlink failed "
- "%s -> %s\nError: %s\n",
- path, msdfs_link, strerror(errno)));
- goto out;
- }
-
ret = True;
out:
--
Samba Shared Repository
More information about the samba-cvs
mailing list