[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Review Request 120202: [OS X] improvements to the kwallet/OSX keychain integration
From:       René J.V. Bertin <rjvbertin () gmail ! com>
Date:       2014-09-25 13:58:45
Message-ID: 20140925135845.6970.93544 () probe ! kde ! org
[Download RAW message or body]

--===============8850515733201621481==
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/120202/
-----------------------------------------------------------

(Updated Sept. 25, 2014, 3:58 p.m.)


Review request for KDE Software on Mac OS X and kdelibs.


Changes
-------

I have addressed the idleTimer's slot issue by making the WalletPrivate class inherit \
QObject in addition to QOSXKeychain.h . For that I've had to move it to a new \
headerfile, `kwallet_mac.h`, a header I could have created earlier given the \
complexity `kwallet_mac.cpp` has attained. In the end this I thought this was the \
cleanest solution.

Now that this is out of the way (I hope), I'd appreciate some feedback on the 2 open \
questions:

1- what is missing from my DBus implementation that could explain why I see the slots \
and signals in qdbusviewer but calls sent to the slots never arrive in my code? Or \
rather, how do I get it to work?

2- how to complete the DBus-free wallet-user registry? The only thing missing is a \
method to share the structure in distributed memory without a central server. I'd \
need something like QSharedMemory with resizing capabilities. Should I stop looking \
and share the reference to another QSharedMemory instance rather than share the \
registry's representation directly? A kind of shared handle (pointer to pointer, in \
old Apple speak from pre-MMU days). The requirements are simple: each application \
having a Wallet open should be able to read the current registry contents ("user \
list"), and add or remove oneself to/from it. All those operations can be performed \
on a copy freshly checked out of shared (and locked) memory but I fear it'd be rather \
delicate and race-condition prone. Each client will need to attach to the shared \
reference as well as the shared resource (to which that reference refers), and I \
think they'd all need to release the shared resource when the shared reference \
changes.

Any thoughts?

There was some demand from the kde-mac community to try and come up with an approach \
not requiring a central server (kwalletd), so I'd probably want to get approach 2 \
working even if we get approach 1 to function.


Repository: kdelibs


Description
-------

I'm still working on (the KDE4-based version of) my OS X keychain backend for \
kwallet. I'm at a point where I think I can present a work-in-progress in an RR \
because at least one feature has been improved enough to be of interest for everyone, \
and also because I could use feedback on how to proceed. I'm currently focussing on 2 \
settings that are configured in the kwallet KCM (SystemSettings), and for which I'm \
working on an implementation not requiring kwalletd and/or DBus.

- idle time closing of wallets. This feature was not supported in the commited \
version presented in https://git.reviewboard.kde.org/r/119838/ The present patch adds \
an idleTimer and a shared lastAccessTime member. The idleTimer is reset each time a \
client performs one of a series of actions that I count as wallet accesses, and \
before resetting I update the idle timeout value from KConfig. When the timer fires, \
the elapsed time is compared to the shared last access time, and if it is >= the \
timeout, the wallet is closed. This applies only to "KDE keychains", so keychains \
used by OS X applications should not be affected.

- "close when last application exits". This requires maintaining a "user list" which \
keeps track of what application has what wallet open. I've implemented an "internal" \
version of such a registry, mapping wallet name to application names and the list of \
wallets they have open (a list of wallet reference, pid per application name). The \
registry is functional, but I have not yet decided (read: figured out) how to make a \
distributed representation of it.

So the work-in-progress concerns the distributed user registry. The idea would be to \
maintain the registry in shared memory, meaning it'd be reset (= disappear) when the \
last application exits, contrary to a file which can go stale. This would be simple \
if QSharedMemory objects could be resized, but apparently they cannot, so I'll have \
to look at other solutions possibly involving OS X frameworks (NSData and it's \
non-objectiveC version CFDataRef or CFMutableDataRef might be candidates). \
Suggestions welcome.

Other work in progress concerns a less wheel-reinventing approach that builds on \
kwalletd and DBus. I don't see why the code used in `kwallet.cpp` wouldn't work, but \
I must still misunderstand its finer details. The present patch contains outcommented \
code that does indeed cause kwalletd to be launched and slots and signals to become \
visible e.g. in `qdbusviewer`. But they don't work, which in turn makes the whole \
kwallet layer dysfunctional. Here too feedback is welcome on how what I'm missing \
and/or how to get this to work. Once kwalletd works, wallet idle timeout closing and \
closing when the last client exits should work out-of-the-box, or at least I suppose.


Diffs (updated)
-----

  kdeui/util/kwallet.h d7f703f 
  kdeui/util/kwallet_mac.cpp 8344ebb 
  kdeui/util/qosxkeychain.h d0934e6 
  kdeui/util/qosxkeychain.cpp 7cb9a22 

Diff: https://git.reviewboard.kde.org/r/120202/diff/


Testing
-------

OS X 10.6.8, kdelibs 4.14.1 git/master, KDE/MacPorts 4.12.5 .
Once finalised, all changes should port easily to KF5's kwallet_mac.cpp .


Thanks,

René J.V. Bertin


--===============8850515733201621481==
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 8bit




<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 \
solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">  \
<tr>  <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/120202/">https://git.reviewboard.kde.org/r/120202/</a>
  </td>
    </tr>
   </table>
   <br />





<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: \
1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; \
-webkit-border-radius: 6px;">  <tr>
  <td>

<div>Review request for KDE Software on Mac OS X and kdelibs.</div>
<div>By René J.V. Bertin.</div>


<p style="color: grey;"><i>Updated Sept. 25, 2014, 3:58 p.m.</i></p>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">I have addressed the idleTimer&#39;s slot issue by making the \
WalletPrivate class inherit QObject in addition to QOSXKeychain.h . For that I&#39;ve \
had to move it to a new headerfile, `kwallet_mac.h`, a header I could have created \
earlier given the complexity `kwallet_mac.cpp` has attained. In the end this I \
thought this was the cleanest solution.

Now that this is out of the way (I hope), I&#39;d appreciate some feedback on the 2 \
open questions:

1- what is missing from my DBus implementation that could explain why I see the slots \
and signals in qdbusviewer but calls sent to the slots never arrive in my code? Or \
rather, how do I get it to work?

2- how to complete the DBus-free wallet-user registry? The only thing missing is a \
method to share the structure in distributed memory without a central server. I&#39;d \
need something like QSharedMemory with resizing capabilities. Should I stop looking \
and share the reference to another QSharedMemory instance rather than share the \
registry&#39;s representation directly? A kind of shared handle (pointer to pointer, \
in old Apple speak from pre-MMU days). The requirements are simple: each application \
having a Wallet open should be able to read the current registry contents (&quot;user \
list&quot;), and add or remove oneself to/from it. All those operations can be \
performed on a copy freshly checked out of shared (and locked) memory but I fear \
it&#39;d be rather delicate and race-condition prone. Each client will need to attach \
to the shared reference as well as the shared resource (to which that reference \
refers), and I think they&#39;d all need to release the shared resource when the \
shared reference changes.

Any thoughts?

There was some demand from the kde-mac community to try and come up with an approach \
not requiring a central server (kwalletd), so I&#39;d probably want to get approach 2 \
working even if we get approach 1 to function. </pre>
  </td>
 </tr>
</table>







<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
kdelibs
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">I'm still working on (the KDE4-based version of) my OS \
X keychain backend for kwallet. I'm at a point where I think I can present a \
work-in-progress in an RR because at least one feature has been improved enough to be \
of interest for everyone, and also because I could use feedback on how to proceed.<br \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
normal;" /> I'm currently focussing on 2 settings that are configured in the kwallet \
KCM (SystemSettings), and for which I'm working on an implementation not requiring \
kwalletd and/or DBus.</p> <ul style="padding: 0;text-rendering: inherit;margin: 0 0 0 \
1em;line-height: inherit;white-space: normal;"> <li style="padding: 0;text-rendering: \
inherit;margin: 0;line-height: inherit;white-space: normal;"> <p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">idle \
time closing of wallets. This feature was not supported in the commited version \
presented in https://git.reviewboard.kde.org/r/119838/ The present patch adds an \
idleTimer and a shared lastAccessTime member. The idleTimer is reset each time a \
client performs one of a series of actions that I count as wallet accesses, and \
before resetting I update the idle timeout value from KConfig. When the timer fires, \
the elapsed time is compared to the shared last access time, and if it is &gt;= the \
timeout, the wallet is closed. This applies only to "KDE keychains", so keychains \
used by OS X applications should not be affected.</p> </li>
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: normal;"> <p style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: inherit;">"close when last application exits". \
This requires maintaining a "user list" which keeps track of what application has \
what wallet open. I've implemented an "internal" version of such a registry, mapping \
wallet name to application names and the list of wallets they have open (a list of \
wallet reference, pid per application name). The registry is functional, but I have \
not yet decided (read: figured out) how to make a distributed representation of \
it.</p> </li>
</ul>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">So the work-in-progress concerns the distributed user \
registry. The idea would be to maintain the registry in shared memory, meaning it'd \
be reset (= disappear) when the last application exits, contrary to a file which can \
go stale. This would be simple if QSharedMemory objects could be resized, but \
apparently they cannot, so I'll have to look at other solutions possibly involving OS \
X frameworks (NSData and it's non-objectiveC version CFDataRef or CFMutableDataRef \
might be candidates). Suggestions welcome.</p> <p style="padding: 0;text-rendering: \
inherit;margin: 0;line-height: inherit;white-space: inherit;">Other work in progress \
concerns a less wheel-reinventing approach that builds on kwalletd and DBus. I don't \
see why the code used in <code style="text-rendering: inherit;color: #4444cc;padding: \
0;white-space: normal;margin: 0;line-height: inherit;">kwallet.cpp</code> wouldn't \
work, but I must still misunderstand its finer details. The present patch contains \
outcommented code that does indeed cause kwalletd to be launched and slots and \
signals to become visible e.g. in <code style="text-rendering: inherit;color: \
#4444cc;padding: 0;white-space: normal;margin: 0;line-height: \
inherit;">qdbusviewer</code>. But they don't work, which in turn makes the whole \
kwallet layer dysfunctional. Here too feedback is welcome on how what I'm missing \
and/or how to get this to work.<br style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: normal;" /> Once kwalletd works, wallet idle \
timeout closing and closing when the last client exits should work out-of-the-box, or \
at least I suppose.</p></pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">OS X 10.6.8, kdelibs 4.14.1 git/master, KDE/MacPorts \
4.12.5 .<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: normal;" /> Once finalised, all changes should port easily to \
KF5's kwallet_mac.cpp .</p></pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> \
(updated)</h1> <ul style="margin-left: 3em; padding-left: 0;">

 <li>kdeui/util/kwallet.h <span style="color: grey">(d7f703f)</span></li>

 <li>kdeui/util/kwallet_mac.cpp <span style="color: grey">(8344ebb)</span></li>

 <li>kdeui/util/qosxkeychain.h <span style="color: grey">(d0934e6)</span></li>

 <li>kdeui/util/qosxkeychain.cpp <span style="color: grey">(7cb9a22)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/120202/diff/" style="margin-left: \
3em;">View Diff</a></p>






  </td>
 </tr>
</table>




  </div>
 </body>
</html>


--===============8850515733201621481==--


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic