summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/msdfs.c29
-rw-r--r--source3/smbd/trans2.c7
-rw-r--r--source3/smbd/vfs.c7
3 files changed, 21 insertions, 22 deletions
diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c
index b88538c2ba1..9c25d8ba8fe 100644
--- a/source3/smbd/msdfs.c
+++ b/source3/smbd/msdfs.c
@@ -1297,6 +1297,7 @@ bool create_msdfs_link(const struct junction_map *jucn)
int i=0;
bool insert_comma = False;
bool ret = False;
+ struct smb_filename *smb_fname = NULL;
if(!junction_to_local_path(jucn, &path, &conn, &cwd)) {
return False;
@@ -1339,27 +1340,24 @@ 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(SMB_VFS_SYMLINK(conn, msdfs_link, path) < 0) {
- if (errno == EEXIST) {
- struct smb_filename *smb_fname;
-
- smb_fname = synthetic_smb_fname(talloc_tos(),
- path,
- NULL,
- NULL,
- 0);
- if (smb_fname == NULL) {
- errno = ENOMEM;
- goto out;
- }
+ smb_fname = synthetic_smb_fname(talloc_tos(),
+ path,
+ NULL,
+ NULL,
+ 0);
+ if (smb_fname == NULL) {
+ errno = ENOMEM;
+ goto out;
+ }
+ if(SMB_VFS_SYMLINK(conn, msdfs_link, smb_fname) < 0) {
+ if (errno == EEXIST) {
if(SMB_VFS_UNLINK(conn, smb_fname)!=0) {
TALLOC_FREE(smb_fname);
goto out;
}
- TALLOC_FREE(smb_fname);
}
- if (SMB_VFS_SYMLINK(conn, msdfs_link, path) < 0) {
+ if (SMB_VFS_SYMLINK(conn, msdfs_link, smb_fname) < 0) {
DEBUG(1,("create_msdfs_link: symlink failed "
"%s -> %s\nError: %s\n",
path, msdfs_link, strerror(errno)));
@@ -1370,6 +1368,7 @@ bool create_msdfs_link(const struct junction_map *jucn)
ret = True;
out:
+ TALLOC_FREE(smb_fname);
vfs_ChDir(conn, cwd);
SMB_VFS_DISCONNECT(conn);
conn_free(conn);
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 8615a782f4a..de6073a973f 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -6607,10 +6607,9 @@ static NTSTATUS smb_set_file_unix_link(connection_struct *conn,
struct smb_request *req,
const char *pdata,
int total_data,
- const struct smb_filename *smb_fname)
+ const struct smb_filename *new_smb_fname)
{
char *link_target = NULL;
- const char *newname = smb_fname->base_name;
TALLOC_CTX *ctx = talloc_tos();
/* Set a symbolic link. */
@@ -6632,9 +6631,9 @@ static NTSTATUS smb_set_file_unix_link(connection_struct *conn,
}
DEBUG(10,("smb_set_file_unix_link: SMB_SET_FILE_UNIX_LINK doing symlink %s -> %s\n",
- newname, link_target ));
+ new_smb_fname->base_name, link_target ));
- if (SMB_VFS_SYMLINK(conn,link_target,newname) != 0) {
+ if (SMB_VFS_SYMLINK(conn,link_target,new_smb_fname) != 0) {
return map_nt_error_from_unix(errno);
}
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index bed3d2c1554..5acfb9af38a 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -2152,11 +2152,12 @@ int smb_vfs_call_linux_setlease(struct vfs_handle_struct *handle,
return handle->fns->linux_setlease_fn(handle, fsp, leasetype);
}
-int smb_vfs_call_symlink(struct vfs_handle_struct *handle, const char *oldpath,
- const char *newpath)
+int smb_vfs_call_symlink(struct vfs_handle_struct *handle,
+ const char *link_target,
+ const struct smb_filename *new_smb_fname)
{
VFS_FIND(symlink);
- return handle->fns->symlink_fn(handle, oldpath, newpath);
+ return handle->fns->symlink_fn(handle, link_target, new_smb_fname);
}
int smb_vfs_call_readlink(struct vfs_handle_struct *handle,