limit size of key attachements and their number per mail for import
authorVolker Birk <vb@pep-project.org>
Mon, 18 Jul 2016 12:42:11 +0200
changeset 908f3dd95d4315f
parent 907 8f5cca5bfa2d
child 909 e39e9fec2da0
limit size of key attachements and their number per mail for import
asn.1/devicegroup.asn1
asn.1/pEp.asn1
src/message_api.c
src/pEp_internal.h
     1.1 --- a/asn.1/devicegroup.asn1	Mon Jul 18 10:15:06 2016 +0200
     1.2 +++ b/asn.1/devicegroup.asn1	Mon Jul 18 12:42:11 2016 +0200
     1.3 @@ -1,5 +1,5 @@
     1.4  DEVICEGROUP
     1.5 -    { iso(1) org(3) dod(6) internet(1) private(4) enterprise(1) pEp (47878) sync (1) keysync (1) }
     1.6 +    { iso(1) org(3) dod(6) internet(1) private(4) enterprise(1) pEp (47878) sync(1) keysync(1) }
     1.7  
     1.8  DEFINITIONS AUTOMATIC TAGS EXTENSIBILITY IMPLIED ::=
     1.9  
     2.1 --- a/asn.1/pEp.asn1	Mon Jul 18 10:15:06 2016 +0200
     2.2 +++ b/asn.1/pEp.asn1	Mon Jul 18 12:42:11 2016 +0200
     2.3 @@ -1,5 +1,5 @@
     2.4  PEP
     2.5 -    { iso(1) org(3) dod(6) internet(1) private(4) enterprise(1) pEp (47878) basic (0) }
     2.6 +    { iso(1) org(3) dod(6) internet(1) private(4) enterprise(1) pEp(47878) basic(0) }
     2.7  
     2.8  DEFINITIONS AUTOMATIC TAGS EXTENSIBILITY IMPLIED ::=
     2.9  
     3.1 --- a/src/message_api.c	Mon Jul 18 10:15:06 2016 +0200
     3.2 +++ b/src/message_api.c	Mon Jul 18 12:42:11 2016 +0200
     3.3 @@ -925,9 +925,12 @@
     3.4      bool remove = false;
     3.5  
     3.6      bloblist_t *bl;
     3.7 -    for (bl = msg->attachments; bl && bl->value; bl = bl->next) 
     3.8 +    int i = 0;
     3.9 +    for (bl = msg->attachments; i < MAX_KEYS_TO_IMPORT && bl && bl->value;
    3.10 +            bl = bl->next, i++) 
    3.11      {
    3.12 -        if (bl && bl->value && bl->size && is_key(bl)) 
    3.13 +        if (bl && bl->value && bl->size && bl->size < MAX_KEY_SIZE
    3.14 +                && is_key(bl)) 
    3.15          {
    3.16              import_key(session, bl->value, bl->size, private_idents);
    3.17              remove = true;
     4.1 --- a/src/pEp_internal.h	Mon Jul 18 10:15:06 2016 +0200
     4.2 +++ b/src/pEp_internal.h	Mon Jul 18 12:42:11 2016 +0200
     4.3 @@ -1,4 +1,9 @@
     4.4 -#define PEP_ENGINE_VERSION "0.6.0"
     4.5 +#define PEP_ENGINE_VERSION "0.6.1"
     4.6 +
     4.7 +// maximum attachment size to import as key 1MB, maximum of 20 attachments
     4.8 +
     4.9 +#define MAX_KEY_SIZE (1024 * 1024)
    4.10 +#define MAX_KEYS_TO_IMPORT  20
    4.11  
    4.12  // this is 20 trustwords with 79 chars max
    4.13  #define MAX_TRUSTWORDS_SPACE (20 * 80)