Locations disappear after creating dialup set with MoreSCF
Locations disappear after creating dialup set with MoreSCF
- Subject: Locations disappear after creating dialup set with MoreSCF
- From: dreamflask <email@hidden>
- Date: Sat, 9 Aug 2003 13:43:48 -0400
Hi All,
I've written an application and a unix tool to create a dial up set
using MoreSCF 1.0b3 and the MoreAuthSample 1.0b2. After the tool runs,
when I go to the Network section in System Preferences, all of the
locations are missing from the popup menu. Any changes I make also
disappear if I quit System Preferences and launch it again. Restarting
doesn't solve the problem. If I delete the
/var/db/SystemConfiguration/preferences.xml file and restart then I can
use the Network section of the System Preferences again.
Here is the code that uses MoreSCF:
OSStatus CreateConfiguration( CFDictionaryRef request)
{
MoreSCModemDigest myModemDigest;
MoreSCPPPOptions myPPPOptions;
MoreSCPPPDigest myPPPDigest;
Boolean dirty;
OSStatus err;
CFStringRef newSetID, CurrentSetID = nil, deleteSetID = nil;
CFStringRef ISPName, temp, bsdName;
CFIndex portIndex;
dirty = false;
newSetID = nil;
// Get privileges.
MoreSecSetPrivilegedEUID();
// Connect to MoreSCF.
err = MoreSCOpen( true, true);
if( err == noErr )
{
// Check to see if our set is already present.
ISPName = (CFStringRef) CFDictionaryGetValue(request,
kPPP_ServiceProvider);
err = MoreSCFindSetByUserVisibleNameAndCopyID( ISPName, &newSetID);
// If our set is present then delete it.
if( newSetID != nil )
{
// If this is the current set, then we can't delete it
yet. Just rename it to DeleteMe.
err = MoreSCCopyCurrentSet( &CurrentSetID );
if( err == noErr && CurrentSetID != nil && CurrentSetID ==
newSetID )
{
err = MoreSCRenameSet( CurrentSetID, CFSTR( "DeleteMe" ) );
if( err == noErr ) newSetID = nil;
}
else
{
// This isn't the current set, we can just delete it.
err = MoreSCDeleteSet( newSetID );
if( err == noErr ) newSetID = nil;
}
}
if( newSetID == nil )
{
// Modem
myModemDigest.connectionScript = (CFStringRef)
CFDictionaryGetValue(request, kMODEM_ConnectionScript);
myModemDigest.dataCompressionErrorCorrection =
CFStringToBoolean( (CFStringRef) CFDictionaryGetValue(request,
kMODEM_DataCompressionErrorCorrection) );
myModemDigest.speaker = CFStringToBoolean( (CFStringRef)
CFDictionaryGetValue(request, kMODEM_Speaker) );
myModemDigest.pulseDial = CFStringToBoolean( (CFStringRef)
CFDictionaryGetValue(request, kMODEM_PulseDial) );
myModemDigest.waitForDialTone = CFStringToBoolean(
(CFStringRef) CFDictionaryGetValue(request, kMODEM_WaitForDialTone) );
// PPP
myPPPOptions.dialOnDemand = true;
myPPPOptions.idleReminder = false;
myPPPOptions.idleReminderTimer = 1800;
myPPPOptions.disconnectOnIdle = false;
myPPPOptions.disconnectOnIdleTimer = 900;
myPPPOptions.disconnectOnLogout = true;
myPPPOptions.commRedialEnabled = true;
myPPPOptions.commRedialCount = 3;
myPPPOptions.commRedialInterval = 30;
myPPPOptions.lcpEchoEnabled = true;
myPPPOptions.ipcpCompressionVJ = true;
myPPPOptions.commDisplayTerminalWindow = false;
myPPPOptions.verboseLogging = false;
BlockZero( &myPPPDigest, sizeof(myPPPDigest) );
myPPPDigest.active = true;
myPPPDigest.userDefinedName = (CFStringRef)
CFDictionaryGetValue(request, kPPP_ServiceProvider);
myPPPDigest.authName = (CFStringRef)
CFDictionaryGetValue(request, kPPP_UserName);
myPPPDigest.authPassword = (CFStringRef)
CFDictionaryGetValue(request, kPPP_Password);
myPPPDigest.commRemoteAddress = (CFStringRef)
CFDictionaryGetValue(request, kPPP_TelephoneNumber);
myPPPDigest.commAlternateRemoteAddress =(CFStringRef)
CFDictionaryGetValue(request, kPPP_AlternateNumber);
myPPPDigest.options = &myPPPOptions;
// Get the bsd name of the modem port that was selected.
temp = (CFStringRef) CFDictionaryGetValue(request, kMODEM_Port);
portIndex = (CFIndex) CFStringGetIntValue( temp );
err = CopyBSDNameOfModemPort( portIndex, &bsdName);
if( err == noErr ) err = MoreSCMakeNewDialupSet( bsdName, ISPName,
&myModemDigest, &myPPPDigest, nil, nil, &newSetID);
else err = MoreSCMakeNewDialupSet( nil, ISPName,
&myModemDigest, &myPPPDigest, nil, nil, &newSetID);
dirty = true;
// Make our set active.
err = MoreSCSetCurrentSet( newSetID );
// Check to see if there is a set called "DeleteMe". If
there is then delete it.
err = MoreSCFindSetByUserVisibleNameAndCopyID( CFSTR(
"DeleteMe" ), &deleteSetID);
if( err == noErr && deleteSetID != nil ) err =
MoreSCDeleteSet( deleteSetID );
}
else fprintf(stderr, "Set name already exists. Error %d.\n",
err);
}
else fprintf(stderr, "MoreSCOpen() returned error %d.\n", err);
// Close MoreSCF.
MoreSCClose(&err, dirty);
return true;
}
I'm guessing that something I am doing is preventing System Preferences
from accessing the data but I don't know what.
I'm running MacOS 10.2.6 on a Power Mac G4 400Mhz.
Does anyone have any idea what I'm doing wrong?
Thanks,
David
--
David Garcea
Software Development Engineer
Fine Point Technologies, Inc.
90 John Street, Suite 704
New York, NY 10038
email: email@hidden
telephone: +1 (212) 962-7410
fax: +1 (212) 962-7404
web:
http://www.finepoint.com
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.