slaptool [-hlaspcPef] -r object_name_file | -o "object" [file ...]
The following table describes the command options.
The following Perl application definition, created for the example organization discussed previously, assumes that usernames and passwords are stored in a text file named listofnames.txt. There is one space between each username and password pair per line.
A XML file, such as the XML File Example is required to run this application definition, containing the data for import. Where the data is customized on a per user name basis, the string to be substituted is replaced with *usernamegoeshere*.
For example:
******************************************************
open FILE,"listofnames.txt";
foreach (<FILE>) {
chomp; # Clean string
@lines = split(/\n/); # Split up string
for each $l (@lines) {
@fields = split(/\s/);
$name = $fields[0];
$pass = $fields[1];
open DATAFILE,"source.xml";
open OUTFILE,">data.xml";
foreach (<DATAFILE>) { # Write up a file specific to this user
s/\*usernamegoeshere\*/$name/;
s/\*passwordgoeshere\*/$pass/;
# Any other variable substitution can be done here too...
print OUTFILE "$_";
}
close DATAFILE;
close OUTFILE;
system "slaptool.exe -k \"$pass\" -o
\"CN=$name.O=myorg.T=OURCOMPANY\" data.xml";
}
}
close FILE;
unlink 'data.xml';
****************************************************
Using an XML file called source.xml, run the application definition with the data that is to be imported. For example, you can manually export data from a single user setup with the value for the username replaced with the string "*usernamegoeshere*".
NOTE:The example application definition does not include error handling.
<?xml version="1.0"?>
<SecureLogin>
<passphrasequestions>
<question>Please enter a passphrase for SLAP testing.</question>
</passphrasequestions>
<passphrase>
<activequestion>Please enter a passphrase for SLAP
testing.</activequestion>
<answer>passphrase</answer>
</passphrase>
<logins>
<login>
<name>fnord</name>
<symbol>
<name>username</name>
<value>bob</value>
</symbol>
<symbol>
<name>Password</name>
<value>test</value>
</symbol>
</login>
<login>
<name>notepad.exe</name>
<symbol>
<name>username</name>
<value>asdf</value>
</symbol>
<symbol>
<name>Password</name>
<value>test</value>
</symbol>
</login>
<login>
<name>testlogin</name>
<symbol>
<name>username</name>
<value>Novell</value>
</symbol>
<symbol>
<name>Password</name>
<value>test</value>
</symbol>
</login>
</logins>
</SecureLogin>