Commit Graph

61 Commits

Author SHA1 Message Date
Luiz Augusto von Dentz
30d6274498 obexd: remove unnecessary openobex includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
6e5ae4dc5c obexd: remove duplicated includes 2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
7c358987f9 obexd: Remove use of obex_object_t from service.h
Plugins including service.h need to include openobex headers because of
this.
2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
dcab04f113 obexd: Introduce obex_get_non_header_data
This function remove the need of calling OBEX_ObjectGetNonHdrData in the
plugins.
2012-12-04 22:48:48 +01:00
Luiz Augusto von Dentz
1f3e8d2f12 obexd: fix coding style
Make use of tabs instead of spaces
2012-12-04 22:48:47 +01:00
Luiz Augusto von Dentz
18f3c34d66 obexd: remove pcsuite code
pcsuite code has been moved to pcsuite plugin and this code is no
longer used.
2012-12-04 22:48:47 +01:00
Luiz Augusto von Dentz
b53c0f2086 obexd: Move secure flag to service driver
The driver already define the channel so it makes sense to have the
secure flag in the same place.
2012-12-04 22:48:47 +01:00
Luiz Augusto von Dentz
c178167496 obexd: Remove options per server
Options are general so it is pointless to copy them to each server.
2012-12-04 22:48:46 +01:00
Johan Hedberg
8db017fec4 obexd: Rename dbus.h to manager.g 2012-12-04 22:48:44 +01:00
Johan Hedberg
2a14f573bd obexd: Clean up header files 2012-12-04 22:48:43 +01:00
Slawomir Bochenski
c32fc4f096 obexd: Fix missing Name header check in FTP action code 2012-12-04 22:48:41 +01:00
Slawomir Bochenski
c38a2231dc obexd: Fix several issues in FTP action support
Fixed issues:
- Incorrect handling of absolute path in DestName header
- Possibility of exploiting DestName header to escape FTP plugin root
- Incorrect checking of whether path resides inside FTP root (not
  allowing to move or copy files up)
- Ignoring symbolic links and options regarding them
2012-12-04 22:48:41 +01:00
Slawomir Bochenski
da050e84cf obexd: Simplify symbolic links support
This patch changes the way the symbolic links are treated by FTP, making
code a bit simpler and FTP more intuitive.

Previously symlinks were supposed to be disallowed unless the -l option
was used, and with that option, only symlinks present directly inside
root folder were followed. This did not work for file links, as fstat()
check on open()-ed won't result in S_IFLNK set, so symbolic links to
files were followed regardless to options.

Now links inside root folder are always allowed. Without -l (--symlinks)
option, following them is only allowed when the resulting real path is
still inside the given root directory. When -l is given, all symlinks
are followed.
2012-12-04 22:48:41 +01:00
Slawomir Bochenski
ed7441b89d obexd: Add Name header check to ftp_chkput
Validation of Name header was missing from ftp_chkput, thus still allowing
actual putting.
2012-12-04 22:48:41 +01:00
Slawomir Bochenski
6b5d954ec7 obexd: Fix valid file name checks for FTP & OPP
Until now adversary could exploit OBEX Name header and perform any kind
of operations (listing, getting, putting) outside of given root by
putting path with ".." components inside this header.
2012-12-04 22:48:41 +01:00
Slawomir Bochenski
1729ca8692 obexd: Make mime type matching case-insensitive
This makes mime type checking performed inside plugins case-insensitive, to
be in line with d37af12d8cb76d1eb893955938cb6475333dddb9.
2012-12-04 22:48:41 +01:00
Slawomir Bochenski
e7856e1950 obexd: Start OpenOBEX stream automatically
This removes stream argument from service driver get() function. Now the
streaming is started automatically when first portion of data is
received.

Additionally the possibility to not send body header at all is added. This
can be achieved by returning -ENOSTR from mime plugin read() function.
2012-12-04 22:48:39 +01:00
Syam Sidhardhan
3724703d23 obexd: Fix white space related coding style issues
- Corrected space before '{'
- Corrected space after 'for'
- Corrected space during array initialization
- Corrected space between function arguments.
2012-12-04 22:48:38 +01:00
Luiz Augusto von Dentz
541f8c4f97 obexd: Add support for Action command to pcsuite plugin
PCSuite service relies on ftp driver
2012-12-04 22:48:37 +01:00
Luiz Augusto von Dentz
feeb8b396e obexd: Add basic support for action commands on ftp driver
This add basic support for copy and move actions for ftp service driver
2012-12-04 22:48:37 +01:00
Luiz Augusto von Dentz
4132366bf6 obexd: Move PC Suite drivers to its own plugin
This makes it easier to enable/disable this functionality as a whole.
2012-12-04 22:48:35 +01:00
Luiz Augusto von Dentz
8e773042ed obexd: Add more debug logs for ftp driver 2012-12-04 22:48:35 +01:00
Luiz Augusto von Dentz
06e746ca27 obexd: Add support for pcsuite lock file
This should make others applications able to detect when pcsuite is
connected.
2012-12-04 22:48:35 +01:00
Slawomir Bochenski
156374a0ee obexd: Change obex_service_driver put() signature
This API change is needed for implementing Message Access Profile, as
MAP uses application parameters in puts also (for example
SetMessageStatus function, see MAP specification, chapter 5.7) and in
order to access application parameters headers, access to obex object
is required.
2012-12-04 22:48:32 +01:00
Luiz Augusto von Dentz
b58862b284 obexd: Fix folder listing not able to use name header to list sub folders 2012-12-04 22:48:29 +01:00
Luiz Augusto Von Dentz
fc180e2f74 obexd: Replace uses of debug with DBG 2012-12-04 22:48:21 +01:00
Luiz Augusto von Dentz
97c6683e95 obexd: Add dynamic debug feature 2012-12-04 22:48:21 +01:00
Vinicius Costa Gomes
70bc46acf8 obexd: Fix FTP GET name handling
The FTP service was only using the current folder name to build the
target filename for GET requests.

