Re: Bug#558406: gnome-keyring-daemon doesn't work on GNU/kFreeBSD

2009-12-15 Thread Emmanuel Bouthenot
reopen 558406
thanks

Hi,

Sorry to reopen the bug, but the first patch was not the good one and
it doesn't fix the bug at all.

Attached is a patch which definitely fix this bug.

I'm also CC-ing the debian-bsd@ list. Even if the patch fix the bug,
i'm not really statisfied. I suspect a deeper problem on how socket
credentials should work on kFreeBSD.

from  egg/egg-unix-credentials.c

--8<- line 100 -
#if defined(HAVE_CMSGCRED) || defined(LOCAL_CREDS)
if (cmsg.hdr.cmsg_len < CMSG_LEN (sizeof *cred) ||
   cmsg.hdr.cmsg_type != SCM_CREDS) {
fprintf (stderr, "message from recvmsg() was not\n");
return -1;
}
#endif

=> always return -1
>8--

If the previous test is disabled then if fails on:

--8<- line 122 -
#elif defined(HAVE_CMSGCRED)
  cred = (struct cmsgcred *) CMSG_DATA (&cmsg.hdr);
  *pid = cred->cmcred_pid;
  *uid = cred->cmcred_euid;
#elif defined(LOCAL_CREDS)


=> uid is always 0, it should be the user id (eg. >= 1000)
>8--


The fact that the source code builds fine and
HAVE_CMSGCRED/LOCAL_CREDS are defined makes me feel that something is
weird.

I will be glad to get debian-bsd@ folks opinions on it.

Regards,

-- 
Emmanuel Bouthenot
  mail: kol...@{openics,debian}.orggpg: 1024D/0x414EC36E
  xmpp: kol...@im.openics.org  irc: kol...@{freenode,oftc}

--- gnome-keyring-2.28.1-orig/egg/egg-unix-credentials.c	2009-10-18 01:27:22.0 +0200
+++ gnome-keyring-2.28.1/egg/egg-unix-credentials.c	2009-12-07 01:13:17.0 +0100
@@ -37,6 +37,10 @@
 #include 
 #endif
 
+#if defined(__FreeBSD_kernel__)
+#include 
+#endif
+
 int
 egg_unix_credentials_read (int sock, pid_t *pid, uid_t *uid)
 {
@@ -45,7 +49,7 @@
 	char buf;
 	int ret;
 	
-#if defined(HAVE_CMSGCRED) || defined(LOCAL_CREDS)
+#if (defined(HAVE_CMSGCRED) || defined(LOCAL_CREDS)) && !defined(__FreeBSD_kernel__)
 	/* Prefer CMSGCRED over LOCAL_CREDS because the former provides the
 	 * remote PID. */
 #if defined(HAVE_CMSGCRED)
@@ -73,7 +77,7 @@
 	msg.msg_iov = &iov;
 	msg.msg_iovlen = 1;
 	
-#if defined(HAVE_CMSGCRED) || defined(LOCAL_CREDS)
+#if (defined(HAVE_CMSGCRED) || defined(LOCAL_CREDS)) && !defined(__FreeBSD_kernel__)
 	memset (&cmsg, 0, sizeof (cmsg));
 	msg.msg_control = (caddr_t) &cmsg;
 	msg.msg_controllen = CMSG_SPACE(sizeof *cred);
@@ -97,7 +101,7 @@
 		return -1;
 	}
 
-#if defined(HAVE_CMSGCRED) || defined(LOCAL_CREDS)
+#if (defined(HAVE_CMSGCRED) || defined(LOCAL_CREDS)) && !defined(__FreeBSD_kernel__)
 	if (cmsg.hdr.cmsg_len < CMSG_LEN (sizeof *cred) ||
 	cmsg.hdr.cmsg_type != SCM_CREDS) {
 		fprintf (stderr, "message from recvmsg() was not SCM_CREDS\n");
@@ -119,6 +123,18 @@
  cr_len, (int) sizeof (cr));
 			return -1;
 		}
+#elif defined(LOCAL_PEERCRED) /* GNU/kFreeBSD */
+		struct xucred cr;
+		socklen_t cr_len = sizeof(cr);
+		*pid = 0;
+		
+		if (getsockopt (sock, 0, LOCAL_PEERCRED, &cr, &cr_len) == 0) {
+			*uid = cr.cr_uid;
+		} else {
+			fprintf (stderr, "failed to getsockopt() credentials, returned len %d/%d\n",
+ cr_len, (int) sizeof (cr));
+			return -1;
+		}
 #elif defined(HAVE_CMSGCRED)
 		cred = (struct cmsgcred *) CMSG_DATA (&cmsg.hdr);
 		*pid = cred->cmcred_pid;


