Bug 2050 - sys_select() used with a fixed first argument
sys_select() used with a fixed first argument
Status: CLOSED FIXED
Product: Samba 3.0
Classification: Unclassified
Component: File Services
3.0.8
All Linux
: P3 enhancement
: none
Assigned To: Samba Bugzilla Account
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2004-11-17 12:22 UTC by Lars Müller
Modified: 2005-08-24 10:16 UTC (History)
0 users

See Also:


Attachments
Calculate max fd while opening fds and use it as first art to sys_select() (898 bytes, patch)
2004-11-17 12:24 UTC, Lars Müller
no flags Details
Use also maxfd for nmbd instead of FD_SETSIZE (2.67 KB, patch)
2004-11-18 08:52 UTC, Lars Müller
no flags Details
Fix wrepeld sys_select() call; ensure to count maxfd in smbd/server.c correct; use static int for maxfd in nmbd (4.75 KB, patch)
2004-11-19 05:12 UTC, Lars Müller
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Müller 2004-11-17 12:22:43 UTC
In source/smbd/server.c sys_select() is called with FD_SETSIZE which is fixed
set to 1024.

My colleague Sebastian Krahmer saw this while poking around in smbd with the
debugger.

From the current code it looks easy to calculate the highest numbered descriptor.
Comment 1 Lars Müller 2004-11-17 12:24:33 UTC
Created attachment 781 [details]
Calculate max fd while opening fds and use it as first art to sys_select()
Comment 2 Jeremy Allison 2004-11-17 12:50:41 UTC
Correct - applied.
Good patch, thanks !
Jeremy.
Comment 3 Lars Müller 2004-11-18 08:52:08 UTC
Created attachment 795 [details]
Use also maxfd for nmbd instead of FD_SETSIZE
Comment 4 Lars Müller 2004-11-18 08:52:49 UTC
Reopen as FD_SETSIZE is also used in the select() of nmbd.
Comment 5 Jeremy Allison 2004-11-18 15:09:24 UTC
Applied nmbd patch.
Thanks,
Jeremy.
Comment 6 Lars Müller 2004-11-19 05:09:27 UTC
I have to bother again.

a) wrepld/server.c has the same fixed FD_SETSIZE usage.
b) I've missed one FD_SET in smbd/server.c
c) The int maxfd of listen_for_packets() nmbd/nmbd_packets.c must be a static int.

We also could remove check_set_maxfd() as I found the MAX() define.
Comment 7 Lars Müller 2004-11-19 05:12:16 UTC
Created attachment 796 [details]
Fix wrepeld sys_select() call; ensure to count maxfd in smbd/server.c correct; use static int for maxfd in nmbd
Comment 8 Jeremy Allison 2004-11-19 12:27:28 UTC
Applied (with addition of missing "MAX" macro :-).
Jeremy.
Comment 9 Gerald (Jerry) Carter 2005-08-24 10:16:52 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.