Ignore:
Timestamp:
Dec 21, 2013, 10:16:52 PM (5 years ago)
Author:
landonf@…
Message:

Remove now-unused background execution mode.

Location:
trunk/dports/security/certsync
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/security/certsync/Portfile

    r115007 r115008  
    55name                    certsync
    66version                 1.0.6
     7revision                1
    78categories              security
    89conflicts               curl-ca-bundle
  • trunk/dports/security/certsync/files/certsync.m

    r111188 r115008  
    308308    fprintf(stderr, "Usage: %s [-u] [-o <output file>]\n", progname);
    309309    fprintf(stderr, "\t-u\t\t\tInclude the current user's anchor certificates.\n");
    310     fprintf(stderr, "\t-s\t\t\tDo not exit; observe the system keychain(s) for changes and update the output file accordingly.");
    311310    fprintf(stderr, "\t-o <output file>\tWrite the PEM certificates to the target file, rather than stdout\n");
    312 }
    313 
    314 static void certsync_keychain_cb (ConstFSEventStreamRef streamRef, void *clientCallBackInfo, size_t numEvents, void *eventPaths, const FSEventStreamEventFlags eventFlags[], const FSEventStreamEventId eventIds[])
    315 {
    316     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    317 
    318     MPCertSyncConfig *config = (MPCertSyncConfig *) clientCallBackInfo;
    319 
    320     int ret;
    321     if ((ret = exportCertificates(config->userAnchors, config->outputFile)) != EXIT_SUCCESS)
    322         exit(ret);
    323 
    324     [pool release];
    325311}
    326312
     
    330316    /* Parse the command line arguments */
    331317    BOOL userAnchors = NO;
    332     BOOL runServer = NO;
    333318    NSString *outputFile = nil;
    334319   
     
    340325                break;
    341326               
    342             case 's':
    343                 runServer = YES;
    344                 break;
    345                
    346327            case 'o':
    347328                outputFile = [NSString stringWithUTF8String: optarg];
     
    360341    argv += optind;
    361342   
    362     /* Perform single-shot export  */
    363     if (!runServer)
    364         return exportCertificates(userAnchors, outputFile);
    365    
    366     /* Formulate the list of directories to observe; We use FSEvents rather than SecKeychainAddCallback(), as during testing the keychain
    367      * API never actually fired a callback for the target keychains. */
    368     FSEventStreamRef eventStream;
    369     {
    370         NSAutoreleasePool *streamPool = [[NSAutoreleasePool alloc] init];
    371 
    372         NSSearchPathDomainMask searchPathDomains = NSLocalDomainMask|NSSystemDomainMask;
    373         if (userAnchors)
    374             searchPathDomains |= NSUserDomainMask;
    375 
    376         NSArray *libraryDirectories = NSSearchPathForDirectoriesInDomains(NSAllLibrariesDirectory, searchPathDomains, YES);
    377         NSMutableArray *keychainDirectories = [NSMutableArray arrayWithCapacity: [libraryDirectories count]];
    378         for (NSString *dir in libraryDirectories) {
    379             [keychainDirectories addObject: [dir stringByAppendingPathComponent: @"Keychains"]];
    380             [keychainDirectories addObject: [dir stringByAppendingPathComponent: @"Security/Trust Settings"]];
    381         }
    382 
    383         /* Configure the listener */
    384         MPCertSyncConfig *config = [[[MPCertSyncConfig alloc] init] autorelease];
    385         config->userAnchors = userAnchors;
    386         config->outputFile = [outputFile retain];
    387 
    388         FSEventStreamContext ctx = {
    389             .version = 0,
    390             .info = config,
    391             .retain = CFRetain,
    392             .release = CFRelease,
    393             .copyDescription = CFCopyDescription
    394         };
    395         eventStream = FSEventStreamCreate(NULL, certsync_keychain_cb, &ctx, (CFArrayRef)keychainDirectories, kFSEventStreamEventIdSinceNow, 0.0, kFSEventStreamCreateFlagUseCFTypes);
    396         FSEventStreamScheduleWithRunLoop(eventStream, CFRunLoopGetCurrent(), kCFRunLoopCommonModes);
    397         FSEventStreamStart(eventStream);
    398        
    399         [streamPool release];
    400     }
    401 
    402     /* Perform an initial one-shot export, and then run forever */
    403     {
    404     NSAutoreleasePool *shotPool = [[NSAutoreleasePool alloc] init];
    405         int ret;
    406         if ((ret = exportCertificates(userAnchors, outputFile)) != EXIT_SUCCESS)
    407             return EXIT_FAILURE;
    408         [shotPool release];
    409     }
    410 
    411     CFRunLoopRun();
    412     FSEventStreamRelease(eventStream);
     343    /* Perform export  */
     344    int result = exportCertificates(userAnchors, outputFile);
     345
    413346    [pool release];
    414 
    415     return EXIT_SUCCESS;
    416 }
    417 
     347    return result;
     348}
     349
Note: See TracChangeset for help on using the changeset viewer.