summaryrefslogtreecommitdiff
path: root/examples/LDAP/smbldap-tools/smbldap-migrate-accounts.pl
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-12-04 21:59:20 +0000
committerGerald Carter <jerry@samba.org>2003-12-04 21:59:20 +0000
commitdc058d980b369578b56c53972e8033fc77ee0b48 (patch)
treee7567c0106c01d92f908954578cc914a5455df92 /examples/LDAP/smbldap-tools/smbldap-migrate-accounts.pl
parentb47a3a920a9a03ecc3e71d6594384cae674b6775 (diff)
downloadsamba-dc058d980b369578b56c53972e8033fc77ee0b48.tar.gz
samba-dc058d980b369578b56c53972e8033fc77ee0b48.tar.bz2
samba-dc058d980b369578b56c53972e8033fc77ee0b48.zip
updating top 0.8.2-1 of the smbldap tools
(This used to be commit b798f30f0a83ba00ebbe1b82983ca6690642ad02)
Diffstat (limited to 'examples/LDAP/smbldap-tools/smbldap-migrate-accounts.pl')
-rwxr-xr-xexamples/LDAP/smbldap-tools/smbldap-migrate-accounts.pl44
1 files changed, 23 insertions, 21 deletions
diff --git a/examples/LDAP/smbldap-tools/smbldap-migrate-accounts.pl b/examples/LDAP/smbldap-tools/smbldap-migrate-accounts.pl
index 86f52cb53e..05f9b27600 100755
--- a/examples/LDAP/smbldap-tools/smbldap-migrate-accounts.pl
+++ b/examples/LDAP/smbldap-tools/smbldap-migrate-accounts.pl
@@ -1,5 +1,7 @@
#!/usr/bin/perl -w
+# $Id: smbldap-migrate-accounts.pl,v 1.1.6.4 2003/12/04 21:59:19 jerry Exp $
+#
# This code was developped by IDEALX (http://IDEALX.org/) and
# contributors (their names can be found in the CONTRIBUTORS file).
#
@@ -39,8 +41,8 @@ use smbldap_conf;
# Errors, debug and stats are output to stderr.
sub modify_account
-{
- my ($login, $basedn, $lmpwd, $ntpwd, $gecos, $homedir) = @_;
+ {
+ my ($login, $basedn, $lmpwd, $ntpwd, $gecos, $homedir) = @_;
# bind to a directory with dn and password
my $ldap_master=connect_ldap_master();
my $modify = $ldap_master->modify ("uid=$login,$basedn",
@@ -54,7 +56,7 @@ sub modify_account
$modify->code && die "failed to modify entry: ", $modify->error ;
# take down the session
$ldap_master->unbind;
-}
+ }
#####################
@@ -64,15 +66,15 @@ my %Options;
my $ok = getopts('awA:CUW:?h', \%Options);
if ( (!$ok) || ($Options{'?'}) || ($Options{'h'}) ) {
- print "Usage: $0 [-awAWCU?]\n";
- print " -a process only people, ignore computers\n";
- print " -w process only computers, ignore persons\n";
- print " -A <opts> option string passed verbatim to smbldap-useradd for persons\n";
- print " -W <opts> option string passed verbatim to smbldap-useradd for computers\n";
- print " -C if entry not found, don't create it and log it to stdout (default: create it)\n";
- print " -U if entry found, don't update it and log it to stdout (default: update it)\n";
+ print "Usage: $0 [-awAWCU?]\n";
+ print " -a process only people, ignore computers\n";
+ print " -w process only computers, ignore persons\n";
+ print " -A <opts> option string passed verbatim to smbldap-useradd for persons\n";
+ print " -W <opts> option string passed verbatim to smbldap-useradd for computers\n";
+ print " -C if entry not found, don't create it and log it to stdout (default: create it)\n";
+ print " -U if entry found, don't update it and log it to stdout (default: update it)\n";
print " -?|-h show this help message\n";
- exit (1);
+ exit (1);
}
my %processed = ( 'user' => 0, 'machine' => 0);
@@ -90,7 +92,7 @@ while (<>) {
my $entry_type = 'user';
- if ($login =~ m/.*\$$/ ) { # computer
+ if ($login =~ m/.*\$$/ ) { # computer
$processed{'machine'}++;
$entry_type = 'machine';
if (defined($Options{'a'})) {
@@ -117,14 +119,14 @@ while (<>) {
}
# normalize homedir
-# uncomment to replace configured share with share from pwdump
-# if ($homedir eq "") {
- $homedir = $_userSmbHome;
-# }
+ # uncomment to replace configured share with share from pwdump
+ # if ($homedir eq "") {
+ $homedir = $_userSmbHome;
+ # }
# normalize gecos
if (!($gecos eq "")) {
- $gecos =~ tr/ÁÀÂÄáàâäÇçÉÈÊËÆéèêëæÍÌÏÎíìîÏÑñÓÒÔÖóòôöÚÙÜÛúùüûÝýÿ/AAAAaaaaCcEEEEEeeeeeIIIIiiiiNnOOOOooooUUUUuuuuYyy/;
+ $gecos =~ tr//AAAAaaaaCcEEEEEeeeeeIIIIiiiiNnOOOOooooUUUUuuuuYyy/;
} else {
$gecos = $_userGecos;
}
@@ -141,12 +143,12 @@ while (<>) {
print STDERR "error adding $login, skipping\n";
next;
}
- # lem modif... a retirer si pb
+ # lem modif... a retirer si pb
if ($entry_type eq "user") {
modify_account($login, $userbasedn, $lmpwd, $ntpwd, $gecos, $homedir);
- }
+ }
- $created{$entry_type}++;
+ $created{$entry_type}++;
} else { # uid doesn't exist and no create => log
print "$_";
$logged{$entry_type}++;
@@ -187,7 +189,7 @@ print STDERR "special users skipped: $specialskipped\n";
=head1 NAME
- smbldap-migrate.pl - Migrate NT accounts to LDAP
+smbldap-migrate.pl - Migrate NT accounts to LDAP
=head1 SYNOPSIS