ALT Linux Bugzilla
– Attachment 1606 Details for
Bug 9913
Патч для раздельного экспорта пользователей и машин
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
Выборочная обработка пользователей и компьютеров
separate-users-and-groups.patch (text/plain), 3.27 KB, created by
Slava Dubrovskiy
on 2006-08-23 19:15:31 MSD
(
hide
)
Description:
Выборочная обработка пользователей и компьютеров
Filename:
MIME Type:
Creator:
Slava Dubrovskiy
Created:
2006-08-23 19:15:31 MSD
Size:
3.27 KB
patch
obsolete
>--- smbldap-migrate-unix-accounts.org 2006-01-03 12:57:41 +0200 >+++ smbldap-migrate-unix-accounts 2006-08-23 18:02:32 +0300 >@@ -24,7 +24,7 @@ sub read_shadow_file; > > my %Options; > >-my $ok = getopts('M:P:S:vn?hd:a', \%Options); >+my $ok = getopts('M:P:S:vn?hd:auw', \%Options); > > if ( (!$ok) || ($Options{'?'}) || ($Options{'h'}) || (!keys(%Options)) ) { > print "Usage: $0 [-PSMvn?hda]\n"; >@@ -36,6 +36,9 @@ if ( (!$ok) || ($Options{'?'}) || ($Opti > print " -n do everything execpt updating LDAP\n"; > print " -d obj_nam delete and add (not just update) existing entry in LDAP\n"; > print " -a adds sambaSamAccount objectClass\n"; >+ print " -u process only people, ignore computers\n"; >+ print " -w process only computers, ignore persons\n"; >+ > exit (1); > } > >@@ -60,6 +63,7 @@ if ( $Options{'M'} ) { > } > > my $ldap_master=connect_ldap_master(); >+my $typeuser = undef; > > while ( my $line=<$INFILE> ) { > chop($line); >@@ -67,6 +71,8 @@ while ( my $line=<$INFILE> ) { > next if ( $line =~ /^#/ ); > next if ( $line =~ /^\+/ ); > my $entry = undef; >+ my $login = undef; >+ > if ($Options{'M'}) { > my($user,$pwd,$uid,$gid,$class,$change,$expire,$gecos,$homedir,$shell) = split(/:/,$line); > # if user is not in LDAP new entry will be created >@@ -82,6 +88,7 @@ while ( my $line=<$INFILE> ) { > # if user is not in LDAP new entry will be created > $entry = get_user_entry($ldap_master,$user); > $entry = migrate_user($entry,$user,$pwd,$uid,$gid,$gecos,$homedir,$shell,undef); >+ $login = $user; > > # should I delete next functionality > # add shadow entries if also -S defined >@@ -94,6 +101,21 @@ while ( my $line=<$INFILE> ) { > # if user is not in LDAP new entry will be created > $entry = get_user_entry($ldap_master,$user); > $entry = migrate_shadow_user($entry,$user,$pwd,$lastchg,$min,$max,$warn,$inactive,$expire,$flag); >+ $login = $user; >+ } >+ >+ if ($login =~ m/.*\$$/ ) { # computer >+ $typeuser = "usersdn"; >+ if (defined($Options{'u'})) { >+ print "ignoring $login type: $typeuser\n"; >+ next; >+ } >+ } else { # people >+ $typeuser = "computersdn"; >+ if (defined($Options{'w'})) { >+ print "ignoring $login type: $typeuser\n"; >+ next; >+ } > } > > if ($entry) { >@@ -116,7 +138,7 @@ while ( my $line=<$INFILE> ) { > my $userRid = 2 * $userUidNumber + 1000; > # let's test if this SID already exist > my $user_sid = "$config{SID}-$userRid"; >- my $test_exist_sid = does_sid_exist($user_sid,$config{usersdn}); >+ my $test_exist_sid = does_sid_exist($user_sid,$config{$typeuser}); > if ($test_exist_sid->count == 1) { > print "User SID already owned by\n"; > # there should not exist more than one entry, but ... >@@ -230,14 +252,14 @@ sub get_user_entry > my($ldap_master,$user) = @_; > > # do not use read_user_entry() >- my $mesg = $ldap_master->search( base => $config{usersdn}, >+ my $mesg = $ldap_master->search( base => $config{$typeuser}, > scope => 'one', > filter => "(uid=$user)" > ); > my $entry; > if ( $mesg->count() != 1 ) { > $entry = Net::LDAP::Entry->new(); >- $entry->dn("uid=$user,$config{usersdn}"); >+ $entry->dn("uid=$user,$config{$typeuser}"); > } else { > $entry = $mesg->entry(0); # ???? > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 9913
: 1606