Sorry this is the complete patch -- ---------------------------------- ALEJANDRO SOLER e-mail: asoler@martinaditrento.com Administrador de Sistemas Martina di Trento S.A. Buenos Aires - Argentina Tel.:(5411) 4611-2730 WEB: http://www.martinaditrento.com ----------------------------------- -------------- next part -------------- --- samba/smbldap-tools/smbldap_tools.pm 2002-06-01 06:30:48.000000000 +0200 +++ smbldap_tools.pm 2003-05-23 13:43:53.000000000 +0200 @@ -31,6 +31,16 @@ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); use Exporter; $VERSION = 1.00; + + +# Put your own SID, this section may be in smbldap_conf.pm +# to obtain this number do: # net getlocalsid +my ( $SID ); +$SID = 'replace with your SID number'; + + + + @ISA = qw(Exporter); @EXPORT = qw( @@ -116,7 +126,7 @@ sub is_samba_user { my $user = shift; - my $cmd = "$ldapsearch -b '$suffix' -s '$scope' '(&(objectClass=sambaAccount)(uid=$user))' | grep '^dn:\'"; + my $cmd = "$ldapsearch -b '$suffix' -s '$scope' '(&(objectClass=sambaSamAccount)(uid=$user))' | grep '^dn:\'"; my $res=`$cmd`; chomp $res; if ($res ne '') { @@ -186,7 +196,7 @@ sub add_samba_machine_mkntpwd { my ($user, $uid) = @_; - my $rid = 2 * $uid + 1000; # Samba 2.2.2 stuff + my $sambaSID = 2 * $uid + 1000; # Samba 2.2.2 stuff my $name = $user; $name =~ s/.$//s; @@ -205,18 +215,18 @@ changetype: modify objectclass: top objectclass: posixAccount -objectClass: sambaAccount -pwdLastSet: 0 -logonTime: 0 -logoffTime: 2147483647 -kickoffTime: 2147483647 -pwdCanChange: 0 -pwdMustChange: 2147483647 -acctFlags: [W ] -lmpassword: $lmpassword -ntpassword: $ntpassword -rid: $rid -primaryGroupID: 0 +objectClass: sambaSamAccount +sambaPwdLastSet: 0 +sambaLogonTime: 0 +sambaLogoffTime: 2147483647 +sambakickoffTime: 2147483647 +sambaPwdCanChange: 0 +sambaPwdMustChange: 2147483647 +sambaacctFlags: [W ] +sambaLMPassword: $lmpassword +sambaNTpassword: $ntpassword +sambaSID: $SID-$sambaSID +sambaPrimaryGroupSID: $SID-0 "; @@ -516,8 +526,8 @@ sub file_write { my ($filename, $filecontent) = @_; local *FILE; - open (FILE, "> $filename") || - die "Cannot open ?$filename? for writing: $!\n"; + open (FILE, ">".$filename) || + die "Cannot open $filename for writing: $!\n"; print FILE $filecontent; close FILE; }