...
authorVolker Birk <vb@pep-project.org>
Wed, 18 May 2016 13:59:30 +0200
changeset 6558413f45947e8
parent 654 0aa96447e38f
child 656 bf63654b3a39
...
src/sync_actions.c
sync/gen_actions_skeleton.ysl2
     1.1 --- a/src/sync_actions.c	Wed May 18 12:54:22 2016 +0200
     1.2 +++ b/src/sync_actions.c	Wed May 18 13:59:30 2016 +0200
     1.3 @@ -44,7 +44,9 @@
     1.4      status = myself(session, me);
     1.5      if (status != PEP_STATUS_OK)
     1.6          goto error;
     1.7 -    
     1.8 +    if (Identity_from_Struct(me, &msg->me) == NULL)
     1.9 +        goto enomem;
    1.10 +
    1.11      return status;
    1.12  
    1.13  enomem:
    1.14 @@ -90,7 +92,12 @@
    1.15      status = myself(session, me);
    1.16      if (status != PEP_STATUS_OK)
    1.17          goto error;
    1.18 -    
    1.19 +    if (Identity_from_Struct(me, &msg->me) == NULL)
    1.20 +        goto enomem;
    1.21 +
    1.22 +    if (Identity_from_Struct(partner, &msg->partner) == NULL)
    1.23 +        goto enomem;
    1.24 +
    1.25      return status;
    1.26  
    1.27  enomem:
    1.28 @@ -229,7 +236,15 @@
    1.29      status = myself(session, me);
    1.30      if (status != PEP_STATUS_OK)
    1.31          goto error;
    1.32 -    
    1.33 +    if (Identity_from_Struct(me, &msg->me) == NULL)
    1.34 +        goto enomem;
    1.35 +
    1.36 +    stringlist_t *sl;
    1.37 +    status = own_key_retrieve(session, &sl);
    1.38 +    if (status != PEP_STATUS_OK)
    1.39 +        goto error;
    1.40 +    if (KeyList_from_stringlist(sl, &msg->keylist) == NULL)
    1.41 +        goto enomem;
    1.42      return status;
    1.43  
    1.44  enomem:
     2.1 --- a/sync/gen_actions_skeleton.ysl2	Wed May 18 12:54:22 2016 +0200
     2.2 +++ b/sync/gen_actions_skeleton.ysl2	Wed May 18 13:59:30 2016 +0200
     2.3 @@ -117,12 +117,12 @@
     2.4              PEP_STATUS status = PEP_STATUS_OK;
     2.5  
     2.6              assert(session);
     2.7 -        `` if "parm"        |> assert(partner);
     2.8 -        `` if "parm"        |> if (!(session && partner))
     2.9 -        `` if "parm"        |>> return PEP_ILLEGAL_VALUE;
    2.10 -        `` if "not(parm)"   |> assert(!partner);
    2.11 -        `` if "not(parm)"   |> if (!(session && !partner))
    2.12 -        `` if "not(parm)"   |>> return PEP_ILLEGAL_VALUE;
    2.13 +        `` if "parm/partner"        |> assert(partner);
    2.14 +        `` if "parm/partner"        |> if (!(session && partner))
    2.15 +        `` if "parm/partner"        |>> return PEP_ILLEGAL_VALUE;
    2.16 +        `` if "not(parm/partner)"   |> assert(!partner);
    2.17 +        `` if "not(parm/partner)"   |> if (!(session && !partner))
    2.18 +        `` if "not(parm/partner)"   |>> return PEP_ILLEGAL_VALUE;
    2.19  
    2.20              «$name»_t *msg = («$name»_t *) calloc(1, sizeof(«$name»_t));
    2.21              assert(msg);
    2.22 @@ -141,10 +141,18 @@
    2.23              status = myself(session, me);
    2.24              if (status != PEP_STATUS_OK)
    2.25                  goto error;
    2.26 -            
    2.27 -            // payload
    2.28 +            if (Identity_from_Struct(me, &msg->me) == NULL)
    2.29 +                goto enomem;
    2.30  
    2.31 -
    2.32 +         `` if "parm/partner"   |> if (Identity_from_Struct(partner, &msg->partner) == NULL)
    2.33 +         `` if "parm/partner"   |>> goto enomem;
    2.34 +         `` if "$name='OwnKeys'"|> stringlist_t *sl;
    2.35 +         `` if "$name='OwnKeys'"|> status = own_key_retrieve(session, &sl);
    2.36 +         `` if "$name='OwnKeys'"|> if (status != PEP_STATUS_OK)
    2.37 +         `` if "$name='OwnKeys'"|>> goto error;
    2.38 +         `` if "$name='OwnKeys'"|> if (KeyList_from_stringlist(sl, &msg->keylist) == NULL)
    2.39 +         `` if "$name='OwnKeys'"|>> goto enomem;
    2.40 +         `` if "parm" |
    2.41              return status;
    2.42  
    2.43          enomem: