merged in default ENGINE-214
authorKrista Bennett <krista@pep-project.org>
Wed, 30 Aug 2017 14:42:51 +0200
branchENGINE-214
changeset 2025d8ed439646a9
parent 1982 2e3144cccecc
parent 2022 b2779c4e69f1
child 2029 2099e8070d96
merged in default
README-OSX.md
README.txt
TODO.txt
macports_env.sh
src/message_api.c
     1.1 --- a/.hgignore	Mon Aug 14 09:13:53 2017 +0200
     1.2 +++ b/.hgignore	Wed Aug 30 14:42:51 2017 +0200
     1.3 @@ -3,6 +3,7 @@
     1.4  ^asn\.1/Makefile\.am\.sample$
     1.5  ^asn\.1/libasn1\.a$
     1.6  .*xcuserdata/
     1.7 +^build/
     1.8  
     1.9  syntax: glob
    1.10  *.orig
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/CC_BY-SA.txt	Wed Aug 30 14:42:51 2017 +0200
     2.3 @@ -0,0 +1,359 @@
     2.4 +Creative Commons Legal Code
     2.5 +
     2.6 +Attribution-ShareAlike 3.0 Unported
     2.7 +
     2.8 +    CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
     2.9 +    LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN
    2.10 +    ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
    2.11 +    INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
    2.12 +    REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR
    2.13 +    DAMAGES RESULTING FROM ITS USE.
    2.14 +
    2.15 +License
    2.16 +
    2.17 +THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE
    2.18 +COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY
    2.19 +COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS
    2.20 +AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
    2.21 +
    2.22 +BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE
    2.23 +TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY
    2.24 +BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS
    2.25 +CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND
    2.26 +CONDITIONS.
    2.27 +
    2.28 +1. Definitions
    2.29 +
    2.30 + a. "Adaptation" means a work based upon the Work, or upon the Work and
    2.31 +    other pre-existing works, such as a translation, adaptation,
    2.32 +    derivative work, arrangement of music or other alterations of a
    2.33 +    literary or artistic work, or phonogram or performance and includes
    2.34 +    cinematographic adaptations or any other form in which the Work may be
    2.35 +    recast, transformed, or adapted including in any form recognizably
    2.36 +    derived from the original, except that a work that constitutes a
    2.37 +    Collection will not be considered an Adaptation for the purpose of
    2.38 +    this License. For the avoidance of doubt, where the Work is a musical
    2.39 +    work, performance or phonogram, the synchronization of the Work in
    2.40 +    timed-relation with a moving image ("synching") will be considered an
    2.41 +    Adaptation for the purpose of this License.
    2.42 + b. "Collection" means a collection of literary or artistic works, such as
    2.43 +    encyclopedias and anthologies, or performances, phonograms or
    2.44 +    broadcasts, or other works or subject matter other than works listed
    2.45 +    in Section 1(f) below, which, by reason of the selection and
    2.46 +    arrangement of their contents, constitute intellectual creations, in
    2.47 +    which the Work is included in its entirety in unmodified form along
    2.48 +    with one or more other contributions, each constituting separate and
    2.49 +    independent works in themselves, which together are assembled into a
    2.50 +    collective whole. A work that constitutes a Collection will not be
    2.51 +    considered an Adaptation (as defined below) for the purposes of this
    2.52 +    License.
    2.53 + c. "Creative Commons Compatible License" means a license that is listed
    2.54 +    at https://creativecommons.org/compatiblelicenses that has been
    2.55 +    approved by Creative Commons as being essentially equivalent to this
    2.56 +    License, including, at a minimum, because that license: (i) contains
    2.57 +    terms that have the same purpose, meaning and effect as the License
    2.58 +    Elements of this License; and, (ii) explicitly permits the relicensing
    2.59 +    of adaptations of works made available under that license under this
    2.60 +    License or a Creative Commons jurisdiction license with the same
    2.61 +    License Elements as this License.
    2.62 + d. "Distribute" means to make available to the public the original and
    2.63 +    copies of the Work or Adaptation, as appropriate, through sale or
    2.64 +    other transfer of ownership.
    2.65 + e. "License Elements" means the following high-level license attributes
    2.66 +    as selected by Licensor and indicated in the title of this License:
    2.67 +    Attribution, ShareAlike.
    2.68 + f. "Licensor" means the individual, individuals, entity or entities that
    2.69 +    offer(s) the Work under the terms of this License.
    2.70 + g. "Original Author" means, in the case of a literary or artistic work,
    2.71 +    the individual, individuals, entity or entities who created the Work
    2.72 +    or if no individual or entity can be identified, the publisher; and in
    2.73 +    addition (i) in the case of a performance the actors, singers,
    2.74 +    musicians, dancers, and other persons who act, sing, deliver, declaim,
    2.75 +    play in, interpret or otherwise perform literary or artistic works or
    2.76 +    expressions of folklore; (ii) in the case of a phonogram the producer
    2.77 +    being the person or legal entity who first fixes the sounds of a
    2.78 +    performance or other sounds; and, (iii) in the case of broadcasts, the
    2.79 +    organization that transmits the broadcast.
    2.80 + h. "Work" means the literary and/or artistic work offered under the terms
    2.81 +    of this License including without limitation any production in the
    2.82 +    literary, scientific and artistic domain, whatever may be the mode or
    2.83 +    form of its expression including digital form, such as a book,
    2.84 +    pamphlet and other writing; a lecture, address, sermon or other work
    2.85 +    of the same nature; a dramatic or dramatico-musical work; a
    2.86 +    choreographic work or entertainment in dumb show; a musical
    2.87 +    composition with or without words; a cinematographic work to which are
    2.88 +    assimilated works expressed by a process analogous to cinematography;
    2.89 +    a work of drawing, painting, architecture, sculpture, engraving or
    2.90 +    lithography; a photographic work to which are assimilated works
    2.91 +    expressed by a process analogous to photography; a work of applied
    2.92 +    art; an illustration, map, plan, sketch or three-dimensional work
    2.93 +    relative to geography, topography, architecture or science; a
    2.94 +    performance; a broadcast; a phonogram; a compilation of data to the
    2.95 +    extent it is protected as a copyrightable work; or a work performed by
    2.96 +    a variety or circus performer to the extent it is not otherwise
    2.97 +    considered a literary or artistic work.
    2.98 + i. "You" means an individual or entity exercising rights under this
    2.99 +    License who has not previously violated the terms of this License with
   2.100 +    respect to the Work, or who has received express permission from the
   2.101 +    Licensor to exercise rights under this License despite a previous
   2.102 +    violation.
   2.103 + j. "Publicly Perform" means to perform public recitations of the Work and
   2.104 +    to communicate to the public those public recitations, by any means or
   2.105 +    process, including by wire or wireless means or public digital
   2.106 +    performances; to make available to the public Works in such a way that
   2.107 +    members of the public may access these Works from a place and at a
   2.108 +    place individually chosen by them; to perform the Work to the public
   2.109 +    by any means or process and the communication to the public of the
   2.110 +    performances of the Work, including by public digital performance; to
   2.111 +    broadcast and rebroadcast the Work by any means including signs,
   2.112 +    sounds or images.
   2.113 + k. "Reproduce" means to make copies of the Work by any means including
   2.114 +    without limitation by sound or visual recordings and the right of
   2.115 +    fixation and reproducing fixations of the Work, including storage of a
   2.116 +    protected performance or phonogram in digital form or other electronic
   2.117 +    medium.
   2.118 +
   2.119 +2. Fair Dealing Rights. Nothing in this License is intended to reduce,
   2.120 +limit, or restrict any uses free from copyright or rights arising from
   2.121 +limitations or exceptions that are provided for in connection with the
   2.122 +copyright protection under copyright law or other applicable laws.
   2.123 +
   2.124 +3. License Grant. Subject to the terms and conditions of this License,
   2.125 +Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
   2.126 +perpetual (for the duration of the applicable copyright) license to
   2.127 +exercise the rights in the Work as stated below:
   2.128 +
   2.129 + a. to Reproduce the Work, to incorporate the Work into one or more
   2.130 +    Collections, and to Reproduce the Work as incorporated in the
   2.131 +    Collections;
   2.132 + b. to create and Reproduce Adaptations provided that any such Adaptation,
   2.133 +    including any translation in any medium, takes reasonable steps to
   2.134 +    clearly label, demarcate or otherwise identify that changes were made
   2.135 +    to the original Work. For example, a translation could be marked "The
   2.136 +    original work was translated from English to Spanish," or a
   2.137 +    modification could indicate "The original work has been modified.";
   2.138 + c. to Distribute and Publicly Perform the Work including as incorporated
   2.139 +    in Collections; and,
   2.140 + d. to Distribute and Publicly Perform Adaptations.
   2.141 + e. For the avoidance of doubt:
   2.142 +
   2.143 +     i. Non-waivable Compulsory License Schemes. In those jurisdictions in
   2.144 +        which the right to collect royalties through any statutory or
   2.145 +        compulsory licensing scheme cannot be waived, the Licensor
   2.146 +        reserves the exclusive right to collect such royalties for any
   2.147 +        exercise by You of the rights granted under this License;
   2.148 +    ii. Waivable Compulsory License Schemes. In those jurisdictions in
   2.149 +        which the right to collect royalties through any statutory or
   2.150 +        compulsory licensing scheme can be waived, the Licensor waives the
   2.151 +        exclusive right to collect such royalties for any exercise by You
   2.152 +        of the rights granted under this License; and,
   2.153 +   iii. Voluntary License Schemes. The Licensor waives the right to
   2.154 +        collect royalties, whether individually or, in the event that the
   2.155 +        Licensor is a member of a collecting society that administers
   2.156 +        voluntary licensing schemes, via that society, from any exercise
   2.157 +        by You of the rights granted under this License.
   2.158 +
   2.159 +The above rights may be exercised in all media and formats whether now
   2.160 +known or hereafter devised. The above rights include the right to make
   2.161 +such modifications as are technically necessary to exercise the rights in
   2.162 +other media and formats. Subject to Section 8(f), all rights not expressly
   2.163 +granted by Licensor are hereby reserved.
   2.164 +
   2.165 +4. Restrictions. The license granted in Section 3 above is expressly made
   2.166 +subject to and limited by the following restrictions:
   2.167 +
   2.168 + a. You may Distribute or Publicly Perform the Work only under the terms
   2.169 +    of this License. You must include a copy of, or the Uniform Resource
   2.170 +    Identifier (URI) for, this License with every copy of the Work You
   2.171 +    Distribute or Publicly Perform. You may not offer or impose any terms
   2.172 +    on the Work that restrict the terms of this License or the ability of
   2.173 +    the recipient of the Work to exercise the rights granted to that
   2.174 +    recipient under the terms of the License. You may not sublicense the
   2.175 +    Work. You must keep intact all notices that refer to this License and
   2.176 +    to the disclaimer of warranties with every copy of the Work You
   2.177 +    Distribute or Publicly Perform. When You Distribute or Publicly
   2.178 +    Perform the Work, You may not impose any effective technological
   2.179 +    measures on the Work that restrict the ability of a recipient of the
   2.180 +    Work from You to exercise the rights granted to that recipient under
   2.181 +    the terms of the License. This Section 4(a) applies to the Work as
   2.182 +    incorporated in a Collection, but this does not require the Collection
   2.183 +    apart from the Work itself to be made subject to the terms of this
   2.184 +    License. If You create a Collection, upon notice from any Licensor You
   2.185 +    must, to the extent practicable, remove from the Collection any credit
   2.186 +    as required by Section 4(c), as requested. If You create an
   2.187 +    Adaptation, upon notice from any Licensor You must, to the extent
   2.188 +    practicable, remove from the Adaptation any credit as required by
   2.189 +    Section 4(c), as requested.
   2.190 + b. You may Distribute or Publicly Perform an Adaptation only under the
   2.191 +    terms of: (i) this License; (ii) a later version of this License with
   2.192 +    the same License Elements as this License; (iii) a Creative Commons
   2.193 +    jurisdiction license (either this or a later license version) that
   2.194 +    contains the same License Elements as this License (e.g.,
   2.195 +    Attribution-ShareAlike 3.0 US)); (iv) a Creative Commons Compatible
   2.196 +    License. If you license the Adaptation under one of the licenses
   2.197 +    mentioned in (iv), you must comply with the terms of that license. If
   2.198 +    you license the Adaptation under the terms of any of the licenses
   2.199 +    mentioned in (i), (ii) or (iii) (the "Applicable License"), you must
   2.200 +    comply with the terms of the Applicable License generally and the
   2.201 +    following provisions: (I) You must include a copy of, or the URI for,
   2.202 +    the Applicable License with every copy of each Adaptation You
   2.203 +    Distribute or Publicly Perform; (II) You may not offer or impose any
   2.204 +    terms on the Adaptation that restrict the terms of the Applicable
   2.205 +    License or the ability of the recipient of the Adaptation to exercise
   2.206 +    the rights granted to that recipient under the terms of the Applicable
   2.207 +    License; (III) You must keep intact all notices that refer to the
   2.208 +    Applicable License and to the disclaimer of warranties with every copy
   2.209 +    of the Work as included in the Adaptation You Distribute or Publicly
   2.210 +    Perform; (IV) when You Distribute or Publicly Perform the Adaptation,
   2.211 +    You may not impose any effective technological measures on the
   2.212 +    Adaptation that restrict the ability of a recipient of the Adaptation
   2.213 +    from You to exercise the rights granted to that recipient under the
   2.214 +    terms of the Applicable License. This Section 4(b) applies to the
   2.215 +    Adaptation as incorporated in a Collection, but this does not require
   2.216 +    the Collection apart from the Adaptation itself to be made subject to
   2.217 +    the terms of the Applicable License.
   2.218 + c. If You Distribute, or Publicly Perform the Work or any Adaptations or
   2.219 +    Collections, You must, unless a request has been made pursuant to
   2.220 +    Section 4(a), keep intact all copyright notices for the Work and
   2.221 +    provide, reasonable to the medium or means You are utilizing: (i) the
   2.222 +    name of the Original Author (or pseudonym, if applicable) if supplied,
   2.223 +    and/or if the Original Author and/or Licensor designate another party
   2.224 +    or parties (e.g., a sponsor institute, publishing entity, journal) for
   2.225 +    attribution ("Attribution Parties") in Licensor's copyright notice,
   2.226 +    terms of service or by other reasonable means, the name of such party
   2.227 +    or parties; (ii) the title of the Work if supplied; (iii) to the
   2.228 +    extent reasonably practicable, the URI, if any, that Licensor
   2.229 +    specifies to be associated with the Work, unless such URI does not
   2.230 +    refer to the copyright notice or licensing information for the Work;
   2.231 +    and (iv) , consistent with Ssection 3(b), in the case of an
   2.232 +    Adaptation, a credit identifying the use of the Work in the Adaptation
   2.233 +    (e.g., "French translation of the Work by Original Author," or
   2.234 +    "Screenplay based on original Work by Original Author"). The credit
   2.235 +    required by this Section 4(c) may be implemented in any reasonable
   2.236 +    manner; provided, however, that in the case of a Adaptation or
   2.237 +    Collection, at a minimum such credit will appear, if a credit for all
   2.238 +    contributing authors of the Adaptation or Collection appears, then as
   2.239 +    part of these credits and in a manner at least as prominent as the
   2.240 +    credits for the other contributing authors. For the avoidance of
   2.241 +    doubt, You may only use the credit required by this Section for the
   2.242 +    purpose of attribution in the manner set out above and, by exercising
   2.243 +    Your rights under this License, You may not implicitly or explicitly
   2.244 +    assert or imply any connection with, sponsorship or endorsement by the
   2.245 +    Original Author, Licensor and/or Attribution Parties, as appropriate,
   2.246 +    of You or Your use of the Work, without the separate, express prior
   2.247 +    written permission of the Original Author, Licensor and/or Attribution
   2.248 +    Parties.
   2.249 + d. Except as otherwise agreed in writing by the Licensor or as may be
   2.250 +    otherwise permitted by applicable law, if You Reproduce, Distribute or
   2.251 +    Publicly Perform the Work either by itself or as part of any
   2.252 +    Adaptations or Collections, You must not distort, mutilate, modify or
   2.253 +    take other derogatory action in relation to the Work which would be
   2.254 +    prejudicial to the Original Author's honor or reputation. Licensor
   2.255 +    agrees that in those jurisdictions (e.g. Japan), in which any exercise
   2.256 +    of the right granted in Section 3(b) of this License (the right to
   2.257 +    make Adaptations) would be deemed to be a distortion, mutilation,
   2.258 +    modification or other derogatory action prejudicial to the Original
   2.259 +    Author's honor and reputation, the Licensor will waive or not assert,
   2.260 +    as appropriate, this Section, to the fullest extent permitted by the
   2.261 +    applicable national law, to enable You to reasonably exercise Your
   2.262 +    right under Section 3(b) of this License (right to make Adaptations)
   2.263 +    but not otherwise.
   2.264 +
   2.265 +5. Representations, Warranties and Disclaimer
   2.266 +
   2.267 +UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR
   2.268 +OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY
   2.269 +KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE,
   2.270 +INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY,
   2.271 +FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF
   2.272 +LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS,
   2.273 +WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION
   2.274 +OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
   2.275 +
   2.276 +6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE
   2.277 +LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR
   2.278 +ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES
   2.279 +ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS
   2.280 +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
   2.281 +
   2.282 +7. Termination
   2.283 +
   2.284 + a. This License and the rights granted hereunder will terminate
   2.285 +    automatically upon any breach by You of the terms of this License.
   2.286 +    Individuals or entities who have received Adaptations or Collections
   2.287 +    from You under this License, however, will not have their licenses
   2.288 +    terminated provided such individuals or entities remain in full
   2.289 +    compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will
   2.290 +    survive any termination of this License.
   2.291 + b. Subject to the above terms and conditions, the license granted here is
   2.292 +    perpetual (for the duration of the applicable copyright in the Work).
   2.293 +    Notwithstanding the above, Licensor reserves the right to release the
   2.294 +    Work under different license terms or to stop distributing the Work at
   2.295 +    any time; provided, however that any such election will not serve to
   2.296 +    withdraw this License (or any other license that has been, or is
   2.297 +    required to be, granted under the terms of this License), and this
   2.298 +    License will continue in full force and effect unless terminated as
   2.299 +    stated above.
   2.300 +
   2.301 +8. Miscellaneous
   2.302 +
   2.303 + a. Each time You Distribute or Publicly Perform the Work or a Collection,
   2.304 +    the Licensor offers to the recipient a license to the Work on the same
   2.305 +    terms and conditions as the license granted to You under this License.
   2.306 + b. Each time You Distribute or Publicly Perform an Adaptation, Licensor
   2.307 +    offers to the recipient a license to the original Work on the same
   2.308 +    terms and conditions as the license granted to You under this License.
   2.309 + c. If any provision of this License is invalid or unenforceable under
   2.310 +    applicable law, it shall not affect the validity or enforceability of
   2.311 +    the remainder of the terms of this License, and without further action
   2.312 +    by the parties to this agreement, such provision shall be reformed to
   2.313 +    the minimum extent necessary to make such provision valid and
   2.314 +    enforceable.
   2.315 + d. No term or provision of this License shall be deemed waived and no
   2.316 +    breach consented to unless such waiver or consent shall be in writing
   2.317 +    and signed by the party to be charged with such waiver or consent.
   2.318 + e. This License constitutes the entire agreement between the parties with
   2.319 +    respect to the Work licensed here. There are no understandings,
   2.320 +    agreements or representations with respect to the Work not specified
   2.321 +    here. Licensor shall not be bound by any additional provisions that
   2.322 +    may appear in any communication from You. This License may not be
   2.323 +    modified without the mutual written agreement of the Licensor and You.
   2.324 + f. The rights granted under, and the subject matter referenced, in this
   2.325 +    License were drafted utilizing the terminology of the Berne Convention
   2.326 +    for the Protection of Literary and Artistic Works (as amended on
   2.327 +    September 28, 1979), the Rome Convention of 1961, the WIPO Copyright
   2.328 +    Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996
   2.329 +    and the Universal Copyright Convention (as revised on July 24, 1971).
   2.330 +    These rights and subject matter take effect in the relevant
   2.331 +    jurisdiction in which the License terms are sought to be enforced
   2.332 +    according to the corresponding provisions of the implementation of
   2.333 +    those treaty provisions in the applicable national law. If the
   2.334 +    standard suite of rights granted under applicable copyright law
   2.335 +    includes additional rights not granted under this License, such
   2.336 +    additional rights are deemed to be included in the License; this
   2.337 +    License is not intended to restrict the license of any rights under
   2.338 +    applicable law.
   2.339 +
   2.340 +
   2.341 +Creative Commons Notice
   2.342 +
   2.343 +    Creative Commons is not a party to this License, and makes no warranty
   2.344 +    whatsoever in connection with the Work. Creative Commons will not be
   2.345 +    liable to You or any party on any legal theory for any damages
   2.346 +    whatsoever, including without limitation any general, special,
   2.347 +    incidental or consequential damages arising in connection to this
   2.348 +    license. Notwithstanding the foregoing two (2) sentences, if Creative
   2.349 +    Commons has expressly identified itself as the Licensor hereunder, it
   2.350 +    shall have all rights and obligations of Licensor.
   2.351 +
   2.352 +    Except for the limited purpose of indicating to the public that the
   2.353 +    Work is licensed under the CCPL, Creative Commons does not authorize
   2.354 +    the use by either party of the trademark "Creative Commons" or any
   2.355 +    related trademark or logo of Creative Commons without the prior
   2.356 +    written consent of Creative Commons. Any permitted use will be in
   2.357 +    compliance with Creative Commons' then-current trademark usage
   2.358 +    guidelines, as may be published on its website or otherwise made
   2.359 +    available upon request from time to time. For the avoidance of doubt,
   2.360 +    this trademark restriction does not form part of the License.
   2.361 +
   2.362 +    Creative Commons may be contacted at https://creativecommons.org/.
     3.1 --- a/LICENSE.txt	Mon Aug 14 09:13:53 2017 +0200
     3.2 +++ b/LICENSE.txt	Wed Aug 30 14:42:51 2017 +0200
     3.3 @@ -1,674 +1,674 @@
     3.4 -                    GNU GENERAL PUBLIC LICENSE
     3.5 -                       Version 3, 29 June 2007
     3.6 -
     3.7 - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
     3.8 - Everyone is permitted to copy and distribute verbatim copies
     3.9 - of this license document, but changing it is not allowed.
    3.10 -
    3.11 -                            Preamble
    3.12 -
    3.13 -  The GNU General Public License is a free, copyleft license for
    3.14 -software and other kinds of works.
    3.15 -
    3.16 -  The licenses for most software and other practical works are designed
    3.17 -to take away your freedom to share and change the works.  By contrast,
    3.18 -the GNU General Public License is intended to guarantee your freedom to
    3.19 -share and change all versions of a program--to make sure it remains free
    3.20 -software for all its users.  We, the Free Software Foundation, use the
    3.21 -GNU General Public License for most of our software; it applies also to
    3.22 -any other work released this way by its authors.  You can apply it to
    3.23 -your programs, too.
    3.24 -
    3.25 -  When we speak of free software, we are referring to freedom, not
    3.26 -price.  Our General Public Licenses are designed to make sure that you
    3.27 -have the freedom to distribute copies of free software (and charge for
    3.28 -them if you wish), that you receive source code or can get it if you
    3.29 -want it, that you can change the software or use pieces of it in new
    3.30 -free programs, and that you know you can do these things.
    3.31 -
    3.32 -  To protect your rights, we need to prevent others from denying you
    3.33 -these rights or asking you to surrender the rights.  Therefore, you have
    3.34 -certain responsibilities if you distribute copies of the software, or if
    3.35 -you modify it: responsibilities to respect the freedom of others.
    3.36 -
    3.37 -  For example, if you distribute copies of such a program, whether
    3.38 -gratis or for a fee, you must pass on to the recipients the same
    3.39 -freedoms that you received.  You must make sure that they, too, receive
    3.40 -or can get the source code.  And you must show them these terms so they
    3.41 -know their rights.
    3.42 -
    3.43 -  Developers that use the GNU GPL protect your rights with two steps:
    3.44 -(1) assert copyright on the software, and (2) offer you this License
    3.45 -giving you legal permission to copy, distribute and/or modify it.
    3.46 -
    3.47 -  For the developers' and authors' protection, the GPL clearly explains
    3.48 -that there is no warranty for this free software.  For both users' and
    3.49 -authors' sake, the GPL requires that modified versions be marked as
    3.50 -changed, so that their problems will not be attributed erroneously to
    3.51 -authors of previous versions.
    3.52 -
    3.53 -  Some devices are designed to deny users access to install or run
    3.54 -modified versions of the software inside them, although the manufacturer
    3.55 -can do so.  This is fundamentally incompatible with the aim of
    3.56 -protecting users' freedom to change the software.  The systematic
    3.57 -pattern of such abuse occurs in the area of products for individuals to
    3.58 -use, which is precisely where it is most unacceptable.  Therefore, we
    3.59 -have designed this version of the GPL to prohibit the practice for those
    3.60 -products.  If such problems arise substantially in other domains, we
    3.61 -stand ready to extend this provision to those domains in future versions
    3.62 -of the GPL, as needed to protect the freedom of users.
    3.63 -
    3.64 -  Finally, every program is threatened constantly by software patents.
    3.65 -States should not allow patents to restrict development and use of
    3.66 -software on general-purpose computers, but in those that do, we wish to
    3.67 -avoid the special danger that patents applied to a free program could
    3.68 -make it effectively proprietary.  To prevent this, the GPL assures that
    3.69 -patents cannot be used to render the program non-free.
    3.70 -
    3.71 -  The precise terms and conditions for copying, distribution and
    3.72 -modification follow.
    3.73 -
    3.74 -                       TERMS AND CONDITIONS
    3.75 -
    3.76 -  0. Definitions.
    3.77 -
    3.78 -  "This License" refers to version 3 of the GNU General Public License.
    3.79 -
    3.80 -  "Copyright" also means copyright-like laws that apply to other kinds of
    3.81 -works, such as semiconductor masks.
    3.82 -
    3.83 -  "The Program" refers to any copyrightable work licensed under this
    3.84 -License.  Each licensee is addressed as "you".  "Licensees" and
    3.85 -"recipients" may be individuals or organizations.
    3.86 -
    3.87 -  To "modify" a work means to copy from or adapt all or part of the work
    3.88 -in a fashion requiring copyright permission, other than the making of an
    3.89 -exact copy.  The resulting work is called a "modified version" of the
    3.90 -earlier work or a work "based on" the earlier work.
    3.91 -
    3.92 -  A "covered work" means either the unmodified Program or a work based
    3.93 -on the Program.
    3.94 -
    3.95 -  To "propagate" a work means to do anything with it that, without
    3.96 -permission, would make you directly or secondarily liable for
    3.97 -infringement under applicable copyright law, except executing it on a
    3.98 -computer or modifying a private copy.  Propagation includes copying,
    3.99 -distribution (with or without modification), making available to the
   3.100 -public, and in some countries other activities as well.
   3.101 -
   3.102 -  To "convey" a work means any kind of propagation that enables other
   3.103 -parties to make or receive copies.  Mere interaction with a user through
   3.104 -a computer network, with no transfer of a copy, is not conveying.
   3.105 -
   3.106 -  An interactive user interface displays "Appropriate Legal Notices"
   3.107 -to the extent that it includes a convenient and prominently visible
   3.108 -feature that (1) displays an appropriate copyright notice, and (2)
   3.109 -tells the user that there is no warranty for the work (except to the
   3.110 -extent that warranties are provided), that licensees may convey the
   3.111 -work under this License, and how to view a copy of this License.  If
   3.112 -the interface presents a list of user commands or options, such as a
   3.113 -menu, a prominent item in the list meets this criterion.
   3.114 -
   3.115 -  1. Source Code.
   3.116 -
   3.117 -  The "source code" for a work means the preferred form of the work
   3.118 -for making modifications to it.  "Object code" means any non-source
   3.119 -form of a work.
   3.120 -
   3.121 -  A "Standard Interface" means an interface that either is an official
   3.122 -standard defined by a recognized standards body, or, in the case of
   3.123 -interfaces specified for a particular programming language, one that
   3.124 -is widely used among developers working in that language.
   3.125 -
   3.126 -  The "System Libraries" of an executable work include anything, other
   3.127 -than the work as a whole, that (a) is included in the normal form of
   3.128 -packaging a Major Component, but which is not part of that Major
   3.129 -Component, and (b) serves only to enable use of the work with that
   3.130 -Major Component, or to implement a Standard Interface for which an
   3.131 -implementation is available to the public in source code form.  A
   3.132 -"Major Component", in this context, means a major essential component
   3.133 -(kernel, window system, and so on) of the specific operating system
   3.134 -(if any) on which the executable work runs, or a compiler used to
   3.135 -produce the work, or an object code interpreter used to run it.
   3.136 -
   3.137 -  The "Corresponding Source" for a work in object code form means all
   3.138 -the source code needed to generate, install, and (for an executable
   3.139 -work) run the object code and to modify the work, including scripts to
   3.140 -control those activities.  However, it does not include the work's
   3.141 -System Libraries, or general-purpose tools or generally available free
   3.142 -programs which are used unmodified in performing those activities but
   3.143 -which are not part of the work.  For example, Corresponding Source
   3.144 -includes interface definition files associated with source files for
   3.145 -the work, and the source code for shared libraries and dynamically
   3.146 -linked subprograms that the work is specifically designed to require,
   3.147 -such as by intimate data communication or control flow between those
   3.148 -subprograms and other parts of the work.
   3.149 -
   3.150 -  The Corresponding Source need not include anything that users
   3.151 -can regenerate automatically from other parts of the Corresponding
   3.152 -Source.
   3.153 -
   3.154 -  The Corresponding Source for a work in source code form is that
   3.155 -same work.
   3.156 -
   3.157 -  2. Basic Permissions.
   3.158 -
   3.159 -  All rights granted under this License are granted for the term of
   3.160 -copyright on the Program, and are irrevocable provided the stated
   3.161 -conditions are met.  This License explicitly affirms your unlimited
   3.162 -permission to run the unmodified Program.  The output from running a
   3.163 -covered work is covered by this License only if the output, given its
   3.164 -content, constitutes a covered work.  This License acknowledges your
   3.165 -rights of fair use or other equivalent, as provided by copyright law.
   3.166 -
   3.167 -  You may make, run and propagate covered works that you do not
   3.168 -convey, without conditions so long as your license otherwise remains
   3.169 -in force.  You may convey covered works to others for the sole purpose
   3.170 -of having them make modifications exclusively for you, or provide you
   3.171 -with facilities for running those works, provided that you comply with
   3.172 -the terms of this License in conveying all material for which you do
   3.173 -not control copyright.  Those thus making or running the covered works
   3.174 -for you must do so exclusively on your behalf, under your direction
   3.175 -and control, on terms that prohibit them from making any copies of
   3.176 -your copyrighted material outside their relationship with you.
   3.177 -
   3.178 -  Conveying under any other circumstances is permitted solely under
   3.179 -the conditions stated below.  Sublicensing is not allowed; section 10
   3.180 -makes it unnecessary.
   3.181 -
   3.182 -  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
   3.183 -
   3.184 -  No covered work shall be deemed part of an effective technological
   3.185 -measure under any applicable law fulfilling obligations under article
   3.186 -11 of the WIPO copyright treaty adopted on 20 December 1996, or
   3.187 -similar laws prohibiting or restricting circumvention of such
   3.188 -measures.
   3.189 -
   3.190 -  When you convey a covered work, you waive any legal power to forbid
   3.191 -circumvention of technological measures to the extent such circumvention
   3.192 -is effected by exercising rights under this License with respect to
   3.193 -the covered work, and you disclaim any intention to limit operation or
   3.194 -modification of the work as a means of enforcing, against the work's
   3.195 -users, your or third parties' legal rights to forbid circumvention of
   3.196 -technological measures.
   3.197 -
   3.198 -  4. Conveying Verbatim Copies.
   3.199 -
   3.200 -  You may convey verbatim copies of the Program's source code as you
   3.201 -receive it, in any medium, provided that you conspicuously and
   3.202 -appropriately publish on each copy an appropriate copyright notice;
   3.203 -keep intact all notices stating that this License and any
   3.204 -non-permissive terms added in accord with section 7 apply to the code;
   3.205 -keep intact all notices of the absence of any warranty; and give all
   3.206 -recipients a copy of this License along with the Program.
   3.207 -
   3.208 -  You may charge any price or no price for each copy that you convey,
   3.209 -and you may offer support or warranty protection for a fee.
   3.210 -
   3.211 -  5. Conveying Modified Source Versions.
   3.212 -
   3.213 -  You may convey a work based on the Program, or the modifications to
   3.214 -produce it from the Program, in the form of source code under the
   3.215 -terms of section 4, provided that you also meet all of these conditions:
   3.216 -
   3.217 -    a) The work must carry prominent notices stating that you modified
   3.218 -    it, and giving a relevant date.
   3.219 -
   3.220 -    b) The work must carry prominent notices stating that it is
   3.221 -    released under this License and any conditions added under section
   3.222 -    7.  This requirement modifies the requirement in section 4 to
   3.223 -    "keep intact all notices".
   3.224 -
   3.225 -    c) You must license the entire work, as a whole, under this
   3.226 -    License to anyone who comes into possession of a copy.  This
   3.227 -    License will therefore apply, along with any applicable section 7
   3.228 -    additional terms, to the whole of the work, and all its parts,
   3.229 -    regardless of how they are packaged.  This License gives no
   3.230 -    permission to license the work in any other way, but it does not
   3.231 -    invalidate such permission if you have separately received it.
   3.232 -
   3.233 -    d) If the work has interactive user interfaces, each must display
   3.234 -    Appropriate Legal Notices; however, if the Program has interactive
   3.235 -    interfaces that do not display Appropriate Legal Notices, your
   3.236 -    work need not make them do so.
   3.237 -
   3.238 -  A compilation of a covered work with other separate and independent
   3.239 -works, which are not by their nature extensions of the covered work,
   3.240 -and which are not combined with it such as to form a larger program,
   3.241 -in or on a volume of a storage or distribution medium, is called an
   3.242 -"aggregate" if the compilation and its resulting copyright are not
   3.243 -used to limit the access or legal rights of the compilation's users
   3.244 -beyond what the individual works permit.  Inclusion of a covered work
   3.245 -in an aggregate does not cause this License to apply to the other
   3.246 -parts of the aggregate.
   3.247 -
   3.248 -  6. Conveying Non-Source Forms.
   3.249 -
   3.250 -  You may convey a covered work in object code form under the terms
   3.251 -of sections 4 and 5, provided that you also convey the
   3.252 -machine-readable Corresponding Source under the terms of this License,
   3.253 -in one of these ways:
   3.254 -
   3.255 -    a) Convey the object code in, or embodied in, a physical product
   3.256 -    (including a physical distribution medium), accompanied by the
   3.257 -    Corresponding Source fixed on a durable physical medium
   3.258 -    customarily used for software interchange.
   3.259 -
   3.260 -    b) Convey the object code in, or embodied in, a physical product
   3.261 -    (including a physical distribution medium), accompanied by a
   3.262 -    written offer, valid for at least three years and valid for as
   3.263 -    long as you offer spare parts or customer support for that product
   3.264 -    model, to give anyone who possesses the object code either (1) a
   3.265 -    copy of the Corresponding Source for all the software in the
   3.266 -    product that is covered by this License, on a durable physical
   3.267 -    medium customarily used for software interchange, for a price no
   3.268 -    more than your reasonable cost of physically performing this
   3.269 -    conveying of source, or (2) access to copy the
   3.270 -    Corresponding Source from a network server at no charge.
   3.271 -
   3.272 -    c) Convey individual copies of the object code with a copy of the
   3.273 -    written offer to provide the Corresponding Source.  This
   3.274 -    alternative is allowed only occasionally and noncommercially, and
   3.275 -    only if you received the object code with such an offer, in accord
   3.276 -    with subsection 6b.
   3.277 -
   3.278 -    d) Convey the object code by offering access from a designated
   3.279 -    place (gratis or for a charge), and offer equivalent access to the
   3.280 -    Corresponding Source in the same way through the same place at no
   3.281 -    further charge.  You need not require recipients to copy the
   3.282 -    Corresponding Source along with the object code.  If the place to
   3.283 -    copy the object code is a network server, the Corresponding Source
   3.284 -    may be on a different server (operated by you or a third party)
   3.285 -    that supports equivalent copying facilities, provided you maintain
   3.286 -    clear directions next to the object code saying where to find the
   3.287 -    Corresponding Source.  Regardless of what server hosts the
   3.288 -    Corresponding Source, you remain obligated to ensure that it is
   3.289 -    available for as long as needed to satisfy these requirements.
   3.290 -
   3.291 -    e) Convey the object code using peer-to-peer transmission, provided
   3.292 -    you inform other peers where the object code and Corresponding
   3.293 -    Source of the work are being offered to the general public at no
   3.294 -    charge under subsection 6d.
   3.295 -
   3.296 -  A separable portion of the object code, whose source code is excluded
   3.297 -from the Corresponding Source as a System Library, need not be
   3.298 -included in conveying the object code work.
   3.299 -
   3.300 -  A "User Product" is either (1) a "consumer product", which means any
   3.301 -tangible personal property which is normally used for personal, family,
   3.302 -or household purposes, or (2) anything designed or sold for incorporation
   3.303 -into a dwelling.  In determining whether a product is a consumer product,
   3.304 -doubtful cases shall be resolved in favor of coverage.  For a particular
   3.305 -product received by a particular user, "normally used" refers to a
   3.306 -typical or common use of that class of product, regardless of the status
   3.307 -of the particular user or of the way in which the particular user
   3.308 -actually uses, or expects or is expected to use, the product.  A product
   3.309 -is a consumer product regardless of whether the product has substantial
   3.310 -commercial, industrial or non-consumer uses, unless such uses represent
   3.311 -the only significant mode of use of the product.
   3.312 -
   3.313 -  "Installation Information" for a User Product means any methods,
   3.314 -procedures, authorization keys, or other information required to install
   3.315 -and execute modified versions of a covered work in that User Product from
   3.316 -a modified version of its Corresponding Source.  The information must
   3.317 -suffice to ensure that the continued functioning of the modified object
   3.318 -code is in no case prevented or interfered with solely because
   3.319 -modification has been made.
   3.320 -
   3.321 -  If you convey an object code work under this section in, or with, or
   3.322 -specifically for use in, a User Product, and the conveying occurs as
   3.323 -part of a transaction in which the right of possession and use of the
   3.324 -User Product is transferred to the recipient in perpetuity or for a
   3.325 -fixed term (regardless of how the transaction is characterized), the
   3.326 -Corresponding Source conveyed under this section must be accompanied
   3.327 -by the Installation Information.  But this requirement does not apply
   3.328 -if neither you nor any third party retains the ability to install
   3.329 -modified object code on the User Product (for example, the work has
   3.330 -been installed in ROM).
   3.331 -
   3.332 -  The requirement to provide Installation Information does not include a
   3.333 -requirement to continue to provide support service, warranty, or updates
   3.334 -for a work that has been modified or installed by the recipient, or for
   3.335 -the User Product in which it has been modified or installed.  Access to a
   3.336 -network may be denied when the modification itself materially and
   3.337 -adversely affects the operation of the network or violates the rules and
   3.338 -protocols for communication across the network.
   3.339 -
   3.340 -  Corresponding Source conveyed, and Installation Information provided,
   3.341 -in accord with this section must be in a format that is publicly
   3.342 -documented (and with an implementation available to the public in
   3.343 -source code form), and must require no special password or key for
   3.344 -unpacking, reading or copying.
   3.345 -
   3.346 -  7. Additional Terms.
   3.347 -
   3.348 -  "Additional permissions" are terms that supplement the terms of this
   3.349 -License by making exceptions from one or more of its conditions.
   3.350 -Additional permissions that are applicable to the entire Program shall
   3.351 -be treated as though they were included in this License, to the extent
   3.352 -that they are valid under applicable law.  If additional permissions
   3.353 -apply only to part of the Program, that part may be used separately
   3.354 -under those permissions, but the entire Program remains governed by
   3.355 -this License without regard to the additional permissions.
   3.356 -
   3.357 -  When you convey a copy of a covered work, you may at your option
   3.358 -remove any additional permissions from that copy, or from any part of
   3.359 -it.  (Additional permissions may be written to require their own
   3.360 -removal in certain cases when you modify the work.)  You may place
   3.361 -additional permissions on material, added by you to a covered work,
   3.362 -for which you have or can give appropriate copyright permission.
   3.363 -
   3.364 -  Notwithstanding any other provision of this License, for material you
   3.365 -add to a covered work, you may (if authorized by the copyright holders of
   3.366 -that material) supplement the terms of this License with terms:
   3.367 -
   3.368 -    a) Disclaiming warranty or limiting liability differently from the
   3.369 -    terms of sections 15 and 16 of this License; or
   3.370 -
   3.371 -    b) Requiring preservation of specified reasonable legal notices or
   3.372 -    author attributions in that material or in the Appropriate Legal
   3.373 -    Notices displayed by works containing it; or
   3.374 -
   3.375 -    c) Prohibiting misrepresentation of the origin of that material, or
   3.376 -    requiring that modified versions of such material be marked in
   3.377 -    reasonable ways as different from the original version; or
   3.378 -
   3.379 -    d) Limiting the use for publicity purposes of names of licensors or
   3.380 -    authors of the material; or
   3.381 -
   3.382 -    e) Declining to grant rights under trademark law for use of some
   3.383 -    trade names, trademarks, or service marks; or
   3.384 -
   3.385 -    f) Requiring indemnification of licensors and authors of that
   3.386 -    material by anyone who conveys the material (or modified versions of
   3.387 -    it) with contractual assumptions of liability to the recipient, for
   3.388 -    any liability that these contractual assumptions directly impose on
   3.389 -    those licensors and authors.
   3.390 -
   3.391 -  All other non-permissive additional terms are considered "further
   3.392 -restrictions" within the meaning of section 10.  If the Program as you
   3.393 -received it, or any part of it, contains a notice stating that it is
   3.394 -governed by this License along with a term that is a further
   3.395 -restriction, you may remove that term.  If a license document contains
   3.396 -a further restriction but permits relicensing or conveying under this
   3.397 -License, you may add to a covered work material governed by the terms
   3.398 -of that license document, provided that the further restriction does
   3.399 -not survive such relicensing or conveying.
   3.400 -
   3.401 -  If you add terms to a covered work in accord with this section, you
   3.402 -must place, in the relevant source files, a statement of the
   3.403 -additional terms that apply to those files, or a notice indicating
   3.404 -where to find the applicable terms.
   3.405 -
   3.406 -  Additional terms, permissive or non-permissive, may be stated in the
   3.407 -form of a separately written license, or stated as exceptions;
   3.408 -the above requirements apply either way.
   3.409 -
   3.410 -  8. Termination.
   3.411 -
   3.412 -  You may not propagate or modify a covered work except as expressly
   3.413 -provided under this License.  Any attempt otherwise to propagate or
   3.414 -modify it is void, and will automatically terminate your rights under
   3.415 -this License (including any patent licenses granted under the third
   3.416 -paragraph of section 11).
   3.417 -
   3.418 -  However, if you cease all violation of this License, then your
   3.419 -license from a particular copyright holder is reinstated (a)
   3.420 -provisionally, unless and until the copyright holder explicitly and
   3.421 -finally terminates your license, and (b) permanently, if the copyright
   3.422 -holder fails to notify you of the violation by some reasonable means
   3.423 -prior to 60 days after the cessation.
   3.424 -
   3.425 -  Moreover, your license from a particular copyright holder is
   3.426 -reinstated permanently if the copyright holder notifies you of the
   3.427 -violation by some reasonable means, this is the first time you have
   3.428 -received notice of violation of this License (for any work) from that
   3.429 -copyright holder, and you cure the violation prior to 30 days after
   3.430 -your receipt of the notice.
   3.431 -
   3.432 -  Termination of your rights under this section does not terminate the
   3.433 -licenses of parties who have received copies or rights from you under
   3.434 -this License.  If your rights have been terminated and not permanently
   3.435 -reinstated, you do not qualify to receive new licenses for the same
   3.436 -material under section 10.
   3.437 -
   3.438 -  9. Acceptance Not Required for Having Copies.
   3.439 -
   3.440 -  You are not required to accept this License in order to receive or
   3.441 -run a copy of the Program.  Ancillary propagation of a covered work
   3.442 -occurring solely as a consequence of using peer-to-peer transmission
   3.443 -to receive a copy likewise does not require acceptance.  However,
   3.444 -nothing other than this License grants you permission to propagate or
   3.445 -modify any covered work.  These actions infringe copyright if you do
   3.446 -not accept this License.  Therefore, by modifying or propagating a
   3.447 -covered work, you indicate your acceptance of this License to do so.
   3.448 -
   3.449 -  10. Automatic Licensing of Downstream Recipients.
   3.450 -
   3.451 -  Each time you convey a covered work, the recipient automatically
   3.452 -receives a license from the original licensors, to run, modify and
   3.453 -propagate that work, subject to this License.  You are not responsible
   3.454 -for enforcing compliance by third parties with this License.
   3.455 -
   3.456 -  An "entity transaction" is a transaction transferring control of an
   3.457 -organization, or substantially all assets of one, or subdividing an
   3.458 -organization, or merging organizations.  If propagation of a covered
   3.459 -work results from an entity transaction, each party to that
   3.460 -transaction who receives a copy of the work also receives whatever
   3.461 -licenses to the work the party's predecessor in interest had or could
   3.462 -give under the previous paragraph, plus a right to possession of the
   3.463 -Corresponding Source of the work from the predecessor in interest, if
   3.464 -the predecessor has it or can get it with reasonable efforts.
   3.465 -
   3.466 -  You may not impose any further restrictions on the exercise of the
   3.467 -rights granted or affirmed under this License.  For example, you may
   3.468 -not impose a license fee, royalty, or other charge for exercise of
   3.469 -rights granted under this License, and you may not initiate litigation
   3.470 -(including a cross-claim or counterclaim in a lawsuit) alleging that
   3.471 -any patent claim is infringed by making, using, selling, offering for
   3.472 -sale, or importing the Program or any portion of it.
   3.473 -
   3.474 -  11. Patents.
   3.475 -
   3.476 -  A "contributor" is a copyright holder who authorizes use under this
   3.477 -License of the Program or a work on which the Program is based.  The
   3.478 -work thus licensed is called the contributor's "contributor version".
   3.479 -
   3.480 -  A contributor's "essential patent claims" are all patent claims
   3.481 -owned or controlled by the contributor, whether already acquired or
   3.482 -hereafter acquired, that would be infringed by some manner, permitted
   3.483 -by this License, of making, using, or selling its contributor version,
   3.484 -but do not include claims that would be infringed only as a
   3.485 -consequence of further modification of the contributor version.  For
   3.486 -purposes of this definition, "control" includes the right to grant
   3.487 -patent sublicenses in a manner consistent with the requirements of
   3.488 -this License.
   3.489 -
   3.490 -  Each contributor grants you a non-exclusive, worldwide, royalty-free
   3.491 -patent license under the contributor's essential patent claims, to
   3.492 -make, use, sell, offer for sale, import and otherwise run, modify and
   3.493 -propagate the contents of its contributor version.
   3.494 -
   3.495 -  In the following three paragraphs, a "patent license" is any express
   3.496 -agreement or commitment, however denominated, not to enforce a patent
   3.497 -(such as an express permission to practice a patent or covenant not to
   3.498 -sue for patent infringement).  To "grant" such a patent license to a
   3.499 -party means to make such an agreement or commitment not to enforce a
   3.500 -patent against the party.
   3.501 -
   3.502 -  If you convey a covered work, knowingly relying on a patent license,
   3.503 -and the Corresponding Source of the work is not available for anyone
   3.504 -to copy, free of charge and under the terms of this License, through a
   3.505 -publicly available network server or other readily accessible means,
   3.506 -then you must either (1) cause the Corresponding Source to be so
   3.507 -available, or (2) arrange to deprive yourself of the benefit of the
   3.508 -patent license for this particular work, or (3) arrange, in a manner
   3.509 -consistent with the requirements of this License, to extend the patent
   3.510 -license to downstream recipients.  "Knowingly relying" means you have
   3.511 -actual knowledge that, but for the patent license, your conveying the
   3.512 -covered work in a country, or your recipient's use of the covered work
   3.513 -in a country, would infringe one or more identifiable patents in that
   3.514 -country that you have reason to believe are valid.
   3.515 -
   3.516 -  If, pursuant to or in connection with a single transaction or
   3.517 -arrangement, you convey, or propagate by procuring conveyance of, a
   3.518 -covered work, and grant a patent license to some of the parties
   3.519 -receiving the covered work authorizing them to use, propagate, modify
   3.520 -or convey a specific copy of the covered work, then the patent license
   3.521 -you grant is automatically extended to all recipients of the covered
   3.522 -work and works based on it.
   3.523 -
   3.524 -  A patent license is "discriminatory" if it does not include within
   3.525 -the scope of its coverage, prohibits the exercise of, or is
   3.526 -conditioned on the non-exercise of one or more of the rights that are
   3.527 -specifically granted under this License.  You may not convey a covered
   3.528 -work if you are a party to an arrangement with a third party that is
   3.529 -in the business of distributing software, under which you make payment
   3.530 -to the third party based on the extent of your activity of conveying
   3.531 -the work, and under which the third party grants, to any of the
   3.532 -parties who would receive the covered work from you, a discriminatory
   3.533 -patent license (a) in connection with copies of the covered work
   3.534 -conveyed by you (or copies made from those copies), or (b) primarily
   3.535 -for and in connection with specific products or compilations that
   3.536 -contain the covered work, unless you entered into that arrangement,
   3.537 -or that patent license was granted, prior to 28 March 2007.
   3.538 -
   3.539 -  Nothing in this License shall be construed as excluding or limiting
   3.540 -any implied license or other defenses to infringement that may
   3.541 -otherwise be available to you under applicable patent law.
   3.542 -
   3.543 -  12. No Surrender of Others' Freedom.
   3.544 -
   3.545 -  If conditions are imposed on you (whether by court order, agreement or
   3.546 -otherwise) that contradict the conditions of this License, they do not
   3.547 -excuse you from the conditions of this License.  If you cannot convey a
   3.548 -covered work so as to satisfy simultaneously your obligations under this
   3.549 -License and any other pertinent obligations, then as a consequence you may
   3.550 -not convey it at all.  For example, if you agree to terms that obligate you
   3.551 -to collect a royalty for further conveying from those to whom you convey
   3.552 -the Program, the only way you could satisfy both those terms and this
   3.553 -License would be to refrain entirely from conveying the Program.
   3.554 -
   3.555 -  13. Use with the GNU Affero General Public License.
   3.556 -
   3.557 -  Notwithstanding any other provision of this License, you have
   3.558 -permission to link or combine any covered work with a work licensed
   3.559 -under version 3 of the GNU Affero General Public License into a single
   3.560 -combined work, and to convey the resulting work.  The terms of this
   3.561 -License will continue to apply to the part which is the covered work,
   3.562 -but the special requirements of the GNU Affero General Public License,
   3.563 -section 13, concerning interaction through a network will apply to the
   3.564 -combination as such.
   3.565 -
   3.566 -  14. Revised Versions of this License.
   3.567 -
   3.568 -  The Free Software Foundation may publish revised and/or new versions of
   3.569 -the GNU General Public License from time to time.  Such new versions will
   3.570 -be similar in spirit to the present version, but may differ in detail to
   3.571 -address new problems or concerns.
   3.572 -
   3.573 -  Each version is given a distinguishing version number.  If the
   3.574 -Program specifies that a certain numbered version of the GNU General
   3.575 -Public License "or any later version" applies to it, you have the
   3.576 -option of following the terms and conditions either of that numbered
   3.577 -version or of any later version published by the Free Software
   3.578 -Foundation.  If the Program does not specify a version number of the
   3.579 -GNU General Public License, you may choose any version ever published
   3.580 -by the Free Software Foundation.
   3.581 -
   3.582 -  If the Program specifies that a proxy can decide which future
   3.583 -versions of the GNU General Public License can be used, that proxy's
   3.584 -public statement of acceptance of a version permanently authorizes you
   3.585 -to choose that version for the Program.
   3.586 -
   3.587 -  Later license versions may give you additional or different
   3.588 -permissions.  However, no additional obligations are imposed on any
   3.589 -author or copyright holder as a result of your choosing to follow a
   3.590 -later version.
   3.591 -
   3.592 -  15. Disclaimer of Warranty.
   3.593 -
   3.594 -  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
   3.595 -APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
   3.596 -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
   3.597 -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
   3.598 -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   3.599 -PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
   3.600 -IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
   3.601 -ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
   3.602 -
   3.603 -  16. Limitation of Liability.
   3.604 -
   3.605 -  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
   3.606 -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
   3.607 -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
   3.608 -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
   3.609 -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
   3.610 -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
   3.611 -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
   3.612 -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
   3.613 -SUCH DAMAGES.
   3.614 -
   3.615 -  17. Interpretation of Sections 15 and 16.
   3.616 -
   3.617 -  If the disclaimer of warranty and limitation of liability provided
   3.618 -above cannot be given local legal effect according to their terms,
   3.619 -reviewing courts shall apply local law that most closely approximates
   3.620 -an absolute waiver of all civil liability in connection with the
   3.621 -Program, unless a warranty or assumption of liability accompanies a
   3.622 -copy of the Program in return for a fee.
   3.623 -
   3.624 -                     END OF TERMS AND CONDITIONS
   3.625 -
   3.626 -            How to Apply These Terms to Your New Programs
   3.627 -
   3.628 -  If you develop a new program, and you want it to be of the greatest
   3.629 -possible use to the public, the best way to achieve this is to make it
   3.630 -free software which everyone can redistribute and change under these terms.
   3.631 -
   3.632 -  To do so, attach the following notices to the program.  It is safest
   3.633 -to attach them to the start of each source file to most effectively
   3.634 -state the exclusion of warranty; and each file should have at least
   3.635 -the "copyright" line and a pointer to where the full notice is found.
   3.636 -
   3.637 -    <one line to give the program's name and a brief idea of what it does.>
   3.638 -    Copyright (C) <year>  <name of author>
   3.639 -
   3.640 -    This program is free software: you can redistribute it and/or modify
   3.641 -    it under the terms of the GNU General Public License as published by
   3.642 -    the Free Software Foundation, either version 3 of the License, or
   3.643 -    (at your option) any later version.
   3.644 -
   3.645 -    This program is distributed in the hope that it will be useful,
   3.646 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   3.647 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   3.648 -    GNU General Public License for more details.
   3.649 -
   3.650 -    You should have received a copy of the GNU General Public License
   3.651 -    along with this program.  If not, see <http://www.gnu.org/licenses/>.
   3.652 -
   3.653 -Also add information on how to contact you by electronic and paper mail.
   3.654 -
   3.655 -  If the program does terminal interaction, make it output a short
   3.656 -notice like this when it starts in an interactive mode:
   3.657 -
   3.658 -    <program>  Copyright (C) <year>  <name of author>
   3.659 -    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
   3.660 -    This is free software, and you are welcome to redistribute it
   3.661 -    under certain conditions; type `show c' for details.
   3.662 -
   3.663 -The hypothetical commands `show w' and `show c' should show the appropriate
   3.664 -parts of the General Public License.  Of course, your program's commands
   3.665 -might be different; for a GUI interface, you would use an "about box".
   3.666 -
   3.667 -  You should also get your employer (if you work as a programmer) or school,
   3.668 -if any, to sign a "copyright disclaimer" for the program, if necessary.
   3.669 -For more information on this, and how to apply and follow the GNU GPL, see
   3.670 -<http://www.gnu.org/licenses/>.
   3.671 -
   3.672 -  The GNU General Public License does not permit incorporating your program
   3.673 -into proprietary programs.  If your program is a subroutine library, you
   3.674 -may consider it more useful to permit linking proprietary applications with
   3.675 -the library.  If this is what you want to do, use the GNU Lesser General
   3.676 -Public License instead of this License.  But first, please read
   3.677 -<http://www.gnu.org/philosophy/why-not-lgpl.html>.
   3.678 +                    GNU GENERAL PUBLIC LICENSE
   3.679 +                       Version 3, 29 June 2007
   3.680 +
   3.681 + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
   3.682 + Everyone is permitted to copy and distribute verbatim copies
   3.683 + of this license document, but changing it is not allowed.
   3.684 +
   3.685 +                            Preamble
   3.686 +
   3.687 +  The GNU General Public License is a free, copyleft license for
   3.688 +software and other kinds of works.
   3.689 +
   3.690 +  The licenses for most software and other practical works are designed
   3.691 +to take away your freedom to share and change the works.  By contrast,
   3.692 +the GNU General Public License is intended to guarantee your freedom to
   3.693 +share and change all versions of a program--to make sure it remains free
   3.694 +software for all its users.  We, the Free Software Foundation, use the
   3.695 +GNU General Public License for most of our software; it applies also to
   3.696 +any other work released this way by its authors.  You can apply it to
   3.697 +your programs, too.
   3.698 +
   3.699 +  When we speak of free software, we are referring to freedom, not
   3.700 +price.  Our General Public Licenses are designed to make sure that you
   3.701 +have the freedom to distribute copies of free software (and charge for
   3.702 +them if you wish), that you receive source code or can get it if you
   3.703 +want it, that you can change the software or use pieces of it in new
   3.704 +free programs, and that you know you can do these things.
   3.705 +
   3.706 +  To protect your rights, we need to prevent others from denying you
   3.707 +these rights or asking you to surrender the rights.  Therefore, you have
   3.708 +certain responsibilities if you distribute copies of the software, or if
   3.709 +you modify it: responsibilities to respect the freedom of others.
   3.710 +
   3.711 +  For example, if you distribute copies of such a program, whether
   3.712 +gratis or for a fee, you must pass on to the recipients the same
   3.713 +freedoms that you received.  You must make sure that they, too, receive
   3.714 +or can get the source code.  And you must show them these terms so they
   3.715 +know their rights.
   3.716 +
   3.717 +  Developers that use the GNU GPL protect your rights with two steps:
   3.718 +(1) assert copyright on the software, and (2) offer you this License
   3.719 +giving you legal permission to copy, distribute and/or modify it.
   3.720 +
   3.721 +  For the developers' and authors' protection, the GPL clearly explains
   3.722 +that there is no warranty for this free software.  For both users' and
   3.723 +authors' sake, the GPL requires that modified versions be marked as
   3.724 +changed, so that their problems will not be attributed erroneously to
   3.725 +authors of previous versions.
   3.726 +
   3.727 +  Some devices are designed to deny users access to install or run
   3.728 +modified versions of the software inside them, although the manufacturer
   3.729 +can do so.  This is fundamentally incompatible with the aim of
   3.730 +protecting users' freedom to change the software.  The systematic
   3.731 +pattern of such abuse occurs in the area of products for individuals to
   3.732 +use, which is precisely where it is most unacceptable.  Therefore, we
   3.733 +have designed this version of the GPL to prohibit the practice for those
   3.734 +products.  If such problems arise substantially in other domains, we
   3.735 +stand ready to extend this provision to those domains in future versions
   3.736 +of the GPL, as needed to protect the freedom of users.
   3.737 +
   3.738 +  Finally, every program is threatened constantly by software patents.
   3.739 +States should not allow patents to restrict development and use of
   3.740 +software on general-purpose computers, but in those that do, we wish to
   3.741 +avoid the special danger that patents applied to a free program could
   3.742 +make it effectively proprietary.  To prevent this, the GPL assures that
   3.743 +patents cannot be used to render the program non-free.
   3.744 +
   3.745 +  The precise terms and conditions for copying, distribution and
   3.746 +modification follow.
   3.747 +
   3.748 +                       TERMS AND CONDITIONS
   3.749 +
   3.750 +  0. Definitions.
   3.751 +
   3.752 +  "This License" refers to version 3 of the GNU General Public License.
   3.753 +
   3.754 +  "Copyright" also means copyright-like laws that apply to other kinds of
   3.755 +works, such as semiconductor masks.
   3.756 +
   3.757 +  "The Program" refers to any copyrightable work licensed under this
   3.758 +License.  Each licensee is addressed as "you".  "Licensees" and
   3.759 +"recipients" may be individuals or organizations.
   3.760 +
   3.761 +  To "modify" a work means to copy from or adapt all or part of the work
   3.762 +in a fashion requiring copyright permission, other than the making of an
   3.763 +exact copy.  The resulting work is called a "modified version" of the
   3.764 +earlier work or a work "based on" the earlier work.
   3.765 +
   3.766 +  A "covered work" means either the unmodified Program or a work based
   3.767 +on the Program.
   3.768 +
   3.769 +  To "propagate" a work means to do anything with it that, without
   3.770 +permission, would make you directly or secondarily liable for
   3.771 +infringement under applicable copyright law, except executing it on a
   3.772 +computer or modifying a private copy.  Propagation includes copying,
   3.773 +distribution (with or without modification), making available to the
   3.774 +public, and in some countries other activities as well.
   3.775 +
   3.776 +  To "convey" a work means any kind of propagation that enables other
   3.777 +parties to make or receive copies.  Mere interaction with a user through
   3.778 +a computer network, with no transfer of a copy, is not conveying.
   3.779 +
   3.780 +  An interactive user interface displays "Appropriate Legal Notices"
   3.781 +to the extent that it includes a convenient and prominently visible
   3.782 +feature that (1) displays an appropriate copyright notice, and (2)
   3.783 +tells the user that there is no warranty for the work (except to the
   3.784 +extent that warranties are provided), that licensees may convey the
   3.785 +work under this License, and how to view a copy of this License.  If
   3.786 +the interface presents a list of user commands or options, such as a
   3.787 +menu, a prominent item in the list meets this criterion.
   3.788 +
   3.789 +  1. Source Code.
   3.790 +
   3.791 +  The "source code" for a work means the preferred form of the work
   3.792 +for making modifications to it.  "Object code" means any non-source
   3.793 +form of a work.
   3.794 +
   3.795 +  A "Standard Interface" means an interface that either is an official
   3.796 +standard defined by a recognized standards body, or, in the case of
   3.797 +interfaces specified for a particular programming language, one that
   3.798 +is widely used among developers working in that language.
   3.799 +
   3.800 +  The "System Libraries" of an executable work include anything, other
   3.801 +than the work as a whole, that (a) is included in the normal form of
   3.802 +packaging a Major Component, but which is not part of that Major
   3.803 +Component, and (b) serves only to enable use of the work with that
   3.804 +Major Component, or to implement a Standard Interface for which an
   3.805 +implementation is available to the public in source code form.  A
   3.806 +"Major Component", in this context, means a major essential component
   3.807 +(kernel, window system, and so on) of the specific operating system
   3.808 +(if any) on which the executable work runs, or a compiler used to
   3.809 +produce the work, or an object code interpreter used to run it.
   3.810 +
   3.811 +  The "Corresponding Source" for a work in object code form means all
   3.812 +the source code needed to generate, install, and (for an executable
   3.813 +work) run the object code and to modify the work, including scripts to
   3.814 +control those activities.  However, it does not include the work's
   3.815 +System Libraries, or general-purpose tools or generally available free
   3.816 +programs which are used unmodified in performing those activities but
   3.817 +which are not part of the work.  For example, Corresponding Source
   3.818 +includes interface definition files associated with source files for
   3.819 +the work, and the source code for shared libraries and dynamically
   3.820 +linked subprograms that the work is specifically designed to require,
   3.821 +such as by intimate data communication or control flow between those
   3.822 +subprograms and other parts of the work.
   3.823 +
   3.824 +  The Corresponding Source need not include anything that users
   3.825 +can regenerate automatically from other parts of the Corresponding
   3.826 +Source.
   3.827 +
   3.828 +  The Corresponding Source for a work in source code form is that
   3.829 +same work.
   3.830 +
   3.831 +  2. Basic Permissions.
   3.832 +
   3.833 +  All rights granted under this License are granted for the term of
   3.834 +copyright on the Program, and are irrevocable provided the stated
   3.835 +conditions are met.  This License explicitly affirms your unlimited
   3.836 +permission to run the unmodified Program.  The output from running a
   3.837 +covered work is covered by this License only if the output, given its
   3.838 +content, constitutes a covered work.  This License acknowledges your
   3.839 +rights of fair use or other equivalent, as provided by copyright law.
   3.840 +
   3.841 +  You may make, run and propagate covered works that you do not
   3.842 +convey, without conditions so long as your license otherwise remains
   3.843 +in force.  You may convey covered works to others for the sole purpose
   3.844 +of having them make modifications exclusively for you, or provide you
   3.845 +with facilities for running those works, provided that you comply with
   3.846 +the terms of this License in conveying all material for which you do
   3.847 +not control copyright.  Those thus making or running the covered works
   3.848 +for you must do so exclusively on your behalf, under your direction
   3.849 +and control, on terms that prohibit them from making any copies of
   3.850 +your copyrighted material outside their relationship with you.
   3.851 +
   3.852 +  Conveying under any other circumstances is permitted solely under
   3.853 +the conditions stated below.  Sublicensing is not allowed; section 10
   3.854 +makes it unnecessary.
   3.855 +
   3.856 +  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
   3.857 +
   3.858 +  No covered work shall be deemed part of an effective technological
   3.859 +measure under any applicable law fulfilling obligations under article
   3.860 +11 of the WIPO copyright treaty adopted on 20 December 1996, or
   3.861 +similar laws prohibiting or restricting circumvention of such
   3.862 +measures.
   3.863 +
   3.864 +  When you convey a covered work, you waive any legal power to forbid
   3.865 +circumvention of technological measures to the extent such circumvention
   3.866 +is effected by exercising rights under this License with respect to
   3.867 +the covered work, and you disclaim any intention to limit operation or
   3.868 +modification of the work as a means of enforcing, against the work's
   3.869 +users, your or third parties' legal rights to forbid circumvention of
   3.870 +technological measures.
   3.871 +
   3.872 +  4. Conveying Verbatim Copies.
   3.873 +
   3.874 +  You may convey verbatim copies of the Program's source code as you
   3.875 +receive it, in any medium, provided that you conspicuously and
   3.876 +appropriately publish on each copy an appropriate copyright notice;
   3.877 +keep intact all notices stating that this License and any
   3.878 +non-permissive terms added in accord with section 7 apply to the code;
   3.879 +keep intact all notices of the absence of any warranty; and give all
   3.880 +recipients a copy of this License along with the Program.
   3.881 +
   3.882 +  You may charge any price or no price for each copy that you convey,
   3.883 +and you may offer support or warranty protection for a fee.
   3.884 +
   3.885 +  5. Conveying Modified Source Versions.
   3.886 +
   3.887 +  You may convey a work based on the Program, or the modifications to
   3.888 +produce it from the Program, in the form of source code under the
   3.889 +terms of section 4, provided that you also meet all of these conditions:
   3.890 +
   3.891 +    a) The work must carry prominent notices stating that you modified
   3.892 +    it, and giving a relevant date.
   3.893 +
   3.894 +    b) The work must carry prominent notices stating that it is
   3.895 +    released under this License and any conditions added under section
   3.896 +    7.  This requirement modifies the requirement in section 4 to
   3.897 +    "keep intact all notices".
   3.898 +
   3.899 +    c) You must license the entire work, as a whole, under this
   3.900 +    License to anyone who comes into possession of a copy.  This
   3.901 +    License will therefore apply, along with any applicable section 7
   3.902 +    additional terms, to the whole of the work, and all its parts,
   3.903 +    regardless of how they are packaged.  This License gives no
   3.904 +    permission to license the work in any other way, but it does not
   3.905 +    invalidate such permission if you have separately received it.
   3.906 +
   3.907 +    d) If the work has interactive user interfaces, each must display
   3.908 +    Appropriate Legal Notices; however, if the Program has interactive
   3.909 +    interfaces that do not display Appropriate Legal Notices, your
   3.910 +    work need not make them do so.
   3.911 +
   3.912 +  A compilation of a covered work with other separate and independent
   3.913 +works, which are not by their nature extensions of the covered work,
   3.914 +and which are not combined with it such as to form a larger program,
   3.915 +in or on a volume of a storage or distribution medium, is called an
   3.916 +"aggregate" if the compilation and its resulting copyright are not
   3.917 +used to limit the access or legal rights of the compilation's users
   3.918 +beyond what the individual works permit.  Inclusion of a covered work
   3.919 +in an aggregate does not cause this License to apply to the other
   3.920 +parts of the aggregate.
   3.921 +
   3.922 +  6. Conveying Non-Source Forms.
   3.923 +
   3.924 +  You may convey a covered work in object code form under the terms
   3.925 +of sections 4 and 5, provided that you also convey the
   3.926 +machine-readable Corresponding Source under the terms of this License,
   3.927 +in one of these ways:
   3.928 +
   3.929 +    a) Convey the object code in, or embodied in, a physical product
   3.930 +    (including a physical distribution medium), accompanied by the
   3.931 +    Corresponding Source fixed on a durable physical medium
   3.932 +    customarily used for software interchange.
   3.933 +
   3.934 +    b) Convey the object code in, or embodied in, a physical product
   3.935 +    (including a physical distribution medium), accompanied by a
   3.936 +    written offer, valid for at least three years and valid for as
   3.937 +    long as you offer spare parts or customer support for that product
   3.938 +    model, to give anyone who possesses the object code either (1) a
   3.939 +    copy of the Corresponding Source for all the software in the
   3.940 +    product that is covered by this License, on a durable physical
   3.941 +    medium customarily used for software interchange, for a price no
   3.942 +    more than your reasonable cost of physically performing this
   3.943 +    conveying of source, or (2) access to copy the
   3.944 +    Corresponding Source from a network server at no charge.
   3.945 +
   3.946 +    c) Convey individual copies of the object code with a copy of the
   3.947 +    written offer to provide the Corresponding Source.  This
   3.948 +    alternative is allowed only occasionally and noncommercially, and
   3.949 +    only if you received the object code with such an offer, in accord
   3.950 +    with subsection 6b.
   3.951 +
   3.952 +    d) Convey the object code by offering access from a designated
   3.953 +    place (gratis or for a charge), and offer equivalent access to the
   3.954 +    Corresponding Source in the same way through the same place at no
   3.955 +    further charge.  You need not require recipients to copy the
   3.956 +    Corresponding Source along with the object code.  If the place to
   3.957 +    copy the object code is a network server, the Corresponding Source
   3.958 +    may be on a different server (operated by you or a third party)
   3.959 +    that supports equivalent copying facilities, provided you maintain
   3.960 +    clear directions next to the object code saying where to find the
   3.961 +    Corresponding Source.  Regardless of what server hosts the
   3.962 +    Corresponding Source, you remain obligated to ensure that it is
   3.963 +    available for as long as needed to satisfy these requirements.
   3.964 +
   3.965 +    e) Convey the object code using peer-to-peer transmission, provided
   3.966 +    you inform other peers where the object code and Corresponding
   3.967 +    Source of the work are being offered to the general public at no
   3.968 +    charge under subsection 6d.
   3.969 +
   3.970 +  A separable portion of the object code, whose source code is excluded
   3.971 +from the Corresponding Source as a System Library, need not be
   3.972 +included in conveying the object code work.
   3.973 +
   3.974 +  A "User Product" is either (1) a "consumer product", which means any
   3.975 +tangible personal property which is normally used for personal, family,
   3.976 +or household purposes, or (2) anything designed or sold for incorporation
   3.977 +into a dwelling.  In determining whether a product is a consumer product,
   3.978 +doubtful cases shall be resolved in favor of coverage.  For a particular
   3.979 +product received by a particular user, "normally used" refers to a
   3.980 +typical or common use of that class of product, regardless of the status
   3.981 +of the particular user or of the way in which the particular user
   3.982 +actually uses, or expects or is expected to use, the product.  A product
   3.983 +is a consumer product regardless of whether the product has substantial
   3.984 +commercial, industrial or non-consumer uses, unless such uses represent
   3.985 +the only significant mode of use of the product.
   3.986 +
   3.987 +  "Installation Information" for a User Product means any methods,
   3.988 +procedures, authorization keys, or other information required to install
   3.989 +and execute modified versions of a covered work in that User Product from
   3.990 +a modified version of its Corresponding Source.  The information must
   3.991 +suffice to ensure that the continued functioning of the modified object
   3.992 +code is in no case prevented or interfered with solely because
   3.993 +modification has been made.
   3.994 +
   3.995 +  If you convey an object code work under this section in, or with, or
   3.996 +specifically for use in, a User Product, and the conveying occurs as
   3.997 +part of a transaction in which the right of possession and use of the
   3.998 +User Product is transferred to the recipient in perpetuity or for a
   3.999 +fixed term (regardless of how the transaction is characterized), the
  3.1000 +Corresponding Source conveyed under this section must be accompanied
  3.1001 +by the Installation Information.  But this requirement does not apply
  3.1002 +if neither you nor any third party retains the ability to install
  3.1003 +modified object code on the User Product (for example, the work has
  3.1004 +been installed in ROM).
  3.1005 +
  3.1006 +  The requirement to provide Installation Information does not include a
  3.1007 +requirement to continue to provide support service, warranty, or updates
  3.1008 +for a work that has been modified or installed by the recipient, or for
  3.1009 +the User Product in which it has been modified or installed.  Access to a
  3.1010 +network may be denied when the modification itself materially and
  3.1011 +adversely affects the operation of the network or violates the rules and
  3.1012 +protocols for communication across the network.
  3.1013 +
  3.1014 +  Corresponding Source conveyed, and Installation Information provided,
  3.1015 +in accord with this section must be in a format that is publicly
  3.1016 +documented (and with an implementation available to the public in
  3.1017 +source code form), and must require no special password or key for
  3.1018 +unpacking, reading or copying.
  3.1019 +
  3.1020 +  7. Additional Terms.
  3.1021 +
  3.1022 +  "Additional permissions" are terms that supplement the terms of this
  3.1023 +License by making exceptions from one or more of its conditions.
  3.1024 +Additional permissions that are applicable to the entire Program shall
  3.1025 +be treated as though they were included in this License, to the extent
  3.1026 +that they are valid under applicable law.  If additional permissions
  3.1027 +apply only to part of the Program, that part may be used separately
  3.1028 +under those permissions, but the entire Program remains governed by
  3.1029 +this License without regard to the additional permissions.
  3.1030 +
  3.1031 +  When you convey a copy of a covered work, you may at your option
  3.1032 +remove any additional permissions from that copy, or from any part of
  3.1033 +it.  (Additional permissions may be written to require their own
  3.1034 +removal in certain cases when you modify the work.)  You may place
  3.1035 +additional permissions on material, added by you to a covered work,
  3.1036 +for which you have or can give appropriate copyright permission.
  3.1037 +
  3.1038 +  Notwithstanding any other provision of this License, for material you
  3.1039 +add to a covered work, you may (if authorized by the copyright holders of
  3.1040 +that material) supplement the terms of this License with terms:
  3.1041 +
  3.1042 +    a) Disclaiming warranty or limiting liability differently from the
  3.1043 +    terms of sections 15 and 16 of this License; or
  3.1044 +
  3.1045 +    b) Requiring preservation of specified reasonable legal notices or
  3.1046 +    author attributions in that material or in the Appropriate Legal
  3.1047 +    Notices displayed by works containing it; or
  3.1048 +
  3.1049 +    c) Prohibiting misrepresentation of the origin of that material, or
  3.1050 +    requiring that modified versions of such material be marked in
  3.1051 +    reasonable ways as different from the original version; or
  3.1052 +
  3.1053 +    d) Limiting the use for publicity purposes of names of licensors or
  3.1054 +    authors of the material; or
  3.1055 +
  3.1056 +    e) Declining to grant rights under trademark law for use of some
  3.1057 +    trade names, trademarks, or service marks; or
  3.1058 +
  3.1059 +    f) Requiring indemnification of licensors and authors of that
  3.1060 +    material by anyone who conveys the material (or modified versions of
  3.1061 +    it) with contractual assumptions of liability to the recipient, for
  3.1062 +    any liability that these contractual assumptions directly impose on
  3.1063 +    those licensors and authors.
  3.1064 +
  3.1065 +  All other non-permissive additional terms are considered "further
  3.1066 +restrictions" within the meaning of section 10.  If the Program as you
  3.1067 +received it, or any part of it, contains a notice stating that it is
  3.1068 +governed by this License along with a term that is a further
  3.1069 +restriction, you may remove that term.  If a license document contains
  3.1070 +a further restriction but permits relicensing or conveying under this
  3.1071 +License, you may add to a covered work material governed by the terms
  3.1072 +of that license document, provided that the further restriction does
  3.1073 +not survive such relicensing or conveying.
  3.1074 +
  3.1075 +  If you add terms to a covered work in accord with this section, you
  3.1076 +must place, in the relevant source files, a statement of the
  3.1077 +additional terms that apply to those files, or a notice indicating
  3.1078 +where to find the applicable terms.
  3.1079 +
  3.1080 +  Additional terms, permissive or non-permissive, may be stated in the
  3.1081 +form of a separately written license, or stated as exceptions;
  3.1082 +the above requirements apply either way.
  3.1083 +
  3.1084 +  8. Termination.
  3.1085 +
  3.1086 +  You may not propagate or modify a covered work except as expressly
  3.1087 +provided under this License.  Any attempt otherwise to propagate or
  3.1088 +modify it is void, and will automatically terminate your rights under
  3.1089 +this License (including any patent licenses granted under the third
  3.1090 +paragraph of section 11).
  3.1091 +
  3.1092 +  However, if you cease all violation of this License, then your
  3.1093 +license from a particular copyright holder is reinstated (a)
  3.1094 +provisionally, unless and until the copyright holder explicitly and
  3.1095 +finally terminates your license, and (b) permanently, if the copyright
  3.1096 +holder fails to notify you of the violation by some reasonable means
  3.1097 +prior to 60 days after the cessation.
  3.1098 +
  3.1099 +  Moreover, your license from a particular copyright holder is
  3.1100 +reinstated permanently if the copyright holder notifies you of the
  3.1101 +violation by some reasonable means, this is the first time you have
  3.1102 +received notice of violation of this License (for any work) from that
  3.1103 +copyright holder, and you cure the violation prior to 30 days after
  3.1104 +your receipt of the notice.
  3.1105 +
  3.1106 +  Termination of your rights under this section does not terminate the
  3.1107 +licenses of parties who have received copies or rights from you under
  3.1108 +this License.  If your rights have been terminated and not permanently
  3.1109 +reinstated, you do not qualify to receive new licenses for the same
  3.1110 +material under section 10.
  3.1111 +
  3.1112 +  9. Acceptance Not Required for Having Copies.
  3.1113 +
  3.1114 +  You are not required to accept this License in order to receive or
  3.1115 +run a copy of the Program.  Ancillary propagation of a covered work
  3.1116 +occurring solely as a consequence of using peer-to-peer transmission
  3.1117 +to receive a copy likewise does not require acceptance.  However,
  3.1118 +nothing other than this License grants you permission to propagate or
  3.1119 +modify any covered work.  These actions infringe copyright if you do
  3.1120 +not accept this License.  Therefore, by modifying or propagating a
  3.1121 +covered work, you indicate your acceptance of this License to do so.
  3.1122 +
  3.1123 +  10. Automatic Licensing of Downstream Recipients.
  3.1124 +
  3.1125 +  Each time you convey a covered work, the recipient automatically
  3.1126 +receives a license from the original licensors, to run, modify and
  3.1127 +propagate that work, subject to this License.  You are not responsible
  3.1128 +for enforcing compliance by third parties with this License.
  3.1129 +
  3.1130 +  An "entity transaction" is a transaction transferring control of an
  3.1131 +organization, or substantially all assets of one, or subdividing an
  3.1132 +organization, or merging organizations.  If propagation of a covered
  3.1133 +work results from an entity transaction, each party to that
  3.1134 +transaction who receives a copy of the work also receives whatever
  3.1135 +licenses to the work the party's predecessor in interest had or could
  3.1136 +give under the previous paragraph, plus a right to possession of the
  3.1137 +Corresponding Source of the work from the predecessor in interest, if
  3.1138 +the predecessor has it or can get it with reasonable efforts.
  3.1139 +
  3.1140 +  You may not impose any further restrictions on the exercise of the
  3.1141 +rights granted or affirmed under this License.  For example, you may
  3.1142 +not impose a license fee, royalty, or other charge for exercise of
  3.1143 +rights granted under this License, and you may not initiate litigation
  3.1144 +(including a cross-claim or counterclaim in a lawsuit) alleging that
  3.1145 +any patent claim is infringed by making, using, selling, offering for
  3.1146 +sale, or importing the Program or any portion of it.
  3.1147 +
  3.1148 +  11. Patents.
  3.1149 +
  3.1150 +  A "contributor" is a copyright holder who authorizes use under this
  3.1151 +License of the Program or a work on which the Program is based.  The
  3.1152 +work thus licensed is called the contributor's "contributor version".
  3.1153 +
  3.1154 +  A contributor's "essential patent claims" are all patent claims
  3.1155 +owned or controlled by the contributor, whether already acquired or
  3.1156 +hereafter acquired, that would be infringed by some manner, permitted
  3.1157 +by this License, of making, using, or selling its contributor version,
  3.1158 +but do not include claims that would be infringed only as a
  3.1159 +consequence of further modification of the contributor version.  For
  3.1160 +purposes of this definition, "control" includes the right to grant
  3.1161 +patent sublicenses in a manner consistent with the requirements of
  3.1162 +this License.
  3.1163 +
  3.1164 +  Each contributor grants you a non-exclusive, worldwide, royalty-free
  3.1165 +patent license under the contributor's essential patent claims, to
  3.1166 +make, use, sell, offer for sale, import and otherwise run, modify and
  3.1167 +propagate the contents of its contributor version.
  3.1168 +
  3.1169 +  In the following three paragraphs, a "patent license" is any express
  3.1170 +agreement or commitment, however denominated, not to enforce a patent
  3.1171 +(such as an express permission to practice a patent or covenant not to
  3.1172 +sue for patent infringement).  To "grant" such a patent license to a
  3.1173 +party means to make such an agreement or commitment not to enforce a
  3.1174 +patent against the party.
  3.1175 +
  3.1176 +  If you convey a covered work, knowingly relying on a patent license,
  3.1177 +and the Corresponding Source of the work is not available for anyone
  3.1178 +to copy, free of charge and under the terms of this License, through a
  3.1179 +publicly available network server or other readily accessible means,
  3.1180 +then you must either (1) cause the Corresponding Source to be so
  3.1181 +available, or (2) arrange to deprive yourself of the benefit of the
  3.1182 +patent license for this particular work, or (3) arrange, in a manner
  3.1183 +consistent with the requirements of this License, to extend the patent
  3.1184 +license to downstream recipients.  "Knowingly relying" means you have
  3.1185 +actual knowledge that, but for the patent license, your conveying the
  3.1186 +covered work in a country, or your recipient's use of the covered work
  3.1187 +in a country, would infringe one or more identifiable patents in that
  3.1188 +country that you have reason to believe are valid.
  3.1189 +
  3.1190 +  If, pursuant to or in connection with a single transaction or
  3.1191 +arrangement, you convey, or propagate by procuring conveyance of, a
  3.1192 +covered work, and grant a patent license to some of the parties
  3.1193 +receiving the covered work authorizing them to use, propagate, modify
  3.1194 +or convey a specific copy of the covered work, then the patent license
  3.1195 +you grant is automatically extended to all recipients of the covered
  3.1196 +work and works based on it.
  3.1197 +
  3.1198 +  A patent license is "discriminatory" if it does not include within
  3.1199 +the scope of its coverage, prohibits the exercise of, or is
  3.1200 +conditioned on the non-exercise of one or more of the rights that are
  3.1201 +specifically granted under this License.  You may not convey a covered
  3.1202 +work if you are a party to an arrangement with a third party that is
  3.1203 +in the business of distributing software, under which you make payment
  3.1204 +to the third party based on the extent of your activity of conveying
  3.1205 +the work, and under which the third party grants, to any of the
  3.1206 +parties who would receive the covered work from you, a discriminatory
  3.1207 +patent license (a) in connection with copies of the covered work
  3.1208 +conveyed by you (or copies made from those copies), or (b) primarily
  3.1209 +for and in connection with specific products or compilations that
  3.1210 +contain the covered work, unless you entered into that arrangement,
  3.1211 +or that patent license was granted, prior to 28 March 2007.
  3.1212 +
  3.1213 +  Nothing in this License shall be construed as excluding or limiting
  3.1214 +any implied license or other defenses to infringement that may
  3.1215 +otherwise be available to you under applicable patent law.
  3.1216 +
  3.1217 +  12. No Surrender of Others' Freedom.
  3.1218 +
  3.1219 +  If conditions are imposed on you (whether by court order, agreement or
  3.1220 +otherwise) that contradict the conditions of this License, they do not
  3.1221 +excuse you from the conditions of this License.  If you cannot convey a
  3.1222 +covered work so as to satisfy simultaneously your obligations under this
  3.1223 +License and any other pertinent obligations, then as a consequence you may
  3.1224 +not convey it at all.  For example, if you agree to terms that obligate you
  3.1225 +to collect a royalty for further conveying from those to whom you convey
  3.1226 +the Program, the only way you could satisfy both those terms and this
  3.1227 +License would be to refrain entirely from conveying the Program.
  3.1228 +
  3.1229 +  13. Use with the GNU Affero General Public License.
  3.1230 +
  3.1231 +  Notwithstanding any other provision of this License, you have
  3.1232 +permission to link or combine any covered work with a work licensed
  3.1233 +under version 3 of the GNU Affero General Public License into a single
  3.1234 +combined work, and to convey the resulting work.  The terms of this
  3.1235 +License will continue to apply to the part which is the covered work,
  3.1236 +but the special requirements of the GNU Affero General Public License,
  3.1237 +section 13, concerning interaction through a network will apply to the
  3.1238 +combination as such.
  3.1239 +
  3.1240 +  14. Revised Versions of this License.
  3.1241 +
  3.1242 +  The Free Software Foundation may publish revised and/or new versions of
  3.1243 +the GNU General Public License from time to time.  Such new versions will
  3.1244 +be similar in spirit to the present version, but may differ in detail to
  3.1245 +address new problems or concerns.
  3.1246 +
  3.1247 +  Each version is given a distinguishing version number.  If the
  3.1248 +Program specifies that a certain numbered version of the GNU General
  3.1249 +Public License "or any later version" applies to it, you have the
  3.1250 +option of following the terms and conditions either of that numbered
  3.1251 +version or of any later version published by the Free Software
  3.1252 +Foundation.  If the Program does not specify a version number of the
  3.1253 +GNU General Public License, you may choose any version ever published
  3.1254 +by the Free Software Foundation.
  3.1255 +
  3.1256 +  If the Program specifies that a proxy can decide which future
  3.1257 +versions of the GNU General Public License can be used, that proxy's
  3.1258 +public statement of acceptance of a version permanently authorizes you
  3.1259 +to choose that version for the Program.
  3.1260 +
  3.1261 +  Later license versions may give you additional or different
  3.1262 +permissions.  However, no additional obligations are imposed on any
  3.1263 +author or copyright holder as a result of your choosing to follow a
  3.1264 +later version.
  3.1265 +
  3.1266 +  15. Disclaimer of Warranty.
  3.1267 +
  3.1268 +  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
  3.1269 +APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
  3.1270 +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
  3.1271 +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
  3.1272 +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  3.1273 +PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
  3.1274 +IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
  3.1275 +ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
  3.1276 +
  3.1277 +  16. Limitation of Liability.
  3.1278 +
  3.1279 +  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
  3.1280 +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
  3.1281 +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
  3.1282 +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
  3.1283 +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
  3.1284 +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
  3.1285 +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
  3.1286 +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
  3.1287 +SUCH DAMAGES.
  3.1288 +
  3.1289 +  17. Interpretation of Sections 15 and 16.
  3.1290 +
  3.1291 +  If the disclaimer of warranty and limitation of liability provided
  3.1292 +above cannot be given local legal effect according to their terms,
  3.1293 +reviewing courts shall apply local law that most closely approximates
  3.1294 +an absolute waiver of all civil liability in connection with the
  3.1295 +Program, unless a warranty or assumption of liability accompanies a
  3.1296 +copy of the Program in return for a fee.
  3.1297 +
  3.1298 +                     END OF TERMS AND CONDITIONS
  3.1299 +
  3.1300 +            How to Apply These Terms to Your New Programs
  3.1301 +
  3.1302 +  If you develop a new program, and you want it to be of the greatest
  3.1303 +possible use to the public, the best way to achieve this is to make it
  3.1304 +free software which everyone can redistribute and change under these terms.
  3.1305 +
  3.1306 +  To do so, attach the following notices to the program.  It is safest
  3.1307 +to attach them to the start of each source file to most effectively
  3.1308 +state the exclusion of warranty; and each file should have at least
  3.1309 +the "copyright" line and a pointer to where the full notice is found.
  3.1310 +
  3.1311 +    <one line to give the program's name and a brief idea of what it does.>
  3.1312 +    Copyright (C) <year>  <name of author>
  3.1313 +
  3.1314 +    This program is free software: you can redistribute it and/or modify
  3.1315 +    it under the terms of the GNU General Public License as published by
  3.1316 +    the Free Software Foundation, either version 3 of the License, or
  3.1317 +    (at your option) any later version.
  3.1318 +
  3.1319 +    This program is distributed in the hope that it will be useful,
  3.1320 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
  3.1321 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  3.1322 +    GNU General Public License for more details.
  3.1323 +
  3.1324 +    You should have received a copy of the GNU General Public License
  3.1325 +    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  3.1326 +
  3.1327 +Also add information on how to contact you by electronic and paper mail.
  3.1328 +
  3.1329 +  If the program does terminal interaction, make it output a short
  3.1330 +notice like this when it starts in an interactive mode:
  3.1331 +
  3.1332 +    <program>  Copyright (C) <year>  <name of author>
  3.1333 +    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
  3.1334 +    This is free software, and you are welcome to redistribute it
  3.1335 +    under certain conditions; type `show c' for details.
  3.1336 +
  3.1337 +The hypothetical commands `show w' and `show c' should show the appropriate
  3.1338 +parts of the General Public License.  Of course, your program's commands
  3.1339 +might be different; for a GUI interface, you would use an "about box".
  3.1340 +
  3.1341 +  You should also get your employer (if you work as a programmer) or school,
  3.1342 +if any, to sign a "copyright disclaimer" for the program, if necessary.
  3.1343 +For more information on this, and how to apply and follow the GNU GPL, see
  3.1344 +<http://www.gnu.org/licenses/>.
  3.1345 +
  3.1346 +  The GNU General Public License does not permit incorporating your program
  3.1347 +into proprietary programs.  If your program is a subroutine library, you
  3.1348 +may consider it more useful to permit linking proprietary applications with
  3.1349 +the library.  If this is what you want to do, use the GNU Lesser General
  3.1350 +Public License instead of this License.  But first, please read
  3.1351 +<http://www.gnu.org/philosophy/why-not-lgpl.html>.
     4.1 --- a/Makefile	Mon Aug 14 09:13:53 2017 +0200
     4.2 +++ b/Makefile	Wed Aug 30 14:42:51 2017 +0200
     4.3 @@ -1,27 +1,33 @@
     4.4 -# this file is under GNU General Public License v3.0
     4.5 +# Copyright 2017, pEp Foundation
     4.6 +# This file is part of pEpEngine
     4.7 +# This file may be used under the terms of the GNU General Public License version 3
     4.8  # see LICENSE.txt
     4.9  
    4.10 +HERE_REL := $(notdir $(CURDIR))
    4.11 +
    4.12  include Makefile.conf
    4.13  
    4.14 -# add it to the environment of all executed programs:
    4.15 -export YML_PATH
    4.16 +# YML_PATH is needed in the environment of every call to a program of the YML2 distribution
    4.17 +export YML_PATH=$(YML2_PATH)
    4.18  
    4.19 -
    4.20 -all:
    4.21 +.PHONY: all
    4.22 +all: _platform_override_info
    4.23  	$(MAKE) -C asn.1 generate
    4.24  	$(MAKE) -C asn.1
    4.25  	$(MAKE) -C sync
    4.26  	$(MAKE) -C src all
    4.27  
    4.28 -.PHONY: clean build_test test package install uninstall db
    4.29 -
    4.30 +.PHONY: install
    4.31  install: all
    4.32  	$(MAKE) -C src install
    4.33  	$(MAKE) -C asn.1 install
    4.34  
    4.35 +.PHONY: uninstall
    4.36  uninstall:
    4.37  	$(MAKE) -C src uninstall
    4.38 +	$(MAKE) -C asn.1 uninstall
    4.39  
    4.40 +.PHONY: clean
    4.41  clean:
    4.42  	$(MAKE) -C src clean
    4.43  	$(MAKE) -C test clean
    4.44 @@ -29,26 +35,29 @@
    4.45  	$(MAKE) -C sync clean
    4.46  	$(MAKE) -C asn.1 clean
    4.47  
    4.48 +.PHONY: test
    4.49  test: all
    4.50  	$(MAKE) -C test test
    4.51  	$(MAKE) -C test unit_tests
    4.52  
    4.53 +.PHONY: unit_tests
    4.54  unit_tests: all
    4.55  	$(MAKE) -C test unit_tests
    4.56  
    4.57 +.PHONY: package
    4.58  package: clean
    4.59 -	cd .. ; COPYFILE_DISABLE=true tar cjf pEpEngine.tar.bz2 pEpEngine
    4.60 +	cd .. ; COPYFILE_DISABLE=true tar cjf pEpEngine.tar.bz2 "$(HERE_REL)"
    4.61  
    4.62 +.PHONY: db
    4.63  db:
    4.64  	$(MAKE) -C db db
    4.65  
    4.66 -windist:
    4.67 -ifneq ($(BUILD_FOR),Windoze)
    4.68 -	@echo use BUILD_FOR=Windoze \(did you forget -e ?\)
    4.69 +.PHONY: _platform_override
    4.70 +ifdef PLATFORM_OVERRIDE
    4.71 +_platform_override_info:
    4.72 +	@echo "================================================"
    4.73 +	@echo "PLATFORM_OVERRIDE is set to '$(PLATFORM_OVERRIDE)'."
    4.74 +	@echo "================================================"
    4.75  else
    4.76 -	make clean
    4.77 -	$(MAKE) all
    4.78 -	$(MAKE) -C test all
    4.79 -	zip -j pEpEngine-dist.zip src/pEpEngine.h src/keymanagement.h src/pEpEngine.dll src/pEpEngine.def test/pEpEngineTest.exe test/*.asc test/*.key db/*.db test/*.txt test/*.asc src/*.sql
    4.80 +_platform_override_info:
    4.81  endif
    4.82 -
     5.1 --- a/Makefile.conf	Mon Aug 14 09:13:53 2017 +0200
     5.2 +++ b/Makefile.conf	Wed Aug 30 14:42:51 2017 +0200
     5.3 @@ -1,30 +1,21 @@
     5.4 -# this file is in the Public Domain
     5.5 +# Copyright 2017, pEp Foundation
     5.6 +# This file is part of pEpEngine
     5.7 +# This file may be used under the terms of the GNU General Public License version 3
     5.8 +# see LICENSE.txt
     5.9  
    5.10 -BUILD_ON=$(shell uname)
    5.11 -BUILD_FOR=$(BUILD_ON)
    5.12 -OPTIMIZE=-g -Wall -O0 -fPIC -DDEBUG_ERRORSTACK
    5.13 -#OPTIMIZE=-O3 -Wall -DNDEBUG -std=c99
    5.14 -LD=$(CC)
    5.15 -#CC=gcc-mp-4.9 -std=c99 -fstrict-aliasing -Wstrict-aliasing=3
    5.16 -#LD=gcc-mp-4.9
    5.17 -SYSTEM_DB=/usr/local/share/pEp/system.db
    5.18 -PREFIX=$(HOME)
    5.19 -YML2PROC=$(HOME)/yml2/yml2proc
    5.20 -YML_OPTS=--encoding=utf8
    5.21 -YML_PATH=$(HOME)/yml2
    5.22 -ASN1C=asn1c
    5.23 -ASN1C_INCLUDE=/opt/local/share/asn1c
    5.24 -#ETPAN_IN=$(HOME)
    5.25 -#LIBGPGME=/opt/local/lib/libgpgme.11.dylib
    5.26 +# This file assembles all the make variables that a maintainer or dev may want to taylor to his or her needs on a given platform.
    5.27  
    5.28 -# C makros (not environment variables) to overwrite:
    5.29 -#
    5.30 -# DEFAULT_KEYSERVER - string with default keyserver
    5.31 -# CRASHDUMP_DEFAULT_LINES - number of log lines to deliver for crashdumps
    5.32 +# To use custom build configuration variables, put them in a new file with the path `build-config/<name>.conf`. Execute `export PLATFORM_OVERRIDE=<name>` before running make. If this environment variable is not set, make will load a default configuration for your platform.
    5.33  
    5.34 -#EXTRAMACROS=-DDEFAULT_KEYSERVER=\"default-server.org\" -DCRASHDUMP_DEFAULT_LINES=23
    5.35 +BUILD_CONFIG:=$(dir $(lastword $(MAKEFILE_LIST)))build-config
    5.36  
    5.37 -# second instance for testing
    5.38 -
    5.39 -#EXTRAMACROS=-DLOCAL_DB_FILENAME=\".pEp_management2.db\"
    5.40 -#TARGET=libpEpEngine2.dylib 
    5.41 +include $(BUILD_CONFIG)/common.conf
    5.42 +# cross-compiling is currently not supported, but maybe you can hack something with `PLATFORM_OVERRIDE`
    5.43 +ifeq ($(BUILD_ON),$(BUILD_FOR))
    5.44 +    include $(BUILD_CONFIG)/$(BUILD_ON).conf
    5.45 +else
    5.46 +    $(error I don't know how to build for $(BUILD_FOR) on $(BUILD_ON))
    5.47 +endif
    5.48 +ifdef PLATFORM_OVERRIDE
    5.49 +    include $(BUILD_CONFIG)/$(PLATFORM_OVERRIDE).conf
    5.50 +endif
     6.1 --- a/README-OSX.md	Mon Aug 14 09:13:53 2017 +0200
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,137 +0,0 @@
     6.4 -This file is under Creative Commons License 3.0 cc-by-sa
     6.5 -
     6.6 -# Building for OS X/macOS
     6.7 -See also README.txt for general information.
     6.8 -
     6.9 -For compiling pEp Engine and its dependencies, make sure you have the LANG variable set. Some source files contain unicode characters, and python (assuming files are ascii) will fail.
    6.10 -
    6.11 -```
    6.12 -export LANG=en_US.UTF-8
    6.13 -```
    6.14 -
    6.15 -## Dependencies
    6.16 -
    6.17 -### MacPorts
    6.18 -[Install MacPorts](https://www.macports.org/install.php) for your version of OS X/macOS.
    6.19 -
    6.20 -If MacPorts is already installed on your machine, but was installed by a different user, make sure your `PATH` variable is set as follows in `~/.profile`:
    6.21 -
    6.22 -```
    6.23 -export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
    6.24 -```
    6.25 -
    6.26 -Install dependencies packaged with MacPorts as follows.
    6.27 -
    6.28 -```
    6.29 -sudo port install mercurial py27-lxml gpgme autoconf automake libtool asn1c zlib openssl libiconv cyrus-sasl2
    6.30 -```
    6.31 -
    6.32 -Make sure that `python` is a version 2 one:
    6.33 -
    6.34 -```
    6.35 -sudo port select python python27
    6.36 -```
    6.37 -
    6.38 -### NetPGP (if not GPGME)
    6.39 -
    6.40 -#### Prepare :
    6.41 -
    6.42 -Get OpenSSL and build/install it as shared library.
    6.43 -
    6.44 -```
    6.45 -wget https://www.openssl.org/source/old/1.0.1/openssl-1.0.1u.tar.gz
    6.46 -tar xvfz openssl-1.0.1u.tar.gz
    6.47 -cd openssl-1.0.1u
    6.48 -./Configure darwin64-x86_64-cc --prefix=$HOME shared
    6.49 -make install
    6.50 -```
    6.51 -
    6.52 -Get and autoconf NetPGP
    6.53 -
    6.54 -```
    6.55 -cd $SRC
    6.56 -hg clone https://cacert.pep.foundation/dev/repos/netpgp-et/
    6.57 -cd netpgp-et
    6.58 -autoreconf -i
    6.59 -```
    6.60 -
    6.61 -#### Build
    6.62 -
    6.63 -Important : LDFLAGS is set to help finding OpenSSL shared lib. If not set,
    6.64 -system's default libcrypto may silently be used instead, causing memory
    6.65 -corruption or crash at runtime.
    6.66 -
    6.67 -```
    6.68 -mkdir netpgp_debug
    6.69 -cd netpgp_debug
    6.70 -$SRC/netpgp-et/configure --with-openssl=$HOME --prefix=$HOME CPPFLAGS=-DDEBUG CXXFLAGS="-g -O0" LDFLAGS="-L${HOME}/lib"
    6.71 -make
    6.72 -make install
    6.73 -```
    6.74 -
    6.75 -### Other Dependecies
    6.76 -
    6.77 -#### [yml2](https://fdik.org/yml/toolchain)
    6.78 -Install into your home directory:
    6.79 -
    6.80 -```
    6.81 -pushd ~
    6.82 -hg clone https://cacert.pep.foundation/dev/repos/yml2/
    6.83 -popd
    6.84 -```
    6.85 -
    6.86 -#### libetpan
    6.87 -
    6.88 -Note: libetpan needs libz and libiconv, but the libiconv from MacPorts is not compatible, some
    6.89 -functions seem to have been renamed there. Therefore the dynlib from OS X is used.
    6.90 -
    6.91 -```
    6.92 -git clone https://github.com/fdik/libetpan
    6.93 -cd libetpan
    6.94 -./autogen.sh --prefix "$HOME"
    6.95 -make
    6.96 -make install
    6.97 -```
    6.98 -
    6.99 -## Building pEp Engine
   6.100 -
   6.101 -### Configuration
   6.102 -You can change some defaults by editing `Makefile.conf`. The following variable needs to be set appropriately:
   6.103 -
   6.104 -```
   6.105 -LIBGPGME=/opt/local/lib/libgpgme.11.dylib
   6.106 -```
   6.107 -
   6.108 -### Build
   6.109 -
   6.110 -```
   6.111 -make clean
   6.112 -make all
   6.113 -make db
   6.114 -```
   6.115 -
   6.116 -### Installation
   6.117 -
   6.118 -```
   6.119 -make install
   6.120 -sudo make -C db install
   6.121 -```
   6.122 -
   6.123 -Since the `system.db` rarely changes, the last step is not needed for every build. If you would like to be able to install the engine without `sudo`, ensure that your user can write the file `/usr/local/share/pEp/system.db`. This is not recommended for production machines.
   6.124 -
   6.125 -### Run tests
   6.126 -
   6.127 -If you installed the test keys in your keyring (see: README.txt), this should just work:
   6.128 -
   6.129 -```
   6.130 -cd test
   6.131 -make test
   6.132 -```
   6.133 -
   6.134 -# Building for iOS
   6.135 -
   6.136 -This is done with Xcode. Simply add `pEpEngine.xcodeproj` to
   6.137 -your project and add a dependency to the target `pEpEngine`
   6.138 -(in `Target Dependencies` in your `Build Phases`.
   6.139 -
   6.140 -Usually you just integrate `pEpiOSAdapter.xcodeproj`.
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/README.md	Wed Aug 30 14:42:51 2017 +0200
     7.3 @@ -0,0 +1,60 @@
     7.4 +<!-- Copyright 2015-2017, pEp foundation, Switzerland
     7.5 +This file is part of the pEp Engine
     7.6 +This file may be used under the terms of the Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) License
     7.7 +See CC_BY-SA.txt -->
     7.8 +
     7.9 +# What is the p≡p Engine?
    7.10 +The p≡p Engine is a Free Software library encapsulating implementations of:
    7.11 +
    7.12 +- Key Management
    7.13 +
    7.14 +  Key Management in the p≡p Engine is based on GnuPG key chains (NetPGP on iOS).
    7.15 +  Keys are stored in an OpenPGP-compatible format, and can be used for different crypto implementations.
    7.16 +
    7.17 +- Trust Rating
    7.18 +
    7.19 +  The p≡p Engine sports a two phase trust rating system for messages:
    7.20 +  In phase one a rating is derived based on channel, crypto and key security.
    7.21 +  This is named "comm\_types".
    7.22 +  In phase two these ratings are mapped to user-representable values mimicking the semantics of a traffic light.
    7.23 +
    7.24 +- Abstract Crypto API
    7.25 +
    7.26 +  The Abstract Crypto API provides functions to encrypt and decrypt data or full messages, without requiring an application programmer to understand the different applied formats and standards.
    7.27 +
    7.28 +- Message Transports
    7.29 +
    7.30 +  The p≡p Engine will sport a growing list of message transports, to support any widespread text-based messaging system such as E-Mail, SMS, XMPP and many more.
    7.31 +
    7.32 +The p≡p Engine is written in C99 and is expected to run on any platform that conforms to the SUS/POSIX specification.
    7.33 +Selected non-SUS platforms are supported as well (such as Microsoft Windows).
    7.34 +
    7.35 +# How can I use the p≡p Engine?
    7.36 +Build instructions can be found in the "doc/" subfolder in this repository.
    7.37 +The p≡p Engine is not meant to be used in application code directly.
    7.38 +Instead, the p≡p Engine is meant to be used in conjunction with a so-called "adapter".
    7.39 +An adapter provides an API in a programming language that best accomodates developers in their respective software development ecosystem.
    7.40 +So, for example, a Java Native Interface adapter exists for development of apps for the Android mobile operating system, or a .NET adapter exists for development of applications on Microsoft Windows.
    7.41 +Various adapters are also available at the link provided for the p≡p Engine's code above.
    7.42 +
    7.43 +# What is the current state of the project?
    7.44 +The p≡p Engine is production-ready.
    7.45 +It is under active development by several full-time employees of the p≡p foundation and its partner organizations.
    7.46 +The most recent version of the source code can be obtained here: <https://cacert.pep.foundation/dev>.
    7.47 +This is the only offical way to obtain a copy of the source code.
    7.48 +
    7.49 +# I would like to contribute to the p≡p Engine or a realated project, where do I start?
    7.50 +First of all, excellent!
    7.51 +We'd love to dicuss this opportunity further with you.
    7.52 +Please contact the upstream developers to get started.
    7.53 +See the [Contact](#contact) section.
    7.54 +
    7.55 +# Legal notes
    7.56 +The p≡p Engine is Copyright 2015-2017 by p≡p foundation, Switzerland.
    7.57 +The source code of the p≡p Engine is licensed under the terms of the GNU General Public License version 3.
    7.58 +Accompanying documentation is licensed under the terms of the Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) License.
    7.59 +Each file includes a notice near its beginning, that indicates the applicable license.
    7.60 +If you wish to license the p≡p Engine under different terms, please contact <mailto:council@pep.foundation>.
    7.61 +
    7.62 +# Contact
    7.63 +The p≡p foundation and the developers of the p≡p Engine can be reached as detailed here: <https://pep.foundation/contact-us/index.html>.
     8.1 --- a/README.txt	Mon Aug 14 09:13:53 2017 +0200
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,125 +0,0 @@
     8.4 -# this file is under Creative Commons License 3.0 cc-by-sa
     8.5 -
     8.6 -p≡p Engine
     8.7 -==========
     8.8 -
     8.9 -0. What it is
    8.10 --------------
    8.11 -
    8.12 -The p≡p engine is a Free Software library encapsulating implementations of:
    8.13 -
    8.14 -- Key Management
    8.15 -
    8.16 -  Key Management in p≡p engine is based on GnuPG key chains (NetPGP on iOS).
    8.17 -  Keys are stored in an OpenPGP compatbile format and can be used for different
    8.18 -  crypto implementations.
    8.19 -
    8.20 -- Trust Rating
    8.21 -
    8.22 -  p≡p engine is sporting a two phase trust rating system. In phase one there is
    8.23 -  a rating based on channel, crypto and key security named “comm_types”. In
    8.24 -  phase 2 these are mapped to user representable values which have attached
    8.25 -  colors to present them in traffic light semantics.
    8.26 -
    8.27 -- Abstract Crypto API
    8.28 -
    8.29 -  The Abstract Crypto API is providing functions to encrypt and decrypt data or
    8.30 -  full messages without requiring an application programmer to understand the
    8.31 -  different formats and standards.
    8.32 -
    8.33 -- Message Transports
    8.34 -
    8.35 -  p≡p engine will sport a growing list of Message Transports to support any
    8.36 -  widespread text messaging system including E-Mail, SMS, XMPP and many more.
    8.37 -
    8.38 -p≡p engine is written in C99. It is not meant to be used in application code
    8.39 -directly. Instead, p≡p engine is coming together with a list of software
    8.40 -adapters for a variety of programming languages and development environments.
    8.41 -
    8.42 -p≡p engine is under Gnu General Public License v3. If you want to use it under
    8.43 -a different license, please contact mailto:council@pep.foundation.
    8.44 -
    8.45 -
    8.46 -1. Dependencies
    8.47 ----------------
    8.48 -
    8.49 -p≡p engine is depending on the following FOSS libraries:
    8.50 -
    8.51 -* libetpan, see https://github.com/fdik/libetpan
    8.52 -       git clone https://github.com/fdik/libetpan
    8.53 -
    8.54 -* zlib, see http://zlib.net/
    8.55 -
    8.56 -* OpenSSL, see http://openssl.org/
    8.57 -
    8.58 -* iconv, see http://www.gnu.org/software/libiconv/
    8.59 -
    8.60 -* Cyrus SASL, see http://cyrusimap.org/
    8.61 -
    8.62 -* GnuPG via GPGME, version 1.6.0 or newer, see https://gnupg.org/
    8.63 -
    8.64 -* NetPGP/p≡p, see https://cacert.pep.foundation/dev/repos/netpgp-et/
    8.65 -
    8.66 -* Asn1c, download from https://lionet.info/soft/asn1c-0.9.27.tar.gz
    8.67 -       (Debian's version 0.9.24 does not work)
    8.68 -
    8.69 -* yml2, which needs lxml (where to get?)
    8.70 -
    8.71 -2. Building p≡p engine
    8.72 -----------------------
    8.73 -
    8.74 -p≡p engine has an old style Makefile for building it.
    8.75 -
    8.76 -The build is configured in Makefile.conf
    8.77 -
    8.78 -It supports the common targets
    8.79 -
    8.80 -$ make all
    8.81 -$ make install
    8.82 -$ make clean
    8.83 -
    8.84 -and additionally
    8.85 -
    8.86 -$ make package # for building a .tar.bz2 with the source distribution
    8.87 -
    8.88 -On Windows, use Visual Studio.
    8.89 -
    8.90 -
    8.91 -3. How to cross-build
    8.92 ----------------------
    8.93 -
    8.94 -For cross-building, BUILD_FOR is being used. I.e.:
    8.95 -
    8.96 -$ BUILD_FOR=yourOS make -e
    8.97 -
    8.98 -
    8.99 -4. How to build the databases
   8.100 ------------------------------
   8.101 -
   8.102 -p≡p Engine uses two databases: ~/.pEp_management (on *NIX) or
   8.103 -%LOCALAPPDATA%\pEp\management.db on Windoze respectively, and
   8.104 -/usr/local/share/system.db on *NIX or %ALLUSERSPROFILE%\pEp\system.db
   8.105 -respectively. The latter contains the Trustwords dbs.
   8.106 -
   8.107 -The managment db is being created by the first call of init() of p≡p Engine. It
   8.108 -does not need to be created manually. system.db is being created by using the
   8.109 -DDL in db/create_system_db.sql – the content is created by db/dic2csv.py
   8.110 -out of hunspell's dictionary packages (or something similar) and then being
   8.111 -imported using sqlite3's .import command. Dictionary files for different
   8.112 -languages are part of p≡p engine source distribution.
   8.113 -
   8.114 -$ make db
   8.115 -$ make -C db install
   8.116 -
   8.117 -You can test the Trustwords in system.db using db/trustwords.py
   8.118 -Both Python tools have a switch --help
   8.119 -
   8.120 -
   8.121 -5. How to run the tests
   8.122 ------------------------
   8.123 -
   8.124 -You have to import all the test keys into your local gpg instance:
   8.125 -
   8.126 -	cd test
   8.127 -	cat 0x*.asc *_sec.asc| gpg --import
   8.128 -
     9.1 --- a/TODO.txt	Mon Aug 14 09:13:53 2017 +0200
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,8 +0,0 @@
     9.4 -# this file is in the Public Domain
     9.5 -
     9.6 -- add required Debian packages to build pEp (or where to find non-debian-packaged software, like "libetpan/mailmime_encode.h"
     9.7 -- add build instructions and required "brew" packages for Mac OS X.
     9.8 -- describe, how to configure pEpEngine to use self-compiled libetpan (in $HOME/local/ or the like)
     9.9 -- check if own key is good; if not: create a new keypair
    9.10 -- warning with forwarding former encrypted messages unencryptedly
    9.11 -
    10.1 --- a/asn.1/Makefile	Mon Aug 14 09:13:53 2017 +0200
    10.2 +++ b/asn.1/Makefile	Wed Aug 30 14:42:51 2017 +0200
    10.3 @@ -1,37 +1,35 @@
    10.4 -# This file is under GNU General Public License 3.0
    10.5 +# Copyright 2017, pEp Foundation
    10.6 +# This file is part of pEpEngine
    10.7 +# This file may be used under the terms of the GNU General Public License version 3
    10.8  # see LICENSE.txt
    10.9  
   10.10  include ../Makefile.conf
   10.11  
   10.12 -ifeq ($(BUILD_ON),Linux)
   10.13 -ifeq ($(BUILD_FOR),Linux)
   10.14 -
   10.15 -CC=gcc
   10.16 -CFLAGS?=-fPIC
   10.17 -else
   10.18 -$(error don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
   10.19 -endif
   10.20 -endif
   10.21 -
   10.22 -ALL_SOURCE=$(subst $(NO_SOURCE),,$(wildcard *.c))
   10.23 +ALL_SOURCE=$(wildcard *.c)
   10.24  ALL_OBJECTS=$(subst .c,.o,$(ALL_SOURCE))
   10.25  
   10.26  libasn1.a: $(ALL_OBJECTS)
   10.27 -	ar -rc $@ $(ALL_OBJECTS)
   10.28 +	ar -rc $@ $^
   10.29  
   10.30 +# "converter-sample.c" is the example file containing a "main()" function generated by ans1c.
   10.31 +.PHONY: generate
   10.32  generate: Sync-Protocols.c
   10.33  	rm -f converter-sample.c
   10.34  
   10.35  %.o: %.c %.h
   10.36 -	$(CC) $(CFLAGS) $(OPTIMIZE) -I. -I$(ASN1C_INCLUDE) -c $< -o $@
   10.37 +	$(CC) $(CFLAGS) $(CFLAGS_GENERATED) -I. $(ASN1C_INC) -c $< -o $@
   10.38  
   10.39 -Sync-Protocols.c: protocols.asn1 devicegroup.asn1 pEp.asn1
   10.40 -	$(ASN1C) -gen-PER -fincludes-quoted -fcompound-names -pdu=PEP.Message pEp.asn1 devicegroup.asn1 $<
   10.41 +Sync-Protocols.c: pEp.asn1 devicegroup.asn1 protocols.asn1
   10.42 +	$(ASN1C) -gen-PER -fincludes-quoted -fcompound-names -pdu=PEP.Message $^
   10.43  
   10.44  .PHONY: clean
   10.45 -
   10.46  clean:
   10.47  	rm -f *.a *.o *.c *.h *.sample
   10.48  
   10.49 +.PHONY: install
   10.50  install: libasn1.a
   10.51  	cp $< $(PREFIX)/lib/
   10.52 +
   10.53 +.PHONY: uninstall
   10.54 +uninstall:
   10.55 +	rm -f $(PREFIX)/lib/libasn1.a
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/build-config/Darwin.conf	Wed Aug 30 14:42:51 2017 +0200
    11.3 @@ -0,0 +1,58 @@
    11.4 +# Copyright 2017, pEp Foundation
    11.5 +# This file is part of pEpEngine
    11.6 +# This file may be used under the terms of the GNU General Public License version 3
    11.7 +# see LICENSE.txt
    11.8 +
    11.9 +######### General #########
   11.10 +TARGET=libpEpEngine.dylib
   11.11 +
   11.12 +######### C #########
   11.13 +# clang issues a warning when "-pthread" is used for linking. So, include it in CFLAGS, and not in CC
   11.14 +CC=clang -std=c99
   11.15 +CFLAGS=-pthread -fPIC -fstrict-aliasing -fcolor-diagnostics
   11.16 +ifdef WARN
   11.17 +    # FIXME Remove 'no-extended-offsetof' after ENGINE-236 is closed.
   11.18 +    CFLAGS+= -Wall -pedantic -Wno-extended-offsetof
   11.19 +else
   11.20 +    CFLAGS+= -w
   11.21 +endif
   11.22 +ifdef DEBUG
   11.23 +    CFLAGS+= -O0 -g -DDEBUG_ERRORSTACK
   11.24 +else
   11.25 +    CFLAGS+= -O3 -DNDEBUG
   11.26 +endif
   11.27 +CFLAGS_GENERATED=
   11.28 +
   11.29 +######### C++ #########
   11.30 +# clang issues a warning when "-pthread" is used for linking. So, include it in CXXFLAGS, and not in CXX
   11.31 +CXX=clang -std=c++11
   11.32 +CXXFLAGS=-pthread -fcolor-diagnostics -I../src -I../asn.1 $(ETPAN_INC)
   11.33 +ifdef WARN
   11.34 +    CXXFLAGS+=
   11.35 +else
   11.36 +    CXXFLAGS+= -w
   11.37 +endif
   11.38 +ifdef DEBUG
   11.39 +    CXXFLAGS+= -O0 -g
   11.40 +else
   11.41 +    CXXFLAGS+= -O3 -DNDEBUG
   11.42 +endif
   11.43 +
   11.44 +######### C and C++ #########
   11.45 +# "-bind_at_load" helps find symbol resolution errors faster
   11.46 +LDFLAGS=-bind_at_load
   11.47 +
   11.48 +######### YML2 #########
   11.49 +
   11.50 +######### asn1c #########
   11.51 +
   11.52 +######### libetpan #########
   11.53 +
   11.54 +######### OpenPGP #########
   11.55 +LIBGPGME=libgpgme.dylib
   11.56 +GPGME_LIB=-L/opt/local/lib
   11.57 +GPGME_INC=-I/opt/local/include
   11.58 +
   11.59 +######### Engine internals #########
   11.60 +
   11.61 +######### Misc #########
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/build-config/Linux.conf	Wed Aug 30 14:42:51 2017 +0200
    12.3 @@ -0,0 +1,55 @@
    12.4 +# Copyright 2017, pEp Foundation
    12.5 +# This file is part of pEpEngine
    12.6 +# This file may be used under the terms of the GNU General Public License version 3
    12.7 +# see LICENSE.txt
    12.8 +
    12.9 +######### General #########
   12.10 +TARGET=libpEpEngine.so
   12.11 +
   12.12 +######### C #########
   12.13 +CC=gcc -std=c99 -pthread
   12.14 +CFLAGS=-fPIC -fstrict-aliasing -fdiagnostics-color=always
   12.15 +ifdef WARN
   12.16 +    CFLAGS+= -Wall -pedantic -Wstrict-aliasing=3
   12.17 +else
   12.18 +    CFLAGS+= -w
   12.19 +endif
   12.20 +ifdef DEBUG
   12.21 +    CFLAGS+= -Og -ggdb -DDEBUG_ERRORSTACK
   12.22 +else
   12.23 +    CFLAGS+= -O3 -DNDEBUG
   12.24 +endif
   12.25 +# The '_DEFAULT_SOURCE' feature test macro is required to suppress the warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" otherwise printed during the compilation of every asn1c-generated C file. It's a glibc specific warning, only present in few versions around ~2.19. See https://lwn.net/Articles/590381/ for a discussion.
   12.26 +CFLAGS_GENERATED=-D_DEFAULT_SOURCE
   12.27 +
   12.28 +######### C++ #########
   12.29 +CXX=g++ -std=gnu++11 -pthread
   12.30 +CXXFLAGS=-fdiagnostics-color=always -I../src -I../asn.1 $(ETPAN_INC)
   12.31 +ifdef WARN
   12.32 +    CXXFLAGS+=
   12.33 +else
   12.34 +    CXXFLAGS+= -w
   12.35 +endif
   12.36 +ifdef DEBUG
   12.37 +    CXXFLAGS+= -Og -ggdb
   12.38 +else
   12.39 +    CXXFLAGS+= -O3 -DNDEBUG
   12.40 +endif
   12.41 +
   12.42 +######### C and C++ #########
   12.43 +LDFLAGS=
   12.44 +
   12.45 +######### YML2 #########
   12.46 +
   12.47 +######### asn1c #########
   12.48 +
   12.49 +######### libetpan #########
   12.50 +
   12.51 +######### OpenPGP #########
   12.52 +LIBGPGME=libgpgme.so.11
   12.53 +GPGME_LIB=
   12.54 +GPGME_INC=
   12.55 +
   12.56 +######### Engine internals #########
   12.57 +
   12.58 +######### Misc #########
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/build-config/common.conf	Wed Aug 30 14:42:51 2017 +0200
    13.3 @@ -0,0 +1,94 @@
    13.4 +# Copyright 2017, pEp Foundation
    13.5 +# This file is part of pEpEngine
    13.6 +# This file may be used under the terms of the GNU General Public License version 3
    13.7 +# see LICENSE.txt
    13.8 +
    13.9 +# General remark: to use (only) system libraries, set all the *_INC and *_LIB variables to the empty string.
   13.10 +# All the *_INC and *_LIB variables are command line flags, not paths. Thus, all *_INC variables' values must start with "-I", and all *_LIB variables' values must start with "-L".
   13.11 +
   13.12 +######### General #########
   13.13 +BUILD_ON:=$(shell uname)
   13.14 +# This variable specifies the platform that the engine should be cross-compiled for.
   13.15 +BUILD_FOR=$(BUILD_ON)
   13.16 +# Installation path prefix for libraries and binaries, except for system.db
   13.17 +PREFIX=$(HOME)
   13.18 +# Installation path for system.db
   13.19 +SYSTEM_DB=/usr/local/share/pEp/system.db
   13.20 +# Filename of the pEpEngine library
   13.21 +#TARGET This option is platform-specific
   13.22 +# If not empty, create a debug build. This variable is ineffective in your PLATFORM_OVERRIDE.conf file.
   13.23 +DEBUG=
   13.24 +# If not empty, print compiler warnings. This variable is ineffective in your PLATFORM_OVERRIDE.conf file.
   13.25 +WARN=placeholder
   13.26 +
   13.27 +######### C #########
   13.28 +#CC This option is platform-specific
   13.29 +CPPFLAGS=
   13.30 +#CFLAGS This option is platform-specific
   13.31 +# Additional CFLAGS used for compiling ASN1C-generated code
   13.32 +#CFLAGS_GENERATED This option is platform-specific
   13.33 +
   13.34 +######### C++ #########
   13.35 +#CXX This option is platform-specific
   13.36 +#CXXFLAGS This option is platform-specific
   13.37 +
   13.38 +######### C and C++ #########
   13.39 +TARGET_ARCH=
   13.40 +# The following two variables will be appended to. You can thus not set them to a fixed value here.
   13.41 +#LDFLAGS= This option is platform-specific
   13.42 +LDLIBS=
   13.43 +
   13.44 +######### YML2 #########
   13.45 +YML2_PATH=$(HOME)/yml2
   13.46 +YML2_PROC=$(YML2_PATH)/yml2proc
   13.47 +YML2_OPTS=--encoding=utf8
   13.48 +
   13.49 +######### asn1c #########
   13.50 +# asn1c binary
   13.51 +ASN1C=asn1c
   13.52 +# asn1c include search flag
   13.53 +ASN1C_INC=
   13.54 +#ASN1C_INC=-I$(HOME)/include
   13.55 +
   13.56 +######### libetpan #########
   13.57 +# libetpan library search flag
   13.58 +ETPAN_LIB=-L$(PREFIX)/lib
   13.59 +# libetpan include search flag
   13.60 +ETPAN_INC=-I$(PREFIX)/include
   13.61 +
   13.62 +######### sqlite3 #########
   13.63 +# If empty (or undefined), compile sqlite3 from the sources shipped with the pEp distribution. Otherwise, use an sqlite3 implementation found in the OS's include/library paths.
   13.64 +SQLITE3_FROM_OS=placeholder
   13.65 +
   13.66 +######### OpenPGP #########
   13.67 +# Path of GPG binary
   13.68 +GPG_CMD=gpg
   13.69 +ifneq ($(shell which gpg2),)
   13.70 +    GPG_CMD=gpg2
   13.71 +endif
   13.72 +# Selects OpenPGP implementation. must be either `GPG` or `NETPGP`
   13.73 +OPENPGP=GPG
   13.74 +# Path of libGPGME binary
   13.75 +#LIBGPGME This option is platform-specific
   13.76 +# libGPGME library search flag
   13.77 +#GPGME_LIB= This option is platform-specific
   13.78 +# libGPGME include search flag
   13.79 +#GPGME_INC= This option is platform-specific
   13.80 +# NETPGP library search flag
   13.81 +NETPGP_LIB=
   13.82 +#NETPGP_LIB=-L$(PREFIX)/lib
   13.83 +# libGPGME include search flag
   13.84 +NETPGP_INC=
   13.85 +#NETPGP_INC=-I$(PREFIX)/include
   13.86 +
   13.87 +######### Engine internals #########
   13.88 +# C macros (not environment variables) that can be overridden:
   13.89 +# DEFAULT_KEYSERVER - string with default keyserver
   13.90 +# CRASHDUMP_DEFAULT_LINES - number of log lines to deliver for crashdumps
   13.91 +# Example:
   13.92 +#    EXTRA_MACROS=-DDEFAULT_KEYSERVER=\"default-server.org\" -DCRASHDUMP_DEFAULT_LINES=23
   13.93 +EXTRA_MACROS=
   13.94 +
   13.95 +######### Misc #########
   13.96 +# FIXME Maybe include these variables here. Check how they are used throughout the project before setting them here
   13.97 +#LLDB_BIN
    14.1 --- a/db/Makefile	Mon Aug 14 09:13:53 2017 +0200
    14.2 +++ b/db/Makefile	Wed Aug 30 14:42:51 2017 +0200
    14.3 @@ -1,22 +1,26 @@
    14.4 -# This file is under GNU General Public License 3.0
    14.5 +# Copyright 2017, pEp Foundation
    14.6 +# This file is part of pEpEngine
    14.7 +# This file may be used under the terms of the GNU General Public License version 3
    14.8  # see LICENSE.txt
    14.9  
   14.10  include ../Makefile.conf
   14.11  
   14.12 +.PHONY: db
   14.13  db: system.db
   14.14  
   14.15 -dicos=$(wildcard *.csv)
   14.16 +DICOS = $(wildcard *.csv)
   14.17  
   14.18 -system.db: create_system_db.sql $(dicos)
   14.19 +# The 'mv' keeps a backup db around
   14.20 +system.db: create_system_db.sql $(DICOS)
   14.21  	-mv -f $@ $@~ 
   14.22  	sqlite3 -batch $@ < $<
   14.23 -	for c in $(dicos); do echo $$c ; echo .import "$$c" wordlist | sqlite3 -batch -csv $@ ; done
   14.24 +	for c in $(DICOS) ; do echo "$$c" ; echo .import "$$c" wordlist | sqlite3 -batch -csv $@ ; done
   14.25  
   14.26 -.PHONY: clean install
   14.27 -
   14.28 +.PHONY: install
   14.29  install: system.db
   14.30  	mkdir -p `dirname $(SYSTEM_DB)`
   14.31  	cp system.db $(SYSTEM_DB)
   14.32  
   14.33 +.PHONY: clean
   14.34  clean:
   14.35 -	rm -f system.db
   14.36 +	rm -f system.db system.db~
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/doc/build-debian.md	Wed Aug 30 14:42:51 2017 +0200
    15.3 @@ -0,0 +1,111 @@
    15.4 +<!-- Copyright 2015-2017, pEp foundation, Switzerland
    15.5 +This file is part of the pEp Engine
    15.6 +This file may be used under the terms of the Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) License
    15.7 +See CC_BY-SA.txt -->
    15.8 +
    15.9 +# Build instructions for Debian 9
   15.10 +
   15.11 +# Installing packaged dependencies
   15.12 +
   15.13 +~~~
   15.14 +# general
   15.15 +apt install -y ca-cacert mercurial
   15.16 +# YML2
   15.17 +apt install -y python-lxml
   15.18 +# libetpan
   15.19 +apt install -y git build-essential automake libtool
   15.20 +# asn1c
   15.21 +apt install -y git build-essential automake libtool
   15.22 +# engine
   15.23 +apt install -y uuid-dev libgpgme11-dev libsqlite3-dev sqlite3
   15.24 +~~~
   15.25 +
   15.26 +# Installing unpackaged dependencies
   15.27 +## YML2
   15.28 +
   15.29 +~~~
   15.30 +mkdir -p ~/code/yml2
   15.31 +hg clone https://cacert.pep.foundation/dev/repos/yml2/ ~/code/yml2
   15.32 +~~~
   15.33 +
   15.34 +## libetpan
   15.35 +pEp Engine requires libetpan with a set of patches that have not been upstreamed yet.
   15.36 +
   15.37 +~~~
   15.38 +mkdir -p ~/code/libetpan
   15.39 +git clone https://github.com/fdik/libetpan ~/code/libetpan
   15.40 +cd ~/code/libetpan
   15.41 +mkdir ~/code/libetpan/build
   15.42 +./autogen.sh --prefix="$HOME/code/libetpan/build"
   15.43 +make
   15.44 +make install
   15.45 +~~~
   15.46 +
   15.47 +## asn1c
   15.48 +
   15.49 +~~~
   15.50 +mkdir -p ~/code/asn1c
   15.51 +git clone git://github.com/vlm/asn1c.git ~/code/asn1c
   15.52 +cd ~/code/asn1c
   15.53 +git checkout tags/v0.9.28 -b pep-engine
   15.54 +autoreconf -iv
   15.55 +mkdir ~/code/asn1c/build
   15.56 +./configure --prefix="$HOME/code/asn1c/build"
   15.57 +make
   15.58 +make install
   15.59 +~~~
   15.60 +
   15.61 +# pEp Engine
   15.62 +
   15.63 +~~~
   15.64 +mkdir -p ~/code/pep-engine
   15.65 +hg clone https://cacert.pep.foundation/dev/repos/pEpEngine/ ~/code/pep-engine
   15.66 +cd ~/code/pep-engine
   15.67 +mkdir ~/code/pep-engine/build
   15.68 +~~~
   15.69 +
   15.70 +For an explanation of the mechanics of `PLATFORM_OVERRIDE`, see the inline comments in `Makefile.conf`.
   15.71 +In this guide, the platform-specific configuration will be called `local`.
   15.72 +The installation directory will be a subdirectory of the repository.
   15.73 +This is useful for testing only.
   15.74 +
   15.75 +~~~
   15.76 +export PLATFORM_OVERRIDE=local
   15.77 +~~~
   15.78 +
   15.79 +`./build-config/local.conf`:
   15.80 +
   15.81 +~~~
   15.82 +PREFIX=$(HOME)/code/pep-engine/build
   15.83 +SYSTEM_DB=$(PREFIX)/share/pEp/system.db
   15.84 +
   15.85 +YML2_PATH=$(HOME)/code/yml2
   15.86 +
   15.87 +ETPAN_LIB=-L$(HOME)/code/libetpan/build/lib
   15.88 +ETPAN_INC=-I$(HOME)/code/libetpan/build/include
   15.89 +
   15.90 +ASN1C=$(HOME)/code/asn1c/build/bin/asn1c
   15.91 +ASN1C_INC=-I$(HOME)/code/asn1c/build/share
   15.92 +~~~
   15.93 +
   15.94 +The engine is built as follows:
   15.95 +
   15.96 +~~~
   15.97 +make all
   15.98 +make db
   15.99 +~~~
  15.100 +
  15.101 +The unit tests can be run without the engine library being installed, however `system.db` must be installed:
  15.102 +
  15.103 +~~~
  15.104 +make -C db install
  15.105 +~~~
  15.106 +
  15.107 +Since `system.db` rarely changes, its installation is not needed for every build.
  15.108 +
  15.109 +Tests can be compiled and executed with the following commands:
  15.110 +
  15.111 +~~~
  15.112 +make -C test compile
  15.113 +make test
  15.114 +~~~
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/doc/build-ios.md	Wed Aug 30 14:42:51 2017 +0200
    16.3 @@ -0,0 +1,35 @@
    16.4 +# Using NetPGP instead of GnuPG
    16.5 +## Prepare
    16.6 +
    16.7 +Get OpenSSL and build/install it as shared library.
    16.8 +
    16.9 +```
   16.10 +wget https://www.openssl.org/source/old/1.0.1/openssl-1.0.1u.tar.gz
   16.11 +tar xvfz openssl-1.0.1u.tar.gz
   16.12 +cd openssl-1.0.1u
   16.13 +./Configure darwin64-x86_64-cc --prefix=$HOME shared
   16.14 +make install
   16.15 +```
   16.16 +
   16.17 +Get and autoconf NetPGP
   16.18 +
   16.19 +```
   16.20 +cd $SRC
   16.21 +hg clone https://cacert.pep.foundation/dev/repos/netpgp-et/
   16.22 +cd netpgp-et
   16.23 +autoreconf -i
   16.24 +```
   16.25 +
   16.26 +## Build
   16.27 +
   16.28 +Important : LDFLAGS is set to help finding OpenSSL shared lib. If not set,
   16.29 +system's default libcrypto may silently be used instead, causing memory
   16.30 +corruption or crash at runtime.
   16.31 +
   16.32 +```
   16.33 +mkdir netpgp_debug
   16.34 +cd netpgp_debug
   16.35 +$SRC/netpgp-et/configure --with-openssl=$HOME --prefix=$HOME CPPFLAGS=-DDEBUG CXXFLAGS="-g -O0" LDFLAGS="-L${HOME}/lib"
   16.36 +make
   16.37 +make install
   16.38 +```
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/doc/build-macos.md	Wed Aug 30 14:42:51 2017 +0200
    17.3 @@ -0,0 +1,126 @@
    17.4 +<!-- Copyright 2015-2017, pEp foundation, Switzerland
    17.5 +This file is part of the pEp Engine
    17.6 +This file may be used under the terms of the Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) License
    17.7 +See CC_BY-SA.txt -->
    17.8 +
    17.9 +# Build instructions for macOS Sierra and iOS
   17.10 +
   17.11 +# Installing packaged dependencies
   17.12 +
   17.13 +## MacPorts
   17.14 +
   17.15 +MacPorts is needed to install some compile-time dependencies.
   17.16 +Install MacPorts according to the instructions found [here](https://www.macports.org/install.php).
   17.17 +Ensure that Macports' binary paths (`/opt/local/bin` and `/opt/local/sbin`) are in your `PATH` environment variable.
   17.18 +
   17.19 +~~~
   17.20 +# general
   17.21 +sudo port install mercurial
   17.22 +# YML2
   17.23 +sudo port install py27-lxml
   17.24 +# libetpan
   17.25 +sudo port install git autoconf automake libtool
   17.26 +# asn1c
   17.27 +sudo port install asn1c
   17.28 +# engine
   17.29 +sudo port install gpgme
   17.30 +~~~
   17.31 +
   17.32 +FIXME Are `zlib openssl cyrus-sasl2` needed?
   17.33 +They were present in an older revision of the build instructions.
   17.34 +
   17.35 +Ensure that `python` is Python 2.7:
   17.36 +
   17.37 +~~~
   17.38 +sudo port select python python27
   17.39 +~~~
   17.40 +
   17.41 +# Installing unpackaged dependencies
   17.42 +## YML2
   17.43 +
   17.44 +~~~
   17.45 +mkdir -p ~/code/yml2
   17.46 +hg clone https://cacert.pep.foundation/dev/repos/yml2/ ~/code/yml2
   17.47 +~~~
   17.48 +
   17.49 +## libetpan
   17.50 +pEp Engine requires libetpan with a set of patches that have not been upstreamed yet.
   17.51 +
   17.52 +~~~
   17.53 +mkdir -p ~/code/libetpan
   17.54 +git clone https://github.com/fdik/libetpan ~/code/libetpan
   17.55 +cd ~/code/libetpan
   17.56 +mkdir ~/code/libetpan/build
   17.57 +./autogen.sh --prefix="$HOME/code/libetpan/build"
   17.58 +make
   17.59 +make install
   17.60 +~~~
   17.61 +
   17.62 +## GPGME
   17.63 +The MacPorts-packaged GPGME links to a version of GNU libiconv that has files in the same include/library paths as GPGME. This version of libiconv must not be visible to the linker when the pEp Engine is build or run.
   17.64 +
   17.65 +Thus the files of the GPGME distribution will have to be manually copied to separate include/library folders, so that no include or library paths used for building the pEp Engine contains files of MacPorts' libiconv distribution.
   17.66 +
   17.67 +~~~
   17.68 +mkdir -p ~/code/gpgme/build/include
   17.69 +cp /opt/local/include/gpg*.h ~/code/gpgme/build/include
   17.70 +mkdir -p ~/code/gpgme/build/lib
   17.71 +cp -r /opt/local/lib/libgpg* ~/code/gpgme/build/lib
   17.72 +~~~
   17.73 +
   17.74 +It's of course possible to skip MacPort's version, and use a self-compiled GPGME/GPG.
   17.75 +
   17.76 +# pEp Engine
   17.77 +
   17.78 +~~~
   17.79 +mkdir -p ~/code/pep-engine
   17.80 +hg clone https://cacert.pep.foundation/dev/repos/pEpEngine/ ~/code/pep-engine
   17.81 +cd ~/code/pep-engine
   17.82 +mkdir ~/code/pep-engine/build
   17.83 +~~~
   17.84 +
   17.85 +For an explanation of the mechanics of `PLATFORM_OVERRIDE`, see the inline comments in `Makefile.conf`.
   17.86 +In this guide, the platform-specific configuration will be called `local`.
   17.87 +The installation directory will be a subdirectory of the repository.
   17.88 +This is useful for testing only.
   17.89 +
   17.90 +~~~
   17.91 +export PLATFORM_OVERRIDE=local
   17.92 +~~~
   17.93 +
   17.94 +`./build-config/local.conf`:
   17.95 +
   17.96 +~~~
   17.97 +PREFIX=$(HOME)/code/pep-engine/build
   17.98 +SYSTEM_DB=$(PREFIX)/share/pEp/system.db
   17.99 +
  17.100 +YML2_PATH=$(HOME)/code/yml2
  17.101 +
  17.102 +ETPAN_LIB=-L$(HOME)/code/libetpan/build/lib
  17.103 +ETPAN_INC=-I$(HOME)/code/libetpan/build/include
  17.104 +
  17.105 +GPGME_LIB=-L$(HOME)/code/gpgme/build/lib
  17.106 +GPGME_INC=-I$(HOME)/code/gpgme/build/include
  17.107 +~~~
  17.108 +
  17.109 +The engine is built as follows:
  17.110 +
  17.111 +~~~
  17.112 +make all
  17.113 +make db
  17.114 +~~~
  17.115 +
  17.116 +The unit tests can be run without the engine library being installed, however `system.db` must be installed:
  17.117 +
  17.118 +~~~
  17.119 +make -C db install
  17.120 +~~~
  17.121 +
  17.122 +Since `system.db` rarely changes, its installation is not needed for every build.
  17.123 +
  17.124 +Tests can be compiled and executed with the following commands:
  17.125 +
  17.126 +~~~
  17.127 +make -C test compile
  17.128 +make test
  17.129 +~~~
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/doc/macports_env.sh	Wed Aug 30 14:42:51 2017 +0200
    18.3 @@ -0,0 +1,10 @@
    18.4 +# this file is in the Public Domain
    18.5 +
    18.6 +# Typical pure MacPorts environment
    18.7 +
    18.8 +# Restrict to MacPorts
    18.9 +export PATH=/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
   18.10 +
   18.11 +# Make sure the Apple python (which will be triggered by the makefile)
   18.12 +# has access to the Python libs installed for MacPorts
   18.13 +export PYTHONPATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/doc/misc/cc-header.md	Wed Aug 30 14:42:51 2017 +0200
    19.3 @@ -0,0 +1,4 @@
    19.4 +<!-- Copyright 2015-2017, pEp foundation, Switzerland
    19.5 +This file is part of the pEp Engine
    19.6 +This file may be used under the terms of the Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) License
    19.7 +See CC_BY-SA.txt -->
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/doc/misc/gpl-header.txt	Wed Aug 30 14:42:51 2017 +0200
    20.3 @@ -0,0 +1,4 @@
    20.4 +Copyright 2015-2017, pEp foundation, Switzerland
    20.5 +This file is part of the pEp Engine
    20.6 +This file may be used under the terms of the GNU General Public License version 3
    20.7 +See LICENSE.txt
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/doc/readme.md	Wed Aug 30 14:42:51 2017 +0200
    21.3 @@ -0,0 +1,49 @@
    21.4 +<!-- Copyright 2015-2017, pEp foundation, Switzerland
    21.5 +This file is part of the pEp Engine
    21.6 +This file may be used under the terms of the Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) License
    21.7 +See CC_BY-SA.txt -->
    21.8 +
    21.9 +# Information about the pEp Engine
   21.10 +
   21.11 +# Dependencies
   21.12 +The p≡p Engine depends on the following projects:
   21.13 +
   21.14 +- run-time dependencies
   21.15 +  - One of the following OpenPGP implementations:
   21.16 +    - GnuPG (version 2.0.30 or 2.1.16 or newer) by way of GPGME (version 1.6.0 or newer) [https://gnupg.org/](https://gnupg.org/)
   21.17 +    - a fork of NetPGP, [https://cacert.pep.foundation/dev/repos/netpgp-et/](https://cacert.pep.foundation/dev/repos/netpgp-et/)
   21.18 +  - a fork of libetpan, [https://github.com/fdik/libetpan](https://github.com/fdik/libetpan)
   21.19 +  - zlib (Oh yeah, where?), [http://zlib.net/](http://zlib.net/)
   21.20 +  - OpenSSL (Oh yeah, where?), [https://www.openssl.org](https://www.openssl.org)
   21.21 +  - Cyrus SASL (Oh yeah, where?), [https://www.cyrusimap.org](https://www.cyrusimap.org)
   21.22 +  - libcurl (Oh yeah, where?), [https://curl.haxx.se/libcurl/](https://curl.haxx.se/libcurl/)
   21.23 +  - libuuid, [https://www.kernel.org/pub/linux/utils/util-linux/](https://www.kernel.org/pub/linux/utils/util-linux/)
   21.24 +  - SQLite, [https://sqlite.org](https://sqlite.org)
   21.25 +- compile-time dependencies
   21.26 +  - asn1c (version v0.9.28), [http://lionet.info/asn1c/blog/](http://lionet.info/asn1c/blog/)
   21.27 +  - yml2, [https://fdik.org/yml//toolchain](https://fdik.org/yml//toolchain)
   21.28 +  - One of the following build systems:
   21.29 +    - GNU make (on Linux and macOS)
   21.30 +    - MSBuild distributed with Microsoft Visual Studio 2015 (on Windows)
   21.31 +  - One of the following compilers for C and C++:
   21.32 +    - GNU GCC (on Linux)
   21.33 +    - Apple "clang" LLVM (on MacOS)
   21.34 +    - Microsoft MSVC/MSVC++ distributed with Microsoft Visual Studio 2015 (on Windows)
   21.35 +
   21.36 +# The pEp Engine's databases
   21.37 +The p≡p Engine uses two databases:
   21.38 +
   21.39 +- the management database
   21.40 +  - `~/.pEp_management` on \*NIX
   21.41 +  - `%LOCALAPPDATA%\pEp\management.db` on Windows
   21.42 +- the Trustword database
   21.43 +  - `/usr/local/share/system.db` on \*NIX
   21.44 +  - `%ALLUSERSPROFILE%\pEp\system.db` on Windows
   21.45 +
   21.46 +The management db is created by the first call of `init()` of p≡p Engine.
   21.47 +It does not need to be created manually.
   21.48 +`system.db` is created by using the DDL in `db/create_system_db.sql`; the database content is created by `db/dic2csv.py` out of hunspell's dictionary packages (or something similar) and then imported using `sqlite3`'s `.import` command.
   21.49 +Dictionary files for different languages are part of the p≡p Engine source distribution.
   21.50 +
   21.51 +You can test the Trustwords in `system.db` using `db/trustwords.py`.
   21.52 +Both Python tools have a `--help` switch.
    22.1 --- a/macports_env.sh	Mon Aug 14 09:13:53 2017 +0200
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,16 +0,0 @@
    22.4 -# this file is in the Public Domain
    22.5 -
    22.6 -# Typical pure MacPorts environment
    22.7 -
    22.8 -# Restrict to MacPorts
    22.9 -export PATH=/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
   22.10 -
   22.11 -# Make sure the Apple python (which will be triggered by the makefile)
   22.12 -# has access to the Python libs installed for MacPorts
   22.13 -export PYTHONPATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/
   22.14 -
   22.15 -# YML processing might complain about that. Make sure the locale exists (locale -a)
   22.16 -export LC_ALL=en_US.UTF-8
   22.17 -
   22.18 -# Search paths for includes used when doing YML processing
   22.19 -export YML_PATH=~/yml2/
    23.1 --- a/src/Makefile	Mon Aug 14 09:13:53 2017 +0200
    23.2 +++ b/src/Makefile	Wed Aug 30 14:42:51 2017 +0200
    23.3 @@ -1,70 +1,61 @@
    23.4 +# Copyright 2017, pEp Foundation
    23.5 +# This file is part of pEpEngine
    23.6 +# This file may be used under the terms of the GNU General Public License version 3
    23.7 +# see LICENSE.txt
    23.8 +
    23.9  include ../Makefile.conf
   23.10  
   23.11 -ETPAN_IN?=$(HOME)
   23.12 +CFLAGS+= $(ETPAN_INC) -I../asn.1 -DSYSTEM_DB=\"$(SYSTEM_DB)\" $(EXTRA_MACROS)
   23.13 +LDFLAGS+= $(ETPAN_LIB) -L../asn.1 -shared
   23.14 +LDLIBS+= -lc -letpan -lasn1
   23.15 +NO_SOURCE=
   23.16  
   23.17  ifeq ($(BUILD_ON),Darwin)
   23.18 -ifeq ($(BUILD_FOR),Darwin)
   23.19 -
   23.20 -TARGET?=libpEpEngine.dylib
   23.21 -MACOSX_VERSION_MIN=10.6
   23.22 -LIBGPGME?=libgpgme.dylib
   23.23 -CC?=clang -std=c99 -pthread
   23.24 -LD?=clang
   23.25 -CFLAGS?= -I$(ETPAN_IN)/include -I/opt/local/include $(OPTIMIZE) -pedantic \
   23.26 -	-DSYSTEM_DB=\"$(SYSTEM_DB)\" -I../asn.1 $(EXTRAMACROS)
   23.27 -LDFLAGS?= -lc -shared -arch x86_64 \
   23.28 -	-L$(ETPAN_IN)/lib -L/usr/lib -L/opt/local/lib -letpan -lsqlite3 -L../asn.1 -lasn1 -lz -liconv
   23.29 -
   23.30 +    ifeq ($(BUILD_FOR),Darwin)
   23.31 +        CFLAGS+= -DSQLITE_THREADSAFE=1
   23.32 +        LDLIBS+= -lz -liconv
   23.33 +    else
   23.34 +        $(error I don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
   23.35 +    endif
   23.36 +else ifeq ($(BUILD_ON),Linux)
   23.37 +    ifeq ($(BUILD_FOR),Linux)
   23.38 +        CFLAGS+= -DSQLITE_THREADSAFE=1 -D_GNU_SOURCE
   23.39 +        LDLIBS+= -ldl -luuid
   23.40 +    else
   23.41 +        $(error I don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
   23.42 +    endif
   23.43  else
   23.44 -$(error don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
   23.45 +    $(error I don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
   23.46  endif
   23.47  
   23.48 -else ifeq ($(BUILD_ON),Linux)
   23.49 -ifeq ($(BUILD_FOR),Linux)
   23.50 -
   23.51 -TARGET=libpEpEngine.so
   23.52 -LIBGPGME?=libgpgme.so.11
   23.53 -CC=gcc -std=c99
   23.54 -CFLAGS?= -I$(ETPAN_IN)/include $(OPTIMIZE) -fPIC -pedantic -DSYSTEM_DB=\"$(SYSTEM_DB)\" \
   23.55 -	-DSQLITE_THREADSAFE=1 -D_GNU_SOURCE -I../asn.1 $(EXTRAMACROS)
   23.56 -LDFLAGS?= -L$(ETPAN_IN)/lib -shared -lc -ldl -letpan -lpthread -L../asn.1 -lasn1 -luuid
   23.57 -
   23.58 -else
   23.59 -$(error don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
   23.60 +ifdef SQLITE3_FROM_OS
   23.61 +    NO_SOURCE+= sqlite3.c
   23.62 +    CFLAGS+= -DSQLITE3_FROM_OS
   23.63 +    LDLIBS+= -lsqlite3
   23.64  endif
   23.65  
   23.66 +ifeq ($(OPENPGP),GPG)
   23.67 +    NO_SOURCE+= pgp_netpgp.c
   23.68 +    CFLAGS+= -DUSE_GPG $(GPGME_INC) -DLIBGPGME=\"$(LIBGPGME)\"
   23.69 +    LDFLAGS+= $(GPGME_LIB)
   23.70 +    # No extra LDLIBS are needed here, because GPGME is dynamically loaded
   23.71 +else ifeq ($(OPENPGP),NETPGP)
   23.72 +    NO_SOURCE+= pgp_gpg.c
   23.73 +    CFLAGS+= -DUSE_NETPGP $(NETGPG_INC)
   23.74 +    LDFLAGS+= $(NETGPG_LIB)
   23.75 +    LDLIBS+= -lnetpgp -lcurl
   23.76  else
   23.77 -$(error don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
   23.78 +    $(error Unknown OpenPGP library: $(OPENPGP))
   23.79  endif
   23.80  
   23.81 -DEBUG?=NO
   23.82 -ifeq ("$(DEBUG)","NO")
   23.83 -    CFLAGS+= -DNDEBUG
   23.84 -endif
   23.85 -
   23.86 -OPENPGP?=GPG
   23.87 -ifeq ("$(OPENPGP)","GPG")
   23.88 -    NO_SOURCE=pgp_netpgp.c
   23.89 -    GPGME_IN?=$(HOME)
   23.90 -    CFLAGS+= -DUSE_GPG -I$(GPGME_IN)/include -DLIBGPGME=\"$(LIBGPGME)\"
   23.91 -    #LDFLAGS+= -L$(GPGME_IN)/lib -lgpgme
   23.92 -else ifeq ("$(OPENPGP)","NETPGP")
   23.93 -    NO_SOURCE=pgp_gpg.c
   23.94 -    NETPGP_IN?=$(HOME)
   23.95 -    CFLAGS+= -DUSE_NETPGP -I$(NETPGP_IN)/include
   23.96 -    LDFLAGS+= -L$(NETPGP_IN)/lib -lnetpgp -lcurl
   23.97 -else
   23.98 -	$(error Unknown OpenPGP library : $(OPENPGP))
   23.99 -endif
  23.100 -
  23.101 -ALL_SOURCE=$(subst $(NO_SOURCE),,$(wildcard *.c))
  23.102 -
  23.103 +ALL_SOURCE=$(filter-out $(NO_SOURCE),$(wildcard *.c))
  23.104  DEPENDS=$(subst .c,.d,$(ALL_SOURCE))
  23.105  ALL_OBJECTS=$(subst .c,.o,$(ALL_SOURCE))
  23.106  
  23.107 +.PHONY: all
  23.108  all: $(TARGET)
  23.109  
  23.110 -include Makefile.protocols
  23.111 +-include Makefile.protocols
  23.112  
  23.113  %.d: %.c
  23.114  	@set -e; rm -f $@; \
  23.115 @@ -72,29 +63,32 @@
  23.116  	sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
  23.117  	rm -f $@.$$$$
  23.118  
  23.119 --include $(DEPENDS)
  23.120 -
  23.121 -#platform_windows.o: platform_windows.cpp
  23.122 -#	$(CXX) $(CXX_FLAGS) -o $@ -c $<
  23.123 +# If only the goal 'clean' is given, do not generate and include the '%.d' files.
  23.124 +ifneq ($(MAKECMDGOALS),clean)
  23.125 +    -include $(DEPENDS)
  23.126 +endif
  23.127  
  23.128  $(TARGET): libpEpEngine.a
  23.129 -	$(LD) $(ALL_OBJECTS) $(LDFLAGS) -o $@
  23.130 +	$(CC) $(ALL_OBJECTS) $(LDFLAGS) $(LDLIBS) -o $@
  23.131  
  23.132 +.PHONY: objects
  23.133  objects: $(ALL_OBJECTS)
  23.134  
  23.135  libpEpEngine.a: $(ALL_OBJECTS)
  23.136 -	ar -r $@ $(ALL_OBJECTS)
  23.137 +	ar -rc $@ $^
  23.138  
  23.139  .PHONY: clean
  23.140 -
  23.141  clean:
  23.142  	rm -f *.d *.o *.a $(TARGET) *.dll *.so *.zip *.d.* *.def *~
  23.143  
  23.144 +.PHONY: install
  23.145  install: $(TARGET)
  23.146 +	mkdir -p "$(PREFIX)/lib/"
  23.147  	cp $< $(PREFIX)/lib/
  23.148  	mkdir -p $(PREFIX)/include/pEp
  23.149  	cp pEpEngine.h keymanagement.h message_api.h dynamic_api.h stringlist.h timestamp.h identity_list.h bloblist.h stringpair.h message.h mime.h cryptotech.h sync.h sync_fsm.h sync_app.h blacklist.h openpgp_compat.h $(PREFIX)/include/pEp/
  23.150  
  23.151 +.PHONY: uninstall
  23.152  uninstall:
  23.153  	rm -f $(PREFIX)/lib/$(TARGET)
  23.154 -
  23.155 +	rm -rf $(PREFIX)/include/pEp
    24.1 --- a/src/bloblist.c	Mon Aug 14 09:13:53 2017 +0200
    24.2 +++ b/src/bloblist.c	Wed Aug 30 14:42:51 2017 +0200
    24.3 @@ -9,6 +9,40 @@
    24.4  
    24.5  #include "bloblist.h"
    24.6  
    24.7 +static bool set_blob_data(bloblist_t* bloblist, char* blob, size_t size, const char* mime_type,
    24.8 +                          const char* filename) {
    24.9 +    
   24.10 +    if (!bloblist)
   24.11 +        return false;
   24.12 +        
   24.13 +    if (mime_type) {
   24.14 +       bloblist->mime_type = strdup(mime_type);
   24.15 +       if (bloblist->mime_type == NULL) {
   24.16 +           return false;
   24.17 +       }
   24.18 +    }
   24.19 +    
   24.20 +    if (filename) {
   24.21 +       bloblist->filename = strdup(filename);
   24.22 +       if (bloblist->filename == NULL) {
   24.23 +           free(bloblist->mime_type);
   24.24 +           return false;
   24.25 +       }
   24.26 +       /* Default behaviour, can be overwritten post-allocation with
   24.27 +          set_blob_content_disposition */
   24.28 +       if (strstr(filename, "cid://") == filename)
   24.29 +           bloblist->disposition = PEP_CONTENT_DISP_INLINE;
   24.30 +                        
   24.31 +    }               
   24.32 +    
   24.33 +    if (blob) {
   24.34 +        bloblist->value = blob;
   24.35 +        bloblist->size = size;
   24.36 +    }
   24.37 +    
   24.38 +    return true;
   24.39 +}
   24.40 +
   24.41  DYNAMIC_API bloblist_t *new_bloblist(char *blob, size_t size, const char *mime_type,
   24.42          const char *filename)
   24.43  {
   24.44 @@ -17,26 +51,9 @@
   24.45      if (bloblist == NULL)
   24.46          return NULL;
   24.47  
   24.48 -    if (mime_type) {
   24.49 -        bloblist->mime_type = strdup(mime_type);
   24.50 -        if (bloblist->mime_type == NULL) {
   24.51 -            free(bloblist);
   24.52 -            return NULL;
   24.53 -        }
   24.54 -    }
   24.55 -
   24.56 -    if (filename) {
   24.57 -        bloblist->filename = strdup(filename);
   24.58 -        if (bloblist->filename == NULL) {
   24.59 -            free(bloblist->mime_type);
   24.60 -            free(bloblist);
   24.61 -            return NULL;
   24.62 -        }
   24.63 -    }
   24.64 -
   24.65 -    if (blob) {
   24.66 -        bloblist->value = blob;
   24.67 -        bloblist->size = size;
   24.68 +    if (!set_blob_data(bloblist, blob, size, mime_type, filename)) {
   24.69 +        free(bloblist);
   24.70 +        bloblist = NULL;
   24.71      }
   24.72  
   24.73      return bloblist;
   24.74 @@ -118,25 +135,11 @@
   24.75      if (bloblist->value == NULL) { // empty list
   24.76          if (bloblist->next != NULL)
   24.77              return NULL; // invalid list
   24.78 -
   24.79 -        if (mime_type) {
   24.80 -            bloblist->mime_type = strdup(mime_type);
   24.81 -            if (bloblist->mime_type == NULL) {
   24.82 -                free(bloblist);
   24.83 -                return NULL;
   24.84 -            }
   24.85 +            
   24.86 +        if (!set_blob_data(bloblist, blob, size, mime_type, filename)) {
   24.87 +            free(bloblist);
   24.88 +            bloblist = NULL;
   24.89          }
   24.90 -        if (filename) {
   24.91 -            bloblist->filename = strdup(filename);
   24.92 -            if (bloblist->filename == NULL) {
   24.93 -                free(bloblist->mime_type);
   24.94 -                free(bloblist);
   24.95 -                return NULL;
   24.96 -            }
   24.97 -        }
   24.98 -
   24.99 -        bloblist->value = blob;
  24.100 -        bloblist->size = size;
  24.101  
  24.102          return bloblist;
  24.103      }
  24.104 @@ -165,3 +168,9 @@
  24.105  
  24.106      return len;
  24.107  }
  24.108 +
  24.109 +DYNAMIC_API void set_blob_disposition(bloblist_t* blob, 
  24.110 +                                      content_disposition_type disposition) {
  24.111 +    if (blob)                                    
  24.112 +        blob->disposition = disposition;
  24.113 +}
    25.1 --- a/src/bloblist.h	Mon Aug 14 09:13:53 2017 +0200
    25.2 +++ b/src/bloblist.h	Wed Aug 30 14:42:51 2017 +0200
    25.3 @@ -4,11 +4,17 @@
    25.4  #pragma once
    25.5  
    25.6  #include "dynamic_api.h"
    25.7 +#include "stringpair.h"
    25.8  
    25.9  #ifdef __cplusplus
   25.10  extern "C" {
   25.11  #endif
   25.12  
   25.13 +typedef enum {
   25.14 +    PEP_CONTENT_DISP_ATTACHMENT = 0,
   25.15 +    PEP_CONTENT_DISP_INLINE = 1,
   25.16 +    PEP_CONTENT_DISP_OTHER = -1      // must be affirmatively set
   25.17 +} content_disposition_type;
   25.18  
   25.19  typedef struct _bloblist_t {
   25.20      char *value;                    // blob
   25.21 @@ -17,6 +23,8 @@
   25.22                                      // NULL if unknown
   25.23      char *filename;                // UTF-8 string of file name of blob or
   25.24                                      // NULL if unknown
   25.25 +    content_disposition_type disposition; // default is attachment when allocated
   25.26 +                                          // (see mime.h and RFC2183)
   25.27      struct _bloblist_t *next;
   25.28  } bloblist_t;
   25.29  
   25.30 @@ -94,7 +102,19 @@
   25.31  
   25.32  DYNAMIC_API int bloblist_length(const bloblist_t *bloblist);
   25.33  
   25.34 +// set_blob_content_disposition() - set blob content disposition and parameters
   25.35 +//                                  when necessary
   25.36 +//
   25.37 +//  parameters:
   25.38 +//      blob (in)               bloblist struct to change disposition for
   25.39 +//      disposition (in)        disposition type (see enum)
   25.40 +
   25.41 +DYNAMIC_API void set_blob_disposition(bloblist_t* blob, 
   25.42 +                                              content_disposition_type disposition);
   25.43 +
   25.44 +
   25.45 +
   25.46 +
   25.47  #ifdef __cplusplus
   25.48  }
   25.49  #endif
   25.50 -
    26.1 --- a/src/etpan_mime.c	Mon Aug 14 09:13:53 2017 +0200
    26.2 +++ b/src/etpan_mime.c	Wed Aug 30 14:42:51 2017 +0200
    26.3 @@ -301,6 +301,11 @@
    26.4          switch (resource->rid_type) {
    26.5              case PEP_RID_CID:
    26.6                  content_id = strdup(resource->rid);
    26.7 +                disposition =
    26.8 +                    mailmime_disposition_new_with_data(MAILMIME_DISPOSITION_TYPE_INLINE,
    26.9 +                                                       NULL, NULL, NULL, NULL, (size_t) -1);
   26.10 +                    if (disposition == NULL)
   26.11 +                        goto enomem;
   26.12                  break;
   26.13              case PEP_RID_FILENAME:
   26.14              default:
    27.1 --- a/src/mime.c	Mon Aug 14 09:13:53 2017 +0200
    27.2 +++ b/src/mime.c	Wed Aug 30 14:42:51 2017 +0200
    27.3 @@ -97,82 +97,6 @@
    27.4      return status;
    27.5  }
    27.6  
    27.7 -static PEP_STATUS mime_html_text(
    27.8 -        const char *plaintext,
    27.9 -        const char *htmltext,
   27.10 -        struct mailmime **result
   27.11 -    )
   27.12 -{
   27.13 -    PEP_STATUS status = PEP_STATUS_OK;
   27.14 -    struct mailmime * mime = NULL;
   27.15 -    struct mailmime * submime = NULL;
   27.16 -    int r;
   27.17 -
   27.18 -    assert(plaintext);
   27.19 -    assert(htmltext);
   27.20 -    assert(result);
   27.21 -
   27.22 -    *result = NULL;
   27.23 -
   27.24 -    mime = part_multiple_new("multipart/alternative");
   27.25 -    assert(mime);
   27.26 -    if (mime == NULL)
   27.27 -        goto enomem;
   27.28 -
   27.29 -    pEp_rid_list_t* resource = new_rid_node(PEP_RID_FILENAME, "msg.txt");
   27.30 -    
   27.31 -    submime = get_text_part(resource, "text/plain", plaintext, strlen(plaintext),
   27.32 -            MAILMIME_MECHANISM_QUOTED_PRINTABLE);
   27.33 -    free_rid_list(resource);
   27.34 -    resource = NULL;
   27.35 -    
   27.36 -    assert(submime);
   27.37 -    if (submime == NULL)
   27.38 -        goto enomem;
   27.39 -
   27.40 -    r = mailmime_smart_add_part(mime, submime);
   27.41 -    assert(r == MAILIMF_NO_ERROR);
   27.42 -    if (r == MAILIMF_ERROR_MEMORY) {
   27.43 -        goto enomem;
   27.44 -    }
   27.45 -    else {
   27.46 -        // mailmime_smart_add_part() takes ownership of submime
   27.47 -        submime = NULL;
   27.48 -    }
   27.49 -
   27.50 -    resource = new_rid_node(PEP_RID_FILENAME, "msg.html");
   27.51 -    submime = get_text_part(resource, "text/html", htmltext, strlen(htmltext),
   27.52 -            MAILMIME_MECHANISM_QUOTED_PRINTABLE);
   27.53 -    free_rid_list(resource);
   27.54 -    resource = NULL;
   27.55 -    
   27.56 -    assert(submime);
   27.57 -    if (submime == NULL)
   27.58 -        goto enomem;
   27.59 -
   27.60 -    r = mailmime_smart_add_part(mime, submime);
   27.61 -    assert(r == MAILIMF_NO_ERROR);
   27.62 -    if (r == MAILIMF_ERROR_MEMORY)
   27.63 -        goto enomem;
   27.64 -    else {
   27.65 -        // mailmime_smart_add_part() takes ownership of submime
   27.66 -        submime = NULL;
   27.67 -    }
   27.68 -
   27.69 -    *result = mime;
   27.70 -    return PEP_STATUS_OK;
   27.71 -
   27.72 -enomem:
   27.73 -    status = PEP_OUT_OF_MEMORY;
   27.74 -
   27.75 -    if (mime)
   27.76 -        mailmime_free(mime);
   27.77 -
   27.78 -    if (submime)
   27.79 -        mailmime_free(submime);
   27.80 -
   27.81 -    return status;
   27.82 -}
   27.83  
   27.84  static PEP_STATUS mime_attachment(
   27.85          bloblist_t *blob,
   27.86 @@ -216,6 +140,127 @@
   27.87      return status;
   27.88  }
   27.89  
   27.90 +static PEP_STATUS mime_html_text(
   27.91 +        const char *plaintext,
   27.92 +        const char *htmltext,
   27.93 +        bloblist_t *inlined_attachments,
   27.94 +        struct mailmime **result
   27.95 +    )
   27.96 +{
   27.97 +    PEP_STATUS status = PEP_STATUS_OK;
   27.98 +    struct mailmime * top_level_html_mime = NULL;
   27.99 +    struct mailmime * mime = NULL;
  27.100 +    struct mailmime * submime = NULL;
  27.101 +    int r;
  27.102 +
  27.103 +    assert(plaintext);
  27.104 +    assert(htmltext);
  27.105 +    assert(result);
  27.106 +
  27.107 +    *result = NULL;
  27.108 +
  27.109 +    mime = part_multiple_new("multipart/alternative");
  27.110 +    assert(mime);
  27.111 +    if (mime == NULL)
  27.112 +        goto enomem;
  27.113 +
  27.114 +    pEp_rid_list_t* resource = new_rid_node(PEP_RID_FILENAME, "msg.txt");
  27.115 +    
  27.116 +    submime = get_text_part(NULL, "text/plain", plaintext, strlen(plaintext),
  27.117 +            MAILMIME_MECHANISM_QUOTED_PRINTABLE);
  27.118 +    free_rid_list(resource);
  27.119 +    resource = NULL;
  27.120 +    
  27.121 +    assert(submime);
  27.122 +    if (submime == NULL)
  27.123 +        goto enomem;
  27.124 +
  27.125 +    r = mailmime_smart_add_part(mime, submime);
  27.126 +    assert(r == MAILIMF_NO_ERROR);
  27.127 +    if (r == MAILIMF_ERROR_MEMORY) {
  27.128 +        goto enomem;
  27.129 +    }
  27.130 +    else {
  27.131 +        // mailmime_smart_add_part() takes ownership of submime
  27.132 +        submime = NULL;
  27.133 +    }
  27.134 +
  27.135 +
  27.136 +    if (inlined_attachments) {
  27.137 +        /* Noooooo... dirk, why do you do this to me? */
  27.138 +        submime = part_multiple_new("multipart/related");
  27.139 +        assert(submime);
  27.140 +        if (submime == NULL)
  27.141 +            goto enomem;
  27.142 +
  27.143 +        top_level_html_mime = submime;
  27.144 +        
  27.145 +        r = mailmime_smart_add_part(mime, top_level_html_mime);
  27.146 +        assert(r == MAILIMF_NO_ERROR);
  27.147 +        if (r == MAILIMF_ERROR_MEMORY) {
  27.148 +            goto enomem;
  27.149 +        }
  27.150 +        else {
  27.151 +            // mailmime_smart_add_part() takes ownership of submime
  27.152 +            submime = NULL;
  27.153 +        }
  27.154 +    }
  27.155 +    else {
  27.156 +        top_level_html_mime = mime;
  27.157 +    }
  27.158 +
  27.159 +//    resource = new_rid_node(PEP_RID_FILENAME, "msg.html");
  27.160 +    submime = get_text_part(NULL, "text/html", htmltext, strlen(htmltext),
  27.161 +            MAILMIME_MECHANISM_QUOTED_PRINTABLE);
  27.162 +    free_rid_list(resource);
  27.163 +    resource = NULL;
  27.164 +    
  27.165 +    assert(submime);
  27.166 +    if (submime == NULL)
  27.167 +        goto enomem;
  27.168 +
  27.169 +    r = mailmime_smart_add_part(top_level_html_mime, submime);
  27.170 +    assert(r == MAILIMF_NO_ERROR);
  27.171 +    if (r == MAILIMF_ERROR_MEMORY)
  27.172 +        goto enomem;
  27.173 +    else {
  27.174 +        // mailmime_smart_add_part() takes ownership of submime
  27.175 +        submime = NULL;
  27.176 +    }
  27.177 +
  27.178 +    bloblist_t *_a;
  27.179 +    for (_a = inlined_attachments; _a != NULL; _a = _a->next) {
  27.180 +
  27.181 +        status = mime_attachment(_a, &submime);
  27.182 +        if (status != PEP_STATUS_OK)
  27.183 +            return PEP_UNKNOWN_ERROR; // FIXME
  27.184 +
  27.185 +        r = mailmime_smart_add_part(top_level_html_mime, submime);
  27.186 +        assert(r == MAILIMF_NO_ERROR);
  27.187 +        if (r == MAILIMF_ERROR_MEMORY) {
  27.188 +            goto enomem;
  27.189 +        }
  27.190 +        else {
  27.191 +            // mailmime_smart_add_part() takes ownership of submime
  27.192 +            submime = NULL;
  27.193 +        }
  27.194 +    }
  27.195 +
  27.196 +    *result = mime;
  27.197 +    return PEP_STATUS_OK;
  27.198 +
  27.199 +enomem:
  27.200 +    status = PEP_OUT_OF_MEMORY;
  27.201 +
  27.202 +    if (mime)
  27.203 +        mailmime_free(mime);
  27.204 +
  27.205 +    if (submime)
  27.206 +        mailmime_free(submime);
  27.207 +
  27.208 +    return status;
  27.209 +}
  27.210 +
  27.211  static struct mailimf_mailbox * identity_to_mailbox(const pEp_identity *ident)
  27.212  {
  27.213      char *_username = NULL;
  27.214 @@ -605,6 +650,35 @@
  27.215      return retval;
  27.216  }
  27.217  
  27.218 +static void split_inlined_and_attached(bloblist_t** inlined, bloblist_t** attached) {
  27.219 +    bloblist_t** curr_pp = attached;
  27.220 +    bloblist_t* curr = *curr_pp;
  27.221 +    
  27.222 +    bloblist_t* inline_ret = NULL;
  27.223 +    bloblist_t** inline_curr_pp = &inline_ret;
  27.224 +    
  27.225 +    bloblist_t* att_ret = NULL;
  27.226 +    bloblist_t** att_curr_pp = &att_ret;
  27.227 +    
  27.228 +    while (curr) {
  27.229 +        if (curr->disposition == PEP_CONTENT_DISP_INLINE) {
  27.230 +            *inline_curr_pp = curr;
  27.231 +            inline_curr_pp = &(curr->next);
  27.232 +        }
  27.233 +        else {
  27.234 +            *att_curr_pp = curr;
  27.235 +            att_curr_pp = &(curr->next);            
  27.236 +        }
  27.237 +        *curr_pp = curr->next;
  27.238 +        curr->next = NULL;
  27.239 +        curr = *curr_pp;
  27.240 +    }
  27.241 +    
  27.242 +    *inlined = inline_ret;
  27.243 +    *attached = att_ret;
  27.244 +}
  27.245 +
  27.246 +
  27.247  static PEP_STATUS mime_encode_message_plain(
  27.248          const message *msg,
  27.249          bool omit_fields,
  27.250 @@ -627,7 +701,15 @@
  27.251      htmltext = msg->longmsg_formatted;
  27.252  
  27.253      if (htmltext && (htmltext[0] != '\0')) {
  27.254 -        status = mime_html_text(plaintext, htmltext, &mime);
  27.255 +        /* first, we need to strip out the inlined attachments to ensure this
  27.256 +           gets set up correctly */
  27.257 +        
  27.258 +        bloblist_t* inlined_attachments = NULL;
  27.259 +        /* Noooooo... dirk, why do you do this to me? */
  27.260 +        split_inlined_and_attached(&inlined_attachments, &msg->attachments);
  27.261 +
  27.262 +        
  27.263 +        status = mime_html_text(plaintext, htmltext, inlined_attachments, &mime);
  27.264          if (status != PEP_STATUS_OK)
  27.265              goto pep_error;
  27.266      }
    28.1 --- a/src/mime.h	Mon Aug 14 09:13:53 2017 +0200
    28.2 +++ b/src/mime.h	Wed Aug 30 14:42:51 2017 +0200
    28.3 @@ -9,7 +9,6 @@
    28.4  extern "C" {
    28.5  #endif
    28.6  
    28.7 -
    28.8  // is_PGP_message_text() - determine if text encodes a PGP message
    28.9  //
   28.10  //  parameters:
   28.11 @@ -78,4 +77,3 @@
   28.12  #ifdef __cplusplus
   28.13  }
   28.14  #endif
   28.15 -
    29.1 --- a/src/pEp_internal.h	Mon Aug 14 09:13:53 2017 +0200
    29.2 +++ b/src/pEp_internal.h	Wed Aug 30 14:42:51 2017 +0200
    29.3 @@ -56,7 +56,11 @@
    29.4  #include <stdio.h>
    29.5  #include <ctype.h>
    29.6  
    29.7 +#ifdef SQLITE3_FROM_OS
    29.8 +#include <sqlite3.h>
    29.9 +#else
   29.10  #include "sqlite3.h"
   29.11 +#endif
   29.12  
   29.13  #define _EXPORT_PEP_ENGINE_DLL
   29.14  #include "pEpEngine.h"
    30.1 --- a/sync/Makefile	Mon Aug 14 09:13:53 2017 +0200
    30.2 +++ b/sync/Makefile	Wed Aug 30 14:42:51 2017 +0200
    30.3 @@ -1,35 +1,38 @@
    30.4 -
    30.5 -# This file is under GNU General Public License 3.0
    30.6 +# Copyright 2017, pEp Foundation
    30.7 +# This file is part of pEpEngine
    30.8 +# This file may be used under the terms of the GNU General Public License version 3
    30.9  # see LICENSE.txt
   30.10  
   30.11  include ../Makefile.conf
   30.12  
   30.13 +.PHONY: all
   30.14  all: .codegen
   30.15  
   30.16 +# Currently not in use, kept for historic reasons
   30.17  skeleton: .actions
   30.18  
   30.19  .codegen: .statemachines .actions
   30.20  	cp -f generated/*.* ../src
   30.21 -	touch .codegen
   30.22 +	touch $@
   30.23  
   30.24  .actions: devicegroup.fsm gen_actions.ysl2 fsm.yml2 functions.ysl2
   30.25 -	$(YML2PROC) $(YML_OPTS) -y gen_actions.ysl2 $< -o $@
   30.26 +	$(YML2_PROC) $(YML2_OPTS) -y gen_actions.ysl2 $< -o $@
   30.27  
   30.28  .statemachines: devicegroup.fsm gen_statemachine.ysl2 fsm.yml2 functions.ysl2
   30.29 -	$(YML2PROC) $(YML_OPTS) -y gen_statemachine.ysl2 $< -o $@
   30.30 +	$(YML2_PROC) $(YML2_OPTS) -y gen_statemachine.ysl2 $< -o $@
   30.31  
   30.32  .PHONY: clean
   30.33 -
   30.34  clean:
   30.35 -	rm -f *.xml *.xsl \
   30.36 -    $(pathsub generated/%, ../src/% $(wildcard generated/*.*)) \
   30.37 -    ../generated/* ../skeletons/* .statemachines .actions *.dot *.svg
   30.38 +	rm -f *.xml *.xsl *.dot *.svg \
   30.39 +	$(patsubst generated/%,../src/%,$(wildcard generated/*.*)) \
   30.40 +	../generated/* ../skeletons/* .statemachines .actions .codegen \
   30.41 +	generated/Makefile.protocols
   30.42  
   30.43  %.xml: %.fsm
   30.44 -	yml2c $< -o $@
   30.45 +	$(YML2_PATH)/yml2c $< -o $@
   30.46  
   30.47 -%.dot: devicegroup.fsm gen_dot.ysl2
   30.48 -	$(YML2PROC) $(YML_OPTS) -y gen_dot.ysl2 $<
   30.49 +%.dot: gen_dot.ysl2 devicegroup.fsm
   30.50 +	$(YML2_PROC) $(YML2_OPTS) -y $^
   30.51  
   30.52  %.svg: %.dot
   30.53  	dot -Tsvg -o $@ $<
    31.1 --- a/test/Makefile	Mon Aug 14 09:13:53 2017 +0200
    31.2 +++ b/test/Makefile	Wed Aug 30 14:42:51 2017 +0200
    31.3 @@ -1,59 +1,69 @@
    31.4 -
    31.5 -# This file is under GNU General Public License 3.0
    31.6 +# Copyright 2017, pEp Foundation
    31.7 +# This file is part of pEpEngine
    31.8 +# This file may be used under the terms of the GNU General Public License version 3
    31.9  # see LICENSE.txt
   31.10  
   31.11 -HERE := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
   31.12 +HERE:=$(CURDIR)
   31.13  
   31.14  include ../Makefile.conf
   31.15  
   31.16 -CC?=g++ -std=gnu++11 -pthread
   31.17 -CXX?=g++ -std=gnu++11 -pthread
   31.18 -LD?=$(CXX)
   31.19 -LDFLAGS?=-L$(HOME)/lib
   31.20 -LDLIBS?=-letpan -lpEpEngine -lstdc++ -L../asn.1 -lasn1
   31.21 +TARGET=pEpEngineTest
   31.22 +
   31.23 +unexport GNUPGHOME
   31.24 +TEST_HOME=$(HERE)/test_home
   31.25 +TEST_GNUPGHOME=$(TEST_HOME)/.gnupg
   31.26 +
   31.27 +LDFLAGS+= $(ETPAN_LIB) -L../asn.1 -L../src
   31.28 +LDLIBS+= -letpan -lpEpEngine -lstdc++ -lasn1
   31.29 +
   31.30  ifeq ($(BUILD_FOR),Linux)
   31.31 -	LDLIBS+= -luuid
   31.32 -endif
   31.33 -CXXFLAGS?=-std=c++11 -g -O0 -I../src -I../asn.1
   31.34 -# CXXFLAGS=-O3 -DNDEBUG
   31.35 -
   31.36 -ifeq ("$(OPENPGP)","NETPGP")
   31.37 -	LDLIBS+= -lnetpgp
   31.38 +    LDLIBS+= -luuid
   31.39  endif
   31.40  
   31.41 -TARGET=pEpEngineTest
   31.42 +ifeq ($(OPENPGP),NETPGP)
   31.43 +    LDLIBS+= -lnetpgp
   31.44 +endif
   31.45 +
   31.46 +ifdef SQLITE3_FROM_OS
   31.47 +    LDLIBS+= -lsqlite3
   31.48 +endif
   31.49 +
   31.50 +ifeq ($(shell uname),Darwin)
   31.51 +    LIBPATH=DYLD_LIBRARY_PATH
   31.52 +    LLDB_BIN=/Applications/Xcode.app/Contents/Developer/usr/bin/lldb
   31.53 +else
   31.54 +    LIBPATH=LD_LIBRARY_PATH
   31.55 +    LLDB_BIN=lldb
   31.56 +endif
   31.57 +
   31.58 +# Create a list of the extra library paths for the loader. I do not assume that the engine (and its dependencies) are installed for testing.
   31.59 +# Note that += can not be used here, as it changes the amount of whitespace
   31.60 +EXTRA_LIB_PATHS=../src:
   31.61 +ifdef ETPAN_LIB
   31.62 +    EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(ETPAN_LIB)):
   31.63 +endif
   31.64 +ifdef GPGME_LIB
   31.65 +    EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(GPGME_LIB)):
   31.66 +endif
   31.67 +ifdef NETPGP_LIB
   31.68 +    EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(NETPGP_LIB)):
   31.69 +endif
   31.70 +# Remove trailing ':'
   31.71 +EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS::=)
   31.72 +
   31.73 +TEST_CMD_PFX=$(LIBPATH)=$(EXTRA_LIB_PATHS) HOME=$(TEST_HOME)
   31.74  
   31.75  UNIT_TESTS_SOURCE=$(wildcard *_test.cc)
   31.76  UNIT_TESTS=$(subst .cc,,$(UNIT_TESTS_SOURCE))
   31.77  UNIT_TESTS_RUN=$(subst .cc,_run,$(UNIT_TESTS_SOURCE))
   31.78  
   31.79 +.PHONY: all
   31.80  all: $(TARGET) $(UNIT_TESTS)
   31.81  
   31.82 -.PHONY: clean
   31.83 -
   31.84  # don't delete .o files!
   31.85  .PRECIOUS: %.o
   31.86  
   31.87 -unexport GNUPGHOME;
   31.88 -TEST_HOME=$(HERE)/test_home
   31.89 -TEST_GNUPGHOME=$(TEST_HOME)/.gnupg
   31.90 -
   31.91 -ifeq ($(shell which gpg2), )
   31.92 -    GPG_CMD = gpg
   31.93 -else
   31.94 -    GPG_CMD = gpg2
   31.95 -endif
   31.96 -
   31.97 -ifeq ($(shell uname), Darwin)
   31.98 -    LIBPATH = DYLD_LIBRARY_PATH
   31.99 -    LLDB_BIN = /Applications/Xcode.app/Contents/Developer/usr/bin/lldb
  31.100 -else
  31.101 -    LIBPATH = LD_LIBRARY_PATH
  31.102 -    LLDB_BIN = lldb
  31.103 -endif
  31.104 -
  31.105 -TEST_CMD_PFX = $(LIBPATH)=$(HOME)/lib:../src HOME=$(TEST_HOME)
  31.106 -
  31.107 +.PHONY: test_home_
  31.108  test_home_: 
  31.109  	-gpgconf --kill gpg-agent
  31.110  	-HOME=$(TEST_HOME) gpgconf --kill gpg-agent
  31.111 @@ -62,15 +72,17 @@
  31.112  	mkdir -p $(TEST_GNUPGHOME)/private-keys-v1.d
  31.113  	$(GPG_CMD) --import --batch --homedir $(TEST_GNUPGHOME) 0x*.asc *_sec.asc
  31.114  
  31.115 +.PHONY: clean
  31.116  clean:
  31.117  	rm -f *.o $(TARGET) *.a *~ $(UNIT_TESTS) pep_Dokument_Titel.pdf msg4.asc
  31.118  	rm -Rf *.dSYM $(TEST_HOME) pubring.gpg secring.gpg random_seed *.conf trustdb.gpg
  31.119  
  31.120 -test: pEpEngineTest test_home_
  31.121 -	$(TEST_CMD_PFX) ./pEpEngineTest
  31.122 +.PHONY: test
  31.123 +test: $(TARGET) test_home_
  31.124 +	$(TEST_CMD_PFX) ./$<
  31.125  
  31.126  %_test : %_test.o test_util.o
  31.127 -	 $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
  31.128 +	$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
  31.129  
  31.130  %_run : % test_home_
  31.131  	$(TEST_CMD_PFX) ./$<
  31.132 @@ -84,7 +96,13 @@
  31.133  %_gdb : % test_home_
  31.134  	$(TEST_CMD_PFX) gdb ./$<
  31.135  
  31.136 +.PHONY: unit_tests
  31.137  unit_tests: $(UNIT_TESTS) $(UNIT_TESTS_RUN)
  31.138  
  31.139 +.PHONY: compile
  31.140 +compile: $(UNIT_TESTS) $(TARGET)
  31.141 +
  31.142 +# Installs the engine, not the test binaries
  31.143 +.PHONY: install
  31.144  install:
  31.145 -	make -C .. install
  31.146 +	$(MAKE) -C .. install