Dead code removal. Proper check should be in smbd/open.c. Inspired
authorJeremy Allison <jra@samba.org>
Tue, 11 Apr 2000 00:49:00 +0000 (00:49 +0000)
committerJeremy Allison <jra@samba.org>
Tue, 11 Apr 2000 00:49:00 +0000 (00:49 +0000)
by HEAD.
Jeremy.

source/smbd/open.c
source/smbd/reply.c

index 8ee7c240fa8f2048157c55d0214a52f02019d89f..9395703b54c4ccda7fb138721621397819ea14ac 100644 (file)
@@ -809,6 +809,9 @@ void open_file_shared(files_struct *fsp,connection_struct *conn,char *fname,int
   DEBUG(10,("open_file_shared: fname = %s, share_mode = %x, ofun = %x, mode = %o, oplock request = %d\n",
         fname, share_mode, ofun, (int)mode,  oplock_request ));
 
+  if (!check_name(fname,conn)) {
+      return;
+  }
 
   /* ignore any oplock requests if oplocks are disabled */
   if (!lp_oplocks(SNUM(conn)) || global_client_failed_oplock_break) {
index a48b82a9b560828bdf537384872f75c616b7d407..fe66730b9917e059d103ccdeb5a401866abbae57 100644 (file)
@@ -1538,17 +1538,6 @@ int reply_open(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
   if (!fsp)
     return(ERROR(ERRSRV,ERRnofids));
 
-  if (!check_name(fname,conn))
-  {
-    if((errno == ENOENT) && bad_path)
-    {
-      unix_ERR_class = ERRDOS;
-      unix_ERR_code = ERRbadpath;
-    }
-    file_free(fsp);
-    return(UNIXERROR(ERRDOS,ERRnoaccess));
-  }
   unixmode = unix_mode(conn,aARCH,fname);
       
   open_file_shared(fsp,conn,fname,share_mode,(FILE_FAIL_IF_NOT_EXIST|FILE_EXISTS_OPEN),
@@ -1640,17 +1629,6 @@ int reply_open_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
   if (!fsp)
     return(ERROR(ERRSRV,ERRnofids));
 
-  if (!check_name(fname,conn))
-  {
-    if((errno == ENOENT) && bad_path)
-    {
-      unix_ERR_class = ERRDOS;
-      unix_ERR_code = ERRbadpath;
-    }
-    file_free(fsp);
-    return(UNIXERROR(ERRDOS,ERRnoaccess));
-  }
-
   unixmode = unix_mode(conn,smb_attr | aARCH, fname);
       
   open_file_shared(fsp,conn,fname,smb_mode,smb_ofun,unixmode,
@@ -1781,17 +1759,6 @@ int reply_mknew(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
   if (!fsp)
     return(ERROR(ERRSRV,ERRnofids));
 
-  if (!check_name(fname,conn))
-  {
-    if((errno == ENOENT) && bad_path)
-    {
-      unix_ERR_class = ERRDOS;
-      unix_ERR_code = ERRbadpath;
-    }
-    file_free(fsp);
-    return(UNIXERROR(ERRDOS,ERRnoaccess));
-  }
-
   if(com == SMBmknew)
   {
     /* We should fail if file exists. */
@@ -1861,17 +1828,6 @@ int reply_ctemp(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
   if (fsp)
     return(ERROR(ERRSRV,ERRnofids));
 
-  if (!check_name(fname,conn))
-  {
-    if((errno == ENOENT) && bad_path)
-    {
-      unix_ERR_class = ERRDOS;
-      unix_ERR_code = ERRbadpath;
-    }
-    file_free(fsp);
-    return(UNIXERROR(ERRDOS,ERRnoaccess));
-  }
-
   pstrcpy(fname2,(char *)smbd_mktemp(fname));
 
   /* Open file in dos compatibility share mode. */
@@ -3072,11 +3028,6 @@ int reply_printopen(connection_struct *conn,
        
        pstrcpy(fname2,(char *)smbd_mktemp(fname));
 
-       if (!check_name(fname2,conn)) {
-               file_free(fsp);
-               return(ERROR(ERRDOS,ERRnoaccess));
-       }
-
        /* Open for exclusive use, write only. */
        open_file_shared(fsp,conn,fname2, SET_DENY_MODE(DENY_ALL)|SET_OPEN_MODE(DOS_OPEN_WRONLY),
                      (FILE_CREATE_IF_NOT_EXIST|FILE_EXISTS_FAIL), unix_mode(conn,0,fname2), 0, NULL, NULL);