/usr/share/perl5/EBox/LDB/IdMapDb.pm is in zentyal-samba 2.3.12+quantal1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | package EBox::LDB::IdMapDb;
use strict;
use warnings;
use constant PRIVATE_DIR => '/var/lib/samba/private/';
use constant FILE => 'idmap.ldb';
# Mappings for ID_TYPE_UID, ID_TYPE_GID and ID_TYPE_BOTH
use constant TYPE_UID => 'ID_TYPE_UID';
use constant TYPE_GID => 'ID_TYPE_GID';
use constant TYPE_BOTH => 'ID_TYPE_BOTH';
sub new
{
my $class = shift;
my $self = {
file => PRIVATE_DIR . FILE
};
bless ($self, $class);
return $self;
}
# Method: setupNameMapping
#
# Setup a mapping between a SID and a uidNumber
#
sub setupNameMapping
{
my ($self, $sid, $type, $uidNumber) = @_;
$self->deleteMapping($sid, 1);
my $file = EBox::Config::tmp() . 'idmap.ldif';
my $ldif = "dn: CN=$sid\n" .
"changetype: add\n" .
"xidNumber: $uidNumber\n" .
"objectSid: $sid\n" .
"objectClass: sidMap\n" .
"type: $type\n" .
"cn: $sid\n";
EBox::debug("Mapping XID '$uidNumber' to '$sid'");
EBox::Sudo::root("echo '$ldif' | ldbmodify -H $self->{file}");
unlink $file;
}
sub deleteMapping
{
my ($self, $sid, $silent) = @_;
my $file = EBox::Config::tmp() . 'idmap.ldif';
my $ldif = "dn: CN=$sid\n" .
"changetype: delete\n";
if ($silent) {
EBox::Sudo::silentRoot("echo '$ldif' | ldbmodify -H $self->{file}");
} else {
EBox::debug("Unmapping XID '$sid'");
EBox::Sudo::root("echo '$ldif' | ldbmodify -H $self->{file}");
}
unlink $file;
}
1;
|