1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-03 12:58:35 +03:00

Fixed the problem with reply_getatr() being passed a "" name in reply_getatr,

replaced the paranoid code in smbd/filename.c that replaces a "" with a ".".
I am starting to think this code may well be needed.
Jeremy.
This commit is contained in:
Jeremy Allison -
parent 548634915f
commit bdc3d9f52f
2 changed files with 10 additions and 11 deletions

View File

@ -366,8 +366,6 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component,
trim_string(name,"/","/");
/* I've disabled this till we fix printing (probably a getatr problem) (tridge) */
#if TRIM_NULL_NAMES
/*
* If we trimmed down to a single '\0' character
* then we should use the "." directory to avoid
@ -378,7 +376,6 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component,
name[0] = '.';
name[1] = '\0';
}
#endif
/*
* Ensure saved_last_component is valid even if file exists.

View File

@ -812,19 +812,20 @@ int reply_getatr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
BOOL bad_path = False;
pstrcpy(fname,smb_buf(inbuf) + 1);
unix_convert(fname,conn,0,&bad_path,&sbuf);
/* dos smetimes asks for a stat of "" - it returns a "hidden directory"
under WfWg - weird! */
if (! (*fname))
{
mode = aHIDDEN | aDIR;
if (!CAN_WRITE(conn)) mode |= aRONLY;
size = 0;
mtime = 0;
ok = True;
}
{
mode = aHIDDEN | aDIR;
if (!CAN_WRITE(conn)) mode |= aRONLY;
size = 0;
mtime = 0;
ok = True;
}
else
{
unix_convert(fname,conn,0,&bad_path,&sbuf);
if (check_name(fname,conn))
{
if (VALID_STAT(sbuf) || dos_stat(fname,&sbuf) == 0)
@ -839,6 +840,7 @@ int reply_getatr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
else
DEBUG(3,("stat of %s failed (%s)\n",fname,strerror(errno)));
}
}
if (!ok)
{