Need help scripting user import

skinlayers

Registered
Hello,

I was wondering if someone could help me build a script to import the Client Control Database (CCD) from MacAdministrator 3.0 into Mac OS X Server 10.3. The CCD is stored in directories of XML files. Each XML file is named after the user's login name. This is an example of one of the XML files. We'll say the file is named 'user1':
Code:
<LoginEnabled>1</LoginEnabled>
<PrintCredits>0</PrintCredits>
<MacAdminPasswordOn>1</MacAdminPasswordOn>
<MacAdminPassword>password</MacAdminPassword>
<LoginList></LoginList>

Some files have addition entries like LastPasswordChange. Notice the password is stored in the XML file as plain text. Also, notice that the username is not contained in the XML, only the file name. Mac OS X Server 10.3 can import users in from an XML file, but the format is different than MacAdministrator. Example:
Code:
0x0A 0x5C 0x3A 0x2C dsRecTypeStandard:Users 3
dsAttrTypeStandard:RecordName dsAttrTypeStandard:Password
dsAttrTypeStandard:RealName
user1:password:user1

The one time record description at the top is not a problem. I can add that manually. The important part is the user1:password:user1. That's the actual user entry.
If you want to read more on the file format, and what the hex numbers at the top are for, look at this PDF.
So basically, I need a script to build an XML file by taking the password out of the MacAdministrator XML files, and putting the file's name on either side of the password seperated by ':'. I can then throw the example Record Descriptor in my second example, and import them all into Mac OS X Server 10.3.

Any Questions?
Thanks!
skinlayers
 
Back
Top