openobex:mainline.git
5 years agoFix: add missing includes
Hendrik Sattler [Tue, 16 Apr 2013 19:33:16 +0000 (21:33 +0200)]
Fix: add missing includes

5 years agoAdd OBEX_FL_STREAM_CONTINUE
Hendrik Sattler [Fri, 8 Mar 2013 23:40:25 +0000 (00:40 +0100)]
Add OBEX_FL_STREAM_CONTINUE

OBEX_FL_STREAM_CONTINUE allows inserting other OBEX headers in-between streamed
BODY headers (e.g. SRM headers).
This also uses the data given with OBEX_FL_STREAM_START instead of ignoring it.
Additional, using the BODY_END header id now behaves like OBEX_FL_STREAM_DATAEND
was given if streaming is enabled.

5 years agoFix public identifier of DTD entities
Hendrik Sattler [Fri, 8 Mar 2013 22:37:17 +0000 (23:37 +0100)]
Fix public identifier of DTD entities

5 years agoReleasing OpenOBEX-1.7 1.7
Hendrik Sattler [Tue, 5 Mar 2013 19:55:49 +0000 (20:55 +0100)]
Releasing OpenOBEX-1.7

5 years agoDon't warn about missing msvc runtime DLLs when compiling with Visual Studio Express
Hendrik Sattler [Mon, 4 Mar 2013 21:07:30 +0000 (22:07 +0100)]
Don't warn about missing msvc runtime DLLs when compiling with Visual Studio Express

5 years agoFix MSVC include directory
Hendrik Sattler [Mon, 4 Mar 2013 19:44:08 +0000 (20:44 +0100)]
Fix MSVC include directory

5 years agoFix return type mismatch
Hendrik Sattler [Mon, 4 Mar 2013 19:41:28 +0000 (20:41 +0100)]
Fix return type mismatch

5 years agoFix: missing declaration of ssize_t on MSVC
Hendrik Sattler [Mon, 4 Mar 2013 19:41:20 +0000 (20:41 +0100)]
Fix: missing declaration of ssize_t on MSVC

5 years agoFix: explicitely cast to long for struct timeval values
Hendrik Sattler [Mon, 4 Mar 2013 19:41:14 +0000 (20:41 +0100)]
Fix: explicitely cast to long for struct timeval values

5 years agoFix: use uint8_t* instead of void* when adding byte offsets
Hendrik Sattler [Mon, 4 Mar 2013 19:41:05 +0000 (20:41 +0100)]
Fix: use uint8_t* instead of void* when adding byte offsets

5 years agoFix: MSVC compiler wants ssize_t and bool as typedefs
Hendrik Sattler [Mon, 4 Mar 2013 19:40:56 +0000 (20:40 +0100)]
Fix: MSVC compiler wants ssize_t and bool as typedefs

5 years agoGenerate refernceinfo.xml
Hendrik Sattler [Sun, 3 Mar 2013 21:06:27 +0000 (22:06 +0100)]
Generate refernceinfo.xml

This also extends Saxon and Xalan2 functional to use Xerces XInclude processing.
However, this breaks out-of-source builds with these two unless something like
xsltproc's --path option is used.

5 years agoSplit openobex-apps.xml using XIncludes
Hendrik Sattler [Sun, 3 Mar 2013 11:12:13 +0000 (12:12 +0100)]
Split openobex-apps.xml using XIncludes

This also extends the CMake modules to be able to handle Docbook file that use
XIncludes. This involves a new dependency: xmllint.

This also fixes a minor bug for Xalan support.

5 years agoWhitespace fixes
Hendrik Sattler [Sun, 3 Mar 2013 08:33:14 +0000 (09:33 +0100)]
Whitespace fixes

5 years agoFix invalid use of free()
Hendrik Sattler [Sun, 3 Mar 2013 07:40:30 +0000 (08:40 +0100)]
Fix invalid use of free()

5 years agoFix include dirs in build dir openobex-config.cmake
Hendrik Sattler [Sun, 3 Mar 2013 07:37:51 +0000 (08:37 +0100)]
Fix include dirs in build dir openobex-config.cmake

There are now a generated include file openobex/version.h, so the build dir
include directory is also necessary. This does not affect the installed tree
configuration.

5 years agoAdd missing return code checking
Hendrik Sattler [Sat, 2 Mar 2013 15:36:41 +0000 (16:36 +0100)]
Add missing return code checking

5 years agoFix possible memory leaks
Hendrik Sattler [Sat, 2 Mar 2013 15:28:02 +0000 (16:28 +0100)]
Fix possible memory leaks

5 years agoFix use of strncpy()
Hendrik Sattler [Sat, 2 Mar 2013 15:23:35 +0000 (16:23 +0100)]
Fix use of strncpy()

5 years agoUse const string table instead of strdup()+modification
Hendrik Sattler [Sat, 2 Mar 2013 15:21:12 +0000 (16:21 +0100)]
Use const string table instead of strdup()+modification

5 years agoFix: add missing return code check
Hendrik Sattler [Sat, 2 Mar 2013 15:18:47 +0000 (16:18 +0100)]
Fix: add missing return code check

