...
authorVolker Birk <vb@pep-project.org>
Sun, 29 May 2016 14:35:39 +0200
changeset 6926f7f1b7627bc
parent 691 67c247f1da64
child 696 0b3ad1c40304
child 711 d88dea0f5448
...
src/sync_actions.c
sync/gen_actions_skeleton.ysl2
     1.1 --- a/src/sync_actions.c	Sun May 29 14:13:53 2016 +0200
     1.2 +++ b/src/sync_actions.c	Sun May 29 14:35:39 2016 +0200
     1.3 @@ -64,12 +64,12 @@
     1.4      if (Identity_from_Struct(me, &msg->me) == NULL)
     1.5          goto enomem;
     1.6  
     1.7 -    if (asn_check_constraints(&asn_DEF_HandshakeRequest, msg, NULL, NULL)) {
     1.8 +    if (asn_check_constraints(&asn_DEF_Beacon, msg, NULL, NULL)) {
     1.9          status = PEP_CONTRAINTS_VIOLATED;
    1.10          goto error;
    1.11      }
    1.12  
    1.13 -    ssize_t size = uper_encode_to_new_buffer(&asn_DEF_HandshakeRequest,
    1.14 +    ssize_t size = uper_encode_to_new_buffer(&asn_DEF_Beacon,
    1.15              NULL, msg, (void **) &payload);
    1.16      if (size == -1) {
    1.17          status = PEP_CANNOT_ENCODE;
    1.18 @@ -153,6 +153,11 @@
    1.19      if (Identity_from_Struct(partner, &msg->partner) == NULL)
    1.20          goto enomem;
    1.21  
    1.22 +    if (asn_check_constraints(&asn_DEF_HandshakeRequest, msg, NULL, NULL)) {
    1.23 +        status = PEP_CONTRAINTS_VIOLATED;
    1.24 +        goto error;
    1.25 +    }
    1.26 +
    1.27      ssize_t size = uper_encode_to_new_buffer(&asn_DEF_HandshakeRequest,
    1.28              NULL, msg, (void **) &payload);
    1.29      if (size == -1) {
    1.30 @@ -349,7 +354,12 @@
    1.31      if (KeyList_from_stringlist(sl, &msg->keylist) == NULL)
    1.32          goto enomem;
    1.33  
    1.34 -    ssize_t size = uper_encode_to_new_buffer(&asn_DEF_HandshakeRequest,
    1.35 +    if (asn_check_constraints(&asn_DEF_OwnKeys, msg, NULL, NULL)) {
    1.36 +        status = PEP_CONTRAINTS_VIOLATED;
    1.37 +        goto error;
    1.38 +    }
    1.39 +
    1.40 +    ssize_t size = uper_encode_to_new_buffer(&asn_DEF_OwnKeys,
    1.41              NULL, msg, (void **) &payload);
    1.42      if (size == -1) {
    1.43          status = PEP_CANNOT_ENCODE;
     2.1 --- a/sync/gen_actions_skeleton.ysl2	Sun May 29 14:13:53 2016 +0200
     2.2 +++ b/sync/gen_actions_skeleton.ysl2	Sun May 29 14:35:39 2016 +0200
     2.3 @@ -168,7 +168,12 @@
     2.4           `` if "$name='OwnKeys'"|> if (KeyList_from_stringlist(sl, &msg->keylist) == NULL)
     2.5           `` if "$name='OwnKeys'"|>> goto enomem;
     2.6  
     2.7 -            ssize_t size = uper_encode_to_new_buffer(&asn_DEF_HandshakeRequest,
     2.8 +            if (asn_check_constraints(&asn_DEF_«$name», msg, NULL, NULL)) {
     2.9 +                status = PEP_CONTRAINTS_VIOLATED;
    2.10 +                goto error;
    2.11 +            }
    2.12 +
    2.13 +            ssize_t size = uper_encode_to_new_buffer(&asn_DEF_«$name»,
    2.14                      NULL, msg, (void **) &payload);
    2.15              if (size == -1) {
    2.16                  status = PEP_CANNOT_ENCODE;