And we must reject requests without name and type headers:

"Either the Type header or the Name header must be included in the
GET request when it is sent to the server." -- GOEP
2012-12-04 22:48:18 +01:00
Vinicius Costa Gomes
df9dd7403d obexd: Coding style fixes 2012-12-04 22:48:16 +01:00
Luiz Augusto von Dentz
38c2f10f77 obexd: Fix regression on opp put when name is not set
OBEX specification 1.3 says:

"Though the Name header is very useful for operations like file transfer,
it is optional"

To fix this the drivers .chkput can now return -EBADR which will be
translated to bad request, so in case of opp if the auto answer is not
active it will let the agent to set a proper name to the object.
2012-12-04 22:48:16 +01:00
Vinicius Costa Gomes
7c028648e2 obexd: drivers should know nothing about obex_session
This removes all references from obex_session from the drivers. At most,
they should only know about their respective services.
2012-12-04 22:48:14 +01:00
Claudio Takahasi
a5ebb33ef1 obexd: Implements PhonebookSize for PullPhoneBook function
According to PBAP spec, when MaxListCount is zero, the PSE shall
ignore all other application parameters that may be present in the
request and return the PhonebookSize encoded in the application
parameter.
2012-12-04 22:48:13 +01:00
Vinicius Costa Gomes
539120ca33 obexd: all the drivers structs can be declared static 2012-12-04 22:48:12 +01:00
Vinicius Costa Gomes
ed13e117c1 obexd: Renaming of obex_prepare_put and obex_stream_start
Make the use of these functions more clear, now they are called
obex_put_stream_start and obex_get_stream_start, respectively.
2012-12-04 22:48:12 +01:00
Vinicius Costa Gomes
6c4b6ba514 obexd: obexd core should know nothing about filesystems
obexd core should not assume that it is dealing with "real"
files.
2012-12-04 22:48:12 +01:00
Luiz Augusto Von Dentz
e265df7404 obexd: Fix bug when creating directories
(l)stat will return ENOENT when creating directories since mkdir hasn't
been called yet, which should be ignored and not returned as an error.
2012-12-04 22:48:12 +01:00
Claudio Takahasi
f53123b6a1 obexd: Added PBAP application parameter parser function 2012-12-04 22:48:11 +01:00
Vinicius Costa Gomes
4ce2d8b85b obexd: current_folder should not be in the core
We should not keep track of the current folder in the core obexd,
this should be taken care of by each plugin.
2012-12-04 22:48:11 +01:00
Vinicius Costa Gomes
556447e3b8 obexd: Add support for per service user data 2012-12-04 22:48:11 +01:00
Vinicius Costa Gomes
9a885b6bc3 obexd: Now obex_session is private to the core obexd
This finishes the process of making struct obex_session private to
the core.
2012-12-04 22:48:10 +01:00
Vinicius Costa Gomes
84786d598b obexd: Remove all the uses of obex_rsp_t 2012-12-04 22:48:10 +01:00
Claudio Takahasi
2e2c48dfc2 obexd: Initial support for mimetype drivers on PBAP
Initial step to convert the current PBAP implementation to mimetype
driver approach. This patch breaks ebook driver support temporarily.
2012-12-04 22:48:10 +01:00
Vinicius Costa Gomes
171d3aeca8 obexd: Cleaning up the ftp service
Now, all access to session information is done through the proper
channels.
2012-12-04 22:48:10 +01:00
Claudio Takahasi
0c2498c870 obexd: Cleanup of check put function of OBEX service driver 2012-12-04 22:48:09 +01:00
Claudio Takahasi
5ec3275a2e obexd: Rename some obexd core functions
It is not necessary add "session" in the name of these functions since
the first argument is the obex session structure. The following
functions were renamed: obex_session_get_name, obex_session_get_size
and obex_session_get_type.
2012-12-04 22:48:09 +01:00
Vinicius Costa Gomes
d485fe8bbd obexd: Cleanup of put function of OBEX service driver 2012-12-04 22:48:09 +01:00
Claudio Takahasi
eaa0966ae0 obexd: Cleanup of set path function of OBEX service driver 2012-12-04 22:48:09 +01:00
Vinicius Costa Gomes
cec04075a7 obexd: Cleanup of get function of OBEX service driver 2012-12-04 22:48:09 +01:00
Claudio Takahasi
815bfac99d obexd: Cleanup of disconnect function of OBEX service driver 2012-12-04 22:48:09 +01:00
Claudio Takahasi
ac94e9bd28 obexd: Initial core cleanup
Changed connect function of OBEX service driver to avoid access internal
obex session structure attributes.
2012-12-04 22:48:09 +01:00