5 years agoFix: rollback on error in OBEX_Request()
Hendrik Sattler [Sat, 2 Mar 2013 15:08:56 +0000 (16:08 +0100)]
Fix: rollback on error in OBEX_Request()

5 years agoRemove value assigning to a no more used variable
Hendrik Sattler [Sat, 2 Mar 2013 08:49:54 +0000 (09:49 +0100)]
Remove value assigning to a no more used variable

5 years agoFix return code of OBEX_HandleInput()
Hendrik Sattler [Sat, 2 Mar 2013 08:48:58 +0000 (09:48 +0100)]
Fix return code of OBEX_HandleInput()

5 years agoThrough away the result of optional setsockopt() calls
Hendrik Sattler [Sat, 2 Mar 2013 08:48:34 +0000 (09:48 +0100)]
Through away the result of optional setsockopt() calls

5 years agoDon't check self->object
Hendrik Sattler [Sat, 2 Mar 2013 08:45:57 +0000 (09:45 +0100)]
Don't check self->object

Either it should be checked everytime before being used or never. As it cannot
actually be NULL here, the two remaining checks are removed.

5 years agoMake it clearer that free() is used
Hendrik Sattler [Sat, 2 Mar 2013 08:43:35 +0000 (09:43 +0100)]
Make it clearer that free() is used

5 years agoFix use of strncpy()
Hendrik Sattler [Sat, 2 Mar 2013 08:27:31 +0000 (09:27 +0100)]
Fix use of strncpy()

5 years agoFix return code evaluation
Hendrik Sattler [Sat, 2 Mar 2013 08:23:53 +0000 (09:23 +0100)]
Fix return code evaluation

5 years agoConvert struct obex_usb_intf_transport_t to a single-linked list
Hendrik Sattler [Sat, 2 Mar 2013 08:19:34 +0000 (09:19 +0100)]
Convert struct obex_usb_intf_transport_t to a single-linked list

5 years agoFix build warnings
Hendrik Sattler [Sun, 24 Feb 2013 10:53:39 +0000 (11:53 +0100)]
Fix build warnings

5 years agoFix definition of in_addr_t
Hendrik Sattler [Sun, 24 Feb 2013 10:53:07 +0000 (11:53 +0100)]
Fix definition of in_addr_t

5 years agoFix: RESOURCE_LEAK (CWE-404)
Tomas Hozza [Sun, 24 Feb 2013 10:38:25 +0000 (11:38 +0100)]
Fix: RESOURCE_LEAK (CWE-404)

Coverity output:
apps/obex_test/obex_test_server.c:57: cond_true: Condition
"OBEX_ObjectGetNextHeader(handle, object, &hi, &hv, &hlen)", taking true
branch
apps/obex_test/obex_test_server.c:58: switch: Switch case
value "1"
apps/obex_test/obex_test_server.c:64: switch_case: Reached
case "1"
apps/obex_test/obex_test_server.c:66: alloc_fn: Storage is
returned from allocation function "malloc(size_t)".
apps/obex_test/obex_test_server.c:66: var_assign: Assigning:
"namebuf" = storage returned from "malloc(hlen / 2U)".
apps/obex_test/obex_test_server.c:66: cond_true: Condition
"namebuf = malloc(hlen / 2)", taking true branch
apps/obex_test/obex_test_server.c:67: noescape: Resource
"(uint8_t *)namebuf" is not freed or pointed-to in function
"OBEX_UnicodeToChar(uint8_t *, uint8_t const *, int)".
openobex-1.5.0-Source/lib/obex.c:899:41: noescape:
"OBEX_UnicodeToChar(uint8_t *, uint8_t const *, int)" does not free or
save its pointer parameter "c".
apps/obex_test/obex_test_server.c:68: var_assign: Assigning:
"name" = "namebuf".
apps/obex_test/obex_test_server.c:70: break: Breaking from
switch
apps/obex_test/obex_test_server.c:74: switch_end:
Reached end of switch
apps/obex_test/obex_test_server.c:75: loop: Jumping back
to the beginning of the loop
apps/obex_test/obex_test_server.c:57: loop_begin: Jumped
back to beginning of loop
apps/obex_test/obex_test_server.c:57: cond_false:
Condition "OBEX_ObjectGetNextHeader(handle, object, &hi, &hv,
&hlen)", taking false branch
apps/obex_test/obex_test_server.c:75: loop_end: Reached
end of loop
apps/obex_test/obex_test_server.c:76: cond_true:
Condition "!body", taking true branch
apps/obex_test/obex_test_server.c:78: leaked_storage:
Variable "namebuf" going out of scope leaks the storage it points
to.
apps/obex_test/obex_test_server.c:78: leaked_storage:
Variable "name" going out of scope leaks the storage it points to.

5 years agoFix: RESOURCE_LEAK (CWE-404)
Tomas Hozza [Sun, 24 Feb 2013 10:38:21 +0000 (11:38 +0100)]
Fix: RESOURCE_LEAK (CWE-404)

Coverity output:
apps/obex_test/obex_test_server.c:106: cond_true: Condition
 "OBEX_ObjectGetNextHeader(handle, object, &hi, &hv, &hlen)", taking true branch
