Issue 92247 - xmlsecurity: avoid duplication of object code
Summary: xmlsecurity: avoid duplication of object code
Status: CLOSED FIXED
Alias: None
Product: xml
Classification: Code
Component: code (show other issues)
Version: DEV300m28
Hardware: All Linux, all
: P3 Trivial (vote)
Target Milestone: OOo 3.1
Assignee: frank
QA Contact: issues@xml
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-29 13:59 UTC by caolanm
Modified: 2008-11-12 13:51 UTC (History)
3 users (show)

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


Attachments
patch to do this (31.10 KB, patch)
2008-07-30 10:54 UTC, caolanm
no flags Details | Diff
updated patch (25.82 KB, patch)
2008-07-31 15:11 UTC, caolanm
no flags Details | Diff
move invasive patch (47.61 KB, patch)
2008-08-01 14:03 UTC, caolanm
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description caolanm 2008-07-29 13:59:56 UTC
Some code is linked both into libxmlsecurity and libxsec_xmlsec, I'd like to
avoid that, and thus avoid linking libxmlsecurity itself to libxmlsec1.
Comment 1 caolanm 2008-07-30 10:54:28 UTC
Created attachment 55445 [details]
patch to do this
Comment 2 caolanm 2008-07-30 10:59:53 UTC
cmc->mt: In xmlsecurity/util/makefile.mk is a to-do of "#MT: Remove libxml2 and
xs_comm (above) by creating service for base encodings"

I'd like to remove the linkage of libxmlsecurity on libxmlsec, leaving just
libxsec_xmlsec linked to libxmlsec. And removing the duplicated object code of
basencoding.o and biginteger.o which is linked into both. 

The attached patch does this by reusing the base64 encoder of the xmloff
project, and introducing a new uno api for converting the serial numbers to/from
big integer uno::sequences and OUStrings.

Is this ok from your side, or any alternative changes you'd prefer ?
Comment 3 malte_timmermann 2008-07-30 11:19:37 UTC
Jochen (jl) took over xmlsecurity some time ago...

Jochen - can you please have a look at that?

Thanks :)
Comment 4 joachim.lingner 2008-07-31 11:45:47 UTC
Good idea.
Please use a 'new style'. That is define the service in idl (should be a
separate file). For example:

service SerialNumberAdapter: XSerialNumberAdapter;

An instance is create like this:

Reference<XSerialNumberAdapter> adapter =
SerialNumberAdapter::create(component_context);

You can certainly find a description in the Developer's Guide. There are also
test services in testtools, which use a parameterized constructor. Look for the
service Constructor in 
testtools/source/bridgetest/idl/bridgetest.idl
testools/source/bridgetest/constructors.cxx
testtools/wntmsci12.pro/inc/test/testtools/bridgetest/Constructors.hpp

Having this service, I would create an instance in the classes directly where I
need them and not passing the interface along in the constructors. However, one
always needs the component context. So if you found an easy way to access the
context in the respective classes ...




Comment 5 caolanm 2008-07-31 15:11:18 UTC
Created attachment 55480 [details]
updated patch
Comment 6 caolanm 2008-07-31 15:12:54 UTC
How about this then, uses new service. 

Though the existing xmlsecurity doesn't keep any component handles around, so
still have to effectively key off the XMultiServiceFactory unless we go
rewriting a chunk of it, which is surely out of scope of this little effort
Comment 7 joachim.lingner 2008-08-01 07:32:39 UTC
Looks good. You missed the one creation of SerialNumberAdapter in
certificatechooser.cxx, though :)


Comment 8 caolanm 2008-08-01 09:57:18 UTC
Do you mean the comphelper::createProcessComponent usage in
certificatechooser.cxx, (and the same in macrosecurity.cxx), neither of those
already have a convenient handle. So would you prefer that I add a
XMultiServiceFactory member to CertificateChooser, (or add a XComponentContext
member to them) and key off that rather than using createProcessComponent ?
Comment 9 joachim.lingner 2008-08-01 10:58:19 UTC
I'd prefer to pass the XComponentContext along. That is,  the initial service
should keep the context and pass it to the constructors of other classes. But
that's the ideal world. So, leave it or change it if you like. :)
Comment 10 caolanm 2008-08-01 14:03:46 UTC
Created attachment 55493 [details]
move invasive patch
Comment 11 caolanm 2008-08-01 14:06:00 UTC
I kind of wanted to avoid getting sucked into fixing/updating code unrelated to
my mini-mission. But nevertheless, this should do the trick, bumping up from
XMultiServiceManagers to the XComponentContext based stuff the tree of users.
Comment 12 joachim.lingner 2008-08-01 14:14:47 UTC
... and while you are at it, how about fixing the whole signing feature? :)

Just kidding. Thanks for your trouble.
Comment 13 caolanm 2008-08-01 17:28:37 UTC
Checked into cmcfixes48
Comment 14 caolanm 2008-08-11 11:17:06 UTC
reassign for qa
Comment 15 frank 2008-08-15 10:59:27 UTC
Signing works as expected and fully functional. Checked with Linux and Windows build
Comment 16 caolanm 2008-11-12 13:51:45 UTC
Integrated DEV300m30