pstring fname;
pstrcpy(fname,dname);
- if((strcmp(fname, ".") == 0) || (strcmp(fname, "..")==0))
- continue;
+ /* Quick check for "." and ".." */
+ if (fname[0] == '.') {
+ if (!fname[1] || (fname[1] == '.' && !fname[2])) {
+ continue;
+ }
+ }
if(!mask_match(fname, mask, case_sensitive))
continue;
ZERO_STRUCT(sbuf);
unix_convert(newname,conn,newname_last_component,&bad_path,&sbuf);
+ /* Quick check for "." and ".." */
+ if (newname_last_component[0] == '.') {
+ if (!newname_last_component[1] || (newname_last_component[1] == '.' && !newname_last_component[2])) {
+ return NT_STATUS_ACCESS_DENIED;
+ }
+ }
+
/* Ensure newname contains a '/' */
if(strrchr_m(newname,'/') == 0) {
pstring tmpstr;
rc = unix_convert(name,conn,0,&bad_path1,&sbuf1);
unix_convert(newname,conn,newname_last_component,&bad_path2,&sbuf2);
+ /* Quick check for "." and ".." */
+ if (newname_last_component[0] == '.') {
+ if (!newname_last_component[1] || (newname_last_component[1] == '.' && !newname_last_component[2])) {
+ return NT_STATUS_ACCESS_DENIED;
+ }
+ }
+
/*
* Split the old name into directory and last component
* strings. Note that unix_convert may have stripped off a
* name and newname contain a / character or neither of them do
* as this is checked in resolve_wildcards().
*/
-
+
p = strrchr_m(name,'/');
if (!p) {
pstrcpy(directory,".");
pstrcpy(fname,dname);
- if((strcmp(fname, ".") == 0) || (strcmp(fname, "..")==0))
- continue;
+ /* Quick check for "." and ".." */
+ if (fname[0] == '.') {
+ if (!fname[1] || (fname[1] == '.' && !fname[2])) {
+ continue;
+ }
+ }
if(!mask_match(fname, mask, case_sensitive))
continue;