apps/obex_test/obex_test_server.c:107: switch: Switch case value "1"
apps/obex_test/obex_test_server.c:108: switch_case: Reached case "1"
apps/obex_test/obex_test_server.c:110: alloc_fn: Storage is returned from
 allocation function "malloc(size_t)".
apps/obex_test/obex_test_server.c:110: var_assign: Assigning:
 "namebuf" = storage returned from "malloc(hlen / 2U)".
apps/obex_test/obex_test_server.c:110: cond_true: Condition
 "namebuf = malloc(hlen / 2)", taking true branch
apps/obex_test/obex_test_server.c:111: noescape: Resource "(uint8_t *)namebuf"
 is not freed or pointed-to in function "OBEX_UnicodeToChar(uint8_t *,
 uint8_t const *, int)".
openobex-1.5.0-Source/lib/obex.c:899:41: noescape:
 "OBEX_UnicodeToChar(uint8_t *, uint8_t const *, int)" does not free or save
 its pointer parameter "c".
apps/obex_test/obex_test_server.c:112: var_assign: Assigning:
 "name" = "namebuf".
apps/obex_test/obex_test_server.c:114: break: Breaking from switch
apps/obex_test/obex_test_server.c:118: switch_end: Reached end of switch
apps/obex_test/obex_test_server.c:119: loop: Jumping back to the beginning of
 the loop
apps/obex_test/obex_test_server.c:106: loop_begin: Jumped back to beginning of
 loop
apps/obex_test/obex_test_server.c:106: cond_false: Condition
 "OBEX_ObjectGetNextHeader(handle, object, &hi, &hv, &hlen)", taking false
 branch
apps/obex_test/obex_test_server.c:119: loop_end: Reached end of loop
apps/obex_test/obex_test_server.c:121: cond_false: Condition "!name", taking
 false branch
apps/obex_test/obex_test_server.c:125: if_end: End of if statement
apps/obex_test/obex_test_server.c:126: noescape: Resource "name" is not freed
 or pointed-to in function "printf(char const * restrict, ...)".
apps/obex_test/obex_test_server.c:128: noescape: Resource "name" is not freed
 or pointed-to in function "easy_readfile(char const *, int *)".
apps/obex_test/obex_io.c:77:36: noescape: "easy_readfile(char const *, int *)"
 does not free or save its pointer parameter "filename".
apps/obex_test/obex_test_server.c:129: cond_true: Condition "buf == NULL",
 taking true branch
apps/obex_test/obex_test_server.c:130: noescape: Resource "name" is not freed
 or pointed-to in function "printf(char const * restrict, ...)".
apps/obex_test/obex_test_server.c:132: leaked_storage: Variable "namebuf" going
 out of scope leaks the storage it points to.
apps/obex_test/obex_test_server.c:132: leaked_storage: Variable "name" going
 out of scope leaks the storage it points to.

apps/obex_test/obex_test_server.c:106: cond_true: Condition
 "OBEX_ObjectGetNextHeader(handle, object, &hi, &hv, &hlen)", taking true branch
apps/obex_test/obex_test_server.c:107: switch: Switch case value "1"
apps/obex_test/obex_test_server.c:108: switch_case: Reached case "1"
apps/obex_test/obex_test_server.c:110: alloc_fn: Storage is returned from
 allocation function "malloc(size_t)".
apps/obex_test/obex_test_server.c:110: var_assign: Assigning: "namebuf" =
 storage returned from "malloc(hlen / 2U)".
apps/obex_test/obex_test_server.c:110: cond_true: Condition
 "namebuf = malloc(hlen / 2)", taking true branch
apps/obex_test/obex_test_server.c:111: noescape: Resource "(uint8_t *)namebuf"
 is not freed or pointed-to in function "OBEX_UnicodeToChar(uint8_t *,
 uint8_t const *, int)".
openobex-1.5.0-Source/lib/obex.c:899:41: noescape:
 "OBEX_UnicodeToChar(uint8_t *, uint8_t const *, int)" does not free or save
 its pointer parameter "c".
apps/obex_test/obex_test_server.c:112: var_assign: Assigning:
 "name" = "namebuf".
apps/obex_test/obex_test_server.c:114: break: Breaking from switch
apps/obex_test/obex_test_server.c:118: switch_end: Reached end of switch
apps/obex_test/obex_test_server.c:119: loop: Jumping back to the beginning of
 the loop
apps/obex_test/obex_test_server.c:106: loop_begin: Jumped back to beginning of
 loop
apps/obex_test/obex_test_server.c:106: cond_false: Condition
 "OBEX_ObjectGetNextHeader(handle, object, &hi, &hv, &hlen)", taking false
 branch
apps/obex_test/obex_test_server.c:119: loop_end: Reached end of loop
apps/obex_test/obex_test_server.c:121: cond_false: Condition "!name", taking
 false branch
apps/obex_test/obex_test_server.c:125: if_end: End of if statement
apps/obex_test/obex_test_server.c:126: noescape: Resource "name" is not freed
 or pointed-to in function "printf(char const * restrict, ...)".
apps/obex_test/obex_test_server.c:128: noescape: Resource "name" is not freed
 or pointed-to in function "easy_readfile(char const *, int *)".
apps/obex_test/obex_io.c:77:36: noescape: "easy_readfile(char const *, int *)"
 does not free or save its pointer parameter "filename".
