You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
(56) |
Apr
(109) |
May
(15) |
Jun
(3) |
Jul
(37) |
Aug
(96) |
Sep
(40) |
Oct
(4) |
Nov
(54) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(47) |
Feb
(30) |
Mar
(102) |
Apr
(120) |
May
(68) |
Jun
(54) |
Jul
(53) |
Aug
(122) |
Sep
(190) |
Oct
(71) |
Nov
(85) |
Dec
(108) |
2007 |
Jan
(72) |
Feb
(190) |
Mar
(53) |
Apr
(101) |
May
(145) |
Jun
(148) |
Jul
(167) |
Aug
(143) |
Sep
(23) |
Oct
(198) |
Nov
(223) |
Dec
(195) |
2008 |
Jan
(100) |
Feb
(129) |
Mar
(79) |
Apr
(77) |
May
(34) |
Jun
(95) |
Jul
(112) |
Aug
(160) |
Sep
(82) |
Oct
(124) |
Nov
(199) |
Dec
(355) |
2009 |
Jan
(436) |
Feb
(89) |
Mar
(298) |
Apr
(189) |
May
(33) |
Jun
(88) |
Jul
(105) |
Aug
(44) |
Sep
(181) |
Oct
(87) |
Nov
(75) |
Dec
(1) |
2010 |
Jan
(63) |
Feb
(21) |
Mar
(3) |
Apr
(1) |
May
(1) |
Jun
(3) |
Jul
(26) |
Aug
(37) |
Sep
(26) |
Oct
(15) |
Nov
(13) |
Dec
|
From: <svn...@op...> - 2009-02-25 15:19:32
|
Author: bellmich Date: Wed Feb 25 16:19:24 2009 New Revision: 949 URL: http://libsyncml.opensync.org/changeset/949 Log: small modification because sometimes there is trouble with traces Modified: trunk/tests/check_data_sync_api.c Modified: trunk/tests/check_data_sync_api.c ============================================================================== --- trunk/tests/check_data_sync_api.c Tue Feb 24 18:37:41 2009 (r948) +++ trunk/tests/check_data_sync_api.c Wed Feb 25 16:19:24 2009 (r949) @@ -345,7 +345,10 @@ if (!smlDataSyncRun(client, &error)) goto error; /* The OBEX server needs some time to start. */ - sleep(5); + if (g_getenv("SYNCML_TRACE")) + sleep(2); + else + sleep(5); if (!smlDataSyncRun(server, &error)) goto error; } |
From: <svn...@op...> - 2009-02-25 13:58:34
|
Author: friedrich.beckmann Date: Wed Feb 25 14:58:27 2009 New Revision: 5273 URL: http://www.opensync.org/changeset/5273 Log: Added thread based communication for the queues. This avoids the usage of the file pipe mechanism. Messages are simple forwarded directly between g_async_queues. This is required for the windows port and is usefull also on unix as the communication is faster (no file i/o). It is automatically enabled, when the start type of the plugin is THREAD. Modified: trunk/opensync/client/opensync_client_proxy.c trunk/opensync/engine/opensync_engine.c trunk/opensync/ipc/opensync_queue.c trunk/opensync/ipc/opensync_queue_internals.h trunk/opensync/ipc/opensync_queue_private.h trunk/tests/CMakeLists.txt trunk/tests/client-tests/check_client.c Modified: trunk/opensync/client/opensync_client_proxy.c ============================================================================== --- trunk/opensync/client/opensync_client_proxy.c Wed Feb 25 14:31:43 2009 (r5272) +++ trunk/opensync/client/opensync_client_proxy.c Wed Feb 25 14:58:27 2009 (r5273) @@ -887,19 +887,17 @@ proxy->type = type; if (type != OSYNC_START_TYPE_EXTERNAL) { - // First, create the pipe from the engine to the client - if (!osync_queue_new_pipes(&read1, &write1, error)) - goto error; - - // Then the pipe from the client to the engine - if (!osync_queue_new_pipes(&read2, &write2, error)) - goto error_free_pipe1; - - proxy->outgoing = osync_queue_ref(write1); - proxy->incoming = osync_queue_ref(read2); - /* Now we either spawn a new process, or we create a new thread */ if (type == OSYNC_START_TYPE_THREAD) { + // First, create the pipe from the engine to the client + if (!osync_queue_new_threadcom(&read1, &write1, error)) + goto error; + // Then the pipe from the client to the engine + if (!osync_queue_new_threadcom(&read2, &write2, error)) + goto error_free_pipe1; + proxy->outgoing = osync_queue_ref(write1); + proxy->incoming = osync_queue_ref(read2); + proxy->client = osync_client_new(error); if (!proxy->client) goto error_free_pipe2; @@ -920,6 +918,13 @@ if (!osync_client_run(proxy->client, error)) goto error_free_pipe2; } else { + if (!osync_queue_new_pipes(&read1, &write1, error)) + goto error; + if (!osync_queue_new_pipes(&read2, &write2, error)) + goto error_free_pipe1; + proxy->outgoing = osync_queue_ref(write1); + proxy->incoming = osync_queue_ref(read2); + /* First lets see if the old plugin exists, and kill it if it does */ //if (!_osync_client_kill_old_osplugin(proxy, error)) // goto error; Modified: trunk/opensync/engine/opensync_engine.c ============================================================================== --- trunk/opensync/engine/opensync_engine.c Wed Feb 25 14:31:43 2009 (r5272) +++ trunk/opensync/engine/opensync_engine.c Wed Feb 25 14:58:27 2009 (r5273) @@ -690,7 +690,7 @@ static osync_bool _osync_engine_finalize_member(OSyncEngine *engine, OSyncClientProxy *proxy, OSyncError **error) { - unsigned int i = 2000; + unsigned int i = 1000; osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, engine, proxy, error); engine->busy = TRUE; @@ -699,7 +699,13 @@ goto error; //FIXME - while (engine->busy && i > 0) { g_usleep(1000); g_main_context_iteration(engine->context, FALSE); i--; } + osync_trace(TRACE_INTERNAL, "Start waiting for engine"); +// while (engine->busy && i > 0) { g_usleep(1000); g_main_context_iteration(engine->context, FALSE); i--; } + while (engine->busy && i > 0) { g_usleep(1000); i--; } + + if (engine->busy) + osync_trace(TRACE_INTERNAL, "Engine still busy - I give up waiting"); + osync_trace(TRACE_INTERNAL, "Done waiting"); if (!osync_client_proxy_shutdown(proxy, error)) Modified: trunk/opensync/ipc/opensync_queue.c ============================================================================== --- trunk/opensync/ipc/opensync_queue.c Wed Feb 25 14:31:43 2009 (r5272) +++ trunk/opensync/ipc/opensync_queue.c Wed Feb 25 14:58:27 2009 (r5273) @@ -497,6 +497,13 @@ osync_error_set(&error, OSYNC_ERROR_GENERIC, "Trying to send to a queue thats not connected"); goto error; } + + /* When using threadec communication, the message is directly passed to the */ + /* incoming asynch queue of the connected queue */ + if (queue->usethreadcom){ + g_async_queue_push(queue->connected_queue->incoming, message); + continue; + } /* The size of the message */ if (!_osync_queue_write_int(queue, osync_message_get_message_size(message), &error)) @@ -640,6 +647,12 @@ return FALSE; } + + if (queue->usethreadcom){ + if (queue->connection_closing) + _osync_queue_generate_error(queue, OSYNC_MESSAGE_QUEUE_HUP, &error); + return FALSE; + } switch (osync_queue_poll(queue)) { case OSYNC_QUEUE_EVENT_NONE: @@ -794,6 +807,10 @@ queue->ref_count = 1; + queue->usethreadcom = FALSE; + queue->connected_queue = NULL; + queue->connection_closing = FALSE; + osync_trace(TRACE_EXIT, "%s: %p", __func__, queue); return queue; @@ -821,6 +838,32 @@ return NULL; } +osync_bool osync_queue_new_threadcom(OSyncQueue **read_queue, OSyncQueue **write_queue, OSyncError **error){ + + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, read_queue, write_queue, error); + *read_queue = osync_queue_new(NULL, error); + if (!*read_queue) + goto error; + *write_queue = osync_queue_new(NULL, error); + if (!*write_queue) + goto error_free_read_queue; + + (*read_queue)->usethreadcom = TRUE; + (*write_queue)->usethreadcom = TRUE; + (*read_queue)->connected_queue = *write_queue; + (*write_queue)->connected_queue = *read_queue; + + osync_trace(TRACE_EXIT, "%s", __func__); + return TRUE; + + error_free_read_queue: + osync_queue_unref(*read_queue); + error: + osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); + return FALSE; + +} + osync_bool osync_queue_new_pipes(OSyncQueue **read_queue, OSyncQueue **write_queue, OSyncError **error) { #ifdef _WIN32 @@ -905,6 +948,9 @@ if (queue->name) osync_free(queue->name); + + if (queue->connected_queue) + queue->connected_queue = NULL; osync_free(queue); queue = NULL; @@ -963,38 +1009,44 @@ osync_bool osync_queue_connect(OSyncQueue *queue, OSyncQueueType type, OSyncError **error) { -#ifdef _WIN32 - return FALSE; -#else //_WIN32 OSyncQueue **queueptr = NULL; osync_trace(TRACE_ENTRY, "%s(%p, %i, %p)", __func__, queue, type, error); osync_assert(queue); osync_assert(queue->connected == FALSE); queue->type = type; - - if (queue->fd == -1) { - /* First, open the queue with the flags provided by the user */ - int fd = open(queue->name, type == OSYNC_QUEUE_SENDER ? O_WRONLY : O_RDONLY); - if (fd == -1) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to open fifo"); - goto error; + + if (!queue->usethreadcom){ +#ifdef _WIN32 + osync_error_set(error, OSYNC_ERROR_GENERIC, "Windows does not support pipes"); + goto error; +#else + if (queue->fd == -1) { + /* First, open the queue with the flags provided by the user */ + int fd = open(queue->name, type == OSYNC_QUEUE_SENDER ? O_WRONLY : O_RDONLY); + if (fd == -1) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to open fifo"); + goto error; + } + queue->fd = fd; } - queue->fd = fd; - } - int oldflags = fcntl(queue->fd, F_GETFD); - if (oldflags == -1) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to get fifo flags"); - goto error_close; - } - if (fcntl(queue->fd, F_SETFD, oldflags|FD_CLOEXEC) == -1) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to set fifo flags"); - goto error_close; + int oldflags = fcntl(queue->fd, F_GETFD); + if (oldflags == -1) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to get fifo flags"); + goto error_close; + } + if (fcntl(queue->fd, F_SETFD, oldflags|FD_CLOEXEC) == -1) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to set fifo flags"); + goto error_close; + } +#endif /*_WIN32*/ } - queue->connected = TRUE; + queue->connection_closing = FALSE; +#ifndef _WIN32 signal(SIGPIPE, SIG_IGN); +#endif /* now we start a thread which handles reading/writing of the queue */ queue->thread = osync_thread_new(queue->context, error); @@ -1056,11 +1108,13 @@ return TRUE; error_close: - close(queue->fd); +#ifndef _WIN32 + if (!queue->usethreadcom) + close(queue->fd); +#endif error: osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); return FALSE; -#endif //_WIN32 } osync_bool osync_queue_disconnect(OSyncQueue *queue, OSyncError **error) @@ -1142,11 +1196,15 @@ /* We have to empty the incoming queue if we disconnect the queue. Otherwise, the * consumer threads might try to pick up messages even after we are done. */ _osync_queue_flush_messages(queue->incoming); - - if (queue->fd != -1 && close(queue->fd) != 0) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to close queue"); - osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); - return FALSE; + + if (queue->usethreadcom){ + queue->connected_queue->connection_closing = TRUE; + }else{ + if (queue->fd != -1 && close(queue->fd) != 0) { + osync_error_set(error, OSYNC_ERROR_GENERIC, "Unable to close queue"); + osync_trace(TRACE_EXIT_ERROR, "%s: %s", __func__, osync_error_print(error)); + return FALSE; + } } queue->fd = -1; Modified: trunk/opensync/ipc/opensync_queue_internals.h ============================================================================== --- trunk/opensync/ipc/opensync_queue_internals.h Wed Feb 25 14:31:43 2009 (r5272) +++ trunk/opensync/ipc/opensync_queue_internals.h Wed Feb 25 14:58:27 2009 (r5273) @@ -51,6 +51,11 @@ OSYNC_TEST_EXPORT osync_bool osync_queue_new_pipes(OSyncQueue **read_queue, OSyncQueue **write_queue, OSyncError **error); /** + * @brief Creates two queues which are connected via thread communication + */ +OSYNC_TEST_EXPORT osync_bool osync_queue_new_threadcom(OSyncQueue **read_queue, OSyncQueue **write_queue, OSyncError **error); + +/** * @brief Removes a Queue * @param queue OpenSync Queue that should be removed * @param error Modified: trunk/opensync/ipc/opensync_queue_private.h ============================================================================== --- trunk/opensync/ipc/opensync_queue_private.h Wed Feb 25 14:31:43 2009 (r5272) +++ trunk/opensync/ipc/opensync_queue_private.h Wed Feb 25 14:58:27 2009 (r5273) @@ -105,6 +105,14 @@ /* Expiration time of pending queue timeout */ GTimeVal pending_timeout; + + /* Threaded communication */ + gboolean usethreadcom; + /* Connected queue */ + OSyncQueue *connected_queue; + + /* Indicate that the connection is closing for threaded com */ + gboolean connection_closing; }; /** @brief Pending queue timeout addition for ipc delay Modified: trunk/tests/CMakeLists.txt ============================================================================== --- trunk/tests/CMakeLists.txt Wed Feb 25 14:31:43 2009 (r5272) +++ trunk/tests/CMakeLists.txt Wed Feb 25 14:58:27 2009 (r5273) @@ -52,8 +52,13 @@ BUILD_CHECK_TEST(client client-tests/check_client.c ${TEST_TARGET_LIBRARIES} ) OSYNC_TESTCASE(client client_new) +IF (NOT WIN32) OSYNC_TESTCASE(client client_pipes) OSYNC_TESTCASE(client client_run) +ENDIF (NOT WIN32) +OSYNC_TESTCASE(client client_threadcom) +OSYNC_TESTCASE(client client_run_threadcom) + BUILD_CHECK_TEST( filter sync-tests/check_filter.c ${TEST_TARGET_LIBRARIES} ) OSYNC_TESTCASE(filter filter_setup) Modified: trunk/tests/client-tests/check_client.c ============================================================================== --- trunk/tests/client-tests/check_client.c Wed Feb 25 14:31:43 2009 (r5272) +++ trunk/tests/client-tests/check_client.c Wed Feb 25 14:58:27 2009 (r5273) @@ -100,6 +100,83 @@ } END_TEST +START_TEST (client_threadcom) +{ + char *testbed = setup_testbed(NULL); + + OSyncError *error = NULL; + OSyncQueue *read1 = NULL; + OSyncQueue *write1 = NULL; + OSyncQueue *read2 = NULL; + OSyncQueue *write2 = NULL; + OSyncClient *client = osync_client_new(&error); + fail_unless(client != NULL, NULL); + fail_unless(error == NULL, NULL); + + osync_assert(osync_queue_new_threadcom(&read1, &write1, &error)); + osync_assert(error == NULL); + + fail_unless(osync_queue_connect(read1, OSYNC_QUEUE_RECEIVER, &error), NULL); + fail_unless(error == NULL, NULL); + + fail_unless(osync_queue_connect(write1, OSYNC_QUEUE_SENDER, &error), NULL); + fail_unless(error == NULL, NULL); + + osync_assert(osync_queue_new_threadcom(&read2, &write2, &error)); + osync_assert(error == NULL); + + fail_unless(osync_queue_connect(read2, OSYNC_QUEUE_RECEIVER, &error), NULL); + fail_unless(error == NULL, NULL); + + fail_unless(osync_queue_connect(write2, OSYNC_QUEUE_SENDER, &error), NULL); + fail_unless(error == NULL, NULL); + + osync_client_set_incoming_queue(client, read1); + osync_client_set_outgoing_queue(client, write2); + + OSyncMessage *message = osync_message_new(OSYNC_MESSAGE_NOOP, 0, &error); + fail_unless(message != NULL, NULL); + fail_unless(!osync_error_is_set(&error), NULL); + + fail_unless(osync_queue_send_message(write1, NULL, message, &error), NULL); + fail_unless(!osync_error_is_set(&error), NULL); + osync_message_unref(message); + + osync_assert(osync_queue_disconnect(read1, &error)); + osync_assert(error == NULL); + + message = osync_queue_get_message(write1); + osync_assert(osync_message_get_command(message) == OSYNC_MESSAGE_QUEUE_HUP); + osync_message_unref(message); + + osync_assert(osync_queue_disconnect(write1, &error)); + osync_assert(error == NULL); + + + + + osync_assert(osync_queue_disconnect(read2, &error)); + osync_assert(error == NULL); + + message = osync_queue_get_message(write2); + osync_assert(osync_message_get_command(message) == OSYNC_MESSAGE_QUEUE_HUP); + osync_message_unref(message); + + osync_assert(osync_queue_disconnect(write2, &error)); + osync_assert(error == NULL); + + osync_queue_unref(read2); + osync_queue_unref(write1); + osync_queue_unref(read1); + osync_queue_unref(write2); + + osync_client_unref(client); + + destroy_testbed(testbed); +} +END_TEST + + START_TEST (client_run) { char *testbed = setup_testbed(NULL); @@ -187,9 +264,99 @@ } END_TEST +START_TEST (client_run_threadcom) +{ + char *testbed = setup_testbed(NULL); + + OSyncError *error = NULL; + OSyncQueue *read1 = NULL; + OSyncQueue *write1 = NULL; + OSyncQueue *read2 = NULL; + OSyncQueue *write2 = NULL; + OSyncClient *client = osync_client_new(&error); + fail_unless(client != NULL, NULL); + fail_unless(error == NULL, NULL); + + osync_assert(osync_queue_new_threadcom(&read1, &write1, &error)); + osync_assert(error == NULL); + + fail_unless(osync_queue_connect(read1, OSYNC_QUEUE_RECEIVER, &error), NULL); + fail_unless(error == NULL, NULL); + + fail_unless(osync_queue_connect(write1, OSYNC_QUEUE_SENDER, &error), NULL); + fail_unless(error == NULL, NULL); + + osync_assert(osync_queue_new_threadcom(&read2, &write2, &error)); + osync_assert(error == NULL); + + fail_unless(osync_queue_connect(read2, OSYNC_QUEUE_RECEIVER, &error), NULL); + fail_unless(error == NULL, NULL); + + fail_unless(osync_queue_connect(write2, OSYNC_QUEUE_SENDER, &error), NULL); + fail_unless(error == NULL, NULL); + + osync_client_set_incoming_queue(client, read1); + osync_client_set_outgoing_queue(client, write2); + + OSyncMessage *message = osync_message_new(OSYNC_MESSAGE_NOOP, 0, &error); + fail_unless(message != NULL, NULL); + fail_unless(!osync_error_is_set(&error), NULL); + + fail_unless(osync_queue_send_message(write1, NULL, message, &error), NULL); + fail_unless(!osync_error_is_set(&error), NULL); + osync_message_unref(message); + + OSyncError *locerror = NULL; + osync_error_set(&locerror, OSYNC_ERROR_GENERIC, "test"); + fail_unless(osync_client_run(client, &error), NULL); + fail_unless(!osync_error_is_set(&error), NULL); + osync_client_error_shutdown(client, locerror); + osync_error_unref(&locerror); + + message = osync_queue_get_message(read2); + osync_assert(osync_message_get_command(message) == OSYNC_MESSAGE_ERROR); + osync_message_unref(message); + + osync_assert(osync_queue_disconnect(read1, &error)); + osync_assert(error == NULL); + + message = osync_queue_get_message(write1); + osync_assert(osync_message_get_command(message) == OSYNC_MESSAGE_QUEUE_HUP); + osync_message_unref(message); + + osync_assert(osync_queue_disconnect(write1, &error)); + osync_assert(error == NULL); + + + + + osync_assert(osync_queue_disconnect(read2, &error)); + osync_assert(error == NULL); + + message = osync_queue_get_message(write2); + osync_assert(osync_message_get_command(message) == OSYNC_MESSAGE_QUEUE_HUP); + osync_message_unref(message); + + osync_assert(osync_queue_disconnect(write2, &error)); + osync_assert(error == NULL); + + osync_queue_unref(read2); + osync_queue_unref(write1); + osync_queue_unref(read1); + osync_queue_unref(write2); + + osync_client_unref(client); + + destroy_testbed(testbed); +} +END_TEST + + OSYNC_TESTCASE_START("client") OSYNC_TESTCASE_ADD(client_new) OSYNC_TESTCASE_ADD(client_pipes) +OSYNC_TESTCASE_ADD(client_threadcom) OSYNC_TESTCASE_ADD(client_run) +OSYNC_TESTCASE_ADD(client_run_threadcom) OSYNC_TESTCASE_END |
From: <svn...@op...> - 2009-02-25 13:31:54
|
Author: friedrich.beckmann Date: Wed Feb 25 14:31:43 2009 New Revision: 5272 URL: http://www.opensync.org/changeset/5272 Log: anchor has one reference count too much and is not released Modified: trunk/opensync/plugin/opensync_objtype_sink.c Modified: trunk/opensync/plugin/opensync_objtype_sink.c ============================================================================== --- trunk/opensync/plugin/opensync_objtype_sink.c Sun Feb 22 23:09:30 2009 (r5271) +++ trunk/opensync/plugin/opensync_objtype_sink.c Wed Feb 25 14:31:43 2009 (r5272) @@ -718,7 +718,6 @@ osync_bool osync_objtype_sink_load_anchor(OSyncObjTypeSink *sink, OSyncPluginInfo *plugin_info, OSyncError **error) { char *anchorpath; - OSyncAnchor *anchor = NULL; osync_assert(sink); @@ -733,12 +732,10 @@ osync_plugin_info_get_configdir(plugin_info), G_DIR_SEPARATOR); - anchor = osync_anchor_new(anchorpath, sink->objtype, error); - if (!anchor) + sink->anchor = osync_anchor_new(anchorpath, sink->objtype, error); + if (!sink->anchor) goto error; - osync_objtype_sink_set_anchor(sink, anchor); - osync_free(anchorpath); return TRUE; |
From: <svn...@op...> - 2009-02-24 17:37:51
|
Author: bellmich Date: Tue Feb 24 18:37:41 2009 New Revision: 948 URL: http://libsyncml.opensync.org/changeset/948 Log: even unknown capabilities must be appended Modified: trunk/libsyncml/data_sync_api/data_sync_devinf.c Modified: trunk/libsyncml/data_sync_api/data_sync_devinf.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_devinf.c Tue Feb 24 18:37:10 2009 (r947) +++ trunk/libsyncml/data_sync_api/data_sync_devinf.c Tue Feb 24 18:37:41 2009 (r948) @@ -404,6 +404,7 @@ goto error; smlDevInfCTCapSetCTType(ctcap, cttype); smlDevInfCTCapSetVerCT(ctcap, verct); + smlDevInfAppendCTCap(devinf, ctcap); } smlTrace(TRACE_EXIT, "%s - content type newly added to devinf", __func__); |
From: <svn...@op...> - 2009-02-24 17:37:24
|
Author: bellmich Date: Tue Feb 24 18:37:10 2009 New Revision: 947 URL: http://libsyncml.opensync.org/changeset/947 Log: if a buffer is freed then it should be no longer referenced Modified: trunk/libsyncml/parser/sml_xml_assm.c Modified: trunk/libsyncml/parser/sml_xml_assm.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_assm.c Tue Feb 24 18:36:30 2009 (r946) +++ trunk/libsyncml/parser/sml_xml_assm.c Tue Feb 24 18:37:10 2009 (r947) @@ -1445,6 +1445,7 @@ assm->writer = NULL; error_free_buffer: xmlBufferFree(res->buffer); + res->buffer = NULL; error: g_mutex_unlock(assm->mutex); smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(error)); |
From: <svn...@op...> - 2009-02-24 17:36:43
|
Author: bellmich Date: Tue Feb 24 18:36:30 2009 New Revision: 946 URL: http://libsyncml.opensync.org/changeset/946 Log: - removed a smlDsSessionRef because the reference is already there from smlDsServerSendAlert - added smlLocationUnref after the created location is no longer used by the function Modified: trunk/libsyncml/data_sync_api/data_sync_client.c Modified: trunk/libsyncml/data_sync_api/data_sync_client.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_client.c Tue Feb 24 17:24:54 2009 (r945) +++ trunk/libsyncml/data_sync_api/data_sync_client.c Tue Feb 24 18:36:30 2009 (r946) @@ -198,7 +198,6 @@ smlDsSessionGetChanges(datastore->session, smlDataSyncChangeCallback, datastore); } - smlDsSessionRef(datastore->session); SmlBool ret = TRUE; if (alertType == SML_ALERT_SLOW_SYNC && @@ -273,6 +272,7 @@ goto error; datastore->server = smlDsClientNew(datastore->contentType, loc, loc, error); + smlLocationUnref(loc); if (!datastore->server) goto error; |
From: <svn...@op...> - 2009-02-24 16:25:01
|
Author: bellmich Date: Tue Feb 24 17:24:54 2009 New Revision: 945 URL: http://libsyncml.opensync.org/changeset/945 Log: - fixed trace statement - added two missing smlLocationUnref - removed one smlSessionRef because smlManagerSessionAdd calls smlSessionRef by itself (wrong comment) Modified: trunk/libsyncml/data_sync_api/transport_http_client.c Modified: trunk/libsyncml/data_sync_api/transport_http_client.c ============================================================================== --- trunk/libsyncml/data_sync_api/transport_http_client.c Tue Feb 24 16:08:07 2009 (r944) +++ trunk/libsyncml/data_sync_api/transport_http_client.c Tue Feb 24 17:24:54 2009 (r945) @@ -67,6 +67,9 @@ smlAssert(dsObject->manager); smlAssert(dsObject->agent); + SmlLocation *target = NULL; + SmlLocation *source = NULL; + /* If there is an old session then this is a bug. * the high level API only support one session per * OMA DS object. @@ -78,9 +81,15 @@ } /* create session */ + + target = smlLocationNew(dsObject->target, NULL, error); + if (!target) + goto error; + source = smlLocationNew(dsObject->identifier, NULL, error); + if (!source) + goto error; + char *sessionString = smlManagerGetNewSessionID(dsObject->manager); - SmlLocation *target = smlLocationNew(dsObject->target, NULL, error); - SmlLocation *source = smlLocationNew(dsObject->identifier, NULL, error); dsObject->session = smlSessionNew(SML_SESSION_TYPE_CLIENT, SML_MIMETYPE_XML, dsObject->version, @@ -91,14 +100,10 @@ if (!dsObject->session) goto error; - /* It is necessary to increment the reference counter - * because smlManagerSessionAdd consumes the session - * without incrementing the reference counter by itself. - * So if dsObject wants to use the session by itself - * then dsObject must increment the reference counter - * or dsObject->session must be set to NULL. - */ - smlSessionRef(dsObject->session); + smlLocationUnref(target); + target = NULL; + smlLocationUnref(source); + source = NULL; /* register all the add-ons */ if (!smlManagerSessionAdd(dsObject->manager, dsObject->session, NULL, error)) @@ -108,12 +113,20 @@ return TRUE; error: + if (target) { + smlLocationUnref(target); + target = NULL; + } + if (source) { + smlLocationUnref(source); + source = NULL; + } return FALSE; } SmlBool smlDataSyncTransportHttpClientConnect(SmlDataSyncObject *dsObject, SmlError **error) { - smlTrace(TRACE_ENTRY, "%s(%p, %p, %p)", __func__, dsObject, error); + smlTrace(TRACE_ENTRY, "%s(%p, %p)", __func__, dsObject, error); CHECK_ERROR_REF dsObject->tryDisconnect = FALSE; |
From: <svn...@op...> - 2009-02-24 15:08:13
|
Author: bellmich Date: Tue Feb 24 16:08:07 2009 New Revision: 944 URL: http://libsyncml.opensync.org/changeset/944 Log: better implementation of the automatic UTF-16 to UTF-8 conversion Modified: trunk/libsyncml/parser/sml_xml_parse.c Modified: trunk/libsyncml/parser/sml_xml_parse.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_parse.c Tue Feb 24 16:00:53 2009 (r943) +++ trunk/libsyncml/parser/sml_xml_parse.c Tue Feb 24 16:08:07 2009 (r944) @@ -1692,20 +1692,20 @@ smlTrace(TRACE_INTERNAL, "%s: read %d --> written %d --> %d ::= %s", __func__, read, written, strlen(conv_string), conv_string); /* replace the embedded string */ - char *new_data = smlTryMalloc0(*fixed_size - (last_utf16 - position + 1) + strlen(conv_string) + 1, error); + char *new_data = smlTryMalloc0(*fixed_size - read + written + 1, error); if (!new_data) { smlTrace(TRACE_EXIT_ERROR, "%s - %s", __func__, smlErrorPrint(error)); return FALSE; } memcpy(new_data, *fixed_data, (size_t) position - (size_t) *fixed_data); - memcpy(new_data + (size_t) position - (size_t) *fixed_data, conv_string, strlen(conv_string)); - memcpy(new_data + (size_t) position - (size_t) *fixed_data + strlen(conv_string), - last_utf16 + 1, *fixed_size - ( last_utf16 + 1 - *fixed_data )); + memcpy(new_data + (size_t) position - (size_t) *fixed_data, conv_string, written); + memcpy(new_data + (size_t) position - (size_t) *fixed_data + written, + position + read, *fixed_size - ( (size_t) position - (size_t) *fixed_data ) - read ); /* fix pointers */ - *fixed_size = *fixed_size - (last_utf16 - position + 1) + strlen(conv_string); - position = new_data + (position - *fixed_data) + strlen(conv_string) + 1; + *fixed_size = *fixed_size - read + written; + position = new_data + (position - *fixed_data) + written; smlSafeCFree(fixed_data); *fixed_data = new_data; new_data = NULL; |
From: <svn...@op...> - 2009-02-24 15:01:05
|
Author: bellmich Date: Tue Feb 24 16:00:53 2009 New Revision: 943 URL: http://libsyncml.opensync.org/changeset/943 Log: changes must be cleaned up Modified: trunk/libsyncml/data_sync_api/data_sync.c Modified: trunk/libsyncml/data_sync_api/data_sync.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync.c Tue Feb 24 12:30:09 2009 (r942) +++ trunk/libsyncml/data_sync_api/data_sync.c Tue Feb 24 16:00:53 2009 (r943) @@ -873,6 +873,18 @@ if (datastore->server) smlDsServerFree(datastore->server); + while(datastore->changes) { + SmlDataSyncChange *change = datastore->changes->data; + datastore->changes = g_list_remove( + datastore->changes, + change); + if (change->name) + smlSafeCFree(&(change->name)); + if (change->data) + smlSafeCFree(&(change->data)); + smlSafeFree((gpointer *)&change); + } + smlSafeFree((gpointer *)&datastore); } |
From: <svn...@op...> - 2009-02-24 12:46:37
|
Author: bellmich Date: Tue Feb 24 12:30:09 2009 New Revision: 942 URL: http://libsyncml.opensync.org/changeset/942 Log: fixed memory leaks discovered by dynamic build hosts The host aachen reported a memory leak because of a still used GMainContext. This context was referenced by OBEX server links and queues (sml_queue.c) without an according unref call. Modified: trunk/libsyncml/sml_queue.c trunk/libsyncml/transports/obex_server.c Modified: trunk/libsyncml/sml_queue.c ============================================================================== --- trunk/libsyncml/sml_queue.c Sat Feb 21 13:07:12 2009 (r941) +++ trunk/libsyncml/sml_queue.c Tue Feb 24 12:30:09 2009 (r942) @@ -92,7 +92,7 @@ void smlQueueFree(SmlQueue *queue) { if (queue->source) - g_source_destroy(queue->source); + smlQueueDetach(queue); if (queue->head) g_list_free(queue->head); Modified: trunk/libsyncml/transports/obex_server.c ============================================================================== --- trunk/libsyncml/transports/obex_server.c Sat Feb 21 13:07:12 2009 (r941) +++ trunk/libsyncml/transports/obex_server.c Tue Feb 24 12:30:09 2009 (r942) @@ -73,6 +73,8 @@ smlLinkDeref(linkenv->link); g_source_unref(linkenv->source); OBEX_Cleanup(linkenv->handle); + if (tsp->context) + g_main_context_unref(tsp->context); smlSafeFree((gpointer *)&linkenv); link->link_data = NULL; |
From: <svn...@op...> - 2009-02-22 22:26:36
|
Author: henrik Date: Sun Feb 22 23:09:30 2009 New Revision: 5271 URL: http://www.opensync.org/changeset/5271 Log: Make tests work on Debian (Lenny) Modified: plugins/mozilla-sync/trunk/tests/blackbox_test_common.shinc.in plugins/mozilla-sync/trunk/tests/blackbox_test_init_sunbird.sh plugins/mozilla-sync/trunk/tests/blackbox_test_init_thunderbird.sh plugins/mozilla-sync/trunk/tests/blackbox_test_platform.sh Modified: plugins/mozilla-sync/trunk/tests/blackbox_test_common.shinc.in ============================================================================== --- plugins/mozilla-sync/trunk/tests/blackbox_test_common.shinc.in Thu Feb 19 18:06:25 2009 (r5270) +++ plugins/mozilla-sync/trunk/tests/blackbox_test_common.shinc.in Sun Feb 22 23:09:30 2009 (r5271) @@ -168,11 +168,10 @@ # Try to find the GRE directory # This is an ugly hack, but what else can we do? - TB_EXE=`which thunderbird` + TB_EXE=`which thunderbird` || true test -n "${TB_EXE}" || TB_EXE=`which icedove` myecho "TB_EXE [${TB_EXE}]" test -n "${TB_EXE}" || error_exit "Could not find Thunderbird" 1 - GRE_DIR=`grep moz_libdir "${TB_EXE}" | head -1 | cut -s -d "=" -f 2 | tr -d '"'` test -n "${GRE_DIR}" || GRE_DIR=`grep MOZ_DIST_LIB "${TB_EXE}" | head -1 | cut -s -d "=" -f 2 | tr -d '"'` test -n "${GRE_DIR}" || error_exit "Could not find GRE (Gecko Runtime Environment)" 1 Modified: plugins/mozilla-sync/trunk/tests/blackbox_test_init_sunbird.sh ============================================================================== --- plugins/mozilla-sync/trunk/tests/blackbox_test_init_sunbird.sh Thu Feb 19 18:06:25 2009 (r5270) +++ plugins/mozilla-sync/trunk/tests/blackbox_test_init_sunbird.sh Sun Feb 22 23:09:30 2009 (r5271) @@ -16,8 +16,8 @@ initialize_test "Sunbird initialization" initialize_sunbird -echo "sunbird --version" -sunbird --version +echo "${TB_EXE} --version" +${TB_EXE} --version echo "ls -lR ${GRE_DIR}" ls -lR ${GRE_DIR} Modified: plugins/mozilla-sync/trunk/tests/blackbox_test_init_thunderbird.sh ============================================================================== --- plugins/mozilla-sync/trunk/tests/blackbox_test_init_thunderbird.sh Thu Feb 19 18:06:25 2009 (r5270) +++ plugins/mozilla-sync/trunk/tests/blackbox_test_init_thunderbird.sh Sun Feb 22 23:09:30 2009 (r5271) @@ -16,8 +16,8 @@ initialize_test "Thunderbird initialization" initialize_thunderbird -echo "thunderbird --version" -thunderbird --version +echo "${TB_EXE} --version" +${TB_EXE} --version echo "ls -lR ${GRE_DIR}" ls -lR ${GRE_DIR} Modified: plugins/mozilla-sync/trunk/tests/blackbox_test_platform.sh ============================================================================== --- plugins/mozilla-sync/trunk/tests/blackbox_test_platform.sh Thu Feb 19 18:06:25 2009 (r5270) +++ plugins/mozilla-sync/trunk/tests/blackbox_test_platform.sh Sun Feb 22 23:09:30 2009 (r5271) @@ -23,9 +23,9 @@ lsb_release -a || true echo "thunderbird --version" -thunderbird --version +thunderbird --version || icedove --version echo "sunbird --version" -sunbird --version +sunbird --version || iceowl --version success_exit |
From: <svn...@op...> - 2009-02-21 12:23:07
|
Author: bellmich Date: Sat Feb 21 13:07:12 2009 New Revision: 941 URL: http://libsyncml.opensync.org/changeset/941 Log: added include for header file strings.h to fix Solaris compiler warning Modified: trunk/libsyncml/data_sync_api/data_sync_callbacks.c Modified: trunk/libsyncml/data_sync_api/data_sync_callbacks.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync_callbacks.c Fri Feb 20 11:24:27 2009 (r940) +++ trunk/libsyncml/data_sync_api/data_sync_callbacks.c Sat Feb 21 13:07:12 2009 (r941) @@ -23,6 +23,7 @@ #include "libsyncml/sml_support.h" #include "libsyncml/sml_error_internals.h" #include <string.h> +#include <strings.h> #include "defines.h" #include "data_sync_devinf.h" #include "libsyncml/objects/sml_ds_server_internals.h" |
From: <svn...@op...> - 2009-02-20 10:23:34
|
Author: bellmich Date: Fri Feb 20 11:24:27 2009 New Revision: 940 URL: http://libsyncml.opensync.org/changeset/940 Log: Sources can be UTF-8 encoded strings with special characters. Modified: trunk/libsyncml/data_sync_api/data_sync.c Modified: trunk/libsyncml/data_sync_api/data_sync.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync.c Fri Feb 20 11:22:12 2009 (r939) +++ trunk/libsyncml/data_sync_api/data_sync.c Fri Feb 20 11:24:27 2009 (r940) @@ -275,7 +275,7 @@ if (dsObject->tspType == SML_TRANSPORT_OBEX_CLIENT) { lcCT = g_ascii_strdown(contentType, strlen(contentType)); - lcSource = g_ascii_strdown(source, strlen(source)); + lcSource = g_utf8_strdown(source, strlen(source)); if (strstr(lcCT, "vcard") && !smlTransportSetConfigOption( dsObject->tsp, |
From: <svn...@op...> - 2009-02-20 10:21:20
|
Author: bellmich Date: Fri Feb 20 11:22:12 2009 New Revision: 939 URL: http://libsyncml.opensync.org/changeset/939 Log: strcasestr is not supported on all platforms. It is a non-standard extension. Therefore it is replaced by g_ascii_strdown and strstr. Modified: trunk/libsyncml/data_sync_api/data_sync.c Modified: trunk/libsyncml/data_sync_api/data_sync.c ============================================================================== --- trunk/libsyncml/data_sync_api/data_sync.c Thu Feb 19 18:31:09 2009 (r938) +++ trunk/libsyncml/data_sync_api/data_sync.c Fri Feb 20 11:22:12 2009 (r939) @@ -254,6 +254,9 @@ smlTrace(TRACE_ENTRY, "%s(%p, %s, %s, %s, %p)", __func__, dsObject, VA_STRING(contentType), VA_STRING(target), VA_STRING(source), error); CHECK_ERROR_REF + char *lcCT = NULL; + char *lcSource = NULL; + SmlDataSyncDatastore *datastore = smlTryMalloc0(sizeof(SmlDataSyncDatastore), error); if (!datastore) goto error; @@ -271,7 +274,9 @@ if (dsObject->tspType == SML_TRANSPORT_OBEX_CLIENT) { - if (strstr(contentType, "vcard") && + lcCT = g_ascii_strdown(contentType, strlen(contentType)); + lcSource = g_ascii_strdown(source, strlen(source)); + if (strstr(lcCT, "vcard") && !smlTransportSetConfigOption( dsObject->tsp, SML_TRANSPORT_CONFIG_DATASTORE, @@ -280,9 +285,9 @@ { goto error; } - if (strstr(contentType, "calendar") && - ( strcasestr(source, "cal") || - strcasestr(source, "event") + if (strstr(lcCT, "calendar") && + ( strstr(lcSource, "cal") || + strstr(lcSource, "event") )&& !smlTransportSetConfigOption( dsObject->tsp, @@ -292,8 +297,8 @@ { goto error; } - if (strstr(contentType, "calendar") && - strcasestr(source, "todo") && + if (strstr(lcCT, "calendar") && + strstr(lcSource, "todo") && !smlTransportSetConfigOption( dsObject->tsp, SML_TRANSPORT_CONFIG_DATASTORE, @@ -302,7 +307,7 @@ { goto error; } - if (strstr(contentType, "text/plain") && + if (strstr(lcCT, "text/plain") && !smlTransportSetConfigOption( dsObject->tsp, SML_TRANSPORT_CONFIG_DATASTORE, @@ -311,6 +316,8 @@ { goto error; } + smlSafeCFree(&lcCT); + smlSafeCFree(&lcSource); } smlTrace(TRACE_EXIT, "%s - TRUE", __func__); @@ -318,6 +325,10 @@ error: if (datastore) smlSafeFree((gpointer *)&datastore); + if (lcCT) + smlSafeCFree(&lcCT); + if (lcSource) + smlSafeCFree(&lcSource); smlTrace(TRACE_EXIT_ERROR, "%s - %s", __func__, smlErrorPrint(error)); return FALSE; } |
From: <svn...@op...> - 2009-02-19 17:30:30
|
Author: bellmich Date: Thu Feb 19 18:31:09 2009 New Revision: 938 URL: http://libsyncml.opensync.org/changeset/938 Log: fixed the OMA DS 1.2 SAN tests This is necessary because there was a massive update of the according implementation which includes digest/authentication support and fixed identifiers. Modified: trunk/tests/check_san.c Modified: trunk/tests/check_san.c ============================================================================== --- trunk/tests/check_san.c Thu Feb 19 18:29:24 2009 (r937) +++ trunk/tests/check_san.c Thu Feb 19 18:31:09 2009 (r938) @@ -76,11 +76,15 @@ sml_fail_unless(san != NULL, NULL); sml_fail_unless(error == NULL, NULL); - unsigned char target[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //DIGEST + unsigned char target[] = { + /* old implementation without digest support + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //DIGEST + */ + 0x95, 0x5d, 0x6f, 0x61, 0xa4, 0x20, 0xb1, 0xa7, 0x46, 0x00, 0xc1, 0x12, 0x81, 0x06, 0x5e, 0x64, //DIGEST 0x03, 0x00, //version + ui + init + start of future 0x00, 0x00, 0x00, //Future 0x00, 0x00, //Session id - 0x05, 0x74, 0x74, 0x74, 0x74, 0x00, //server identifier + 0x04, 0x74, 0x74, 0x74, 0x74, //server identifier 0x00}; // num syncs + future char *buffer = NULL; @@ -105,11 +109,15 @@ sml_fail_unless(san != NULL, NULL); sml_fail_unless(error == NULL, NULL); - unsigned char target[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //DIGEST + unsigned char target[] = { + /* old implementation without digest support + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //DIGEST + */ + 0x9e, 0x0d, 0x43, 0x31, 0x4f, 0x18, 0xb6, 0x96, 0x6d, 0x88, 0xf1, 0xa2, 0xdb, 0x00, 0x06, 0x15, //DIGEST 0x03, 0x38, //version + ui + init + start of future 0x00, 0x00, 0x00, //Future 0xFF, 0xFF, //Session id - 0x06, 0x74, 0x74, 0x74, 0x74, 0x74, 0x00, //server identifier + 0x05, 0x74, 0x74, 0x74, 0x74, 0x74, //server identifier 0x00}; // num syncs + future char *buffer = NULL; @@ -137,15 +145,19 @@ sml_fail_unless(smlNotificationNewAlert(san, SML_ALERT_TWO_WAY_BY_SERVER, SML_ELEMENT_TEXT_VCARD, "tttt", &error), NULL); sml_fail_unless(error == NULL, NULL); - unsigned char target[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //DIGEST + unsigned char target[] = { + /* old implementation without digest support + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //DIGEST + */ + 0x7e, 0x39, 0x00, 0x91, 0x5e, 0x39, 0x3a, 0x69, 0xd2, 0x60, 0x18, 0x1f, 0x65, 0x65, 0x49, 0xe5, //DIGEST 0x03, 0x38, //version + ui + init + start of future 0x00, 0x00, 0x00, //Future 0xFF, 0xFF, //Session id - 0x06, 0x74, 0x74, 0x74, 0x74, 0x74, 0x00, //server identifier + 0x05, 0x74, 0x74, 0x74, 0x74, 0x74, //server identifier 0x10,// num syncs + future 0x60, //Sync type + future 0x00, 0x00, 0x07, //Content type - 0x05, 0x74, 0x74, 0x74, 0x74, 0x00 }; //Server URI; + 0x04, 0x74, 0x74, 0x74, 0x74}; //Server URI; char *buffer = NULL; unsigned int size = 0; @@ -175,18 +187,66 @@ sml_fail_unless(smlNotificationNewAlert(san, SML_ALERT_REFRESH_FROM_SERVER_BY_SERVER, SML_ELEMENT_TEXT_VCARD, "tttt", &error), NULL); sml_fail_unless(error == NULL, NULL); - unsigned char target[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //DIGEST + unsigned char target[] = { + /* old implementation without digest support + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //DIGEST + */ + 0x6d, 0x47, 0xd6, 0x78, 0xb2, 0xe0, 0xa3, 0x72, 0x75, 0x03, 0xcc, 0xae, 0xd0, 0x39, 0x3d, 0xea, //DIGEST 0x03, 0x38, //version + ui + init + start of future 0x00, 0x00, 0x00, //Future 0xFF, 0xFF, //Session id - 0x06, 0x74, 0x74, 0x74, 0x74, 0x74, 0x00, //server identifier + 0x05, 0x74, 0x74, 0x74, 0x74, 0x74, //server identifier 0x20,// num syncs + future 0x60, //Sync type + future 0x00, 0x00, 0x07, //Content type - 0x05, 0x74, 0x74, 0x74, 0x74, 0x00, //Server URI; + 0x04, 0x74, 0x74, 0x74, 0x74, //Server URI; 0xA0, //Sync type + future 0x00, 0x00, 0x07, //Content type - 0x05, 0x74, 0x74, 0x74, 0x74, 0x00 }; //Server URI; + 0x04, 0x74, 0x74, 0x74, 0x74}; //Server URI; + + char *buffer = NULL; + unsigned int size = 0; + sml_fail_unless(smlNotificationAssemble(san, &buffer, &size, &error), NULL); + sml_fail_unless(error == NULL, NULL); + + sml_fail_unless(size == sizeof(target), NULL); + sml_fail_unless(memcmp(target, buffer, size) == 0, NULL); + + g_free(buffer); + smlNotificationFree(san); +} +END_TEST + +START_TEST (check_san_alert_auth) +{ + setup_testbed(NULL); + + SmlError *error = NULL; + SmlNotification *san = smlNotificationNew(SML_SAN_VERSION_12, SML_SAN_UIMODE_USER, SML_SAN_INITIATOR_SERVER, 65535, "OpenSync", "/", SML_MIMETYPE_UNKNOWN, &error); + sml_fail_unless(san != NULL, NULL); + sml_fail_unless(error == NULL, NULL); + + sml_fail_unless(smlNotificationNewAlert(san, SML_ALERT_TWO_WAY_BY_SERVER, SML_ELEMENT_TEXT_VCARD, "contacts", &error), NULL); + sml_fail_unless(error == NULL, NULL); + + SmlCred *cred = smlCredNewAuth( + SML_AUTH_TYPE_MD5, + "username", + "password", + &error); + smlNotificationSetCred(san, cred); + smlCredUnref(cred); + + unsigned char target[] = { + 0x61, 0x59, 0x71, 0x16, 0x2e, 0x7d, 0x3e, 0x83, 0xa8, 0x23, 0x48, 0xa8, 0x5b, 0x21, 0x79, 0x49, //DIGEST + 0x03, 0x38, //version + ui + init + start of future + 0x00, 0x00, 0x00, //Future + 0xFF, 0xFF, //Session id + 0x08, 0x4f, 0x70, 0x65, 0x6e, 0x53, 0x79, 0x6e, 0x63, //server identifier + 0x10,// num syncs + future + 0x60, //Sync type + future + 0x00, 0x00, 0x07, //Content type + 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73}; //Server URI; char *buffer = NULL; unsigned int size = 0; @@ -508,6 +568,7 @@ create_case(s, "check_san_empty2", check_san_empty2); create_case(s, "check_san_alert", check_san_alert); create_case(s, "check_san_alert2", check_san_alert2); + create_case(s, "check_san_alert_auth", check_san_alert_auth); create_case(s, "check_san_parse", check_san_parse); create_case(s, "check_san_parse2", check_san_parse2); #ifdef ENABLE_HTTP |
From: <svn...@op...> - 2009-02-19 17:28:44
|
Author: bellmich Date: Thu Feb 19 18:29:24 2009 New Revision: 937 URL: http://libsyncml.opensync.org/changeset/937 Log: added support for authenticated OMA DS 1.2 SANs Modified: trunk/libsyncml/data_sync_api/transport_obex_client.c Modified: trunk/libsyncml/data_sync_api/transport_obex_client.c ============================================================================== --- trunk/libsyncml/data_sync_api/transport_obex_client.c Thu Feb 19 18:28:33 2009 (r936) +++ trunk/libsyncml/data_sync_api/transport_obex_client.c Thu Feb 19 18:29:24 2009 (r937) @@ -85,6 +85,21 @@ smlNotificationSetManager(san, dsObject->manager); + /* init digest - SAN uses always MD5 */ + if (dsObject->username != NULL && strlen(dsObject->username)) + { + SmlCred *cred = smlCredNewAuth( + SML_AUTH_TYPE_MD5, + dsObject->username, + dsObject->password, + error); + if (!cred) + goto error; + smlNotificationSetCred(san, cred); + smlCredUnref(cred); + cred = NULL; + } + GList *o = dsObject->datastores; for (; o; o = o->next) { SmlDataSyncDatastore *datastore = o->data; |
From: <svn...@op...> - 2009-02-19 17:28:19
|
Author: bellmich Date: Thu Feb 19 18:28:33 2009 New Revision: 936 URL: http://libsyncml.opensync.org/changeset/936 Log: fixed error handling and reference counting of smlCredNewAuth Modified: trunk/libsyncml/sml_elements.c Modified: trunk/libsyncml/sml_elements.c ============================================================================== --- trunk/libsyncml/sml_elements.c Thu Feb 19 18:27:02 2009 (r935) +++ trunk/libsyncml/sml_elements.c Thu Feb 19 18:28:33 2009 (r936) @@ -630,6 +630,8 @@ smlTrace(TRACE_ENTRY, "%s(%d, %s, %p)", __func__, type, VA_STRING(username), error); CHECK_ERROR_REF + SmlCred *cred = NULL; + if (username == NULL || !strlen(username)) { smlErrorSet(error, SML_ERROR_INTERNAL_MISCONFIGURATION, "If authentication should be used then the username must be set."); @@ -641,10 +643,11 @@ goto error; } - SmlCred *cred = smlTryMalloc0(sizeof(SmlCred), error); + cred = smlTryMalloc0(sizeof(SmlCred), error); if (!cred) goto error; + cred->refCount = 1; cred->format = SML_FORMAT_TYPE_BASE64; cred->type = type; cred->username = g_strdup(username); |
From: <svn...@op...> - 2009-02-19 17:26:28
|
Author: bellmich Date: Thu Feb 19 18:27:02 2009 New Revision: 935 URL: http://libsyncml.opensync.org/changeset/935 Log: massive update for OMA DS 1.2 SAN - removed trailing NULL bytes from all identifiers - added several new content types - added support for unknown content types like specified by OMA (set content type number to 0x00 0x00 0x00 and use only the identifier to determine the data store) - added implementation for correct digest generation including support for authentication without nonce (BTW I do not know a phone which actually checks the digest) Modified: trunk/libsyncml/sml_notification.c Modified: trunk/libsyncml/sml_notification.c ============================================================================== --- trunk/libsyncml/sml_notification.c Thu Feb 19 18:20:05 2009 (r934) +++ trunk/libsyncml/sml_notification.c Thu Feb 19 18:27:02 2009 (r935) @@ -27,6 +27,8 @@ #include "sml_command_internals.h" #include "sml_manager_internals.h" #include "sml_error_internals.h" +#include "objects/sml_auth_internals.h" +#include "sml_elements_internals.h" SmlNotification *smlNotificationNew(SmlNotificationVersion version, SmlNotificationUIMode mode, SmlNotificationInitiator init, unsigned int sessionID, const char *identifier, const char *target, SmlMimeType type, SmlError **error) { @@ -199,7 +201,8 @@ /* server identifier */ if (idLength) { - san->identifier = smlTryMalloc0(idLength, error); + /* the trailing NULL byte is usually not present in the SAN */ + san->identifier = smlTryMalloc0(idLength + 1, error); if (!san->identifier) goto error_free_san; @@ -238,6 +241,13 @@ /* The contenttype */ const char *alert_ct; switch (contenttype) { + case 0x00: + /* This is exactly like defined in "DS Protocol" section + * 12.4.13 "Content Type" of the official OMA document + * OMA-TS-DS_Protocol-V1_2_1-20070810-A.pdf. + */ + alert_ct = NULL; + break; case 0x07: alert_ct = SML_ELEMENT_TEXT_VCARD; break; @@ -247,6 +257,21 @@ case 0x03: alert_ct = SML_ELEMENT_TEXT_PLAIN; break; + case 0x0305: + alert_ct = SML_ELEMENT_TEXT_ICAL; + break; + case 0x0306: + alert_ct = SML_ELEMENT_APPLICATION_OMA_DS_EMAIL; + break; + case 0x0307: + alert_ct = SML_ELEMENT_APPLICATION_OMA_DS_FILE; + break; + case 0x0308: + alert_ct = SML_ELEMENT_APPLICATION_OMA_DS_FOLDER; + break; + case 0x0309: + alert_ct = SML_ELEMENT_TEXT_VCARD_30; + break; default: /* http://www.openmobilealliance.org/Tech/omna/omna-wsp-content-type.aspx */ smlErrorSet(error, SML_ERROR_GENERIC, "The OMNA WSP Content Type Number 0x%xd is not supported.", contenttype); @@ -256,6 +281,7 @@ /* The server uri */ char *alert_uri; if (idLength) { + /* the trailing NULL byte is usually not present in the SAN */ alert_uri = smlTryMalloc0(idLength + 1, error); if (!alert_uri) goto error_free_san; @@ -407,11 +433,11 @@ SmlSanAlert *alert = NULL; /* Calculate the length of the san data */ - unsigned int length = 16 /* Digest */ + 8 /* Hdr */ + strlen(san->identifier) + 1 /* Identifier */ + 1 /* num-sync + future */; + unsigned int length = 16 /* Digest */ + 8 /* Hdr */ + strlen(san->identifier) /* Identifier */ + 1 /* num-sync + future */; GList *a = NULL; for (a = san->alerts; a; a = a->next) { alert = a->data; - length += 5 + strlen(alert->serverURI) + 1; + length += 5 + strlen(alert->serverURI); numsync++; } @@ -421,11 +447,11 @@ goto error; *data = buffer; *size = length; - - /* FIXME: Now create the digest */ + + /* the digest must be created at the end */ /* Create Header */ - /* Version */ + /* Version - 10 bit */ buffer[16] = 0x03; /* ui mode */ @@ -434,17 +460,17 @@ /* initiator */ buffer[17] = buffer[17] | (san->init << 3); - /* future use is 0 for now */ + /* future use is 0 for now - 27 bit */ /* session id */ buffer[21] = san->sessionID >> 8; buffer[22] = san->sessionID; - /* server identifier */ - buffer[23] = strlen(san->identifier) + 1; - strcpy(buffer + 24, san->identifier); + /* server identifier without trailing NULL byte */ + buffer[23] = strlen(san->identifier); + strncpy(buffer + 24, san->identifier, strlen(san->identifier)); - buffer += 24 + strlen(san->identifier) + 1; + buffer += 24 + strlen(san->identifier); /* Num syncs + future */ buffer[0] = numsync << 4; @@ -456,23 +482,80 @@ buffer[0] = (alert->type - 200) << 4; /* The contenttype */ - if (!strcmp(alert->contenttype, SML_ELEMENT_TEXT_VCARD)) + if (!strcmp(alert->contenttype, SML_ELEMENT_TEXT_VCARD)) { buffer[3] = 0x07; - else if (!strcmp(alert->contenttype, SML_ELEMENT_TEXT_VCAL)) + } else if (!strcmp(alert->contenttype, SML_ELEMENT_TEXT_VCAL)) { buffer[3] = 0x06; - else if (!strcmp(alert->contenttype, SML_ELEMENT_TEXT_PLAIN)) + } else if (!strcmp(alert->contenttype, SML_ELEMENT_TEXT_PLAIN)) { buffer[3] = 0x03; - else { + } else if (!strcmp(alert->contenttype, SML_ELEMENT_TEXT_ICAL)) { + buffer[2] = 0x03; + buffer[3] = 0x05; + } else if (!strcmp(alert->contenttype, SML_ELEMENT_APPLICATION_OMA_DS_EMAIL)) { + buffer[2] = 0x03; + buffer[3] = 0x06; + } else if (!strcmp(alert->contenttype, SML_ELEMENT_APPLICATION_OMA_DS_FILE)) { + buffer[2] = 0x03; + buffer[3] = 0x07; + } else if (!strcmp(alert->contenttype, SML_ELEMENT_APPLICATION_OMA_DS_FOLDER)) { + buffer[2] = 0x03; + buffer[3] = 0x08; + } else if (!strcmp(alert->contenttype, SML_ELEMENT_TEXT_VCARD_30)) { + buffer[2] = 0x03; + buffer[3] = 0x09; + } else { /* http://www.openmobilealliance.org/Tech/omna/omna-wsp-content-type.aspx */ - smlErrorSet(error, SML_ERROR_GENERIC, "The OMNA WSP Content Type Number is unknown for %s.", alert->contenttype); - goto error_free_data; + smlTrace(TRACE_INTERNAL, + "%s: The OMNA WSP Content Type Number is unknown for %s.", + __func__, alert->contenttype); + /* All bytes are already set to zero. */ } - /* The server uri */ - buffer[4] = strlen(alert->serverURI) + 1; - strcpy(buffer + 5, alert->serverURI); - buffer += 5 + strlen(alert->serverURI) + 1; + /* The server uri without a trailing NULL byte */ + buffer[4] = strlen(alert->serverURI); + strncpy(buffer + 5, alert->serverURI, strlen(alert->serverURI)); + buffer += 5 + strlen(alert->serverURI); + } + + /* Create the digest */ + + /* DO NOT USE buffer because this pointer was manipulated + * ALWAYS USE *data. + */ + + /* base64 encoded MD5 digest of the notification */ + unsigned char digest[16]; + smlMD5GetDigest (*data+16, length - 16 /* digest */, digest); + char *b64_san = g_base64_encode(digest, 16); + smlTrace(TRACE_INTERNAL, "%s: b64(md5(san)) ::= %s", __func__, b64_san); + + /* base64 encoded MD5 digest of username:password */ + const char *username = ""; + const char *password = ""; + if (san->cred) { + username = san->cred->username; + password = san->cred->password; } + char *auth = g_strdup_printf("%s:%s", username, password); + smlMD5GetDigest (auth, strlen(auth), digest); + smlSafeCFree(&auth); + char *b64_auth = g_base64_encode(digest, 16); + smlTrace(TRACE_INTERNAL, "%s: b64(md5(username:password)) ::= %s", __func__, b64_auth); + + /* MD5 digest of auth:nonce:notification (empty nonce) */ + char *complete = g_strdup_printf("%s::%s", b64_auth, b64_san); + smlSafeCFree(&b64_auth); + smlSafeCFree(&b64_san); + smlMD5GetDigest (complete, strlen(complete), digest); + smlSafeCFree(&complete); + smlTrace(TRACE_INTERNAL, "%s: md5(auth::san) complete", __func__); + + /* copy digest to buffer */ + memcpy(*data, digest, 16); + smlTrace(TRACE_INTERNAL, "%s: md5(auth::san) copied to san", __func__); + + /* debug */ + char *hex = smlPrintHex(*data, *size); smlTrace(TRACE_INTERNAL, "San packet assembled: %s", hex); smlSafeCFree(&hex); |
From: <svn...@op...> - 2009-02-19 17:19:30
|
Author: bellmich Date: Thu Feb 19 18:20:05 2009 New Revision: 934 URL: http://libsyncml.opensync.org/changeset/934 Log: added parser support for SupportHierarchicalSync Modified: trunk/libsyncml/parser/sml_xml_parse.c trunk/libsyncml/sml_devinf_internals.h Modified: trunk/libsyncml/parser/sml_xml_parse.c ============================================================================== --- trunk/libsyncml/parser/sml_xml_parse.c Thu Feb 19 18:15:54 2009 (r933) +++ trunk/libsyncml/parser/sml_xml_parse.c Thu Feb 19 18:20:05 2009 (r934) @@ -3224,8 +3224,20 @@ } else if (!strcmp((char *)xmlTextReaderConstName(parser->reader), SML_ELEMENT_DSMEM)) { if (!_smlXmlDevInfDataStoreParseDSMem(parser, datastore, error)) goto error_free_datastore; + } else if (!strcmp((char *)xmlTextReaderConstName(parser->reader), SML_ELEMENT_SUPPORT_HIERARCHICAL_SYNC)) { + if (devinf->version < SML_DEVINF_VERSION_12) { + smlErrorSet(error, SML_ERROR_GENERIC, "SupportHierarchicalSync is only supported in OMA DS 1.2 DevInf and later."); + goto error; + } + datastore->supportsHierarchicalSync = TRUE; + if (!xmlTextReaderIsEmptyElement(parser->reader)) { + if (!_smlXmlParserStep(parser)) { + smlErrorSet(error, SML_ERROR_GENERIC, "The closing element of %s is missing.", SML_ELEMENT_SUPPORT_HIERARCHICAL_SYNC); + goto error; + } + } } else { - smlErrorSet(error, SML_ERROR_GENERIC, "wrong initial node (%s)", (char *)xmlTextReaderConstName(parser->reader)); + smlErrorSet(error, SML_ERROR_GENERIC, "A DataStore within DevInf includes the unsupported element %s.", (char *)xmlTextReaderConstName(parser->reader)); goto error_free_datastore; } Modified: trunk/libsyncml/sml_devinf_internals.h ============================================================================== --- trunk/libsyncml/sml_devinf_internals.h Thu Feb 19 18:15:54 2009 (r933) +++ trunk/libsyncml/sml_devinf_internals.h Thu Feb 19 18:20:05 2009 (r934) @@ -54,6 +54,8 @@ struct SmlDevInfDataStore { gint refCount; + + SmlBool supportsHierarchicalSync; char *sourceref; char *displayname; |
From: <svn...@op...> - 2009-02-19 17:15:14
|
Author: bellmich Date: Thu Feb 19 18:15:54 2009 New Revision: 933 URL: http://libsyncml.opensync.org/changeset/933 Log: If _recv_devinf fails then the error must be published via an event because the function itself cannot signal this error via a return value or an error object. Modified: trunk/libsyncml/objects/sml_devinf_obj.c Modified: trunk/libsyncml/objects/sml_devinf_obj.c ============================================================================== --- trunk/libsyncml/objects/sml_devinf_obj.c Thu Feb 19 18:07:45 2009 (r932) +++ trunk/libsyncml/objects/sml_devinf_obj.c Thu Feb 19 18:15:54 2009 (r933) @@ -231,6 +231,7 @@ return; error: + smlSessionDispatchEvent(session, SML_SESSION_EVENT_ERROR, NULL, NULL, NULL, error); smlTrace(TRACE_EXIT_ERROR, "%s: %s", __func__, smlErrorPrint(&error)); smlErrorDeref(&error); } |
From: <svn...@op...> - 2009-02-19 17:11:36
|
Author: bellmich Date: Thu Feb 19 18:11:58 2009 New Revision: 190 URL: http://libwbxml.opensync.org/changeset/190 Log: added "svn status" hint Modified: wbxml2/trunk/RELEASE Modified: wbxml2/trunk/RELEASE ============================================================================== --- wbxml2/trunk/RELEASE Tue Feb 17 13:10:23 2009 (r189) +++ wbxml2/trunk/RELEASE Thu Feb 19 18:11:58 2009 (r190) @@ -32,6 +32,9 @@ - if someone else made changes and the commit fails, you have to "svn up" and run the tests again + - please run "svn status" before you continue to be 100 percent sure + that there is no forgotten commit and no unrevisioned file. + - once the commit succeeds, you have to create a new tag with "mkdir tags/libwbxml-$MAJOR.$MINOR.$PATCH", "tar -C trunk --exclude=\"\\.svn\" -cf - . | tar -C tags/libwbxml-$MAJOR.$MINOR.$PATCH -xf -" |
From: <svn...@op...> - 2009-02-19 17:07:09
|
Author: bellmich Date: Thu Feb 19 18:07:45 2009 New Revision: 932 URL: http://libsyncml.opensync.org/changeset/932 Log: - added SupportHierarchicalSync (OMA DS 1.2) - added some new content types which were registered by the OMA DS WG Modified: trunk/libsyncml/sml_defines.h Modified: trunk/libsyncml/sml_defines.h ============================================================================== --- trunk/libsyncml/sml_defines.h Thu Feb 19 17:57:13 2009 (r931) +++ trunk/libsyncml/sml_defines.h Thu Feb 19 18:07:45 2009 (r932) @@ -117,6 +117,7 @@ #define SML_ELEMENT_SIZE "Size" #define SML_ELEMENT_SUPPORTLARGEOBJS "SupportLargeObjs" #define SML_ELEMENT_SUPPORTNUMBEROFCHANGES "SupportNumberOfChanges" +#define SML_ELEMENT_SUPPORT_HIERARCHICAL_SYNC "SupportHierarchicalSync" #define SML_ELEMENT_SWV "SwV" #define SML_ELEMENT_SYNCCAP "SyncCap" #define SML_ELEMENT_SYNCTYPE "SyncType" @@ -206,6 +207,9 @@ #define SML_ELEMENT_WBXML "application/vnd.syncml+wbxml" #define SML_ELEMENT_XML "application/vnd.syncml+xml" #define SML_ELEMENT_SAN "application/vnd.syncml.ds.notification" +#define SML_ELEMENT_APPLICATION_OMA_DS_EMAIL "application/vnd.omads-email+xml" +#define SML_ELEMENT_APPLICATION_OMA_DS_FILE "application/vnd.omads-file+xml" +#define SML_ELEMENT_APPLICATION_OMA_DS_FOLDER "application/vnd.omads-folder+xml" #define SML_NAMESPACE_METINF "syncml:metinf" #define SML_NAMESPACE_DEVINF "syncml:devinf" |
From: <svn...@op...> - 2009-02-19 17:05:47
|
Author: dgollub Date: Thu Feb 19 18:06:25 2009 New Revision: 5270 URL: http://www.opensync.org/changeset/5270 Log: Test commit Modified: trunk/AUTHORS Modified: trunk/AUTHORS ============================================================================== --- trunk/AUTHORS Tue Feb 17 11:52:55 2009 (r5269) +++ trunk/AUTHORS Thu Feb 19 18:06:25 2009 (r5270) @@ -1,2 +1,5 @@ Armin Bauer -ar...@de... \ No newline at end of file +ar...@de... + +Daniel Gollub +dg...@cr... |
From: <svn...@op...> - 2009-02-18 17:46:17
|
Author: dgollub Date: Wed Feb 18 18:30:51 2009 New Revision: 3 URL: http://www.opensync.org/changeset/3 Log: Test 0 Modified: test.txt Modified: test.txt ============================================================================== --- test.txt Wed Feb 18 17:36:26 2009 (r2) +++ test.txt Wed Feb 18 18:30:51 2009 (r3) @@ -1 +1 @@ -Wed Feb 18 17:37:52 CET 2009 +Wed Feb 18 18:32:11 CET 2009 |
From: <svn...@op...> - 2009-02-18 17:41:17
|
Author: dgollub Date: Wed Feb 18 17:33:51 2009 New Revision: 1 URL: http://www.opensync.org/changeset/1 Log: Test commit 4 Added: test.txt Added: test.txt ============================================================================== |