From: Claudio Takahasi <cktakahasi@gmail.com>
To: bluez-devel@lists.sourceforge.net
Subject: Re: [Bluez-devel] HCID D-Bus (Seg Fault)
Date: Wed, 14 Sep 2005 13:06:41 -0300 [thread overview]
Message-ID: <e1effdeb05091409061f00ea01@mail.gmail.com> (raw)
In-Reply-To: <1126710977.16166.62.camel@station6.example.com>
[-- Attachment #1.1: Type: text/plain, Size: 796 bytes --]
sorry. It's done!
Regards,
Claudio.
On 9/14/05, Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Claudio,
>
> > It's done! The changes was based on the dbus.c revision 1.15.
>
> you used spaces instead of tabs. Please redo it again.
>
> Regards
>
> Marcel
>
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server.
> Download it for free - -and be entered to win a 42" plasma tv or your very
> own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> Bluez-devel mailing list
> Bluez-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>
[-- Attachment #1.2: Type: text/html, Size: 1281 bytes --]
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: hcid_dbus_0005.patch --]
[-- Type: text/x-patch; name="hcid_dbus_0005.patch", Size: 2242 bytes --]
--- bluez-utils-cvs.orig/hcid/dbus.c 2005-09-14 08:51:58.470937024 -0300
+++ bluez-utils-cvs/hcid/dbus.c 2005-09-14 13:02:06.553361696 -0300
@@ -68,39 +68,47 @@
pin_code_reply_cp pr;
DBusMessage *message;
DBusMessageIter iter;
- int type;
+ int arg_type;
+ int msg_type;
size_t len;
char *pin;
-
+ const char *error_msg;
+
message = dbus_pending_call_steal_reply(call);
-
- if (dbus_message_is_error(message, WRONG_ARGS_ERROR))
- goto error;
-
- dbus_message_iter_init(message, &iter);
-
- type = dbus_message_iter_get_arg_type(&iter);
- if (type != DBUS_TYPE_STRING)
- goto error;
-
- dbus_message_iter_get_basic(&iter, &pin);
- len = strlen(pin);
-
- memset(&pr, 0, sizeof(pr));
- bacpy(&pr.bdaddr, &req->bda);
- memcpy(pr.pin_code, pin, len);
- pr.pin_len = len;
- hci_send_cmd(req->dev, OGF_LINK_CTL, OCF_PIN_CODE_REPLY,
- PIN_CODE_REPLY_CP_SIZE, &pr);
-
- dbus_message_unref(message);
+
+ if (message) {
+ msg_type = dbus_message_get_type(message);
+ dbus_message_iter_init(message, &iter);
+
+ if (msg_type == DBUS_MESSAGE_TYPE_ERROR) {
+ dbus_message_iter_get_basic(&iter, &error_msg);
+ /* handling WRONG_ARGS_ERROR, DBUS_ERROR_NO_REPLY, DBUS_ERROR_SERVICE_UNKNOWN */
+ syslog(LOG_ERR, "%s: %s", dbus_message_get_error_name(message), error_msg);
+ hci_send_cmd(req->dev, OGF_LINK_CTL,
+ OCF_PIN_CODE_NEG_REPLY, 6, &req->bda);
+ } else {
+ /* check signature */
+ arg_type = dbus_message_iter_get_arg_type(&iter);
+ if (arg_type != DBUS_TYPE_STRING) {
+ syslog(LOG_ERR, "Wrong reply signature: expected PIN");
+ hci_send_cmd(req->dev, OGF_LINK_CTL,
+ OCF_PIN_CODE_NEG_REPLY, 6, &req->bda);
+ } else {
+ dbus_message_iter_get_basic(&iter, &pin);
+
+ len = strlen(pin);
+
+ memset(&pr, 0, sizeof(pr));
+ bacpy(&pr.bdaddr, &req->bda);
+ memcpy(pr.pin_code, pin, len);
+ pr.pin_len = len;
+ hci_send_cmd(req->dev, OGF_LINK_CTL, OCF_PIN_CODE_REPLY,
+ PIN_CODE_REPLY_CP_SIZE, &pr);
+ }
+ }
+ dbus_message_unref(message);
+ }
dbus_pending_call_unref(call);
-
- return;
-
-error:
- hci_send_cmd(req->dev, OGF_LINK_CTL,
- OCF_PIN_CODE_NEG_REPLY, 6, &req->bda);
}
static void free_pin_req(void *req)
next prev parent reply other threads:[~2005-09-14 16:06 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-08 19:50 [Bluez-devel] HCID D-Bus Claudio Takahasi
2005-09-08 23:07 ` Marcel Holtmann
2005-09-09 8:25 ` Peter Robinson
2005-09-09 9:37 ` Marcel Holtmann
2005-09-09 13:29 ` Sjoerd Simons
2005-09-09 13:40 ` Marcel Holtmann
2005-09-12 21:07 ` [Bluez-devel] HCID D-Bus (Sig Fault) Claudio Takahasi
2005-09-12 21:14 ` [Bluez-devel] HCID D-Bus (Seg Fault) Claudio Takahasi
2005-09-12 21:40 ` [Bluez-devel] HCID D-Bus (Sig Fault) Marcel Holtmann
2005-09-12 23:09 ` Claudio Takahasi
2005-09-12 23:21 ` Marcel Holtmann
2005-09-13 13:03 ` [Bluez-devel] HCID D-Bus (Seg Fault) Claudio Takahasi
2005-09-13 18:54 ` Marcel Holtmann
2005-09-14 12:00 ` Claudio Takahasi
2005-09-14 15:16 ` Marcel Holtmann
2005-09-14 16:06 ` Claudio Takahasi [this message]
2005-09-15 8:11 ` Marcel Holtmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e1effdeb05091409061f00ea01@mail.gmail.com \
--to=cktakahasi@gmail.com \
--cc=bluez-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).