apps/obex_test/obex_test_server.c:129: cond_false: Condition "buf == NULL",
 taking false branch
apps/obex_test/obex_test_server.c:133: if_end: End of if statement
apps/obex_test/obex_test_server.c:141: leaked_storage: Variable "namebuf" going
 out of scope leaks the storage it points to.
apps/obex_test/obex_test_server.c:141: leaked_storage: Variable "name" going
 out of scope leaks the storage it points to.

5 years agoFix: RESOURCE_LEAK (CWE-404)
Tomas Hozza [Sun, 24 Feb 2013 10:38:15 +0000 (11:38 +0100)]
Fix: RESOURCE_LEAK (CWE-404)

Coverity output:
apps/lib/obex_put_common.c:59: cond_true: Condition
 "OBEX_ObjectGetNextHeader(handle, object, &hi, &hv, &hlen)", taking true branch
apps/lib/obex_put_common.c:60: switch: Switch case value "1"
apps/lib/obex_put_common.c:65: switch_case: Reached case "1"
apps/lib/obex_put_common.c:66: alloc_fn: Storage is returned from allocation
 function "malloc(size_t)".
apps/lib/obex_put_common.c:66: var_assign: Assigning: "namebuf" = storage
 returned from "malloc(hlen / 2U)".
apps/lib/obex_put_common.c:66: cond_true: Condition
 "namebuf = malloc(hlen / 2)", taking true branch
apps/lib/obex_put_common.c:67: noescape: Resource "(uint8_t *)namebuf" is not
 freed or pointed-to in function
 "OBEX_UnicodeToChar(uint8_t *, uint8_t const *, int)"
lib/lib/obex.c:899:41: noescape:
 "OBEX_UnicodeToChar(uint8_t *, uint8_t const *, int)" does not free or save
  its pointer parameter "c".
apps/lib/obex_put_common.c:68: var_assign: Assigning: "name" = "namebuf".
apps/lib/obex_put_common.c:70: break: Breaking from switch
apps/lib/obex_put_common.c:82: switch_end: Reached end of switch
apps/lib/obex_put_common.c:83: loop: Jumping back to the beginning of the loop
apps/lib/obex_put_common.c:59: loop_begin: Jumped back to beginning of loop
apps/lib/obex_put_common.c:59: cond_false: Condition
 "OBEX_ObjectGetNextHeader(handle, object, &hi, &hv, &hlen)", taking false
  branch
apps/lib/obex_put_common.c:83: loop_end: Reached end of loop
apps/lib/obex_put_common.c:84: cond_true: Condition "!body", taking true branch
apps/lib/obex_put_common.c:86: leaked_storage: Variable "namebuf" going out of
 scope leaks the storage it points to.
apps/lib/obex_put_common.c:86: leaked_storage: Variable "name" going out of
 scope leaks the storage it points to.

5 years agoFix: RESOURCE_LEAK (CWE-404)
Tomas Hozza [Sun, 24 Feb 2013 10:37:49 +0000 (11:37 +0100)]
Fix: RESOURCE_LEAK (CWE-404)

Coverity output:
apps/ircp/ircp_client.c:281: cond_false: Condition "!(cli != NULL)", taking
 false branch
apps/ircp/ircp_client.c:281: if_end: End of if statement
apps/ircp/ircp_client.c:283: alloc_fn: Storage is returned from allocation
 function "build_object_from_file(obex_t *, char const *, char const *)".
apps/ircp/ircp_io.c:72:2: alloc_fn: Storage is returned from allocation
 function "OBEX_ObjectNew(obex_t *, uint8_t)".
apps/lib/obex.c:626:2: cond_false: Condition "!(self != NULL)", taking false
 branch
apps/lib/obex.c:626:2: if_end: End of if statement
apps/lib/obex.c:628:2: alloc_fn: Storage is returned from allocation function
 "obex_object_new(void)".
apps/lib/obex_object.c:46:2: alloc_fn: Storage is returned from allocation
 function "malloc(size_t)".
apps/lib/obex_object.c:46:2: var_assign: Assigning: "object" = "malloc(120UL)".
apps/lib/obex_object.c:47:2: cond_false: Condition "object == NULL", taking
 false branch
apps/lib/obex_object.c:48:3: if_end: End of if statement
apps/lib/obex_object.c:50:2: noescape: Resource "object" is not freed or
 pointed-to in function "memset(void *, int, size_t)".
apps/lib/obex_object.c:52:2: noescape: Resource "object" is not freed or
 pointed-to in function "obex_object_setrsp(obex_object_t *, uint8_t, uint8_t)".
apps/lib/obex_object.c:128:39: noescape:
 "obex_object_setrsp(obex_object_t *, uint8_t, uint8_t)" does not free or save
 its pointer parameter "object".
apps/lib/obex_object.c:54:2: return_alloc: Returning allocated memory "object".
apps/lib/obex.c:628:2: var_assign: Assigning: "object" = "obex_object_new()".
apps/lib/obex.c:629:2: cond_false: Condition "object == NULL", taking false
 branch
apps/lib/obex.c:630:3: if_end: End of if statement
apps/lib/obex.c:632:2: noescape: Resource "object" is not freed or pointed-to
 in function "obex_object_setcmd(obex_object_t *, uint8_t, uint8_t)".
