Opened 16 years ago

Last modified 16 years ago

#42 defect closed fixed (fixed)

Application.setUID and setEUID not portable.

Reported by: radix Owned by:
Priority: high Milestone:
Component: Keywords:
Cc: radix Branch:


Attachments (1)

patch.txt (1.2 KB) - added by rptownsend 16 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 16 years ago by radix

These methods fail on HP-UX11i because os.getgid()
returns 3, not zero.

comment:2 Changed 16 years ago by Glyph

returns 3 for root, I assume you mean

Changed 16 years ago by rptownsend

Attachment: patch.txt added

comment:3 Changed 16 years ago by rptownsend

Yes, I posted this to the Twisted-Python mailing list:

# id
uid=0(root) gid=3(sys)

# /opt/python/bin/python          
Python 2.2.1 (#5, Jan 23 2003, 13:18:26) [C] on hp-ux11
Type "help", "copyright", "credits" or "license" for more 
>>> import os
>>> os.getgid()

A patch was posted by Martin Armstrong.

Andrew Bennets replied:
"This looks sensible to me.  Would anyone object if I 
checked it in?"

Since then, nothing...

comment:4 Changed 16 years ago by radix

I don't understand how the attached patch is relevant; it
catches more errors, but doesn't seem to do anything about
the fact that on HP/UX root is uid 3. I probably don't
understand the problem enough, can you explain more?

comment:5 Changed 16 years ago by rptownsend

It's root's *gid* that is set to 3, not it's *uid*.

This means that 'if not os.getgid()' will always return 
False, thus setUID() and setEUID() will have no effect.

My patch doesn't call os.getgid(), it just tries to call 
the appropriate set functions and ignores any exceptions if 
the calls fail.

comment:6 Changed 16 years ago by radix

Ah, right, since the code wasn't checking against `0'
explicitly, I was confused. I'll commit your patch.

comment:7 Changed 16 years ago by radix

buildbot's green

comment:8 Changed 8 years ago by <automation>

Note: See TracTickets for help on using tickets.