5 // Created by Richard Murphy on 1/26/16.
9 #include "keychain_log.h"
12 * Copyright (c) 2003-2007,2009-2010,2013-2014 Apple Inc. All Rights Reserved.
14 * @APPLE_LICENSE_HEADER_START@
16 * This file contains Original Code and/or Modifications of Original Code
17 * as defined in and that are subject to the Apple Public Source License
18 * Version 2.0 (the 'License'). You may not use this file except in
19 * compliance with the License. Please obtain a copy of the License at
20 * http://www.opensource.apple.com/apsl/ and read it before using this
23 * The Original Code and all software distributed under the License are
24 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
25 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
26 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
27 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
28 * Please see the License for the specific language governing rights and
29 * limitations under the License.
31 * @APPLE_LICENSE_HEADER_END@
41 #include <sys/utsname.h>
45 #include <Security/SecItem.h>
47 #include <CoreFoundation/CoreFoundation.h>
48 #include <CoreFoundation/CFPriv.h>
50 #include <Security/SecureObjectSync/SOSCloudCircle.h>
51 #include <Security/SecureObjectSync/SOSCloudCircleInternal.h>
52 #include <Security/SecureObjectSync/SOSPeerInfo.h>
53 #include "keychain/SecureObjectSync/SOSPeerInfoPriv.h"
54 #include "keychain/SecureObjectSync/SOSPeerInfoV2.h"
55 #include "keychain/SecureObjectSync/SOSUserKeygen.h"
56 #include "keychain/SecureObjectSync/SOSKVSKeys.h"
57 #include "keychain/securityd/SOSCloudCircleServer.h"
58 #include <Security/SecOTRSession.h>
59 #include "keychain/SecureObjectSync/CKBridge/SOSCloudKeychainClient.h"
61 #include <utilities/SecCFWrappers.h>
62 #include <utilities/debugging.h>
64 #include "SecurityTool/sharedTool/readline.h"
67 #include "keychain_log.h"
68 #include "secToolFileIO.h"
69 #include "secViewDisplay.h"
70 #include "accountCirclesViewsPrint.h"
71 #include <utilities/debugging.h>
74 #include <Security/SecPasswordGenerate.h>
76 #define MAXKVSKEYTYPE kUnknownKey
77 #define DATE_LENGTH 18
79 static bool logmark(const char *optarg) {
80 if(!optarg) return false;
81 secnotice("mark", "%s", optarg);
86 // enable, disable, accept, reject, status, Reset, Clear
88 keychain_log(int argc, char * const *argv)
92 " -i info (current status)"
93 " -D [itemName] dump contents of KVS"
94 " -L list all known view and their status"
95 " -M string place a mark in the syslog - category \"mark\""
98 SOSLogSetOutputTo(NULL, NULL);
101 CFErrorRef error = NULL;
102 bool hadError = false;
104 while ((ch = getopt(argc, argv, "DiLM:")) != -1)
108 SOSCCDumpCircleInformation();
109 SOSCCDumpEngineInformation();
114 (void)SOSCCDumpCircleKVSInformation(optarg);
118 hadError = !listviewcmd(&error);
122 hadError = !logmark(optarg);
127 return SHOW_USAGE_MESSAGE;
131 printerr(CFSTR("Error: %@\n"), error);