summaryrefslogtreecommitdiff
path: root/source3/sam/idmap.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2003-04-26 14:43:33 +0000
committerSimo Sorce <idra@samba.org>2003-04-26 14:43:33 +0000
commit0bc85d32e196acb50dfece16d63410e04c58b712 (patch)
tree91e05641edac53f436673e87052f12de803b8a07 /source3/sam/idmap.c
parent17c29f0faf96f522fb5179bda1ea1904b18df7d5 (diff)
downloadsamba-0bc85d32e196acb50dfece16d63410e04c58b712.tar.gz
samba-0bc85d32e196acb50dfece16d63410e04c58b712.tar.bz2
samba-0bc85d32e196acb50dfece16d63410e04c58b712.zip
add idmap only parameter
make idmap not map SIDs outside the uid/gid range defined by default this is to keep backward compatibility (This used to be commit bec45093c379915082d7b7f44113f5c17110d123)
Diffstat (limited to 'source3/sam/idmap.c')
-rw-r--r--source3/sam/idmap.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/source3/sam/idmap.c b/source3/sam/idmap.c
index 771f4169a2..c2b966cfbe 100644
--- a/source3/sam/idmap.c
+++ b/source3/sam/idmap.c
@@ -91,6 +91,35 @@ NTSTATUS idmap_set_mapping(const DOM_SID *sid, unid_t id, int id_type)
{
NTSTATUS ret;
+ if (!lp_idmap_only()) {
+ if (id_type & ID_USERID) {
+ uid_t low, high;
+ if (!lp_idmap_uid(&low, &high)) {
+ DEBUG(0, ("idmap uid range missing or invalid\n"));
+ DEBUGADD(0, ("idmap will be unable to map SIDs\n"));
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+ if (low > id.uid || high < id.uid) {
+ DEBUG(0, ("uid not in range and idmap only is flase - not storing the mapping\n"));
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+ } else if (id_type & ID_GROUPID) {
+ gid_t low, high;
+ if (!lp_idmap_gid(&low, &high)) {
+ DEBUG(0, ("idmap gid range missing or invalid\n"));
+ DEBUGADD(0, ("idmap will be unable to map SIDs\n"));
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+ if (low > id.gid || high < id.gid) {
+ DEBUG(0, ("uid not in range and idmap only is flase - not storing the mapping\n"));
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+ } else {
+ DEBUG(0, ("Wrong ID Type, mapping failed!"));
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+ }
+
ret = local_map->set_mapping(sid, id, id_type);
if (NT_STATUS_IS_ERR(ret)) {
DEBUG (0, ("idmap_set_mapping: Error, unable to modify local cache!\n"));