diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/createlinks mezzanine_patched_e-smith-base+ldap-4.19.1/createlinks --- e-smith-base+ldap-4.19.1/createlinks 2008-06-06 13:37:45.000000000 +0200 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/createlinks 2008-06-06 13:37:28.000000000 +0200 @@ -209,6 +209,7 @@ /etc/ldap.conf /etc/ldap.secret /etc/cpu.conf + /etc/cpu-machine.conf /etc/security/pam_abl.conf )) { @@ -258,6 +259,7 @@ /var/log/cron /var/log/spooler /var/log/maillog + /var/log/slapd )) { safe_touch "root/etc/e-smith/events/logrotate/logfiles2timestamp/$_"; @@ -423,6 +425,7 @@ $event = "user-create"; event_link("user-create-unix", $event, "04"); +event_link("update-domain-group-maps", $event, "10"); event_link("count-active-user-accounts", $event, "25"); event_link("user-group-modify", $event, "85"); diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/group-create-unix mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/group-create-unix --- e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/group-create-unix 2008-06-06 13:37:45.000000000 +0200 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/group-create-unix 2008-06-05 13:53:32.000000000 +0200 @@ -83,6 +83,7 @@ "-u", $uid, "-g", $gid, "-c", $description, + "-E", $description, "-d", "/home/e-smith", "-s", diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/group-modify-unix mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/group-modify-unix --- e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/group-modify-unix 2008-06-06 13:37:45.000000000 +0200 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/group-modify-unix 2008-06-05 13:53:32.000000000 +0200 @@ -64,7 +64,7 @@ my $groupDesc = $properties{'Description'} if (defined $properties{'Description'}); - system("/usr/sbin/cpu", "usermod", "-c", "$groupDesc", "$groupName") == 0 + system("/usr/sbin/cpu", "usermod", "-c", "$groupDesc", "-E", "$groupDesc", "$groupName") == 0 or die "Failed to modify group description for $groupName.\n"; my ($name, $passwd, $gid, $members) = getgrnam ($groupName); diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/ldap-update mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/ldap-update --- e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/ldap-update 2008-06-06 13:37:45.000000000 +0200 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/ldap-update 2008-06-05 13:53:32.000000000 +0200 @@ -100,79 +100,73 @@ my $key = $acct->key; my $type = $acct->prop('type'); next unless ($type eq 'user' || $type eq 'group'); - my @attrs = (); + my @usr_attrs = (); + my @grp_attrs = (); + my $name = ''; if ($type eq 'user') { - my $name = $acct->prop('FirstName') . " " . $acct->prop('LastName'); + # retrieve informations of the user from the db + # which can override default ones (like Phone, Company etc...) + $name = $acct->prop('FirstName') . " " . $acct->prop('LastName'); utf8::upgrade($name); my $first = $acct->prop('FirstName') || ''; utf8::upgrade($first); my $last = $acct->prop('LastName') || ''; utf8::upgrade($last); - my $phone = $acct->prop('Phone') || ''; - my $company = $acct->prop('Company') || ''; + $phone = $acct->prop('Phone') || ''; + $company = $acct->prop('Company') || ''; utf8::upgrade($company); - my $dept = $acct->prop('Dept') || ''; + $dept = $acct->prop('Dept') || ''; utf8::upgrade($dept); - my $city = $acct->prop('City') || ''; + $city = $acct->prop('City') || ''; utf8::upgrade($city); - my $street = $acct->prop('Street') || ''; + $street = $acct->prop('Street') || ''; utf8::upgrade($street); my $freebusy = $acct->prop('FreeBusy') || 'https://'.$hostname.'.'.$domain.'/horde/kronolith/fb.php?u='.$key.'@'.$domain; utf8::upgrade($freebusy); - push @attrs, (objectClass => ['person', - 'organizationalPerson', - 'inetOrgPerson']); - push @attrs, (uid => $key); - - push @attrs, (cn => $name) unless ($name =~ /^\s*$/); - push @attrs, (givenName => $first) unless $first =~ /^\s*$/; - push @attrs, (sn => $last) unless $last =~ /^\s*$/; - push @attrs, (mail => "$key\@$domain"); - push @attrs, (telephoneNumber => $phone) unless $phone =~ /^\s*$/; - push @attrs, (o => $company) unless $company =~ /^\s*$/; - push @attrs, (ou => $dept) unless $dept =~ /^\s*$/; - push @attrs, (l => $city) unless $city =~ /^\s*$/; - push @attrs, (street => $street) unless $street =~ /^\s*$/; - push @attrs, (calFBURL => $freebusy) unless $freebusy =~ /^\s*$/; + + # Some attributes are only valide for user account + push @usr_attrs, (calFBURL => $freebusy) unless $freebusy =~ /^\s*$/; + push @usr_attrs, (givenName => $first) unless $first =~ /^\s*$/; + push @usr_attrs, (sn => $last) unless $last =~ /^\s*$/; } elsif ($type eq 'group') - { - push @attrs, (objectClass => ['person', - 'organizationalPerson', - 'inetOrgPerson', - 'calEntry']); - push @attrs, (uid => $key); - + { my $key = $acct->key; - my $desc = $acct->prop('Description') || ''; - utf8::upgrade($desc); - push @attrs, (cn => $desc) unless $desc =~ /^\s*$/; - push @attrs, (sn => $desc) unless $desc =~ /^\s*$/; - push @attrs, (mail => "$key\@$domain"); - push @attrs, (telephoneNumber => $phone) unless $phone =~ /^\s*$/; - push @attrs, (o => $company) unless $company =~ /^\s*$/; - push @attrs, (ou => $dept) unless $dept =~ /^\s*$/; - push @attrs, (l => $city) unless $city =~ /^\s*$/; - push @attrs, (street => $street) unless $street =~ /^\s*$/; - } - my $dn = "uid=$key,ou=People,$base"; - if (($event eq 'user-create') || ($event eq 'group-create')) - { - my $result = $ldap->add ($dn, attr => \@attrs); - $result->code && - warn "failed to add entry for $dn: ", $result->error ; - } - else - { - my %attrs = @attrs; - my $result = $ldap->modify ($dn, replace => \%attrs); + $name = $acct->prop('Description') || ''; + # sn Attribute is mandatory for objectClass inetOrgPerson + push @usr_attrs, (sn => $name) unless $name =~ /^\s*$/; + utf8::upgrade($name); - $result->code && - warn "failed to modify entry for $dn: ", $result->error ; } + + # In any case, update common attributes + push @usr_attrs, (displayName => $name) unless ($name =~ /^\s*$/); + push @usr_attrs, (mail => "$key\@$domain"); + push @usr_attrs, (telephoneNumber => $phone) unless $phone =~ /^\s*$/; + push @usr_attrs, (o => $company) unless $company =~ /^\s*$/; + push @usr_attrs, (ou => $dept) unless $dept =~ /^\s*$/; + push @usr_attrs, (l => $city) unless $city =~ /^\s*$/; + push @usr_attrs, (street => $street) unless $street =~ /^\s*$/; + push @usr_attrs, (gecos => $name) unless ($name =~ /^\s*$/); + push @grp_attrs, (displayName => $name) unless ($name =~ /^\s*$/); + + # Update user entry (or dummy user for group accounts) + my %usr_attrs = @usr_attrs; + my $result = $ldap->modify ("uid=$key,ou=Users,$base", replace => \%usr_attrs); + + $result->code && + warn "failed to modify user entry for uid=$key,ou=Users,$base: ", $result->error ; + + # Update Group entry (or personnal group for user accounts) + my %grp_attrs = @grp_attrs; + $result = $ldap->modify ("cn=$key,ou=Groups,$base", replace => \%grp_attrs); + + $result->code && + warn "failed to modify group entry for cn=$key,ou=Groups,$base: ", $result->error ; + } $ldap->unbind; diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/user-create-unix mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/user-create-unix --- e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/user-create-unix 2008-06-06 13:37:45.000000000 +0200 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/user-create-unix 2008-06-05 13:53:32.000000000 +0200 @@ -77,6 +77,8 @@ "-u", $uid, "-g", $uid, "-c", "$first $last", + "-f", "$first", + "-E", "$last", "-d", "/home/e-smith/files/users/$userName", "-G", "shared", "-m", diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/user-modify-unix mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/user-modify-unix --- e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/user-modify-unix 2008-06-06 13:37:45.000000000 +0200 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/events/actions/user-modify-unix 2008-06-05 13:53:32.000000000 +0200 @@ -55,17 +55,16 @@ # to be removed from all it's supplementary groups. Thus, to be able to call # cpu usermod properly we need to know user supplementary groups. - my $cmd = "/usr/bin/id -G -n '$member'"; + my $cmd = "/usr/bin/id -G -n '$userName'"; my $groups = `$cmd 2>/dev/null`; if ($? != 0) { - die "Failed to get supplementary group list for $member.\n"; + die "Failed to get supplementary group list for $userName.\n"; } chomp ($groups); my @groupList = split (/\s+/, $groups); - @groupList = grep (!/^$member$/, @groupList); - push @groupList, $groupName; + @groupList = grep (!/^$userName$/, @groupList); $groups = join (',', sort (@groupList)); diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/etc/cpu.conf/all mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/etc/cpu.conf/all --- e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/etc/cpu.conf/all 2008-06-06 13:37:45.000000000 +0200 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/etc/cpu.conf/all 2008-06-05 13:53:32.000000000 +0200 @@ -10,17 +10,24 @@ # Can also use LDAP_URI = ldaps://localhost:389 for TLS support BIND_DN = "cn=root,{ esmith::util::ldapBase ($DomainName); }" BIND_PASS = { esmith::util::LdapPassword (); } -USER_BASE = ou=Users,{ esmith::util::ldapBase ($DomainName); } -# replace account with inetOrgPerson if you want first or last name +{ +if ($ACCOUNT eq 'machine'){ + $OUT .= "USER_BASE = ou=Computers," . esmith::util::ldapBase ($DomainName) . "\n"; + $OUT .= "USER_OBJECT_CLASS = posixAccount,shadowAccount,account"; +} +else{ + $OUT .= "USER_BASE = ou=Users," . esmith::util::ldapBase ($DomainName) . "\n"; + $OUT .= "USER_OBJECT_CLASS = posixAccount,shadowAccount,calEntry,inetOrgPerson"; +} +} GROUP_BASE = ou=Groups,{ esmith::util::ldapBase ($DomainName); } -USER_OBJECT_CLASS = account,posixAccount,shadowAccount,top GROUP_OBJECT_CLASS = posixGroup,top USER_FILTER = (objectClass=posixAccount) GROUP_FILTER = (objectClass=posixGroup) USER_CN_STRING = uid GROUP_CN_STRING = cn SKEL_DIR = /etc/skel -DEFAULT_SHELL = /bin/bash +DEFAULT_SHELL = /usr/bin/rssh HOME_DIRECTORY = /home MAX_UIDNUMBER = 10000 MIN_UIDNUMBER = 100 diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50groups mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50groups --- e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50groups 2008-06-06 13:37:45.000000000 +0200 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50groups 2008-06-05 13:53:32.000000000 +0200 @@ -23,11 +23,6 @@ { $OUT .= utf8("memberUid: $_\n"); } - if ($name eq 'nobody'){ - foreach(@machines){ - $OUT .= utf8("memberUid: $_\n"); - } - } $OUT .= utf8("description: Local Unix group\n"); $OUT .= utf8("displayName: $dname\n"); $OUT .= utf8("sambaGroupType: 2\n"); diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50people mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50people --- e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50people 2008-06-06 13:37:45.000000000 +0200 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50people 1970-01-01 01:00:00.000000000 +0100 @@ -1,60 +0,0 @@ -{ - @peoples = ($a->users, $a->groups); - - foreach my $people (@peoples) - { - my $key = $people->key; - my $type = $people->prop('type'); - - if ($type eq 'user') - { - my $first = $people->prop('FirstName') || ''; - my $last = $people->prop('LastName') || ''; - my $name = "$first $last"; - my $phone = $people->prop('Phone') || ''; - my $company = $people->prop('Company') || ''; - my $dept = $people->prop('Dept') || ''; - my $city = $people->prop('City') || ''; - my $street = $people->prop('Street') || ''; - - $OUT .= utf8("dn: uid=$key,ou=People,$ldapBase\n"); - $OUT .= utf8("objectClass: person\n"); - $OUT .= utf8("objectClass: organizationalPerson\n"); - $OUT .= utf8("objectClass: inetOrgPerson\n"); - $OUT .= utf8("uid: $key\n"); - $OUT .= utf8("cn: $name\n"); - $OUT .= utf8("givenName: $first\n"); - $OUT .= utf8("sn: $last\n"); - $OUT .= utf8("mail: $key\@$DomainName\n"); - $OUT .= utf8("telephoneNumber: $phone\n"); - $OUT .= utf8("o: $company\n"); - $OUT .= utf8("ou: $dept\n"); - $OUT .= utf8("l: $city\n"); - $OUT .= utf8("street: $street\n\n"); - } - elsif ($type eq 'group') - { - my $desc = $people->prop('Description') || ''; - my $phone = $ldap{defaultPhoneNumber} || ''; - my $company = $ldap{defaultCompany} || ''; - my $dept = $ldap{defaultDepartment} || ''; - my $city = $ldap{defaultCity} || ''; - my $street = $ldap{defaultStreet} || ''; - - $OUT .= utf8("dn: uid=$key,ou=People,$ldapBase\n"); - $OUT .= utf8("objectClass: person\n"); - $OUT .= utf8("objectClass: organizationalPerson\n"); - $OUT .= utf8("objectClass: inetOrgPerson\n"); - $OUT .= utf8("uid: $key\n"); - $OUT .= utf8("cn: $desc\n"); - $OUT .= utf8("sn: $desc\n"); - $OUT .= utf8("mail: $key\@$DomainName\n"); - $OUT .= utf8("telephoneNumber: $phone\n"); - $OUT .= utf8("o: $company\n"); - $OUT .= utf8("ou: $dept\n"); - $OUT .= utf8("l: $city\n"); - $OUT .= utf8("street: $street\n\n"); - } - } -} - diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50users mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50users --- e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50users 2008-06-06 13:37:45.000000000 +0200 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/50users 2008-06-06 13:11:08.000000000 +0200 @@ -3,33 +3,131 @@ my $shadow_info = parse_file("/etc/shadow", @users); my $smbpasswd_info = parse_file("/etc/smbpasswd", @users); + + my $l = $c->get('ldap'); + my $phone = $l->prop('defaultTelephoneNumber') || ''; + my $company = $l->prop('defaultCompany') || ''; + my $dept = $l->prop('defaultDepartment') || ''; + my $city = $l->prop('defaultCity') || ''; + my $street = $l->prop('defaultStreet') || ''; + + my $hostname = $c->get('SystemName') + || die("Couldn't determine system name"); + $hostname = $hostname->value; + + my $domain = $c->get('DomainName') + || die("Couldn't determine domain name"); + $domain = $domain->value; + + foreach my $user (@users) { # Skip users in db but not in /etc/passwd. - next unless ($passwd_info->{$user}); - - my ($name, undef, $uid, $gid, $comment, $home, $shell) + next unless ($passwd_info->{$user}); + # Retrieve info from passwd + my ($name, undef, $uid, $gid, $comment, $home, $shell) = @{$passwd_info->{$user}}; - my (undef, $passwd, $lastchange, $min, $max, $warning, $inactive, + # And from shadow + my (undef, $passwd, $lastchange, $min, $max, $warning, $inactive, $expire, $flag) = @{$shadow_info->{$user}}; - # Import the sambaSID of the user - my $sambaSID = `/usr/bin/net sam show $user -s /etc/samba/smb-pre-ldap.conf 2> /dev/null`; - $sambaSID =~ s/(.*)\\$user is a (.*) with SID (.+)/$3/; - chomp($sambaSID); - - # Import smb passwords (NT and LM) from smbpasswd - my (undef, undef, $sambaLMPassword, $sambaNTPassword, $sambaAcctFlags, undef) - = @{$smbpasswd_info->{$user}} if ($sambaSID ne ''); - - $OUT .= utf8("dn: uid=$user,ou=Users,$ldapBase\n"); - $OUT .= utf8("objectClass: account\n"); - $OUT .= utf8("objectClass: posixAccount\n"); - $OUT .= utf8("objectClass: shadowAccount\n"); - $OUT .= utf8("objectClass: sambaSamAccount\n") if ($sambaSID ne ''); - $OUT .= utf8("objectClass: top\n"); + $OUT .= utf8("dn: uid=$user,ou=Users,$ldapBase\n"); + $OUT .= utf8("objectClass: posixAccount\n"); + $OUT .= utf8("objectClass: shadowAccount\n"); + + my $type = ''; + my $acct = $a->get($user) || ''; + $type = $acct->prop('type') if ($acct ne ''); + + # If the account is a user + if (($type eq 'user') || ($user eq 'admin')){ + my $rid = 1000 + $uid * 2; + my $grid = 1000 + $gid * 2 + 1; + my $sambaSID = $local_sid . "-$rid"; + my $groupSID = ($user eq 'admin') ? + "$local_sid-512" : + "$local_sid-$grid"; + # Import smb passwords (NT and LM) from smbpasswd + my (undef, undef, $sambaLMPassword, $sambaNTPassword, $sambaAcctFlags, undef) + = @{$smbpasswd_info->{$user}} if ($sambaSID ne ''); + + $name = $acct->prop('FirstName') . " " . $acct->prop('LastName'); + utf8::upgrade($name); + my $first = $acct->prop('FirstName') || ''; + utf8::upgrade($first); + my $last = $acct->prop('LastName') || ''; + utf8::upgrade($last); + my $phone = $acct->prop('Phone') || ''; + my $company = $acct->prop('Company') || ''; + utf8::upgrade($company); + my $dept = $acct->prop('Dept') || ''; + utf8::upgrade($dept); + my $city = $acct->prop('City') || ''; + utf8::upgrade($city); + my $street = $acct->prop('Street') || ''; + utf8::upgrade($street); + my $freebusy = $acct->prop('FreeBusy') || + 'https://'.$hostname.'.'.$domain.'/horde/kronolith/fb.php?u='.$user.'@'.$domain; + utf8::upgrade($freebusy); + + + # Write the person informations in the ldif + $OUT .= utf8("objectClass: sambaSamAccount\n") if ($sambaSID ne ''); + $OUT .= utf8("objectClass: calEntry\n"); + $OUT .= utf8("objectClass: inetOrgPerson\n"); + $OUT .= utf8("uid: $user\n"); + $OUT .= utf8("sn: $last\n"); + $OUT .= utf8("displayName: " . ($comment || "no comment") . "\n"); + $OUT .= utf8("givenName: $first\n"); + $OUT .= utf8("mail: $user\@$domain\n"); + #foreach my $alias (@alias){ + # my $acc = $a->get($alias)->prop('Account') || ''; + # if ($acc eq $user){ + # $OUT .= utf8("mail: $alias\@$domain\n"); + # } + #} + $OUT .= utf8("telephoneNumber: $phone\n") unless $phone =~ /^\s*$/; + $OUT .= utf8("o: $company\n") unless $company =~ /^\s*$/; + $OUT .= utf8("ou: $dept\n") unless $dept =~ /^\s*$/; + $OUT .= utf8("l: $city\n") unless $city =~ /^\s*$/; + $OUT .= utf8("street: $street\n") unless $street =~ /^\s*$/; + $OUT .= utf8("calFBURL: $freebusy\n") unless $freebusy =~ /^\s*$/; + + # Write samba informations + $OUT .= utf8("sambaSID: $sambaSID\n") if ($sambaSID ne ''); + $OUT .= utf8("sambaPrimaryGroupSID: $groupSID\n") if ($groupSID ne ''); + $OUT .= utf8("sambaLMPassword: $sambaLMPassword\n") if $sambaLMPassword; + $OUT .= utf8("sambaNTPassword: $sambaNTPassword\n") if $sambaNTPassword; + $OUT .= utf8("sambaPwdLastSet: ".int(time / (24 * 3600))."\n") if ($sambaLMPassword && $sambaNTPassword); + $OUT .= utf8("sambaAcctFlags: $sambaAcctFlags\n") if $sambaAcctFlags; + + } + # This handle dummy users for groups + elsif($type eq 'group'){ + $OUT .= utf8("objectClass: inetOrgPerson\n"); + $OUT .= utf8("uid: $name\n"); + $OUT .= utf8("sn: $name\n"); + $OUT .= utf8("displayName: " . ($comment || "no comment") . "\n"); + $OUT .= utf8("mail: $user\@$domain\n"); + #foreach my $alias (@alias){ + # my $acc = $a->get($alias)->prop('Account') || ''; + # if ($acc eq $user){ + # $OUT .= utf8("mail: $alias\@$domain\n"); + # } + #} + $OUT .= utf8("telephoneNumber: $phone\n") unless $phone =~ /^\s*$/; + $OUT .= utf8("o: $company\n") unless $company =~ /^\s*$/; + $OUT .= utf8("ou: $dept\n") unless $dept =~ /^\s*$/; + $OUT .= utf8("l: $city\n") unless $city =~ /^\s*$/; + $OUT .= utf8("street: $street\n") unless $street =~ /^\s*$/; + } + # Else means, system account like root, www etc... + else{ + $OUT .= utf8("objectClass: account\n"); + $OUT .= utf8("uid: $name\n"); + } + # Some others attributes valid for all accounts $OUT .= utf8("cn: $name\n"); - $OUT .= utf8("uid: $name\n"); $OUT .= utf8("gecos: " . ($comment || "no comment") . "\n"); $OUT .= utf8("uidNumber: $uid\n"); $OUT .= utf8("gidNumber: $gid\n"); @@ -42,11 +140,6 @@ $OUT .= utf8("shadowWarning: " . ($warning || "7") . "\n"); $OUT .= utf8("shadowInactive: " . ($inactive || "-1") . "\n"); $OUT .= utf8("shadowExpire: " . ($expire || "-1") . "\n"); - $OUT .= utf8("sambaSID: $sambaSID\n") if ($sambaSID ne ''); - $OUT .= utf8("sambaLMPassword: $sambaLMPassword\n") if $sambaLMPassword; - $OUT .= utf8("sambaNTPassword: $sambaNTPassword\n") if $sambaNTPassword; - $OUT .= utf8("sambaPwdLastSet: 1207907915\n") if ($sambaLMPassword && $sambaNTPassword); # sambaPwdLastSet needs to be not null - $OUT .= utf8("sambaAcctFlags: $sambaAcctFlags\n") if $sambaAcctFlags; $OUT .= utf8("shadowFlag: " . ($flag || "-1") . "\n\n"); } } diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/template-begin mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/template-begin --- e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/template-begin 2008-06-06 13:37:45.000000000 +0200 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates/home/e-smith/db/ldap/ldif/template-begin 2008-06-05 13:53:32.000000000 +0200 @@ -25,7 +25,7 @@ return $t; } # Basic entries to init. - @ous = ("Groups", "People", "Users", "Computers"); # ous for Organizational Units. + @ous = ("Groups", "Users", "Computers"); # ous for Organizational Units. @users = ("root", "ntp", "www", "admin", "public"); @groups = ("shared", "slocate", "nobody", @users); @machines = (); @@ -56,6 +56,10 @@ foreach ($a->get_all_by_prop('type'=>'machine')){ @machines = (@machines,$_->key); } + #And read alias + #foreach ($a->get_all_by_prop('type'=>'pseudonym')){ + # @alias = (@alias,$_->key); + #} # Parse a file with fields separated by ':' (ie /etc/{group,passwd,shadow}). sub parse_file diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/templates.metadata/etc/cpu.conf mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates.metadata/etc/cpu.conf --- e-smith-base+ldap-4.19.1/root/etc/e-smith/templates.metadata/etc/cpu.conf 2008-06-06 13:37:45.000000000 +0200 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates.metadata/etc/cpu.conf 2008-06-05 13:53:32.000000000 +0200 @@ -1 +1,2 @@ PERMS=0600 +MORE_DATA={ ACCOUNT => "user" } diff -Nur -x '*.orig' -x '*.rej' e-smith-base+ldap-4.19.1/root/etc/e-smith/templates.metadata/etc/cpu-machine.conf mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates.metadata/etc/cpu-machine.conf --- e-smith-base+ldap-4.19.1/root/etc/e-smith/templates.metadata/etc/cpu-machine.conf 1970-01-01 01:00:00.000000000 +0100 +++ mezzanine_patched_e-smith-base+ldap-4.19.1/root/etc/e-smith/templates.metadata/etc/cpu-machine.conf 2008-06-05 13:53:32.000000000 +0200 @@ -0,0 +1,4 @@ +PERMS=0600 +TEMPLATE_PATH="/etc/cpu.conf" +OUTPUT_FILENAME="/etc/cpu-machine.conf" +MORE_DATA={ ACCOUNT => "machine" }