diff -urN -X exclude linux-2.4.18-orig/fs/smbfs/cache.c linux-2.4.18-smbfs/fs/smbfs/cache.c --- linux-2.4.18-orig/fs/smbfs/cache.c Sat Jan 12 16:55:58 2002 +++ linux-2.4.18-smbfs/fs/smbfs/cache.c Fri Mar 1 21:46:36 2002 @@ -84,7 +84,7 @@ struct list_head *next; if (d_validate(dent, parent)) { - if (dent->d_name.len <= SMB_MAXPATHLEN && + if (dent->d_name.len <= SMB_MAXNAMELEN && (unsigned long)dent->d_fsdata == fpos) { if (!dent->d_inode) { dput(dent); diff -urN -X exclude linux-2.4.18-orig/fs/smbfs/proc.c linux-2.4.18-smbfs/fs/smbfs/proc.c --- linux-2.4.18-orig/fs/smbfs/proc.c Fri Mar 1 20:23:38 2002 +++ linux-2.4.18-smbfs/fs/smbfs/proc.c Sat Mar 2 00:04:22 2002 @@ -119,11 +119,6 @@ int n; wchar_t ch; - if (!nls_from || !nls_to) { - PARANOIA("nls_from=%p, nls_to=%p\n", nls_from, nls_to); - return convert_memcpy(output, olen, input, ilen, NULL, NULL); - } - while (ilen > 0) { /* convert by changing to unicode and back to the new cp */ n = nls_from->char2uni((unsigned char *)input, ilen, &ch); @@ -141,6 +136,10 @@ len += n; } return len; + + /* FIXME: these error returns will simply make the files disappear + if there is a codepage error. uni_xlate? Or treat different errors + differently? */ fail: return n; } @@ -226,8 +225,8 @@ if (maxlen < 2) return -ENAMETOOLONG; - if (maxlen > SMB_MAXNAMELEN + 1) - maxlen = SMB_MAXNAMELEN + 1; + if (maxlen > SMB_MAXPATHLEN + 1) + maxlen = SMB_MAXPATHLEN + 1; if (entry == NULL) goto test_name_and_out; @@ -1579,12 +1578,16 @@ } #endif - qname->len = server->convert(server->name_buf, SMB_MAXNAMELEN, - qname->name, len, - server->remote_nls, server->local_nls); - qname->name = server->name_buf; + qname->len = 0; + len = server->convert(server->name_buf, SMB_MAXNAMELEN, + qname->name, len, + server->remote_nls, server->local_nls); + if (len > 0) { + qname->len = len; + qname->name = server->name_buf; + DEBUG1("len=%d, name=%.*s\n",qname->len,qname->len,qname->name); + } - DEBUG1("len=%d, name=%.*s\n", qname->len, qname->len, qname->name); return p + 22; } @@ -1700,6 +1703,10 @@ for (i = 0; i < count; i++) { p = smb_decode_short_dirent(server, p, &qname, &fattr); + if (qname.len == 0) { + printk(KERN_ERR "smbfs: filename charset conversion failed\n"); + continue; + } if (entries_seen == 2 && qname.name[0] == '.') { if (qname.len == 1) @@ -1737,6 +1744,7 @@ { char *result; unsigned int len = 0; + int n; __u16 date, time; /* @@ -1812,10 +1820,14 @@ } #endif - qname->len = server->convert(server->name_buf, SMB_MAXNAMELEN, - qname->name, len, - server->remote_nls, server->local_nls); - qname->name = server->name_buf; + qname->len = 0; + n = server->convert(server->name_buf, SMB_MAXNAMELEN, + qname->name, len, + server->remote_nls, server->local_nls); + if (n > 0) { + qname->len = n; + qname->name = server->name_buf; + } out: return result; @@ -1881,7 +1893,7 @@ */ mask = param + 12; - mask_len = smb_encode_path(server, mask, SMB_MAXNAMELEN+1, dir, &star); + mask_len = smb_encode_path(server, mask, SMB_MAXPATHLEN+1, dir, &star); if (mask_len < 0) { result = mask_len; goto unlock_return; @@ -2030,6 +2042,10 @@ p = smb_decode_long_dirent(server, p, info_level, &qname, &fattr); + if (qname.len == 0) { + printk(KERN_ERR "smbfs: filename charset conversion failed\n"); + continue; + } /* ignore . and .. from the server */ if (entries_seen == 2 && qname.name[0] == '.') { @@ -2088,7 +2104,7 @@ int mask_len, result; retry: - mask_len = smb_encode_path(server, mask, SMB_MAXNAMELEN+1, dentry, NULL); + mask_len = smb_encode_path(server, mask, SMB_MAXPATHLEN+1, dentry, NULL); if (mask_len < 0) { result = mask_len; goto out; @@ -2214,7 +2230,7 @@ retry: WSET(param, 0, 1); /* Info level SMB_INFO_STANDARD */ DSET(param, 2, 0); - result = smb_encode_path(server, param+6, SMB_MAXNAMELEN+1, dir, NULL); + result = smb_encode_path(server, param+6, SMB_MAXPATHLEN+1, dir, NULL); if (result < 0) goto out; p = param + 6 + result; @@ -2464,7 +2480,7 @@ retry: WSET(param, 0, 1); /* Info level SMB_INFO_STANDARD */ DSET(param, 2, 0); - result = smb_encode_path(server, param+6, SMB_MAXNAMELEN+1, dir, NULL); + result = smb_encode_path(server, param+6, SMB_MAXPATHLEN+1, dir, NULL); if (result < 0) goto out; p = param + 6 + result;