]> git.saurik.com Git - apple/security.git/blob - keychain/SecureObjectSync/SOSAccountRingUpdate.m
Security-59306.11.20.tar.gz
[apple/security.git] / keychain / SecureObjectSync / SOSAccountRingUpdate.m
1 //
2 // SOSAccountRingUpdate.c
3 // sec
4 //
5 //
6
7 #include <stdio.h>
8
9 #include "SOSAccountPriv.h"
10 #include "keychain/SecureObjectSync/SOSTransportCircleKVS.h"
11 #include "keychain/SecureObjectSync/SOSTransport.h"
12 #include <Security/SecureObjectSync/SOSViews.h>
13 #include "keychain/SecureObjectSync/SOSRing.h"
14 #include "keychain/SecureObjectSync/SOSRingUtils.h"
15 #include "keychain/SecureObjectSync/SOSPeerInfoCollections.h"
16 #import "keychain/SecureObjectSync/SOSAccountTrust.h"
17
18 bool SOSAccountIsPeerRetired(SOSAccount* account, CFSetRef peers){
19 CFMutableArrayRef peerInfos = CFArrayCreateMutableForCFTypes(kCFAllocatorDefault);
20 bool result = false;
21
22 CFSetForEach(peers, ^(const void *value) {
23 SOSPeerInfoRef peer = (SOSPeerInfoRef)value;
24 if(SOSPeerInfoIsRetirementTicket(peer))
25 CFArrayAppendValue(peerInfos, peer);
26 });
27 if(CFArrayGetCount(peerInfos) > 0){
28 if(!SOSAccountRemoveBackupPeers(account, peerInfos, NULL))
29 secerror("Could not remove peers: %@, from the backup", peerInfos);
30 else
31 return true;
32 }
33 else
34 result = true;
35
36 CFReleaseNull(peerInfos);
37
38 return result;
39 }