CVS commit: src/usr.sbin/bthcid

2020-06-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Jun  7 00:54:22 UTC 2020

Modified Files:
src/usr.sbin/bthcid: config.c

Log Message:
Update for proplib(3) API changes.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/bthcid/config.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/bthcid/config.c
diff -u src/usr.sbin/bthcid/config.c:1.5 src/usr.sbin/bthcid/config.c:1.6
--- src/usr.sbin/bthcid/config.c:1.5	Wed Apr 15 00:37:05 2009
+++ src/usr.sbin/bthcid/config.c	Sun Jun  7 00:54:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.c,v 1.5 2009/04/15 00:37:05 lukem Exp $	*/
+/*	$NetBSD: config.c,v 1.6 2020/06/07 00:54:22 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: config.c,v 1.5 2009/04/15 00:37:05 lukem Exp $");
+__RCSID("$NetBSD: config.c,v 1.6 2020/06/07 00:54:22 thorpej Exp $");
 
 #include 
 #include 
@@ -114,7 +114,7 @@ lookup_key(bdaddr_t *laddr, bdaddr_t *ra
 		return NULL;
 	}
 
-	memcpy(key, prop_data_data_nocopy(obj), sizeof(key));
+	memcpy(key, prop_data_value(obj), sizeof(key));
 	prop_object_release(cfg);
 	return key;
 }
@@ -156,7 +156,7 @@ save_key(bdaddr_t *laddr, bdaddr_t *radd
 		prop_object_release(dev);
 	}
 
-	dat = prop_data_create_data_nocopy(key, HCI_KEY_SIZE);
+	dat = prop_data_create_nocopy(key, HCI_KEY_SIZE);
 	if (dat == NULL) {
 		syslog(LOG_ERR, "Cannot create data object: %m");
 		prop_object_release(cfg);



CVS commit: src/usr.sbin/bthcid

2017-12-21 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Dec 21 12:25:03 UTC 2017

Modified Files:
src/usr.sbin/bthcid: bthcid.8

Log Message:
Add width arguments to tagget lists.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/bthcid/bthcid.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/bthcid/bthcid.8
diff -u src/usr.sbin/bthcid/bthcid.8:1.10 src/usr.sbin/bthcid/bthcid.8:1.11
--- src/usr.sbin/bthcid/bthcid.8:1.10	Thu Dec 21 09:00:19 2017
+++ src/usr.sbin/bthcid/bthcid.8	Thu Dec 21 12:25:03 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: bthcid.8,v 1.10 2017/12/21 09:00:19 plunky Exp $
+.\" $NetBSD: bthcid.8,v 1.11 2017/12/21 12:25:03 wiz Exp $
 .\"
 .\" Copyright (c) 2006 Itronix Inc.
 .\" All rights reserved.
@@ -52,7 +52,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $Id: bthcid.8,v 1.10 2017/12/21 09:00:19 plunky Exp $
+.\" $Id: bthcid.8,v 1.11 2017/12/21 12:25:03 wiz Exp $
 .\" $FreeBSD: src/usr.sbin/bluetooth/hcsecd/hcsecd.8,v 1.6 2006/02/11 15:36:37 markus Exp $
 .\"
 .Dd September 29, 2006
@@ -75,7 +75,7 @@ The
 daemon handles Link Key and PIN code requests for Bluetooth devices.
 It opens a raw HCI socket and listens for the following HCI events.
 .Pp
-.Bl -tag -compact
+.Bl -tag -compact -width "Link_Key_NotificationXXX"
 .It Dv Link_Key_Request
 .Nm
 scans the
@@ -143,7 +143,7 @@ The default path is
 .Pa /var/run/bthcid .
 .El
 .Sh FILES
-.Bl -tag -compact
+.Bl -tag -compact -width "XvarXdbXbthcid.keysXXX"
 .It Pa /var/db/bthcid.keys
 .It Pa /var/run/bthcid
 .It Pa /var/run/bthcid.pid



CVS commit: src/usr.sbin/bthcid

2017-12-21 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Thu Dec 21 09:00:19 UTC 2017

Modified Files:
src/usr.sbin/bthcid: bthcid.8

Log Message:
fix width/indent of list


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/bthcid/bthcid.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/bthcid/bthcid.8
diff -u src/usr.sbin/bthcid/bthcid.8:1.9 src/usr.sbin/bthcid/bthcid.8:1.10
--- src/usr.sbin/bthcid/bthcid.8:1.9	Tue Mar 18 18:20:46 2014
+++ src/usr.sbin/bthcid/bthcid.8	Thu Dec 21 09:00:19 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: bthcid.8,v 1.9 2014/03/18 18:20:46 riastradh Exp $
+.\" $NetBSD: bthcid.8,v 1.10 2017/12/21 09:00:19 plunky Exp $
 .\"
 .\" Copyright (c) 2006 Itronix Inc.
 .\" All rights reserved.
@@ -52,7 +52,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $Id: bthcid.8,v 1.9 2014/03/18 18:20:46 riastradh Exp $
+.\" $Id: bthcid.8,v 1.10 2017/12/21 09:00:19 plunky Exp $
 .\" $FreeBSD: src/usr.sbin/bluetooth/hcsecd/hcsecd.8,v 1.6 2006/02/11 15:36:37 markus Exp $
 .\"
 .Dd September 29, 2006
@@ -75,7 +75,7 @@ The
 daemon handles Link Key and PIN code requests for Bluetooth devices.
 It opens a raw HCI socket and listens for the following HCI events.
 .Pp
-.Bl -tag -width  -compact
+.Bl -tag -compact
 .It Dv Link_Key_Request
 .Nm
 scans the
@@ -124,7 +124,7 @@ Keys may be examined, deleted or moved t
 program.
 .Pp
 The command line options are as follows:
-.Bl -tag -width 
+.Bl -tag -width ".Fl s Ar socket_name"
 .It Fl d Ar device
 Specify the local Bluetooth device address.
 The default is BDADDR_ANY.



CVS commit: src/usr.sbin/bthcid

2017-01-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 10 20:56:41 UTC 2017

Modified Files:
src/usr.sbin/bthcid: client.c

Log Message:
need  for chmod(2)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/bthcid/client.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/bthcid/client.c
diff -u src/usr.sbin/bthcid/client.c:1.4 src/usr.sbin/bthcid/client.c:1.5
--- src/usr.sbin/bthcid/client.c:1.4	Fri Sep 29 16:06:11 2006
+++ src/usr.sbin/bthcid/client.c	Tue Jan 10 15:56:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: client.c,v 1.4 2006/09/29 20:06:11 plunky Exp $	*/
+/*	$NetBSD: client.c,v 1.5 2017/01/10 20:56:41 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -30,11 +30,12 @@
  */
 
 #include 
