diff options
author | Volker Lendecke <vlendec@samba.org> | 2006-12-16 18:41:22 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:16:33 -0500 |
commit | f5b3bed84f204c8cf42126375724ebeb8d7f0cd2 (patch) | |
tree | 58287cae1716eac0c80ffe5f408495b5a9f2fd50 | |
parent | 34a0885df06f17799860d611397562a7d307f060 (diff) | |
download | samba-f5b3bed84f204c8cf42126375724ebeb8d7f0cd2.tar.gz samba-f5b3bed84f204c8cf42126375724ebeb8d7f0cd2.tar.bz2 samba-f5b3bed84f204c8cf42126375724ebeb8d7f0cd2.zip |
r20218: Same fix as r20217 -- can we consolidate that duplicated code a bit?
(This used to be commit fdb310f57932ac3b3fd09721e6b6494b30ad57af)
-rw-r--r-- | source3/nsswitch/idmap_tdb.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/source3/nsswitch/idmap_tdb.c b/source3/nsswitch/idmap_tdb.c index 4d70986b84..4a382d4d89 100644 --- a/source3/nsswitch/idmap_tdb.c +++ b/source3/nsswitch/idmap_tdb.c @@ -340,8 +340,10 @@ static NTSTATUS idmap_tdb_alloc_init( const char *params ) NTSTATUS ret; TALLOC_CTX *ctx; const char *range; - uint32_t low_id = 0; - uint32_t high_id = 0; + uid_t low_uid = 0; + uid_t high_uid = 0; + gid_t low_gid = 0; + gid_t high_gid = 0; /* use our own context here */ ctx = talloc_new(NULL); @@ -366,6 +368,8 @@ static NTSTATUS idmap_tdb_alloc_init( const char *params ) range = lp_parm_const_string(-1, "idmap alloc config", "range", NULL); if (range && range[0]) { + unsigned low_id, high_id; + if (sscanf(range, "%u - %u", &low_id, &high_id) == 2) { if (low_id < high_id) { idmap_tdb_state.low_gid = idmap_tdb_state.low_uid = low_id; @@ -379,14 +383,14 @@ static NTSTATUS idmap_tdb_alloc_init( const char *params ) } /* Create high water marks for group and user id */ - if (lp_idmap_uid(&low_id, &high_id)) { - idmap_tdb_state.low_uid = low_id; - idmap_tdb_state.high_uid = high_id; + if (lp_idmap_uid(&low_uid, &high_uid)) { + idmap_tdb_state.low_uid = low_uid; + idmap_tdb_state.high_uid = high_uid; } - if (lp_idmap_gid(&low_id, &high_id)) { - idmap_tdb_state.low_gid = low_id; - idmap_tdb_state.high_gid = high_id; + if (lp_idmap_gid(&low_gid, &high_gid)) { + idmap_tdb_state.low_gid = low_gid; + idmap_tdb_state.high_gid = high_gid; } if (idmap_tdb_state.high_uid <= idmap_tdb_state.low_uid) { @@ -394,6 +398,8 @@ static NTSTATUS idmap_tdb_alloc_init( const char *params ) DEBUGADD(1, ("idmap will be unable to map foreign SIDs\n")); return NT_STATUS_UNSUCCESSFUL; } else { + uint32 low_id; + if (((low_id = tdb_fetch_int32(idmap_alloc_tdb, HWM_USER)) == -1) || (low_id < idmap_tdb_state.low_uid)) { if (tdb_store_int32(idmap_alloc_tdb, HWM_USER, idmap_tdb_state.low_uid) == -1) { @@ -408,6 +414,8 @@ static NTSTATUS idmap_tdb_alloc_init( const char *params ) DEBUGADD(1, ("idmap will be unable to map foreign SIDs\n")); return NT_STATUS_UNSUCCESSFUL; } else { + uint32 low_id; + if (((low_id = tdb_fetch_int32(idmap_alloc_tdb, HWM_GROUP)) == -1) || (low_id < idmap_tdb_state.low_gid)) { if (tdb_store_int32(idmap_alloc_tdb, HWM_GROUP, idmap_tdb_state.low_gid) == -1) { |