minor fixes
authorSimo Sorce <idra@samba.org>
Fri, 25 Jan 2002 00:35:14 +0000 (00:35 +0000)
committerSimo Sorce <idra@samba.org>
Fri, 25 Jan 2002 00:35:14 +0000 (00:35 +0000)
source/include/smb.h
source/lib/util.c
source/lib/util_str.c
source/smbd/mangle.c

index aa54e38797987e3c77363e27dc6eb6b655f535b7..4168e34d3f69aa703e29d8c7aa5f45f843f2953c 100644 (file)
@@ -6,6 +6,7 @@
    Copyright (C) John H Terpstra              1996-2000
    Copyright (C) Luke Kenneth Casson Leighton 1996-2000
    Copyright (C) Paul Ashton                  1998-2000
+   Copyright (C) Simo Sorce                   2001-2002
    Copyright (C) Martin Pool                 2002
    
    This program is free software; you can redistribute it and/or modify
@@ -386,10 +387,8 @@ typedef struct write_cache
 
 typedef struct
 {
-       smb_ucs2_t *path;
-       smb_ucs2_t *name;
-       smb_ucs2_t *unixname;
-       smb_ucs2_t *dosname;
+       smb_ucs2_t *origname;
+       smb_ucs2_t *filename;
        SMB_STRUCT_STAT *statinfo;
 } smb_filename;
 
index 97ff4e24a0f12b0f4d5df07fd16b603c1e528aaf..2b71b3cb3d9e640a8b7651a873593a01db95f4b7 100644 (file)
@@ -449,13 +449,14 @@ smb_ucs2_t *unix_clean_path(const smb_ucs2_t *s)
 
        /* reduce any /../ */
        t = ns;
-       while ((r = strstr_wa(t, "/.."))) {
+       while (*t && (r = strstr_wa(t, "/.."))) {
                t = &(r[3]);
                if (*t == UCS2_CHAR('/') || *t == 0) {
                        *r = 0;
                        p = strrchr_w(ns, UCS2_CHAR('/'));
                        if (!p) p = ns;
-                       memmove(p, t, (strlen_w(t) + 1) * sizeof(smb_ucs2_t));
+                       if (*t == 0) *p = 0;
+                       else memmove(p, t, (strlen_w(t) + 1) * sizeof(smb_ucs2_t));
                        t = p;
                }
        }
index dbfaf179a173c62a50226a27ca61a93f30bf97c4..a7eeedea3d866d54a5542bb4dd04ab755fb24a86 100644 (file)
@@ -3,6 +3,7 @@
    Version 3.0
    Samba utility functions
    Copyright (C) Andrew Tridgell 1992-2001
+   Copyright (C) Simo Sorce      2001-2002
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -749,8 +750,8 @@ len is the number of bytes, not chars
   if len==0 then no length check is performed
 ****************************************************************************/
 
-smb_ucs2_t *all_string_sub_w(smb_ucs2_t *s, const smb_ucs2_t *pattern,
-                                           const smb_ucs2_t *insert)
+smb_ucs2_t *all_string_sub_w(const smb_ucs2_t *s, const smb_ucs2_t *pattern,
+                               const smb_ucs2_t *insert)
 {
        smb_ucs2_t *r, *rp, *sp;
        size_t  lr, lp, li, lt;
@@ -951,7 +952,7 @@ int pstr_sprintf(pstring s, const char *fmt, ...)
 }
 
 
-/* Just a typesafety wrapper for snprintf into a pstring */
+/* Just a typesafety wrapper for snprintf into a fstring */
 int fstr_sprintf(fstring s, const char *fmt, ...)
 {
        va_list ap;
index b83168712f0e74ea0ddaba5ddc2e711e8b0803c7..a6f63371c3a3a7476bf357546d19e85124fd3535 100644 (file)
@@ -538,16 +538,18 @@ done:
 
 BOOL is_8_3(const char *fname, BOOL check_case)
 {
+       char *f;
        smb_ucs2_t *ucs2name;
        NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
 
        if (!fname || !*fname) return False;
+       if ((f = strrchr(fname, '/')) == NULL) f = fname;
 
-       DEBUG(10,("is_8_3: testing [%s]\n", fname));
+       DEBUG(10,("is_8_3: testing [%s]\n", f));
 
-       if (strlen(fname) > 12) return False;
+       if (strlen(f) > 12) return False;
        
-       ucs2name = acnv_uxu2(fname);
+       ucs2name = acnv_uxu2(f);
        if (!ucs2name)
        {
                DEBUG(0,("is_8_3: out of memory!\n"));