summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2009-01-26 13:12:41 +0100
committerMichael Adam <obnox@samba.org>2009-02-06 10:20:08 +0100
commite0f91c89300a737f774d806d6c5ec3de3486d7f7 (patch)
treea4222a354f5f5b64f2b30d0ab2742788092d496f /source3
parent2125777803cf4b9f259391e34847aafa4ce7668c (diff)
downloadsamba-e0f91c89300a737f774d806d6c5ec3de3486d7f7.tar.gz
samba-e0f91c89300a737f774d806d6c5ec3de3486d7f7.tar.bz2
samba-e0f91c89300a737f774d806d6c5ec3de3486d7f7.zip
s3:idmap_tdb2: factor lodaing of ranges out into idmap_tdb2_load_ranges()
Michael
Diffstat (limited to 'source3')
-rw-r--r--source3/winbindd/idmap_tdb2.c66
1 files changed, 41 insertions, 25 deletions
diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c
index 5d9171e14a..8c96dcafa1 100644
--- a/source3/winbindd/idmap_tdb2.c
+++ b/source3/winbindd/idmap_tdb2.c
@@ -54,6 +54,43 @@ static struct db_context *idmap_tdb2;
static NTSTATUS idmap_tdb2_alloc_load(void);
+static NTSTATUS idmap_tdb2_load_ranges(void)
+{
+ uid_t low_uid = 0;
+ uid_t high_uid = 0;
+ gid_t low_gid = 0;
+ gid_t high_gid = 0;
+
+ if (!lp_idmap_uid(&low_uid, &high_uid)) {
+ DEBUG(1, ("idmap uid missing\n"));
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ if (!lp_idmap_gid(&low_gid, &high_gid)) {
+ DEBUG(1, ("idmap gid missing\n"));
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ idmap_tdb2_state.low_uid = low_uid;
+ idmap_tdb2_state.high_uid = high_uid;
+ idmap_tdb2_state.low_gid = low_gid;
+ idmap_tdb2_state.high_gid = high_gid;
+
+ if (idmap_tdb2_state.high_uid <= idmap_tdb2_state.low_uid) {
+ DEBUG(1, ("idmap uid range missing or invalid\n"));
+ DEBUGADD(1, ("idmap will be unable to map foreign SIDs\n"));
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ if (idmap_tdb2_state.high_gid <= idmap_tdb2_state.low_gid) {
+ DEBUG(1, ("idmap gid range missing or invalid\n"));
+ DEBUGADD(1, ("idmap will be unable to map foreign SIDs\n"));
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return NT_STATUS_OK;
+}
+
/*
open the permanent tdb
*/
@@ -94,10 +131,7 @@ static NTSTATUS idmap_tdb2_open_db(void)
*/
static NTSTATUS idmap_tdb2_alloc_load(void)
{
- uid_t low_uid = 0;
- uid_t high_uid = 0;
- gid_t low_gid = 0;
- gid_t high_gid = 0;
+ NTSTATUS status;
uint32 low_id;
/* see if a idmap script is configured */
@@ -111,27 +145,9 @@ static NTSTATUS idmap_tdb2_alloc_load(void)
/* load ranges */
- if (!lp_idmap_uid(&low_uid, &high_uid)
- || !lp_idmap_gid(&low_gid, &high_gid)) {
- DEBUG(1, ("idmap uid or idmap gid missing\n"));
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- idmap_tdb2_state.low_uid = low_uid;
- idmap_tdb2_state.high_uid = high_uid;
- idmap_tdb2_state.low_gid = low_gid;
- idmap_tdb2_state.high_gid = high_gid;
-
- if (idmap_tdb2_state.high_uid <= idmap_tdb2_state.low_uid) {
- DEBUG(1, ("idmap uid range missing or invalid\n"));
- DEBUGADD(1, ("idmap will be unable to map foreign SIDs\n"));
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- if (idmap_tdb2_state.high_gid <= idmap_tdb2_state.low_gid) {
- DEBUG(1, ("idmap gid range missing or invalid\n"));
- DEBUGADD(1, ("idmap will be unable to map foreign SIDs\n"));
- return NT_STATUS_UNSUCCESSFUL;
+ status = idmap_tdb2_load_ranges();
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
}
/* Create high water marks for group and user id */