apps/lib/obex_object.c:113:39: noescape:
 "obex_object_setcmd(obex_object_t *, uint8_t, uint8_t)" does not free or save
 its pointer parameter "object".
apps/lib/obex.c:634:2: cond_true: Condition "cmd == 0", taking true branch
apps/lib/obex.c:635:3: noescape: Resource "object" is not freed or pointed-to
 in function "obex_insert_connectframe(obex_t *, obex_object_t *)".
apps/lib/obex_connect.c:42:59: noescape:
"obex_insert_connectframe(obex_t *, obex_object_t *)" does not free or save its
 pointer parameter "object".
apps/lib/obex.c:635:3: cond_false: Condition
 "obex_insert_connectframe(self, object) < 0", taking false branch
apps/lib/obex.c:638:3: if_end: End of if statement
apps/lib/obex.c:641:2: return_alloc: Returning allocated memory "object".
apps/ircp/ircp_io.c:72:2: var_assign: Assigning:
 "object" = "OBEX_ObjectNew(handle, 2)".
apps/ircp/ircp_io.c:73:2: cond_false: Condition "object == NULL", taking false
 branch
apps/ircp/ircp_io.c:74:3: if_end: End of if statement
apps/ircp/ircp_io.c:78:2: cond_false: Condition "ucname == NULL", taking false
 branch
apps/ircp/ircp_io.c:79:3: if_end: End of if statement
apps/ircp/ircp_io.c:84:2: noescape: Resource "object" is not freed or
 pointed-to in function "OBEX_ObjectAddHeader(obex_t *, obex_object_t *,
 uint8_t, obex_headerdata_t, uint32_t, unsigned int)".
apps/lib/obex.c:713:63: noescape: "OBEX_ObjectAddHeader(obex_t *,
 obex_object_t *, uint8_t, obex_headerdata_t, uint32_t, unsigned int)" does not
 free or save its pointer parameter "object".
apps/ircp/ircp_io.c:88:2: noescape: Resource "object" is not freed or
 pointed-to in function "OBEX_ObjectAddHeader(obex_t *, obex_object_t *,
 uint8_t, obex_headerdata_t, uint32_t, unsigned int)".
apps/lib/obex.c:713:63: noescape: "OBEX_ObjectAddHeader(obex_t *,
 obex_object_t *, uint8_t, obex_headerdata_t, uint32_t, unsigned int)" does not
 free or save its pointer parameter "object".
apps/ircp/ircp_io.c:98:2: noescape: Resource "object" is not freed or
 pointed-to in function "OBEX_ObjectAddHeader(obex_t *, obex_object_t *,
 uint8_t, obex_headerdata_t, uint32_t, unsigned int)".
apps/lib/obex.c:713:63: noescape: "OBEX_ObjectAddHeader(obex_t *,
 obex_object_t *, uint8_t, obex_headerdata_t, uint32_t, unsigned int)" does not
 free or save its pointer parameter "object".
apps/ircp/ircp_io.c:102:2: return_alloc: Returning allocated memory "object".
apps/ircp/ircp_client.c:283: var_assign: Assigning: "object" = storage returned
 from "build_object_from_file(cli->obexhandle, localname, remotename)".
apps/ircp/ircp_client.c:286: cond_true: Condition "cli->fd < 0", taking true
 branch
apps/ircp/ircp_client.c:287: if_fallthrough: Falling through to end of if
 statement
apps/ircp/ircp_client.c:289: if_end: End of if statement
apps/ircp/ircp_client.c:293: cond_true: Condition "ret < 0", taking true branch
apps/ircp/ircp_client.c:294: if_fallthrough: Falling through to end of if
 statement
apps/ircp/ircp_client.c:296: if_end: End of if statement
apps/ircp/ircp_client.c:298: leaked_storage: Variable "object" going out of
 scope leaks the storage it points to.

5 years agoFix: NEGATIVE_RETURNS (CWE-394)
Tomas Hozza [Sun, 24 Feb 2013 09:38:50 +0000 (10:38 +0100)]
Fix: NEGATIVE_RETURNS (CWE-394)

Coverity output:
apps/ircp/ircp_client.c:281: cond_false: Condition "!(cli != NULL)", taking
false branch
apps/ircp/ircp_client.c:281: if_end: End of if statement
apps/ircp/ircp_client.c:285: negative_return_fn: Function
"open(localname, 0, 0)" returns a negative number.
apps/ircp/ircp_client.c:285: var_assign: Assigning: signed variable
"cli->fd" = "open(char const *, int, ...)".
apps/ircp/ircp_client.c:286: cond_true: Condition "cli->fd < 0", taking true
branch
apps/ircp/ircp_client.c:287: if_fallthrough: Falling through to end of if
statement
apps/ircp/ircp_client.c:289: if_end: End of if statement
apps/ircp/ircp_client.c:291: negative_returns: "cli->fd" is passed to a
parameter that cannot be negative.

5 years agoFix: CHECKED_RETURN (CWE-252)
Tomas Hozza [Sun, 24 Feb 2013 09:38:46 +0000 (10:38 +0100)]
Fix: CHECKED_RETURN (CWE-252)

