linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Make the path to oui.txt a compile-time option
@ 2010-09-06 14:47 Bastien Nocera
  2010-09-06 15:12 ` Pacho Ramos
  2010-09-06 16:10 ` Johan Hedberg
  0 siblings, 2 replies; 7+ messages in thread
From: Bastien Nocera @ 2010-09-06 14:47 UTC (permalink / raw)
  To: BlueZ development

[-- Attachment #1: Type: text/plain, Size: 199 bytes --]

Heya,

We've been carrying a similar (but hard-coded) patch in Fedora for a
long while, and it would be nice if we could do this properly upstream
instead.

Patch attached with explanations.

Cheers

[-- Attachment #2: 0001-Make-the-path-to-oui.txt-a-compile-time-option.patch --]
[-- Type: text/x-patch, Size: 1927 bytes --]

>From b96d9394aa850be86ca368aeaeec3bc24c00bce1 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Mon, 6 Sep 2010 15:43:48 +0100
Subject: [PATCH] Make the path to oui.txt a compile-time option

This avoids bluetoothd trying to load oui.txt from multiple locations
and cause SELinux AVC denials by accessing files it's not supposed
to touch.
---
 acinclude.m4 |    8 ++++++++
 configure.ac |    1 +
 src/oui.c    |   14 +++-----------
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index b34f08d..a4e5e2f 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -152,6 +152,14 @@ AC_DEFUN([AC_PATH_SNDFILE], [
 	AC_SUBST(SNDFILE_LIBS)
 ])
 
+AC_DEFUN([AC_PATH_OUI], [
+	AC_ARG_WITH(ouifile,
+		    AS_HELP_STRING([--with-ouifile=PATH],[Path to the oui.txt file @<:@auto@:>@]),
+		    [ac_with_ouifile=$withval],
+		    [ac_with_ouifile="/var/lib/misc/oui.txt"])
+	AC_DEFINE_UNQUOTED(OUIFILE, ["$ac_with_ouifile"], [Define the OUI file path])
+])
+
 AC_DEFUN([AC_ARG_BLUEZ], [
 	debug_enable=no
 	optimization_enable=yes
diff --git a/configure.ac b/configure.ac
index e8abfe9..74acf31 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,6 +41,7 @@ AC_PATH_ALSA
 AC_PATH_GSTREAMER
 AC_PATH_USB
 AC_PATH_SNDFILE
+AC_PATH_OUI
 
 AC_ARG_BLUEZ
 
diff --git a/src/oui.c b/src/oui.c
index 1096d20..80bb3d3 100644
--- a/src/oui.c
+++ b/src/oui.c
@@ -38,23 +38,15 @@
 
 /* http://standards.ieee.org/regauth/oui/oui.txt */
 
-#define OUIFILE "/var/lib/misc/oui.txt"
-
 char *ouitocomp(const char *oui)
 {
 	struct stat st;
 	char *str, *map, *off, *end;
 	int fd;
 
-	fd = open("oui.txt", O_RDONLY);
-	if (fd < 0) {
-		fd = open(OUIFILE, O_RDONLY);
-		if (fd < 0) {
-			fd = open("/usr/share/misc/oui.txt", O_RDONLY);
-			if (fd < 0)
-				return NULL;
-		}
-	}
+	fd = open(OUIFILE, O_RDONLY);
+	if (fd < 0)
+		return NULL;
 
 	if (fstat(fd, &st) < 0) {
 		close(fd);
-- 
1.7.0.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] Make the path to oui.txt a compile-time option
  2010-09-06 14:47 [PATCH] Make the path to oui.txt a compile-time option Bastien Nocera
@ 2010-09-06 15:12 ` Pacho Ramos
  2010-09-06 15:15   ` Bastien Nocera
  2010-09-06 16:10 ` Johan Hedberg
  1 sibling, 1 reply; 7+ messages in thread
From: Pacho Ramos @ 2010-09-06 15:12 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: BlueZ development

[-- Attachment #1: Type: text/plain, Size: 381 bytes --]

El lun, 06-09-2010 a las 15:47 +0100, Bastien Nocera escribió:
> Heya,
> 
> We've been carrying a similar (but hard-coded) patch in Fedora for a
> long while, and it would be nice if we could do this properly upstream
> instead.
> 
> Patch attached with explanations.
> 
> Cheers

What is the proper package to ship oui.txt file? Thanks a lot for the
information :-)

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Make the path to oui.txt a compile-time option
  2010-09-06 15:12 ` Pacho Ramos
@ 2010-09-06 15:15   ` Bastien Nocera
  2010-09-06 15:16     ` Pacho Ramos
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien Nocera @ 2010-09-06 15:15 UTC (permalink / raw)
  To: pacho; +Cc: BlueZ development

On Mon, 2010-09-06 at 17:12 +0200, Pacho Ramos wrote:
> El lun, 06-09-2010 a las 15:47 +0100, Bastien Nocera escribió:
> > Heya,
> > 
> > We've been carrying a similar (but hard-coded) patch in Fedora for a
> > long while, and it would be nice if we could do this properly upstream
> > instead.
> > 
> > Patch attached with explanations.
> > 
> > Cheers
> 
> What is the proper package to ship oui.txt file? Thanks a lot for the
> information :-)

No idea. In Fedora we ship it in hwdata. No idea where it lives for
Debian-based distributions, or others.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Make the path to oui.txt a compile-time option
  2010-09-06 15:15   ` Bastien Nocera
@ 2010-09-06 15:16     ` Pacho Ramos
  2010-09-06 15:22       ` Bastien Nocera
  0 siblings, 1 reply; 7+ messages in thread
From: Pacho Ramos @ 2010-09-06 15:16 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: BlueZ development

[-- Attachment #1: Type: text/plain, Size: 857 bytes --]

El lun, 06-09-2010 a las 16:15 +0100, Bastien Nocera escribió:
> On Mon, 2010-09-06 at 17:12 +0200, Pacho Ramos wrote:
> > El lun, 06-09-2010 a las 15:47 +0100, Bastien Nocera escribió:
> > > Heya,
> > > 
> > > We've been carrying a similar (but hard-coded) patch in Fedora for a
> > > long while, and it would be nice if we could do this properly upstream
> > > instead.
> > > 
> > > Patch attached with explanations.
> > > 
> > > Cheers
> > 
> > What is the proper package to ship oui.txt file? Thanks a lot for the
> > information :-)
> 
> No idea. In Fedora we ship it in hwdata. No idea where it lives for
> Debian-based distributions, or others.
> 

OK, thanks, I asked it because under Gentoo no package is currently
providing it and a user suggested to supply it with bluez... but I
haven't made any decision about this yet

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Make the path to oui.txt a compile-time option
  2010-09-06 15:16     ` Pacho Ramos
@ 2010-09-06 15:22       ` Bastien Nocera
  2010-09-06 15:38         ` Pacho Ramos
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien Nocera @ 2010-09-06 15:22 UTC (permalink / raw)
  To: pacho; +Cc: BlueZ development

On Mon, 2010-09-06 at 17:16 +0200, Pacho Ramos wrote:
> El lun, 06-09-2010 a las 16:15 +0100, Bastien Nocera escribió:
> > On Mon, 2010-09-06 at 17:12 +0200, Pacho Ramos wrote:
> > > El lun, 06-09-2010 a las 15:47 +0100, Bastien Nocera escribió:
> > > > Heya,
> > > > 
> > > > We've been carrying a similar (but hard-coded) patch in Fedora for a
> > > > long while, and it would be nice if we could do this properly upstream
> > > > instead.
> > > > 
> > > > Patch attached with explanations.
> > > > 
> > > > Cheers
> > > 
> > > What is the proper package to ship oui.txt file? Thanks a lot for the
> > > information :-)
> > 
> > No idea. In Fedora we ship it in hwdata. No idea where it lives for
> > Debian-based distributions, or others.
> > 
> 
> OK, thanks, I asked it because under Gentoo no package is currently
> providing it and a user suggested to supply it with bluez... but I
> haven't made any decision about this yet

That's probably a good enough way to ship it. Various distributions seem
to have a different idea on where it should be.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Make the path to oui.txt a compile-time option
  2010-09-06 15:22       ` Bastien Nocera
@ 2010-09-06 15:38         ` Pacho Ramos
  0 siblings, 0 replies; 7+ messages in thread
From: Pacho Ramos @ 2010-09-06 15:38 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: BlueZ development

[-- Attachment #1: Type: text/plain, Size: 462 bytes --]

El lun, 06-09-2010 a las 16:22 +0100, Bastien Nocera escribió:
> > OK, thanks, I asked it because under Gentoo no package is currently
> > providing it and a user suggested to supply it with bluez... but I
> > haven't made any decision about this yet
> 
> That's probably a good enough way to ship it. Various distributions seem
> to have a different idea on where it should be.
> 

Great, I will probably follow your recommendation, thanks a lot :-)

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Make the path to oui.txt a compile-time option
  2010-09-06 14:47 [PATCH] Make the path to oui.txt a compile-time option Bastien Nocera
  2010-09-06 15:12 ` Pacho Ramos
@ 2010-09-06 16:10 ` Johan Hedberg
  1 sibling, 0 replies; 7+ messages in thread
From: Johan Hedberg @ 2010-09-06 16:10 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: BlueZ development

Hi Bastien,

On Mon, Sep 06, 2010, Bastien Nocera wrote:
> From b96d9394aa850be86ca368aeaeec3bc24c00bce1 Mon Sep 17 00:00:00 2001
> From: Bastien Nocera <hadess@hadess.net>
> Date: Mon, 6 Sep 2010 15:43:48 +0100
> Subject: [PATCH] Make the path to oui.txt a compile-time option
> 
> This avoids bluetoothd trying to load oui.txt from multiple locations
> and cause SELinux AVC denials by accessing files it's not supposed
> to touch.
> ---
>  acinclude.m4 |    8 ++++++++
>  configure.ac |    1 +
>  src/oui.c    |   14 +++-----------
>  3 files changed, 12 insertions(+), 11 deletions(-)

Seems like a good idea. The patch is now upstream.

Johan

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-09-06 16:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-06 14:47 [PATCH] Make the path to oui.txt a compile-time option Bastien Nocera
2010-09-06 15:12 ` Pacho Ramos
2010-09-06 15:15   ` Bastien Nocera
2010-09-06 15:16     ` Pacho Ramos
2010-09-06 15:22       ` Bastien Nocera
2010-09-06 15:38         ` Pacho Ramos
2010-09-06 16:10 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).