summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>2010-05-17 21:22:57 -0300
committerJohan Hedberg <johan.hedberg@nokia.com>2010-05-21 09:34:34 +0200
commitdf83594a69fc2661cfcb9f63bf594e7aae834799 (patch)
tree05ac68ea596f6d2c773d71843e5898fd9cc670cf
parentf01bb096f2df0348df5913a33932c4c53c274d8a (diff)
downloadobexd-df83594a69fc2661cfcb9f63bf594e7aae834799.tar.gz
Fix sending the Not Found response asynchronously
When we only discover that the requested resource can't be found in the async callback, we set the error using the obex_object_set_io_flags method, the Not Found case was not being handled
-rw-r--r--plugins/pbap.c4
-rw-r--r--plugins/phonebook-tracker.c4
-rw-r--r--src/obex.c5
3 files changed, 11 insertions, 2 deletions
diff --git a/plugins/pbap.c b/plugins/pbap.c
index 25d5e24..2085aca 100644
--- a/plugins/pbap.c
+++ b/plugins/pbap.c
@@ -422,6 +422,10 @@ static void cache_entry_done(void *user_data)
pbap->cache.valid = TRUE;
id = cache_find(&pbap->cache, pbap->find_handle);
+ if (id == NULL) {
+ obex_object_set_io_flags(pbap, G_IO_ERR, -ENOENT);
+ return;
+ }
ret = phonebook_get_entry(pbap->folder, id, pbap->params,
query_result, pbap);
diff --git a/plugins/phonebook-tracker.c b/plugins/phonebook-tracker.c
index cfb350e..5b73fe6 100644
--- a/plugins/phonebook-tracker.c
+++ b/plugins/phonebook-tracker.c
@@ -632,7 +632,7 @@ int phonebook_pull(const char *name, const struct apparam_field *params,
query = name2query(name);
if (query == NULL)
- return -1;
+ return -ENOENT;
data = g_new0(struct phonebook_data, 1);
data->vcards = g_string_new(NULL);
@@ -675,7 +675,7 @@ int phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb,
query = folder2query(name);
if (query == NULL)
- return -1;
+ return -ENOENT;
cache = g_new0(struct cache_data, 1);
cache->entry_cb = entry_cb;
diff --git a/src/obex.c b/src/obex.c
index 15a4674..a39a48d 100644
--- a/src/obex.c
+++ b/src/obex.c
@@ -464,10 +464,15 @@ proceed:
case -EINVAL:
OBEX_ObjectSetRsp(os->obj, OBEX_RSP_BAD_REQUEST,
OBEX_RSP_BAD_REQUEST);
+ break;
case -EPERM:
OBEX_ObjectSetRsp(os->obj, OBEX_RSP_FORBIDDEN,
OBEX_RSP_FORBIDDEN);
break;
+ case -ENOENT:
+ OBEX_ObjectSetRsp(os->obj, OBEX_RSP_NOT_FOUND,
+ OBEX_RSP_NOT_FOUND);
+ break;
default:
if (ret < 0)
OBEX_ObjectSetRsp(os->obj,