Coverity output:
apps/ircp/ircp_io.c:49: check_return: Calling function "stat(name, &stats)"
without checking return value. This library function may fail and return an
error code.
apps/ircp/ircp_io.c:49: unchecked_value: No check of the return value of
"stat(name, &stats)".

5 years agoFix: CHECKED_RETURN (CWE-252)
Tomas Hozza [Sun, 24 Feb 2013 09:38:39 +0000 (10:38 +0100)]
Fix: CHECKED_RETURN (CWE-252)

Coverity output:
apps/lib/obex_io.c:68: check_return: Calling function
"stat(filename, &stats)" without checking return value. This library
function may fail and return an error code.
apps/obex_io.c:68: unchecked_value: No check of
the return value of "stat(filename, &stats)".

5 years agoAdd new header file openobex/version.h
Hendrik Sattler [Sat, 23 Feb 2013 11:19:07 +0000 (12:19 +0100)]
Add new header file openobex/version.h

5 years agoRemove left-over automake file
Hendrik Sattler [Sat, 23 Feb 2013 10:32:50 +0000 (11:32 +0100)]
Remove left-over automake file

5 years agoFix: limit each packet to at most one BODY/BODY_END header
Hendrik Sattler [Fri, 22 Feb 2013 12:41:03 +0000 (13:41 +0100)]
Fix: limit each packet to at most one BODY/BODY_END header

The Android OBEX implementation is buggy, so that a transfer always fails
because our last packet used to contain on BODY header and an (empty) BODY_END
header. Now, the BODY_END header is forced to an additional packet.

5 years agoFix update of cmake file install location on version change
Hendrik Sattler [Thu, 21 Feb 2013 21:33:28 +0000 (22:33 +0100)]
Fix update of cmake file install location on version change

5 years agoFix return codes for OBEX_Request()
Hendrik Sattler [Tue, 19 Feb 2013 08:51:10 +0000 (09:51 +0100)]
Fix return codes for OBEX_Request()

Also, since TX_REQUEST substate is set here, call the client state machine.

5 years agoDynamically create header file for symbol export definitions
Hendrik Sattler [Sun, 17 Feb 2013 22:43:14 +0000 (23:43 +0100)]
Dynamically create header file for symbol export definitions

5 years agoFix: remove markdown usage; OBEX_HandleInput -> OBEX_Work
Hendrik Sattler [Sun, 10 Feb 2013 16:25:37 +0000 (17:25 +0100)]
Fix: remove markdown usage; OBEX_HandleInput -> OBEX_Work

5 years agoStrip default settings
Hendrik Sattler [Sun, 10 Feb 2013 16:24:20 +0000 (17:24 +0100)]
Strip default settings

5 years agoAdd function to determine current data direction for OBEX_Work()
Hendrik Sattler [Sun, 10 Feb 2013 12:16:53 +0000 (13:16 +0100)]
Add function to determine current data direction for OBEX_Work()

5 years agoRestore older behaviour of OBEX_HandleInput() and add OBEX_Work() and OBEX_SetTimeout()
Hendrik Sattler [Sun, 10 Feb 2013 12:10:37 +0000 (13:10 +0100)]
Restore older behaviour of OBEX_HandleInput() and add OBEX_Work() and OBEX_SetTimeout()

In earlier versions like OpenObex-1.3, OBEX_HandleInput() really only needed to
be called when there was input available. The new behaviour also needed a call
to send data. Thus it was possible to make application non-functional that
depend on this behaviour (e.g. calling OBEX_HandleInput() from glib mainloop).

As a drawback, the timeout behaviour only means how to wait for input.
Preparing (application callbacks) or sending data can take any amount of time.

5 years agoAlways call the tx prepare function when setting SUBSTATE_TX_PREPARE
Hendrik Sattler [Sun, 10 Feb 2013 12:03:25 +0000 (13:03 +0100)]
Always call the tx prepare function when setting SUBSTATE_TX_PREPARE

5 years agoUse milliseconds in an int64_t for timeout value internally
Hendrik Sattler [Sun, 10 Feb 2013 12:01:58 +0000 (13:01 +0100)]
Use milliseconds in an int64_t for timeout value internally

6 years agoFix memory leaks
Hendrik Sattler [Wed, 3 Oct 2012 16:04:29 +0000 (18:04 +0200)]
Fix memory leaks

6 years agoForce correctness of integer headers when sending
Hendrik Sattler [Wed, 3 Oct 2012 06:21:05 +0000 (08:21 +0200)]
Force correctness of integer headers when sending

6 years agoAdd set_data() member for all obex_hdr
Hendrik Sattler [Wed, 3 Oct 2012 05:15:01 +0000 (07:15 +0200)]
Add set_data() member for all obex_hdr

This also share code of the pointer header in the stream header.

6 years agoFix file transfer server->client with more than one packet
Hendrik Sattler [Sun, 2 Sep 2012 06:09:21 +0000 (08:09 +0200)]
Fix file transfer server->client with more than one packet

6 years agoFix receiving files as server
Hendrik Sattler [Tue, 7 Aug 2012 20:09:58 +0000 (22:09 +0200)]
Fix receiving files as server

