[#7955] Failing tests in ruby since 1.8.2 — "Caleb Tennis" <caleb@...>
The following tests have been failing in Ruby for a long time, including
[#7978] Patch for Unix socket peer credentials — "James F. Hranicky" <jfh@...>
This patch adds support for getting the uid and gid of the peer
In article <200606091528.30171.jfh@cise.ufl.edu>,
On Friday 16 June 2006 11:51, Tanaka Akira wrote:
In article <200606161327.35948.jfh@cise.ufl.edu>,
On Saturday 17 June 2006 06:27, Tanaka Akira wrote:
In article <200607101352.16804.jfh@cise.ufl.edu>,
On Tuesday 11 July 2006 00:10, Tanaka Akira wrote:
Hi,
On Thursday 13 July 2006 22:48, nobu@ruby-lang.org wrote:
On Jul 18, 2006, at 12:27 PM, James F. Hranicky wrote:
On Tuesday 18 July 2006 15:52, Eric Hodel wrote:
[#7994] Ruby Kaigi date confusion — "Charles O Nutter" <headius@...>
I'm quite confused by the dates I have seen reported on various Ruby Kaigi
[#8013] Download page on ruby-lang has numeric URL — Hugh Sasse <hgs@...>
This is off-topic to ruby-core, but possibly core to ruby's uptake:
On Jun 19, 2006, at 3:32 AM, Hugh Sasse wrote:
[#8038] bug in $. ? — Wybo Dekker <wybo@...>
wybo>cat t
Wybo Dekker schrieb:
Pit Capitain wrote:
[#8050] Thank-you to the Rails Core Team — Dave Teare <devlists-ruby-core@...>
While we were listening to Dave Thomas' Keynote address today at
[#8061] Win32 Extension Issues Wanted! — "Austin Ziegler" <halostatue@...>
Everyone. I had a conversation with folks from Microsoft today about
[#8065] Core documentation patches — Alex Young <alex@...>
Hi there,
Hi,
Yukihiro Matsumoto wrote:
[#8073] 1.8.5p1 build failure on Solaris 10 — "Daniel Berger" <Daniel.Berger@...>
Solaris 10
Hi,
Yukihiro Matsumoto wrote:
>>>>> "D" == Daniel Berger <Daniel.Berger@qwest.com> writes:
ts <decoux@moulon.inra.fr> wrote on 28.06.2006 17:37:00:
Hi,
Yukihiro Matsumoto <matz@ruby-lang.org> wrote on 29.06.2006 20:02:11:
Hi,
Yukihiro Matsumoto <matz@ruby-lang.org> wrote on 29.06.2006 20:53:20:
ville.mattila@stonesoft.com wrote:
[#8087] optparse.rb to RDoc documentation patch — <noreply@...>
Patches item #4879, was opened at 2006-06-28 20:50
On Jun 28, 2006, at 11:50 AM, <noreply@rubyforge.org>
[#8102] Reorganizing configure.in by platform? — "Daniel Berger" <Daniel.Berger@...>
Hi,
Re: Patch for Unix socket peer credentials
On Sat, Jun 17, 2006 at 02:27:43AM +0900, James F. Hranicky wrote:
> On Friday 16 June 2006 11:51, Tanaka Akira wrote:
> > In article <200606091528.30171.jfh@cise.ufl.edu>,
> >
> > "James F. Hranicky" <jfh@cise.ufl.edu> writes:
> > > This patch adds support for getting the uid and gid of the peer
> > > socket connected to a Unix domain socket.
> >
> > I think it's good feature.
>
> Ok -- I think I'm going to take Sam's advice and turn it into one
> method that returns [uid, gid] .
It would be nice to get API feedback from more than 2 people though!
> I'm not sure how to get the creds of a DGRAM sock, though.
Sorry, forget I mentioned it, they come (if at all) with the extra
information from recvmsg, and it doesn't have anything to do with
getpeerid(2) or getpeerucred(2).
> > > + * Document-method: peer_uid
> > > + * call-seq: socket.peer_uid => int
> > > + *
> > > + * Returns the uid of the peer socket for Unix domain stream sockets
> >
> > real uid or effective uid?
>
> It depends on the platform -- on FreeBSD it's euid, on Linux (I think) it's
> ruid and on Solaris it can be anything, though I stuck with ruid.
With linux, the man pages make it look like the sender has to explicitly
set the credentials, and can set real or effective, but the kernel does
permissions checks (if non-root, won't allows the uid/gid to be set to
other than the real, effective, or saved values). Perhaps there is
a default if the caller doesn't set them.
A problem with unifying such different interfaces is any assumptions
made (such as the caller doesn't care if it gets ruid or euid from
#peer_uid) are bound to be wrong for somebody.
One other option would be to simply expose system interfaces. I.e.,
- for systems with getpeerid(), add BasicSocket#getpeerid() =>
[euid,egid] or {:euid=>euid, :egid=>egid}
- for systems with getpeerucred(), add BasicSocket#getpeerucred() =>
[uid,gid,euid,egid,...], or {:euid=>euid, :egid=>egid, :uid=>uid, ...}
- for linux, emulate getpeerid() by calling getsockopt(), notice that
linux has struct ucred{pid,uid,gid}
If all three had a single method, peer_id, that returned a Hash, it
would be possible for the caller to look at the contents of the hash,
and use whatever they wanted:
peer = socket.peer_id[:euid] || socket.peer_id[:uid]
or:
unless peer = socket.peer_id[:euid]
raise "effective uid unknown, abort!"
end
I'm just throwing ideas out there. It seems that by exposing the system
interfaces in way that is as close as possible to the system/C
interfaces (but that DOESN'T involve unpacking binary structures whose
layout varies depending on the OS), the Socket APIs allow you to do
anything you could if you were coding in C. I like that about ruby's
socket support, when it works.
High level functions like #peer_id => [uid,gid] are useful, too, but
they can be implemented in terms of the low-level functions.
Anyhow, one way or another, the information returned by getpeerid(2) and
getpeerucred(2) isn't available in ruby now, and I very much support it
becoming available, thanks for putting this out there.
Sam