-__RCSID("$NetBSD: client.c,v 1.4 2006/09/29 20:06:11 plunky Exp $");
+__RCSID("$NetBSD: client.c,v 1.5 2017/01/10 20:56:41 christos Exp $");
 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 



CVS commit: src/usr.sbin/bthcid

2011-08-27 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Aug 27 22:26:05 UTC 2011

Modified Files:
src/usr.sbin/bthcid: bthcid.c

Log Message:
static + __dead


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/bthcid/bthcid.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/bthcid/bthcid.c
diff -u src/usr.sbin/bthcid/bthcid.c:1.5 src/usr.sbin/bthcid/bthcid.c:1.6
--- src/usr.sbin/bthcid/bthcid.c:1.5	Mon Oct  5 12:34:26 2009
+++ src/usr.sbin/bthcid/bthcid.c	Sat Aug 27 22:26:05 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bthcid.c,v 1.5 2009/10/05 12:34:26 plunky Exp $	*/
+/*	$NetBSD: bthcid.c,v 1.6 2011/08/27 22:26:05 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -33,7 +33,7 @@
 __COPYRIGHT(@(#) Copyright (c) 2006 Itronix, Inc.\
   Copyright (c) 2001-2002 Maksim Yevmenkin m_evmen...@yahoo.com.\
   All rights reserved.);
-__RCSID($NetBSD: bthcid.c,v 1.5 2009/10/05 12:34:26 plunky Exp $);
+__RCSID($NetBSD: bthcid.c,v 1.6 2011/08/27 22:26:05 joerg Exp $);
 
 #include sys/param.h
 #include sys/stat.h
@@ -49,15 +49,15 @@
 
 #include bthcid.h
 
-const	char	*socket_name = BTHCID_SOCKET_NAME;
-	int	 detach = 1;
+static const char	*socket_name = BTHCID_SOCKET_NAME;
+static int		 detach = 1;
 
 static struct event	sighup_ev;
 static struct event	sigint_ev;
 static struct event	sigterm_ev;
 
-static void	process_signal(int, short, void *);
-static void	usage(void);
+__dead static void	process_signal(int, short, void *);
+__dead static void	usage(void);
 
 int
 main(int argc, char *argv[])



CVS commit: src/usr.sbin/bthcid

2009-10-05 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Mon Oct  5 12:34:26 UTC 2009

Modified Files:
src/usr.sbin/bthcid: bthcid.c bthcid.h hci.c

Log Message:
use the bt_dev(3) API for increased portability


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/bthcid/bthcid.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/bthcid/bthcid.h
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/bthcid/hci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/bthcid/bthcid.c
diff -u src/usr.sbin/bthcid/bthcid.c:1.4 src/usr.sbin/bthcid/bthcid.c:1.5
--- src/usr.sbin/bthcid/bthcid.c:1.4	Mon Jul 21 13:36:57 2008
+++ src/usr.sbin/bthcid/bthcid.c	Mon Oct  5 12:34:26 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: bthcid.c,v 1.4 2008/07/21 13:36:57 lukem Exp $	*/
+/*	$NetBSD: bthcid.c,v 1.5 2009/10/05 12:34:26 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -33,7 +33,7 @@
 __COPYRIGHT(@(#) Copyright (c) 2006 Itronix, Inc.\
   Copyright (c) 2001-2002 Maksim Yevmenkin m_evmen...@yahoo.com.\
   All rights reserved.);
-__RCSID($NetBSD: bthcid.c,v 1.4 2008/07/21 13:36:57 lukem Exp $);
+__RCSID($NetBSD: bthcid.c,v 1.5 2009/10/05 12:34:26 plunky Exp $);
 
 #include sys/param.h
 #include sys/stat.h
@@ -62,18 +62,17 @@
 int
 main(int argc, char *argv[])
 {
-	bdaddr_t	bdaddr;
+	const char	*device;
 	int		ch;
 	mode_t		mode;
 
-	bdaddr_copy(bdaddr, BDADDR_ANY);
+	device = NULL;
 	mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP;
 
 	while ((ch = getopt(argc, argv, d:fm:ns:h)) != -1) {
 		switch (ch) {
 		case 'd':
-			if (!bt_devaddr(optarg, bdaddr))
-err(EXIT_FAILURE, %s, optarg);
+			device = optarg;
 			break;
 
 		case 'f':
@@ -130,8 +129,8 @@
 		exit(EXIT_FAILURE);
 	}
 
-	if (init_hci(bdaddr)  0) {
-		syslog(LOG_ERR, init_hci(%s), bt_ntoa(bdaddr, NULL));
+	if (init_hci(device)  0) {
+		syslog(LOG_ERR, init_hci(%s), device);
 		exit(EXIT_FAILURE);
 	}
 
@@ -172,7 +171,7 @@
 {
 
 	fprintf(stderr,
-	Usage: %s [-fhn] [-c config] [-d devaddr] [-m mode] [-s path]\n
+	Usage: %s [-fhn] [-c config] [-d device] [-m mode] [-s path]\n
 	Where:\n
 	\t-c config   specify config filename\n
 	\t-d device   specify device address\n

Index: src/usr.sbin/bthcid/bthcid.h
diff -u src/usr.sbin/bthcid/bthcid.h:1.3 src/usr.sbin/bthcid/bthcid.h:1.4
--- src/usr.sbin/bthcid/bthcid.h:1.3	Tue Sep 26 19:18:19 2006
+++ src/usr.sbin/bthcid/bthcid.h	Mon Oct  5 12:34:26 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: bthcid.h,v 1.3 2006/09/26 19:18:19 plunky Exp $	*/
+/*	$NetBSD: bthcid.h,v 1.4 2009/10/05 12:34:26 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -42,7 +42,7 @@
 uint8_t		*lookup_pin		(bdaddr_t *, bdaddr_t *);
 
 /* hci.c */
