mirror of
https://github.com/samba-team/samba.git
synced 2025-01-26 10:04:02 +03:00
s3: smbd: On startup file_name_hash() can be called with an absolute pathname.
This occurs on first CHDIR to the root of the share. Ensure we don't add conn->connectpath twice when doing creating the file name hash. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
parent
a6df051dd5
commit
bd0bad6f58
@ -1361,8 +1361,19 @@ NTSTATUS file_name_hash(connection_struct *conn,
|
||||
|
||||
/* Set the hash of the full pathname. */
|
||||
|
||||
len = full_path_tos(conn->connectpath, name, tmpbuf, sizeof(tmpbuf),
|
||||
&fullpath, &to_free);
|
||||
if (name[0] == '/') {
|
||||
strlcpy(tmpbuf, name, sizeof(tmpbuf));
|
||||
fullpath = tmpbuf;
|
||||
len = strlen(fullpath);
|
||||
to_free = NULL;
|
||||
} else {
|
||||
len = full_path_tos(conn->connectpath,
|
||||
name,
|
||||
tmpbuf,
|
||||
sizeof(tmpbuf),
|
||||
&fullpath,
|
||||
&to_free);
|
||||
}
|
||||
if (len == -1) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user