Replaced YOST code with more functionally equivalent code that
authorSamba Release Account <samba-bugs@samba.org>
Tue, 11 Feb 1997 22:53:29 +0000 (22:53 +0000)
committerSamba Release Account <samba-bugs@samba.org>
Tue, 11 Feb 1997 22:53:29 +0000 (22:53 +0000)
changes a bit less. Also added fix to tricky reply_mv case.
jra@cygnus.com
(This used to be commit f22ac13b1423186d463c9fc5b3588a3dcbd7bc1c)

source3/include/proto.h
source3/smbd/mangle.c
source3/smbd/reply.c
source3/smbd/server.c
source3/smbd/trans2.c

index cd1340dbd56b0beaf98c5df0667f4ae454036b5a..5993e1d67bcadf5162408e38cf1e7740f37949e8 100644 (file)
@@ -272,7 +272,7 @@ void clean_share_modes(void);
 /*The following definitions come from  mangle.c  */
 
 int str_checksum(char *s);
-BOOL is_8_3(char *fname);
+BOOL is_8_3(char *fname, BOOL check_case);
 void create_mangled_stack(int size);
 BOOL check_mangled_stack(char *s);
 BOOL is_mangled(char *s);
index c0baa659821ed19d7db5a686cc5de21df1c326ad..5fdf31b7a419b3d60f206f869eb55f7cc31a697a 100644 (file)
@@ -79,7 +79,7 @@ static BOOL is_reserved_msdos(char *fname)
 /****************************************************************************
 return True if a name is in 8.3 dos format
 ****************************************************************************/
-BOOL is_8_3(char *fname)
+BOOL is_8_3(char *fname, BOOL check_case)
 {
   int len;
   char *dot_pos;
@@ -91,8 +91,7 @@ BOOL is_8_3(char *fname)
 
   DEBUG(5,("checking %s for 8.3\n",fname));
 
-  if (case_mangle)
-#ifndef YOSTW
+  if (check_case && case_mangle)
     switch (case_default)
       {
       case CASE_LOWER:
@@ -102,10 +101,6 @@ BOOL is_8_3(char *fname)
        if (strhaslower(fname)) return(False);
        break;
       }
-#endif
-#ifdef YOSTW
-       if (strhasupper(fname) && strhaslower(fname)) return(False);
-#endif
 
   /* can't be longer than 12 chars */
   if (len == 0 || len > 12)
@@ -652,7 +647,7 @@ BOOL name_map_mangle(char *OutName,BOOL need83,int snum)
   }
 
   /* check if it's already in 8.3 format */
-  if (need83 && !is_8_3(OutName)) {
+  if (need83 && !is_8_3(OutName, True)) {
     if (!lp_manglednames(snum)) return(False);
 
     /* mangle it into 8.3 */
index 3698787ba462f304bce843b363c3bc6c6a614b59..46c385b85eacc010b20de7f6bfbec5e8dbab8f38 100644 (file)
@@ -37,6 +37,7 @@ extern connection_struct Connections[];
 extern files_struct Files[];
 extern BOOL case_sensitive;
 extern BOOL case_preserve;
+extern BOOL short_case_preserve;
 extern pstring sesssetup_user;
 extern int Client;
 
@@ -605,7 +606,7 @@ int reply_getatr(char *inbuf,char *outbuf)
     char *p = strrchr(fname,'/');
     uint16 flg2 = SVAL(outbuf,smb_flg2);
     if (!p) p = fname;
-    if (!is_8_3(fname))
+    if (!is_8_3(fname, True))
       SSVAL(outbuf,smb_flg2,flg2 | 0x40); /* IS_LONG_NAME */
   }
   
@@ -2582,7 +2583,8 @@ int reply_mv(char *inbuf,char *outbuf)
      * the rename (user is trying to change the case of the
      * filename).
      */
-    if((case_sensitive == False) && (case_preserve == True) &&
+    if((case_sensitive == False) && ((case_preserve == True) || 
+            ((short_case_preserve == True) && is_8_3(name, True))) &&
        strcsequal(name, newname)) {
       pstring newname_modified_last_component;
 
index 5ff60c6c6ce7e5f33dbe5c18a56e9bb92612304b..4f3ee0fd0bfff560747f1c35cdc1d2387516e845 100644 (file)
@@ -300,7 +300,7 @@ static BOOL mangled_equal(char *name1, char *name2)
 {
   pstring tmpname;
 
-  if (is_8_3(name2))
+  if (is_8_3(name2, True))
     return(False);
 
   strcpy(tmpname,name2);
@@ -398,18 +398,29 @@ BOOL unix_convert(char *name,int cnum,pstring saved_last_component)
   unix_format(name);
   unix_clean_name(name);
 
-  if (!case_sensitive && 
-      (!case_preserve || (is_8_3(name) && !short_case_preserve)))
-    strnorm(name);
-
   /* names must be relative to the root of the service - trim any leading /.
    also trim trailing /'s */
   trim_string(name,"/","/");
 
+  /*
+   * Ensure saved_last_component is valid even if file exists.
+   */
+  if(saved_last_component) {
+    end = strrchr(name, '/');
+    if(end)
+      strcpy(saved_last_component, end + 1);
+    else
+      strcpy(saved_last_component, name);
+  }
+
+  if (!case_sensitive && 
+      (!case_preserve || (is_8_3(name, False) && !short_case_preserve)))
+    strnorm(name);
+
   /* check if it's a printer file */
   if (Connections[cnum].printer)
     {
-      if ((! *name) || strchr(name,'/') || !is_8_3(name))
+      if ((! *name) || strchr(name,'/') || !is_8_3(name, True))
        {
          char *s;
          fstring name2;
@@ -422,17 +433,6 @@ BOOL unix_convert(char *name,int cnum,pstring saved_last_component)
       return(True);
     }
 
-  /*
-   * Ensure saved_last_component is valid even if file exists.
-   */
-  if(saved_last_component) {
-    end = strrchr(name, '/');
-    if(end)
-      strcpy(saved_last_component, end + 1);
-    else
-      strcpy(saved_last_component, name);
-  }
-
   /* stat the name - if it exists then we are all done! */
   if (sys_stat(name,&st) == 0)
     return(True);
index 2df28e926453e9e676d18c03408bdcd9f4965a29..d489978ab869428d77e7dad32681ef0e7aab0431 100644 (file)
@@ -429,7 +429,7 @@ static int get_lanman2_dir_entry(int cnum,char *path_mask,int dirtype,int info_l
       break;
 
     case SMB_FIND_FILE_BOTH_DIRECTORY_INFO:
-      was_8_3 = is_8_3(fname);
+      was_8_3 = is_8_3(fname, True);
       len = 94+strlen(fname);
       len = (len + 3) & ~3;
       SIVAL(p,0,len); p += 4;