diff -up e-smith-samba-2.2.0/root/etc/e-smith/events/actions/update-domain-group-maps.ldap-auth e-smith-samba-2.2.0/root/etc/e-smith/events/actions/update-domain-group-maps --- e-smith-samba-2.2.0/root/etc/e-smith/events/actions/update-domain-group-maps.ldap-auth 2010-11-01 12:00:21.000000000 -0600 +++ e-smith-samba-2.2.0/root/etc/e-smith/events/actions/update-domain-group-maps 2010-11-01 12:03:56.000000000 -0600 @@ -5,12 +5,25 @@ package esmith; use strict; use Errno; use esmith::AccountsDB; +use esmith::ConfigDB; +use esmith::util; # events: console-save, bootstrap-console-save, group-modify-samba, group-create # post-install, post-upgrade, workgroup-update my $debug = "--debuglevel=1"; my $a = esmith::AccountsDB->open_ro or die "Couldn't open accounts db\n"; +my $c = esmith::ConfigDB->open_ro or die "Could not open Config DB"; + +my $ldapauth = $c->get('ldap')->prop('Authentication') || 'disabled'; +my $pw = esmith::util::LdapPassword(); + +if ($ldapauth eq 'enabled') +{ + # Add the LDAP admin password in secret.tdb + warn "Couldn't add LDAP password in secret.tdb\n" unless + system("/usr/bin/smbpasswd", "-w", "$pw") == 0; +} my $g = `/usr/bin/net getlocalsid`; unless ($g =~ /SID.*is: (.+)/) { @@ -20,6 +33,12 @@ unless ($g =~ /SID.*is: (.+)/) { rename '/var/cache/samba/wins.dat','/var/cache/samba/wins.'.time; $g = `/usr/bin/net getlocalsid`; $g =~ /SID.*is: (.+)/ or die "Could not get current sid\n"; + if ($ldapauth eq 'enabled') + { + # Add the LDAP admin password in secret.tdb + warn "Couldn't add LDAP password in secret.tdb\n" unless + system("/usr/bin/smbpasswd", "-w", "$pw") == 0; + } } my $local_sid = $1; diff -up e-smith-samba-2.2.0/root/etc/e-smith/templates/etc/smb.conf/11passdbBackend.ldap-auth e-smith-samba-2.2.0/root/etc/e-smith/templates/etc/smb.conf/11passdbBackend --- e-smith-samba-2.2.0/root/etc/e-smith/templates/etc/smb.conf/11passdbBackend.ldap-auth 2005-02-17 16:04:02.000000000 -0700 +++ e-smith-samba-2.2.0/root/etc/e-smith/templates/etc/smb.conf/11passdbBackend 2010-11-01 12:06:50.000000000 -0600 @@ -1,4 +1,25 @@ { #Set the Samba user account dbase backend -} + if ( ($ldap{Authentication} || 'disabled') eq 'enabled') + { + my $base = esmith::util::ldapBase ($DomainName); + $OUT .= <&1 exec $smbd -F diff -up e-smith-samba-2.2.0/createlinks.ldap-auth e-smith-samba-2.2.0/createlinks --- e-smith-samba-2.2.0/createlinks.ldap-auth 2007-12-15 08:53:09.000000000 -0700 +++ e-smith-samba-2.2.0/createlinks 2010-11-01 12:14:17.000000000 -0600 @@ -31,7 +31,8 @@ my $event = "console-save"; -$event = "bootstrap-console-save"; +$event = "bootstrap-ldap-save"; +templates2events("/etc/samba/smb.conf", $event); event_link("update-domain-group-maps", $event, "56"); $event = "group-create";