Re: devd, acpiconf and such

2009-12-15 Thread Aurelien Jarno
On Tue, Dec 15, 2009 at 03:26:39PM +0100, Werner Koch wrote:
> Hi!
> 
> Looking at the freebsd kernel event system I obviously came across the
> devd.  Are there any plans to include it or is the plan to port the
> Linux udev system to kfreebsd?

The plan is to include it, the udev file system is not something that
can be ported, it is to dependent on the kernel.

> Looking at devd.conf and its usage I have to say that I really like
> it; in contrast to udev (or whatever the current hotplug system on
> GNU/Linux is) it is easy to understand and thus I assume also easy to
> debug.  It is much like pf.conf in contrast to iptables.  The devd
> code does not look too complex and it should be straightforward to
> port it to glibc.
> 
> To support acpi suspend we also need the acpiconf tool, which is even
> more trivial.
> 
> Anyone working on it?  Shall I take it up?
> 

As far as I know, no one is working on that. Ideally this should be
integrated to the freebsd-utils source package (possibly producing new
binary packages), but this is probably a detail, the most important job
being to port it to glibc.

-- 
Aurelien Jarno  GPG: 1024D/F1BCDB73
aurel...@aurel32.net http://www.aurel32.net


-- 
To UNSUBSCRIBE, email to debian-bsd-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Re: installation fails

2009-12-15 Thread Aurelien Jarno
On Tue, Dec 15, 2009 at 10:24:57PM +0200, Anton Andreev wrote:
> Hello,
> 
> After the debian kfreeBSD installer reboots the system then then first boot 
> fails.
> Does anyone has the same problem?
> 

This is due to a bug in initramfs, that mounts a tmpfs filesystem over
/dev (as on GNU/Linux), it used to be workarounded in freebsd-utils, but
a bug now prevents the workaround to work.

The bug is fixed in freebsd-utils from unstable, but the package still 
needs to migrate into testing. In the meanwhile, it is possible to 
workaround the problem by running "ln -s /proc/mtab /target/etc/mtab"
in the d-i terminal (using alt-f2), at the end of the installation,
and before rebooting.

-- 
Aurelien Jarno  GPG: 1024D/F1BCDB73
aurel...@aurel32.net http://www.aurel32.net


-- 
To UNSUBSCRIBE, email to debian-bsd-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Re: installation fails

2009-12-15 Thread Joshua Cummings
On Tue, 2009-12-15 at 22:24 +0200, Anton Andreev wrote:
> Hello,
> 
> After the debian kfreeBSD installer reboots the system then then first boot 
> fails.
> Does anyone has the same problem?
> 

Is this with a d-i image? How does it fail? Any errors?
I've recently used the latest d-i image with my EeePC and its seems
devfs isn't being mounted for some reason (which breaks the boot
process). Not sure if this is what you're referring to.


--
Joshua


-- 
To UNSUBSCRIBE, email to debian-bsd-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Re: installation fails

2009-12-15 Thread Luca Favatella
On Tue, Dec 15, 2009 at 10:24:57PM +0200, Anton Andreev wrote:
> Hello,

Hi.


> After the debian kfreeBSD installer reboots the system then then first boot 
> fails.
> Does anyone has the same problem?

Can you please briefly describe your hardware and the kind of failure?
If yours is VirtualBox (virtual machine), I tested that first boot fails in 
VirtualBox because of a VirtualBox bug.


Cheers,
Luca Favatella


-- 
To UNSUBSCRIBE, email to debian-bsd-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



installation fails

2009-12-15 Thread Anton Andreev
Hello,

After the debian kfreeBSD installer reboots the system then then first boot 
fails.
Does anyone has the same problem?

Cheers,
Anton


-- 
To UNSUBSCRIBE, email to debian-bsd-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



devd, acpiconf and such

2009-12-15 Thread Werner Koch
Hi!

Looking at the freebsd kernel event system I obviously came across the
devd.  Are there any plans to include it or is the plan to port the
Linux udev system to kfreebsd?

Looking at devd.conf and its usage I have to say that I really like
it; in contrast to udev (or whatever the current hotplug system on
GNU/Linux is) it is easy to understand and thus I assume also easy to
debug.  It is much like pf.conf in contrast to iptables.  The devd
code does not look too complex and it should be straightforward to
port it to glibc.

To support acpi suspend we also need the acpiconf tool, which is even
more trivial.

Anyone working on it?  Shall I take it up?


Salam-Shalom,

   Werner


-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.


-- 
To UNSUBSCRIBE, email to debian-bsd-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org