Skip to content
Tcl Source Code View Ticket
Login

View Ticket

fileevent problem

Closed413100ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 25 years ago
Descriptionplain2001-04-02 11:17:36
Fileevent don't work on transfered (thread::transfer)
socket channel when using setuid extension (from
tclhttpd).
Command after works fine.

I'am using: tclsh8.4a3, libthread2.2, setuid
andreas_kupriesplain2001-04-02 21:41:20
Logged In: YES 
user_id=75003

I don't understand "Command after works fine". Also, is it
possible to attach a small script which exercises this
problem ?
lewandowskiplain2001-04-03 14:08:57
File Added - 4896: script
lewandowskiplain2001-04-03 14:34:58
File Added - 4897: script
lewandowskiplain2001-04-03 14:43:20
Logged In: YES 
user_id=174470

if use setuid "fileevent" and "after" don't work
if use setuid and disable "fileevent", "after" is fine.
lewandowskiplain2001-04-03 14:43:21
File Added - 4898: server
lewandowskiplain2001-04-03 14:51:41
Logged In: YES 
user_id=174470

Please use new version script (4897:script).
I can't delete old (4896:script)
hobbs Ticket [413100ffff]: 1 change [History diff]2001-08-07 07:28:11
andreas_kupriesplain2001-08-07 07:55:02
Logged In: YES 
user_id=75003

I see a couple of problems in the attached scripts:

proc serverOpen {channel addr Port} {
    
    fileevent $channel readable "NewThread $channel $addr"
    puts $channel "Server OK"
    flush $channel
}

Why is 'NewThread' attached to a 'readable event' ?
A simple [after idle] would be sufficient to move the
transfer out of the sockey-handler.

But more important is the fact that a thread is started, 
some event handlers are setup and then the event loop is 
_not_ entered ! The last command in the script should be a 
[vwait Stop] or similar and not the [proc]. As is the 
thread will setup the eventhandlers first and then delete 
itself, never having the opportunity to fire the events.
andreas_kupriesplain2001-09-14 04:27:12
Logged In: YES 
user_id=75003

How did you compile and link 'setuid' ?

When I do it I get a segfault when loading
the extension into tclsh8.4/cvs.

Also, is 'loading' setuid enough to cause the error ? If 
not, where do I place the 'setuid' call to cause the 
problem ?
andreas_kupriesplain2001-09-14 04:37:39
Logged In: YES 
user_id=75003

The location of the 'load libsetuid.so' statement
implies that you try to set the effective user id
for a single thread, right ?

Note that the relevant system call always affects
the whole process, i.e. all threads in it. See the
manpage of 'setuid'.
andreas_kupries Closed ticket [413100ffff]. [History diff]2001-09-14 06:25:51
Log in (anonymous is fine) to add a comment.

Attachments: