IOSAD-134 Sync enable/disable fails for non-own identities. IOSAD-134
authorDirk Zimmermann <dz@pep.security>
Mon, 02 Sep 2019 16:47:25 +0200
branchIOSAD-134
changeset 120186badda71ac9
parent 1200 78570b5c3dd4
child 1202 63befb9a642a
IOSAD-134 Sync enable/disable fails for non-own identities.
pEpObjCAdapter/PEPInternalSession.m
     1.1 --- a/pEpObjCAdapter/PEPInternalSession.m	Mon Sep 02 16:47:25 2019 +0200
     1.2 +++ b/pEpObjCAdapter/PEPInternalSession.m	Mon Sep 02 16:47:25 2019 +0200
     1.3 @@ -651,6 +651,11 @@
     1.4  - (BOOL)enableSyncForIdentity:(PEPIdentity * _Nonnull)identity
     1.5                          error:(NSError * _Nullable * _Nullable)error
     1.6  {
     1.7 +    if (!identity.isOwn) {
     1.8 +        [NSError setError:error fromPEPStatus:PEPStatusIllegalValue];
     1.9 +        return NO;
    1.10 +    }
    1.11 +
    1.12      pEp_identity *ident = PEP_identityToStruct(identity);
    1.13  
    1.14      PEPStatus status = (PEPStatus) enable_identity_for_sync(_session, ident);
    1.15 @@ -668,6 +673,11 @@
    1.16  - (BOOL)disableSyncForIdentity:(PEPIdentity * _Nonnull)identity
    1.17                           error:(NSError * _Nullable * _Nullable)error
    1.18  {
    1.19 +    if (!identity.isOwn) {
    1.20 +        [NSError setError:error fromPEPStatus:PEPStatusIllegalValue];
    1.21 +        return NO;
    1.22 +    }
    1.23 +
    1.24      pEp_identity *ident = PEP_identityToStruct(identity);
    1.25  
    1.26      PEPStatus status = (PEPStatus) disable_identity_for_sync(_session, ident);
    1.27 @@ -687,6 +697,11 @@
    1.28  {
    1.29      pEp_identity *ident = PEP_identityToStruct(identity);
    1.30  
    1.31 +    if (!identity.isOwn) {
    1.32 +        [NSError setError:error fromPEPStatus:PEPStatusIllegalValue];
    1.33 +        return nil;
    1.34 +    }
    1.35 +
    1.36      PEPStatus status = (PEPStatus) myself(_session, ident);
    1.37  
    1.38      if ([NSError setError:error fromPEPStatus:status]) {