6 years agoAvoid double-free of body header
Hendrik Sattler [Wed, 1 Aug 2012 03:47:24 +0000 (05:47 +0200)]
Avoid double-free of body header

The body struct obex_hdr might still be present in the rx or tx header queues
at object deletion time. Avoid calling free() two times on that memory.

6 years agoSend 4-byte headers in network byte order
Hendrik Sattler [Tue, 31 Jul 2012 21:04:36 +0000 (23:04 +0200)]
Send 4-byte headers in network byte order

6 years agoReturn BODY_END on last header part
Hendrik Sattler [Tue, 31 Jul 2012 19:58:25 +0000 (21:58 +0200)]
Return BODY_END on last header part

6 years agoUse bool instead of int
Hendrik Sattler [Tue, 31 Jul 2012 19:55:01 +0000 (21:55 +0200)]
Use bool instead of int

6 years agoFix: do not delete object
Hendrik Sattler [Sat, 28 Jul 2012 19:10:00 +0000 (21:10 +0200)]
Fix: do not delete object

6 years agoinclude <string.h> for memcpy()
Iain Hibbert [Mon, 23 Jul 2012 18:30:15 +0000 (19:30 +0100)]
include <string.h> for memcpy()

6 years agoFix wrong logic for TX I/O
Hendrik Sattler [Mon, 9 Jul 2012 19:59:32 +0000 (21:59 +0200)]
Fix wrong logic for TX I/O

6 years agoMerge substates TX_INPROGRESS and TX_COMPLETE
Hendrik Sattler [Fri, 6 Jul 2012 19:46:19 +0000 (21:46 +0200)]
Merge substates TX_INPROGRESS and TX_COMPLETE

6 years agoChange return type of obex_msg_rx_status() to bool
Hendrik Sattler [Thu, 5 Jul 2012 17:47:08 +0000 (19:47 +0200)]
Change return type of obex_msg_rx_status() to bool

6 years agoMove buffer check to obex_msg
Hendrik Sattler [Wed, 4 Jul 2012 20:15:28 +0000 (22:15 +0200)]
Move buffer check to obex_msg

6 years agoMove SRM zero check to obex_main
Hendrik Sattler [Wed, 4 Jul 2012 04:05:28 +0000 (06:05 +0200)]
Move SRM zero check to obex_main

6 years agoDon't send fatal errors with blocking behaviour
Hendrik Sattler [Thu, 28 Jun 2012 04:57:24 +0000 (06:57 +0200)]
Don't send fatal errors with blocking behaviour

Instead, these errors are sent asynchronously from obex_work(), now.
Two "Internal Server Error"s are not sent anymore, this was wrong anyway.

6 years agoMake last argument of obex_deliver_event bool
Hendrik Sattler [Thu, 28 Jun 2012 04:54:44 +0000 (06:54 +0200)]
Make last argument of obex_deliver_event bool

6 years agoDeclare boolean arguments as bool
Hendrik Sattler [Mon, 25 Jun 2012 20:37:58 +0000 (22:37 +0200)]
Declare boolean arguments as bool

6 years agoChange substates and move common transmit code to obex_main
Hendrik Sattler [Sun, 24 Jun 2012 07:50:20 +0000 (09:50 +0200)]
Change substates and move common transmit code to obex_main

6 years agoShare code for setting MTU
Hendrik Sattler [Wed, 20 Jun 2012 19:29:45 +0000 (21:29 +0200)]
Share code for setting MTU

6 years agoRename lib/obex.c to lib/api.c
Hendrik Sattler [Wed, 20 Jun 2012 19:03:13 +0000 (21:03 +0200)]
Rename lib/obex.c to lib/api.c

6 years agoMove some function implementations to obex_main.c
Hendrik Sattler [Wed, 20 Jun 2012 18:58:08 +0000 (20:58 +0200)]
Move some function implementations to obex_main.c

This moves the function body of OBEX_Init to obex_library_init and obex_create
and makes the result reusable by OBEX_ServerAccept. Two other function bodys are
also moved.

6 years agoAdd missing $
Iain Hibbert [Tue, 19 Jun 2012 18:34:45 +0000 (19:34 +0100)]
Add missing $

6 years agoExtend cmake installed config file
Hendrik Sattler [Sat, 16 Jun 2012 06:37:01 +0000 (08:37 +0200)]
Extend cmake installed config file

Additionally, the same file can be used to directly use the files from a
build tree.

6 years agoMove server/connected decision back to obex_main
Hendrik Sattler [Thu, 14 Jun 2012 20:33:49 +0000 (22:33 +0200)]
Move server/connected decision back to obex_main

This needs a new transport attribute 'is_server' that indicates if listen was
called on this obex_t or if this obex_t is one that to be connected/accepted.
This needs a new create operation in obex_transport_ops and allows to simplify
obex_transport_create().

6 years agoRemove mtu attribute from obex_transport
Hendrik Sattler [Sun, 10 Jun 2012 19:20:03 +0000 (21:20 +0200)]
Remove mtu attribute from obex_transport

This was actively only used in fdobex but even there, it is not needed and is
handled more easily by choosing non-blocking behaviour.

6 years agoRemove type member from obex_transport
Hendrik Sattler [Sun, 10 Jun 2012 16:41:15 +0000 (18:41 +0200)]
Remove type member from obex_transport