-int		 init_hci		(bdaddr_t *);
+int		 init_hci		(const char *);
 int		 send_pin_code_reply	(int, struct sockaddr_bt *, bdaddr_t *, uint8_t *);
 
 #endif	/* _BTHCID_H_ */

Index: src/usr.sbin/bthcid/hci.c
diff -u src/usr.sbin/bthcid/hci.c:1.2 src/usr.sbin/bthcid/hci.c:1.3
--- src/usr.sbin/bthcid/hci.c:1.2	Thu Jan 25 20:33:41 2007
+++ src/usr.sbin/bthcid/hci.c	Mon Oct  5 12:34:26 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci.c,v 1.2 2007/01/25 20:33:41 plunky Exp $	*/
+/*	$NetBSD: hci.c,v 1.3 2009/10/05 12:34:26 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -55,7 +55,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: hci.c,v 1.2 2007/01/25 20:33:41 plunky Exp $);
+__RCSID($NetBSD: hci.c,v 1.3 2009/10/05 12:34:26 plunky Exp $);
 
 #include sys/ioctl.h
 #include sys/time.h
@@ -89,32 +89,21 @@
 
 /* Initialise HCI Events */
 int
-init_hci(bdaddr_t *bdaddr)
+init_hci(const char *device)
 {
-	struct sockaddr_bt	sa;
-	struct hci_filter	filter;
+	struct bt_devfilter	filter;
 	int			hci;
 
-	hci = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
+	hci = bt_devopen(device, 0);
 	if (hci  0)
 		return -1;
 
-	memset(sa, 0, sizeof(sa));
-	sa.bt_len = sizeof(sa);
-	sa.bt_family = AF_BLUETOOTH;
-	bdaddr_copy(sa.bt_bdaddr, bdaddr);
-	if (bind(hci, (struct sockaddr *)sa, sizeof(sa))  0) {
-		close(hci);
-		return -1;
-	}
-
 	memset(filter, 0, sizeof(filter));
-	hci_filter_set(HCI_EVENT_PIN_CODE_REQ, filter);
-	hci_filter_set(HCI_EVENT_LINK_KEY_REQ, filter);
-	hci_filter_set(HCI_EVENT_LINK_KEY_NOTIFICATION, filter);
-
-	if (setsockopt(hci, BTPROTO_HCI, SO_HCI_EVT_FILTER,
-			(const void *)filter, sizeof(filter))  0) {
+	bt_devfilter_pkt_set(filter, HCI_EVENT_PKT);
+	bt_devfilter_evt_set(filter, HCI_EVENT_PIN_CODE_REQ);
+	bt_devfilter_evt_set(filter, HCI_EVENT_LINK_KEY_REQ);
+	bt_devfilter_evt_set(filter, HCI_EVENT_LINK_KEY_NOTIFICATION);
+	if (bt_devfilter(hci, filter, NULL)  0) {
 		close(hci);
 		return -1;
 	}