| 1 | #!/usr/bin/perl -w
|
|---|
| 2 | ##
|
|---|
| 3 | ## Convert an LDIF file containing sambaAccount entries
|
|---|
| 4 | ## to the new sambaSamAccount objectclass
|
|---|
| 5 | ##
|
|---|
| 6 | ## Copyright Gerald (Jerry) Carter 2003
|
|---|
| 7 | ##
|
|---|
| 8 | ## Usage: convertSambaAccount --sid=<Domain SID> \
|
|---|
| 9 | ## --input=<input ldif> --output=<output ldif> \
|
|---|
| 10 | ## --changetype=[modify|add]
|
|---|
| 11 | ##
|
|---|
| 12 | ## You can generate an input ldif file using:
|
|---|
| 13 | ## $ ldapsearch -LL -x -h ldapsrv -D cn=root,dc=company,dc=com \
|
|---|
| 14 | ## -b dc=copmany,dc=com > /tmp/samba3.alpha23.ldif
|
|---|
| 15 | ##
|
|---|
| 16 | ## Note the "-LL" so no additional comments are generated
|
|---|
| 17 | ##
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 | use strict;
|
|---|
| 21 | use Net::LDAP::LDIF;
|
|---|
| 22 | use Getopt::Long;
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 | ##############################################################################
|
|---|
| 26 | ## local variables
|
|---|
| 27 |
|
|---|
| 28 | my ( $domain, $domsid, $changetype );
|
|---|
| 29 | my ( $ldif, $ldif2 );
|
|---|
| 30 | my ( $entry, @objclasses, $obj );
|
|---|
| 31 | my ( $is_samba_account, $is_samba_group );
|
|---|
| 32 | my ( %attr_map, %group_attr_map, $key );
|
|---|
| 33 | my ( @dels, $deletion, @adds, $addition );
|
|---|
| 34 | my ( $result, %options );
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 | ##############################################################################
|
|---|
| 38 | ## Print the option usage
|
|---|
| 39 |
|
|---|
|
|---|