diff -Nur -x '*.orig' -x '*.rej' e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/20ldif mezzanine_patched_e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/20ldif
--- e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/20ldif	2010-12-01 17:07:47.000000000 +0100
+++ mezzanine_patched_e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/20ldif	1970-01-01 01:00:00.000000000 +0100
@@ -1,20 +0,0 @@
-{
-    foreach my $dn (keys %$ldif)
-    {   
-        delete $ldif->{$dn}->{'junk'};
-        $OUT .= "dn: $dn\n";
-        foreach my $attr ( keys %{$ldif->{$dn}} )
-        {
-            if (ref($ldif->{$dn}->{$attr}) eq 'ARRAY')
-            {
-                my %seen = ();
-                $OUT .= "$attr: $_\n" foreach grep { ! $seen{$_}++ } @{$ldif->{$dn}->{$attr}};
-            }
-            else
-            {
-                $OUT .= "$attr: ".$ldif->{$dn}->{$attr}."\n" if $ldif->{$dn}->{$attr};
-            }
-        }
-        $OUT .= "\n";
-    }
-}
diff -Nur -x '*.orig' -x '*.rej' e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/template-begin mezzanine_patched_e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/template-begin
--- e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/template-begin	2010-12-01 17:07:47.000000000 +0100
+++ mezzanine_patched_e-smith-ldap-5.2.0/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/template-begin	1970-01-01 01:00:00.000000000 +0100
@@ -1,207 +0,0 @@
-{
-    use esmith::AccountsDB;
-    use esmith::util;
-    use Date::Parse;
-
-    my $schema = '/etc/openldap/schema/samba.schema';
-
-    $a = esmith::AccountsDB->open_ro;
-    $ldapBase = esmith::util::ldapBase ($DomainName);
-
-    local ($dn, $dc, $obj, $attr, $account, $type);
-    ($dc) = split (/\./, $DomainName);
-
-    $ldif = ();
-
-    # Top domain object
-    utf8::upgrade($ldapBase);
-    $ldif->{$ldapBase}->{objectClass} = [ qw(top organization dcObject) ];
-    $ldif->{$ldapBase}->{dc} = $dc;
-    $ldif->{$ldapBase}->{o} = $ldap{defaultCompany} || $DomainName;
-
-    # Top level groups
-    foreach $obj ( qw(Users Groups Computers) )
-    {
-        $dn = "ou=$obj,$ldapBase";
-        utf8::upgrade($dn);
-
-        $ldif->{$dn}->{objectClass} = [ qw(top organizationalUnit) ];
-        $ldif->{$dn}->{ou} = $obj;
-    }
-
-    local $dnmap = ();
-
-    # Read in user details
-    while(my ($key,$pwd,$uid,$gid,undef,undef,$gecos,$dir,$shell) = getpwent())
-    {
-        # skip non sme users
-        $account = $a->get($key) || next;
-        $type = $account->prop('type') || 'unknown';
-        next unless ($type =~ m{^(?:user|group|ibay|machine)$} or $key eq 'admin');
-
-        if ($type eq 'machine')
-        {
-            $dn = "uid=$key,ou=Computers,$ldapBase";
-            utf8::upgrade($dn);
-        }
-        else
-        {
-            $dn = "uid=$key,ou=Users,$ldapBase";
-            utf8::upgrade($dn);
-        }
-
-        $dnmap->{$key}->{user} = $dn;
-
-        $ldif->{$dn}->{objectClass} = [ qw(posixAccount shadowAccount) ];
-        $ldif->{$dn}->{uid} = $key;
-        $pwd = "!*" if $pwd eq '!!';
-        $ldif->{$dn}->{userPassword} = ($pwd =~ m/^\{/) ? $pwd : "\{CRYPT\}$pwd";
-        $ldif->{$dn}->{uidNumber} = $uid;
-        $ldif->{$dn}->{gidNumber} = $gid;
-        $ldif->{$dn}->{gecos} = $gecos || '';
-        $ldif->{$dn}->{cn} = $gecos || '';
-        $ldif->{$dn}->{homeDirectory} = $dir;
-        $ldif->{$dn}->{loginShell} = $shell;
-
-        if ($type eq 'user' or $key eq 'admin')
-        {
-            push @{$ldif->{$dn}->{objectClass}}, 'inetOrgPerson';
-            $ldif->{$dn}->{mail} = "$key\@$DomainName";
-            $ldif->{$dn}->{givenName} = $account->prop('FirstName') || '';
-            $ldif->{$dn}->{sn} = $account->prop('LastName') || '';
-            $ldif->{$dn}->{telephoneNumber} = $account->prop('Phone') || '';
-            $ldif->{$dn}->{o} = $account->prop('Company') || '';
-            $ldif->{$dn}->{ou} = $account->prop('Dept') || '';
-            $ldif->{$dn}->{l} = $account->prop('City') || '';
-            $ldif->{$dn}->{street} = $account->prop('Street') || '';
-        }
-        else
-        {
-            push @{$ldif->{$dn}->{objectClass}}, 'account';
-        }
-    }
-    endpwent();
-
-    # www is a special user for all accounts
-    foreach my $user (qw/www/)
-    {   
-        $dn = "uid=$user,ou=Users,$ldapBase";
-        utf8::upgrade($dn);
-
-        $dnmap->{$user}->{user} = $dn;
-
-        $ldif->{$dn}->{objectClass} = [ qw(account posixAccount shadowAccount) ];
-        @{$ldif->{$dn}}{'uid','userPassword','uidNumber','gidNumber','junk','junk','gecos','homeDirectory','loginShell'} = getpwnam($user);
-        $ldif->{$dn}->{userPassword} = "!*" if $ldif->{$dn}->{userPassword} eq '!!';
-        $ldif->{$dn}->{userPassword} =~ s/^/{CRYPT}/ unless $ldif->{$dn}->{userPassword} =~ m/^\{/;
-        $ldif->{$dn}->{cn} = $ldif->{$dn}->{gecos} || '';
-    }
-    endpwent();
-
-    # Read in group details
-    while(my ($key,undef,$gid,$members) = getgrent())
-    {
-        # skip non sme groups
-        $account = $a->get($key) || next;
-        $type = $account->prop('type') || 'unknown';
-        next unless ($type =~ m{^(?:user|group|ibay|machine)$} or $key eq 'admin');
-
-        $dn = "cn=$key,ou=Groups,$ldapBase";
-        utf8::upgrade($dn);
-
-        $dnmap->{$key}->{group} = $dn;
-
-        $ldif->{$dn}->{objectClass} = [ qw(posixGroup) ];
-        $ldif->{$dn}->{cn} = $key;
-        $ldif->{$dn}->{gidNumber} = $gid;
-        $ldif->{$dn}->{memberUid} = [ split /\s+/, $members ];
-
-        if ($type eq 'group')
-        {
-            push @{$ldif->{$dn}->{objectClass}}, 'mailboxRelatedObject';
-            $ldif->{$dn}->{mail} = "$key\@$DomainName";
-            $ldif->{$dn}->{description} = $ldif->{$dnmap->{$key}->{user}}->{cn} if exists $ldif->{$dnmap->{$key}->{user}}->{cn};
-        }
-    }
-    endgrent();
-
-    # Nobody and shared are special groups used by samba
-    foreach my $group (qw/nobody shared www/)
-    {   
-        $dn = "cn=$group,ou=Groups,$ldapBase";
-        utf8::upgrade($dn);
-
-        $dnmap->{$group}->{group} = $dn;
-
-        $ldif->{$dn}->{objectClass} = [ qw(posixGroup) ];
-        @{$ldif->{$dn}}{'cn','junk','gidNumber','memberUid'} = getgrnam($group);
-        $ldif->{$dn}->{memberUid} = [ split /\s+/, $ldif->{$dn}->{memberUid} ];
-
-        if ($group eq 'shared'){
-            push @{$ldif->{$dn}->{objectClass}}, 'mailboxRelatedObject';
-            $ldif->{$dn}->{mail} = "everyone\@$DomainName";
-        }
-    }
-    endgrent();
-
-    # Read in samba user details
-    if ( -f "$schema" and -x '/usr/bin/pdbedit' )
-    {
-        foreach my $line (`/usr/bin/pdbedit -Lw 2> /dev/null`)
-        {
-            my ($key,undef,$lmpass,$ntpass) = split(/:/,$line);
-            next unless exists $dnmap->{$key};
-
-            push @{$ldif->{$dnmap->{$key}->{user}}->{objectClass}}, 'sambaSamAccount';
-            $ldif->{$dnmap->{$key}->{user}}->{sambaLMPassword} = $lmpass;
-            $ldif->{$dnmap->{$key}->{user}}->{sambaNTPassword} = $ntpass;
-
-            foreach my $info (`/usr/bin/pdbedit -v '$key' 2> /dev/null`){
-                $ldif->{$dnmap->{$key}->{user}}->{sambaSID} = $1 if $info =~ m{User SID:\s+(S-.*)$};
-                $ldif->{$dnmap->{$key}->{user}}->{displayName} = $1 if $info =~ m{Full Name:\s+(.*)$};
-                $ldif->{$dnmap->{$key}->{user}}->{sambaPrimaryGroupSID} = $1 if $info =~ m{Primary Group SID:\s+(S-.*)$};
-                $ldif->{$dnmap->{$key}->{user}}->{sambaAcctFlags} = $1 if $info =~ m{Account Flags:\s+(.*)$};
-                $ldif->{$dnmap->{$key}->{user}}->{sambaPwdLastSet} = str2time($1) if $info =~ m{Password last set:\s+(.*)$};
-            }
-        }
-    }
-
-    # Read in samba group mappings
-    if ( -f "$schema" and -x '/usr/bin/net' )
-    {
-        foreach (`/usr/bin/net groupmap list 2> /dev/null`){
-            chomp;
-            next if m{\(S-1-5-32-\d+\)};
-            if (/^(.*) \((S-.*-\d+)\) -> (.*)$/)
-            {
-                next unless exists $dnmap->{$3};
-
-                push @{$ldif->{$dnmap->{$3}->{group}}->{objectClass}}, 'sambaGroupMapping';
-                $ldif->{$dnmap->{$3}->{group}}->{displayName} = $1;
-                $ldif->{$dnmap->{$3}->{group}}->{sambaSID} = $2;
-                $ldif->{$dnmap->{$3}->{group}}->{sambaGroupType} = '2';
-            }
-        }
-    }
-
-    # Ensure that attributes are utf8
-    foreach $dn (keys %$ldif)
-    {
-        foreach $attr ( keys %{$ldif->{$dn}} )
-        {
-            if ( ref($ldif->{$dn}->{$attr}) eq 'ARRAY' )
-            {
-                for (my $c = 0; $c < scalar(@{$ldif->{$dn}->{$attr}}); $c++)
-                {
-                    utf8::upgrade($ldif->{$dn}->{$attr}[$c]);
-                }
-            }
-            else
-            {
-                utf8::upgrade($ldif->{$dn}->{$attr});
-            }
-        }
-    }
-
-    $OUT = "";
-}
