Issue 87490 - sfx2: http|ftp|https|file hyperlinks treated different than e.g. smb
Summary: sfx2: http|ftp|https|file hyperlinks treated different than e.g. smb
Status: CLOSED FIXED
Alias: None
Product: General
Classification: Code
Component: code (show other issues)
Version: DEV300m4
Hardware: All Linux, all
: P3 Trivial (vote)
Target Milestone: OOo 3.1
Assignee: Mathias_Bauer
QA Contact: issues@framework
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-27 10:33 UTC by caolanm
Modified: 2009-02-24 14:19 UTC (History)
1 user (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
patch to do this (2.19 KB, patch)
2008-03-27 10:34 UTC, caolanm
no flags Details | Diff
slightly reworked patch (2.24 KB, patch)
2008-04-11 13:36 UTC, caolanm
no flags Details | Diff
smaller patch from mba (1.02 KB, text/plain)
2008-12-03 17:05 UTC, Mathias_Bauer
no flags Details
Something like this would restore help links (1.10 KB, patch)
2008-12-04 10:28 UTC, caolanm
no flags Details | Diff
patch using protocol handler configuration (7.14 KB, text/plain)
2009-01-20 16:13 UTC, Mathias_Bauer
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description caolanm 2008-03-27 10:33:59 UTC
So if in writer we insert a hyperlink to e.g. a png as file:///tmp/demo.png and
click on it under gnome then gnome-open-url is spawned off to handle it and it
typically opens in eog. On the other hand if we insert a link like
smb:///localhost/share/demo.png the png is opened in draw (when the gnome-vfs2
ucb backend is available)

We've effectively got a white-list of url types that we pass to the open-url
handlers in sfx2, Attached is a patch to treat all non-mailto: urls the same and
give open-url a bite at the cherry to attempt to handle it.
Comment 1 caolanm 2008-03-27 10:34:21 UTC
Created attachment 52314 [details]
patch to do this
Comment 2 Mathias_Bauer 2008-03-27 19:48:05 UTC
The patch might cause problems as the code in appopen.cxx also is used for
hyperlinks etc. 

So hyperlinks to files that OOo can't load or programs now will fail.

So I hesitate to accept it.
Comment 3 caolanm 2008-03-27 20:23:41 UTC
I'm not sure that the situation wrt. anything opened through the existing
whitelisted protocols significantly changes ? Unless I'm missing something or
taking too local a look at the code.

In the current situation the whitelisted http|https and ftp urls get passed to
the first xSystemShellExecute->execute branch and on failure of that (e.g. a
failure of the eventually called gnome-open-url or cde-open-url) you just get an
error dialog of some kind.

In the new situation those urls still get passed to what was the second
xSystemShellExecute->execute that was previously only used for file://, where
the difference is that if that fails and there is a possible OOo filter for them
it continues on to get opened by OOo itself. So the current situation should
remain basically unchanged for the existing whitelisted url patterns, except
that OOo will now make an extra attempt to open them if FOO-open-url fails.

And in either case this is supposed to open happen for "external" formats. What
might break is the case of urls like smb://|webdav:// which previously would
only have been handled successfully by OOo itself now getting passed to
FOO-open-url first which might e.g. fail and not return a failure or do
something else unexpected.
Comment 4 caolanm 2008-04-11 08:54:43 UTC
"What might break is the case of urls ... now getting passed to
FOO-open-url first which might e.g. fail and not return a failure or do
something else unexpected."

Bah, and right now passing the help urls would cause just this to happen,
gnome-open passes them to firefox (for some reason) which just pops up a dialog
complaining, i.e. "something unexpected".
Comment 5 Mathias_Bauer 2008-04-11 13:28:32 UTC
Caolan, I will have a closer look on the patch next week. Currently I'm too busy
with other things and the code freeze for beta has passed anyway. So we're not
in a hurry, I assume.

I've set the target to 3.0.
Comment 6 caolanm 2008-04-11 13:32:22 UTC
Oh no hurry at all
Comment 7 caolanm 2008-04-11 13:36:20 UTC
Created attachment 52751 [details]
slightly reworked patch
Comment 8 Mathias_Bauer 2008-06-23 14:21:13 UTC
I wonder whether the more frequent use of "IsSecureURL" now might lead to
problems, by default obviously not.

