mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 12:56:51 +03:00
(smbfs_stat): Don't write to path.
This commit is contained in:
parent
ca70ee44c5
commit
e751871446
23
vfs/smbfs.c
23
vfs/smbfs.c
@ -1439,7 +1439,7 @@ smbfs_stat (vfs * me, char *path, struct stat *buf)
|
||||
{
|
||||
smbfs_connection *sc;
|
||||
pstring server_url;
|
||||
char *service, *pp;
|
||||
char *service, *pp, *at;
|
||||
const char *p;
|
||||
|
||||
DEBUG (3, ("smbfs_stat(path:%s)\n", path));
|
||||
@ -1463,16 +1463,19 @@ smbfs_stat (vfs * me, char *path, struct stat *buf)
|
||||
p++;
|
||||
|
||||
pp = strchr (p, '/'); /* advance past next '/' */
|
||||
|
||||
at = strchr (p, '@');
|
||||
pstrcpy (server_url, URL_HEADER);
|
||||
if (pp) {
|
||||
char *t = strchr (p, '@');
|
||||
if (t && t < pp) { /* user@server */
|
||||
*t = 0;
|
||||
pstrcat (server_url, p);
|
||||
pstrcat (server_url, "@");
|
||||
*t = '@';
|
||||
}
|
||||
if (at && at < pp) { /* user@server */
|
||||
char *z = &(server_url[sizeof (server_url) - 1]);
|
||||
const char *s = p;
|
||||
|
||||
at = &(server_url [HEADER_LEN]) + (at - p + 1);
|
||||
if (z > at)
|
||||
z = at;
|
||||
at = &(server_url [HEADER_LEN]);
|
||||
while (at < z)
|
||||
*at++ = *s++;
|
||||
*z = 0;
|
||||
}
|
||||
pstrcat (server_url, current_bucket->host);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user