Messages in this thread Patch in this message |  | | From | Yuri Per <> | Subject | Patch: smbfs long file name support | Date | Fri, 28 Jun 1996 18:19:16 +0300 (GMT+0300) |
| |
Hi, all!
Problem with long file name support in smbfs is now solved (see patch below).
Yuri Per
diff -r -u linux.2.0.0/fs/smbfs/proc.c linux/fs/smbfs/proc.c --- linux.2.0.0/fs/smbfs/proc.c Fri Jun 28 14:45:02 1996 +++ linux/fs/smbfs/proc.c Fri Jun 28 17:30:02 1996 @@ -3,6 +3,7 @@ * * Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke * + * 28/06/96 - Fixed long file name support (smb_proc_readdir_long) by Yuri Per */ #include <linux/config.h> @@ -1152,6 +1153,7 @@ int info_level = 1; char *p; + char *lastname; int i; int first, total_count; struct smb_dirent *current_entry; @@ -1171,10 +1173,16 @@ int ff_dir_handle=0; int loop_count = 0; - int dirlen = strlen(SMB_FINFO(dir)->path); - char mask[dirlen + 5]; + int dirlen = strlen(SMB_FINFO(dir)->path) + 3; + char *mask; - strcpy(mask, SMB_FINFO(dir)->path); + mask = smb_kmalloc(dirlen, GFP_KERNEL); + if (mask == NULL) + { + printk("smb_proc_readdir_long: Memory allocation failed\n"); + return -ENOMEM; + } + strcpy(mask, SMB_FINFO(dir)->path); strcat(mask, "\\*"); DPRINTK("SMB call lreaddir %d @ %d\n", cache_size, fpos); @@ -1297,22 +1305,37 @@ p = resp_data; /* we might need the lastname for continuations */ + lastname = ""; if (ff_lastname > 0) { switch(info_level) { case 260: - ff_resume_key =0; - strcpy(mask,p+ff_lastname+94); + lastname = p + ff_lastname + 94; + ff_resume_key = 0; break; case 1: - strcpy(mask,p + ff_lastname + 1); + lastname = p + ff_lastname + 1; ff_resume_key = 0; break; } } - else - strcpy(mask,""); + + /* Increase size of mask, if it is too small */ + i = strlen(lastname) + 1; + if (i > dirlen) + { + smb_kfree_s(mask, 0); + dirlen = i; + mask = smb_kmalloc(dirlen, GFP_KERNEL); + if (mask == NULL) + { + printk("smb_proc_readdir_long: Memory allocation failed\n"); + result = -ENOMEM; + break; + } + strcpy(mask, lastname); + } /* Now we are ready to parse smb directory entries. */ @@ -1355,6 +1378,9 @@ } finished: + if (mask != NULL) + smb_kfree_s(mask, 0); + if (resp_data != NULL) { smb_kfree_s(resp_data, 0); resp_data = NULL; diff -r -u linux.2.0.0/CREDITS linux/CREDITS --- linux.2.0.0/CREDITS Sat Jun 8 18:55:40 1996 +++ linux/CREDITS Fri Jun 28 17:39:30 1996 @@ -1029,6 +1029,13 @@ S: Thunder Bay, Ontario S: CANADA P7C 5M9 +N: Yuri Per +E: yuri@pts.mipt.ru +D: Some smbfs fixes +S: Demonstratsii 8-382 +S: Tula 300000 +S: Russia + N: Kai Petzke E: wpp@marie.physik.tu-berlin.de W: http://physik.tu-berlin.de/~wpp
|  |