From: Andrew M. <fit...@us...> - 2006-04-26 14:03:25
|
Update of /cvsroot/radmind/radmind-assistant/rte In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13785 Modified Files: sessionrights.c Log Message: Editing in Xcode messes up formatting. Index: sessionrights.c =================================================================== RCS file: /cvsroot/radmind/radmind-assistant/rte/sessionrights.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sessionrights.c 25 Apr 2006 18:12:35 -0000 1.1 --- sessionrights.c 26 Apr 2006 14:02:52 -0000 1.2 *************** *** 12,23 **** #define AUTH_ADMIN CFSTR( kAuthorizationRuleAuthenticateAsAdmin ) ! #define AUTH_ADMINGROUP CFSTR( "admin" ) #define AUTH_RULE CFSTR( "rule" ) ! #define AUTH_TIMEOUT CFSTR( "timeout" ) #define AUTH_CLASS CFSTR( "class" ) #define AUTH_USER CFSTR( "user" ) #define AUTH_GROUP CFSTR( "group" ) ! #define AUTH_COMMENT CFSTR( "comment" ) ! #define AUTH_ALLOW_ROOT CFSTR( "allow-root" ) #define AUTH_SHARED CFSTR( "shared" ) #define RMCOMMENT CFSTR( "Rights for working with Radmind" ) --- 12,23 ---- #define AUTH_ADMIN CFSTR( kAuthorizationRuleAuthenticateAsAdmin ) ! #define AUTH_ADMINGROUP CFSTR( "admin" ) #define AUTH_RULE CFSTR( "rule" ) ! #define AUTH_TIMEOUT CFSTR( "timeout" ) #define AUTH_CLASS CFSTR( "class" ) #define AUTH_USER CFSTR( "user" ) #define AUTH_GROUP CFSTR( "group" ) ! #define AUTH_COMMENT CFSTR( "comment" ) ! #define AUTH_ALLOW_ROOT CFSTR( "allow-root" ) #define AUTH_SHARED CFSTR( "shared" ) #define RMCOMMENT CFSTR( "Rights for working with Radmind" ) *************** *** 28,36 **** getauthref( AuthorizationRef *ref ) { ! OSStatus err; AuthorizationItem right = { "edu.umich.radmind.generic", 0, NULL, 0 }; AuthorizationRights rights = { 1, &right }; AuthorizationFlags flags = ( kAuthorizationFlagInteractionAllowed | ! kAuthorizationFlagExtendRights ); if ( *ref != NULL ) { --- 28,36 ---- getauthref( AuthorizationRef *ref ) { ! OSStatus err; AuthorizationItem right = { "edu.umich.radmind.generic", 0, NULL, 0 }; AuthorizationRights rights = { 1, &right }; AuthorizationFlags flags = ( kAuthorizationFlagInteractionAllowed | ! kAuthorizationFlagExtendRights ); if ( *ref != NULL ) { *************** *** 39,50 **** if (( err = AuthorizationCreate( NULL, NULL, kAuthorizationFlagDefaults, ! &( *ref ))) != errAuthorizationSuccess ) { ! CFShow( CFSTR( "AuthorizationCreate failed" )); ! return( 0 ); } if (( err = AuthorizationCopyRights( *ref, &rights, NULL, flags, NULL )) ! != errAuthorizationSuccess ) { ! CFShow( CFSTR( "AuthorizationCopyRights failed" )); ! return( 0 ); } --- 39,50 ---- if (( err = AuthorizationCreate( NULL, NULL, kAuthorizationFlagDefaults, ! &( *ref ))) != errAuthorizationSuccess ) { ! CFShow( CFSTR( "AuthorizationCreate failed" )); ! return( 0 ); } if (( err = AuthorizationCopyRights( *ref, &rights, NULL, flags, NULL )) ! != errAuthorizationSuccess ) { ! CFShow( CFSTR( "AuthorizationCopyRights failed" )); ! return( 0 ); } *************** *** 59,65 **** if (( err = AuthorizationRightGet( rightname, &d )) ! != errAuthorizationSuccess && err != errAuthorizationDenied ) { ! CFShow( CFSTR( "AuthorizationRightGet failed" )); ! return( 0 ); } --- 59,65 ---- if (( err = AuthorizationRightGet( rightname, &d )) ! != errAuthorizationSuccess && err != errAuthorizationDenied ) { ! CFShow( CFSTR( "AuthorizationRightGet failed" )); ! return( 0 ); } *************** *** 79,112 **** setright( const char *rightname, int timeout ) { ! int rc = 1; OSStatus err; CFBooleanRef allowroot = kCFBooleanTrue; CFBooleanRef shared = kCFBooleanTrue; CFBundleRef bundle; ! CFIndex retaincount; CFNumberRef num = CFNumberCreate( kCFAllocatorDefault, ! kCFNumberIntType, &timeout ); ! CFStringRef keys[ 6 ] = { AUTH_TIMEOUT, AUTH_CLASS, AUTH_GROUP, ! AUTH_COMMENT, AUTH_ALLOW_ROOT, ! AUTH_SHARED }; CFTypeRef values[ 6 ] = { num, AUTH_USER, AUTH_ADMINGROUP, ! RMCOMMENT, allowroot, ! shared }; CFDictionaryRef dict; AuthorizationRef authref = NULL; if ( getauthref( &authref ) == 0 ) { ! CFRelease( num ); ! return( 0 ); } dict = CFDictionaryCreate( kCFAllocatorDefault, ( void * )keys, ! ( void * )values, 6, &kCFCopyStringDictionaryKeyCallBacks, ! &kCFTypeDictionaryValueCallBacks ); if ( dict == NULL ) { ! CFShow( CFSTR( "CFDictionaryCreate failed" )); ! AuthorizationFree( authref, kAuthorizationFlagDefaults ); ! CFRelease( num ); ! return( 0 ); } --- 79,110 ---- setright( const char *rightname, int timeout ) { ! int rc = 1; OSStatus err; CFBooleanRef allowroot = kCFBooleanTrue; CFBooleanRef shared = kCFBooleanTrue; CFBundleRef bundle; ! CFIndex retaincount; CFNumberRef num = CFNumberCreate( kCFAllocatorDefault, ! kCFNumberIntType, &timeout ); ! CFStringRef keys[ 6 ] = { AUTH_TIMEOUT, AUTH_CLASS, AUTH_GROUP, ! AUTH_COMMENT, AUTH_ALLOW_ROOT, AUTH_SHARED }; CFTypeRef values[ 6 ] = { num, AUTH_USER, AUTH_ADMINGROUP, ! RMCOMMENT, allowroot, shared }; CFDictionaryRef dict; AuthorizationRef authref = NULL; if ( getauthref( &authref ) == 0 ) { ! CFRelease( num ); ! return( 0 ); } dict = CFDictionaryCreate( kCFAllocatorDefault, ( void * )keys, ! ( void * )values, 6, &kCFCopyStringDictionaryKeyCallBacks, ! &kCFTypeDictionaryValueCallBacks ); if ( dict == NULL ) { ! CFShow( CFSTR( "CFDictionaryCreate failed" )); ! AuthorizationFree( authref, kAuthorizationFlagDefaults ); ! CFRelease( num ); ! return( 0 ); } *************** *** 119,124 **** NULL, bundle, NULL )) != errAuthorizationSuccess ) { ! CFShow( CFSTR( "AuthorizationRightSet failed" )); ! rc = 0; } --- 117,122 ---- NULL, bundle, NULL )) != errAuthorizationSuccess ) { ! CFShow( CFSTR( "AuthorizationRightSet failed" )); ! rc = 0; } *************** *** 129,135 **** /* workaround */ if ( CFGetRetainCount( bundle ) == retaincount ) { ! CFShow( CFSTR( "Working around rdar://problems/3446163" )); } else { ! CFRelease( bundle ); } --- 127,133 ---- /* workaround */ if ( CFGetRetainCount( bundle ) == retaincount ) { ! CFShow( CFSTR( "Working around rdar://problems/3446163" )); } else { ! CFRelease( bundle ); } |