summaryrefslogtreecommitdiff
path: root/source3/winbindd
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2010-06-16 16:59:26 +0200
committerMichael Adam <obnox@samba.org>2010-08-14 02:10:42 +0200
commit1cd1dff7569fbcd2ab02066764933fc50f0dc966 (patch)
tree0161af2a9706946a5b9c7887ef9af23291eb1ed7 /source3/winbindd
parent212627e9c0d62cf36f5f6101f0226f76bcee3881 (diff)
downloadsamba-1cd1dff7569fbcd2ab02066764933fc50f0dc966.tar.gz
samba-1cd1dff7569fbcd2ab02066764933fc50f0dc966.tar.bz2
samba-1cd1dff7569fbcd2ab02066764933fc50f0dc966.zip
s3:idmap: add idmap_unix_id_is_in_range() for checking an id against an idmap range
Diffstat (limited to 'source3/winbindd')
-rw-r--r--source3/winbindd/idmap_util.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source3/winbindd/idmap_util.c b/source3/winbindd/idmap_util.c
index 70c109a7a5..3afe9f8607 100644
--- a/source3/winbindd/idmap_util.c
+++ b/source3/winbindd/idmap_util.c
@@ -287,3 +287,22 @@ backend:
}
return NT_STATUS_OK;
}
+
+/**
+ * check whether a given unix id is inside the filter range of an idmap domain
+ */
+bool idmap_unix_id_is_in_range(uint32_t id, struct idmap_domain *dom)
+{
+ if (id == 0) {
+ /* 0 is not an allowed unix id for id mapping */
+ return false;
+ }
+
+ if ((dom->low_id && (id < dom->low_id)) ||
+ (dom->high_id && (id > dom->high_id)))
+ {
+ return false;
+ }
+
+ return true;
+}