The test matrix won't be small - do you agree with target 3.1 to get more time?
Comment 9 caolanm 2008-06-23 22:23:19 UTC
That's fine, I don't mind a delay as long as the principle at least is
considered desirable, even if the first cut at implementation may turn out to
throw up some unexpected nasties.
Comment 10 Mathias_Bauer 2008-06-24 08:37:12 UTC
Yes, your idea is right in general. The "design" of that function was made
before we got the Gnome VFS extensions and should have been revised already. My
problem is just that I have to rethink the current design (fortunately we have a
spec for it ;-)) before I can review changes made to it.
Comment 11 Mathias_Bauer 2008-09-08 10:10:30 UTC
The reason why we used white listing is that the list of "internal" protocols
that only OOo can handle is extendable. vnd.sun.star.help is one example, others
could be brought in by extensions. 

If the OS hands over unknown protocols to the web browser other protocols can
cause the same error message, as you discovered for the help protocol.

Would extending the white list to "smb:" and probably others be acceptable?
Surely the number of "external" protocols is extendable also, but IMHO it's
comprehensible that an application first tries to get its own stuff running well
before it looks for better OS integration.

If we handed over more protocols to the system we had to decide whether they
should go through a security check ("IsSecureURL") or not. Currently we have the
situation that in case of http(s) and ftp we assume that the browser will do
that and that OOo must do it for "file:". IMHO any other protocol perhaps should
be treated like the "file:" protocol, means: IsSecureURL() should be called. 

We shouldn't do this for http(s) and ftp as then they wouldn't become executed
then in case they are part of a document from the internet (what surely is
expected for "file:" or "smb:" URLs!), so we still need the white listing for
this difference.
Comment 12 Mathias_Bauer 2008-11-20 16:51:26 UTC
added it to CWS mba31issues01
Comment 13 Mathias_Bauer 2008-12-03 17:04:09 UTC
So now back to work. :-)

To make the changes smaller I would like to propose the changed patch. Please
comment.
Comment 14 Mathias_Bauer 2008-12-03 17:05:18 UTC
Created attachment 58473 [details]
smaller patch from mba
Comment 15 caolanm 2008-12-04 10:27:29 UTC
Start Help and click on something. Given just this patch then for me help links
would be passed out to a system handler and not get handled by ourselves.
Comment 16 caolanm 2008-12-04 10:28:30 UTC
Created attachment 58500 [details]
Something like this would restore help links
Comment 17 Mathias_Bauer 2008-12-04 16:14:28 UTC
Oh yes, but that can be added easily. The question is: does that solve your
problem? It would remove my concern wrt. the security checks.
Comment 18 caolanm 2008-12-04 16:44:24 UTC
Yeah, otherwise works fine on the type of urls I care about anyway
Comment 19 Mathias_Bauer 2008-12-05 15:23:14 UTC
Thinking a bit further: "vnd.sun.star.help" isn't the only internal protocol we
have. And more over, the list of internal protocols can be extended. 
All of these protocols (once used in a hyperlink) will create the same error
message as we get for help links in my tentative patch.

So I start to think that an unqualified "else" part isn't the right solution.
I'm afraid that we must extend our "white list" for externally handable
protocols. Very unfortunate. The best thing would be if we could get a list of
protocols the system can handle. But I assume that this is not easy, right?
Comment 20 Mathias_Bauer 2009-01-12 11:56:06 UTC
It seems that checking the ProtocolHandler service for registered protocols
instead of checking for "vnd.sun.star.help" only should do the trick. Assuming
that all registered protocols are "OOo internal" only is the best guess we can make.
Comment 21 Mathias_Bauer 2009-01-20 16:12:12 UTC
Here's a patch that implements the usage of the protocol handler.
Caolan, would that be OK for you?
Comment 22 Mathias_Bauer 2009-01-20 16:13:47 UTC
Created attachment 59531 [details]
patch using protocol handler configuration
Comment 23 caolanm 2009-01-21 16:16:55 UTC
That's fine by me, should give consistent behaviour. In my own case it should
mean that e.g. file:///tmp/demo.png and smb:///localhost/share/demo.png (seeing
as we use the gio and/or gnome-vfs ucb handler) would both end up getting opened
by OOo as they can be handled "internally"
Comment 24 Mathias_Bauer 2009-01-21 17:15:19 UTC
The code doesn not check for UCPs, it just checks protocol handlers. So "file:"
should be handled externally as well as "smb:".
Comment 25 Mathias_Bauer 2009-02-02 12:24:46 UTC
fixed in CWS mba31issues01
Comment 26 Mathias_Bauer 2009-02-02 12:25:15 UTC
verified in CWS build
Comment 27 caolanm 2009-02-24 14:18:44 UTC
seen in OOO310_m2 and DEV300_m42