According to IrOBEX specification, there is no IrTTP alignment requirement and
thus we just don't do this.
The only remaining usage of the type member is for protecting custom transport
data member access. This is not strictly needed, so it is also removed.

6 years agoRestrict transport calls to the value of connected attribute
Hendrik Sattler [Sun, 10 Jun 2012 11:12:08 +0000 (13:12 +0200)]
Restrict transport calls to the value of connected attribute

6 years agoRemove unnecessary includes and prototypes
Hendrik Sattler [Sun, 10 Jun 2012 11:09:09 +0000 (13:09 +0200)]
Remove unnecessary includes and prototypes

6 years agoChange transport functions return types
Hendrik Sattler [Sun, 10 Jun 2012 10:52:04 +0000 (12:52 +0200)]
Change transport functions return types

This inlcudes the return types of the obex_transport_* functions and
the function pointers in obex_transport_ops. The "connected" member is changed
to bool and the result of connect, accept and disconnect is assigned to it.

6 years agoFix socket disconnect
Hendrik Sattler [Sun, 10 Jun 2012 07:44:11 +0000 (09:44 +0200)]
Fix socket disconnect

6 years agoAdd CMake export files
Hendrik Sattler [Thu, 7 Jun 2012 20:47:20 +0000 (22:47 +0200)]
Add CMake export files

6 years agoFix independent transport data allocation
Hendrik Sattler [Thu, 7 Jun 2012 20:38:05 +0000 (22:38 +0200)]
Fix independent transport data allocation

6 years agoReplace int by fd_t for file descriptors
Hendrik Sattler [Tue, 5 Jun 2012 18:56:24 +0000 (20:56 +0200)]
Replace int by fd_t for file descriptors

File descriptors are unsigned int on WIN32 and int everywhere else.

6 years agoConvert int return values to bool or result_t
Hendrik Sattler [Tue, 5 Jun 2012 18:50:48 +0000 (20:50 +0200)]
Convert int return values to bool or result_t

6 years agoUnify socket transports
Hendrik Sattler [Sun, 3 Jun 2012 19:11:06 +0000 (21:11 +0200)]
Unify socket transports

This unifies the socket implementations for bluetooth, IrDA and TCP.

6 years agoUse defines.h for standard types
Hendrik Sattler [Sun, 3 Jun 2012 10:29:37 +0000 (12:29 +0200)]
Use defines.h for standard types

The include inttypes.h is moved to defines.h. The C99 include stdbool.h is also
added to allow usage of 'bool' type. An additional return_t type is added.

6 years agoAllocate each transport data independently
Hendrik Sattler [Sun, 13 May 2012 09:12:11 +0000 (11:12 +0200)]
Allocate each transport data independently

6 years agoRename states SEND and REC
Hendrik Sattler [Sat, 12 May 2012 20:56:08 +0000 (22:56 +0200)]
Rename states SEND and REC

6 years agoFix buffered body reception
Hendrik Sattler [Sat, 12 May 2012 11:09:51 +0000 (13:09 +0200)]
Fix buffered body reception

6 years agoFix return codes
Hendrik Sattler [Sat, 12 May 2012 11:03:18 +0000 (13:03 +0200)]
Fix return codes

6 years agoFix memory leaks
Hendrik Sattler [Fri, 11 May 2012 20:24:30 +0000 (22:24 +0200)]
Fix memory leaks

6 years agoAdd missing calls to cleanup RX buffer
Hendrik Sattler [Fri, 11 May 2012 04:37:53 +0000 (06:37 +0200)]
Add missing calls to cleanup RX buffer

6 years agoFix server events and object management
Hendrik Sattler [Thu, 10 May 2012 19:50:37 +0000 (21:50 +0200)]
Fix server events and object management

6 years agoRemove autotools build files
Hendrik Sattler [Sat, 5 May 2012 12:58:28 +0000 (14:58 +0200)]
Remove autotools build files

Cmake is way more flexible and we don't need to maintain two build systems.
If anyone insists on autotools (for whatever strange reason), please note
that reverting this change is not sufficient.

6 years agoRework msg creation/reception
Hendrik Sattler [Sat, 5 May 2012 12:35:50 +0000 (14:35 +0200)]
Rework msg creation/reception

Everything needed to control creation of a TX message from an obex_object_t and
to control parsing a RX message to an obex_object_t is now in obex_msg.c.
Almost all functions in obex_object.c are now independent of obex_t.

6 years agoSplit-off TX header post-processing
Hendrik Sattler [Mon, 30 Apr 2012 14:28:50 +0000 (16:28 +0200)]
Split-off TX header post-processing

Some headers (e.g. the SRM flags header) must be evaluated after being being
put into a TX message buffer. To get this out of the object append function,
the TX headers do not get deleted after usage and a header iterator is used
instead.

6 years agoSimplify obex_hdr iterator
Hendrik Sattler [Mon, 30 Apr 2012 08:48:00 +0000 (10:48 +0200)]
Simplify obex_hdr iterator

A pointer to a list element is sufficient, it does not need to be a deep copy.
To make it easier to us a [a..b] range or reuse the current element, the
function obex_hdr_it_getnext() is split and a comparison function is added.