klmr92 / uguu

Automatically exported from code.google.com/p/uguu
Other
0 stars 1 forks source link

[smbscan] Small issues. Further ideas #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1. Usage should be printed into stderr.

2. In smbwk_url_suspend_undo() change:
-  if (n < SMB_URL_LEN)
+  if (n < SMB_URL_LEN - 1) 

Right now there is a possibility to produce non-null terminated string.
Though it should be fine as it is now, because smbwk_url_suspend_undo() is
only to use right after successful smbwk_url_suspend()
Maybe we should add a check for smbwk_url_suspend either....

Original issue reported on code.google.com by ruslan.savchenko on 31 Dec 2009 at 9:20

GoogleCodeExporter commented 9 years ago
I think, if SMB_URL_LEN is not protocol-specific limitation, we should also 
treat the
files which are not feet in buffer (at smbwk.c, line 151). Also, some compilers 
(i.e.
msvs), has sizeof(off_t)==4. May be, fpos_t is more sufficient type for file 
size.

Original comment by radist...@gmail.com on 31 Dec 2009 at 10:06

GoogleCodeExporter commented 9 years ago
off_t is type of seze item in the struct returned by smbc_stat(). If you want
something else, then I suggest long long.

Original comment by ruslan.savchenko on 31 Dec 2009 at 10:45

GoogleCodeExporter commented 9 years ago
3. In smbwk.c change SMBSCAN_GO into SMBWK_GO

Original comment by ruslan.savchenko on 31 Dec 2009 at 10:46

GoogleCodeExporter commented 9 years ago
>I think, if SMB_URL_LEN is not protocol-specific limitation, we should also 
treat the
files which are not feet in buffer (at smbwk.c, line 151)

AFAIK, passing an entire url is the only way to access a file with 
libsmbclient. We
can always enlarge the buffer, if it appears to be small for our needs. Too long
paths/filenames are not good at all (recursive links for example).

Original comment by ruslan.savchenko on 31 Dec 2009 at 10:51

GoogleCodeExporter commented 9 years ago
4. More inforamtive messages on smbws_url_append fails

Original comment by ruslan.savchenko on 31 Dec 2009 at 10:59

GoogleCodeExporter commented 9 years ago
> off_t is type of seze item in the struct returned by smbc_stat()
We should somehow handle the large files.

> We can always enlarge the buffer, if it appears to be small for our needs. 
Don't need it. Just alloca-ed buffer if the case of failed smbwk_url_append 
call at
line 151.

Original comment by radist...@gmail.com on 31 Dec 2009 at 11:03

GoogleCodeExporter commented 9 years ago
>> off_t is type of seze item in the struct returned by smbc_stat()
>We should somehow handle the large files.
Type returned by library won't change. But in dt_dentry size _must_ be of 64bit 
type
because entire directory size is accumulated in it.

>> We can always enlarge the buffer, if it appears to be small for our needs. 
>Don't need it. Just alloca-ed buffer if the case of failed smbwk_url_append 
call at
line 151.
Now i see the point

Original comment by ruslan.savchenko on 31 Dec 2009 at 11:10

GoogleCodeExporter commented 9 years ago
5. Support for large file names. Scanner can ommit scanning a directory if 
resulting
path is too long, but it should scan all the files in accessed directories.

Original comment by ruslan.savchenko on 31 Dec 2009 at 11:12

GoogleCodeExporter commented 9 years ago
6. long long type for dt_dentry.size

7. Replace two tree walks in dt_mktree by one (if possible)

Original comment by ruslan.savchenko on 31 Dec 2009 at 11:15

GoogleCodeExporter commented 9 years ago
8. SMBSCAN_LOG macro for error messages

Original comment by ruslan.savchenko on 31 Dec 2009 at 11:35

GoogleCodeExporter commented 9 years ago
9. Simplified output:

first line:
<total number of directories>

next lines have format:
<path_id> name <0 if file, id if directory> size
where path_id is id of parent directory

such format should allow easier parsing for high-level scanner

Original comment by ruslan.savchenko on 31 Dec 2009 at 12:15

GoogleCodeExporter commented 9 years ago
><path_id> name <0 if file, id if directory> size
<path_id> <0 if file, id if directory> size name
name can contain spaces. We do not want to encode names here...

Original comment by ruslan.savchenko on 31 Dec 2009 at 12:16

GoogleCodeExporter commented 9 years ago
10. Do not call smbc_open() when going up in file tree. This will cause 
redundant
calls to smbc_close() - remove error checking after calling it.

Original comment by ruslan.savchenko on 31 Dec 2009 at 2:19

GoogleCodeExporter commented 9 years ago
11. print total share size (right now root directory is not printed)

Original comment by ruslan.savchenko on 1 Jan 2010 at 2:12

GoogleCodeExporter commented 9 years ago
topic dammit

Ideas 1,2,3,4,6,7,8,10,11 commited. 5,9 remain

Original comment by ruslan.savchenko on 1 Jan 2010 at 2:18

GoogleCodeExporter commented 9 years ago
5,9 commited

Original comment by ruslan.savchenko on 2 Jan 2010 at 12:56