The Samba-Bugzilla – Attachment 6867 Details for
Bug 8444
idmap_autorid does not have allocation pool
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch (as in master)
0001-s3-idmap-autorid-add-a-small-alloc-pool-to-autorid.patch (text/plain), 2.87 KB, created by
Christian Ambach
on 2011-09-08 10:45:53 UTC
(
hide
)
Description:
Proposed patch (as in master)
Filename:
MIME Type:
Creator:
Christian Ambach
Created:
2011-09-08 10:45:53 UTC
Size:
2.87 KB
patch
obsolete
>From a8ced90990af07c871f9c6667781266cf5dc10b3 Mon Sep 17 00:00:00 2001 >From: Christian Ambach <ambi@samba.org> >Date: Wed, 31 Aug 2011 18:28:51 +0200 >Subject: [PATCH] s3:idmap/autorid add a small alloc pool to autorid > >this is needed to allocate gids for BUILTIN\Users and >BUILTIN\Administrators > >gids are stored at the start of the first domain >as RIDs start with values over 500, we have some room there >so we do not need to allocate a range > >This fixes Bug 8444 - idmap_autorid does not have allocation pool >--- > source3/winbindd/idmap_autorid.c | 52 ++++++++++++++++++++++++++++++++++++++ > 1 files changed, 52 insertions(+), 0 deletions(-) > >diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c >index 4028a46..18db184 100644 >--- a/source3/winbindd/idmap_autorid.c >+++ b/source3/winbindd/idmap_autorid.c >@@ -34,6 +34,8 @@ > #define DBGC_CLASS DBGC_IDMAP > > #define HWM "NEXT RANGE" >+#define ALLOC_HWM "NEXT ALLOC ID" >+#define ALLOC_POOL_SIZE 500 > #define CONFIGKEY "CONFIG" > > struct autorid_global_config { >@@ -360,6 +362,17 @@ static NTSTATUS idmap_autorid_db_init(void) > } > } > >+ /* Initialize high water mark for alloc pool to 0 */ >+ hwm = dbwrap_fetch_int32(autorid_db, ALLOC_HWM); >+ if ((hwm < 0)) { >+ if (!NT_STATUS_IS_OK >+ (dbwrap_trans_store_int32(autorid_db, ALLOC_HWM, 0))) { >+ DEBUG(0, >+ ("Unable to initialise HWM in autorid " >+ "database\n")); >+ return NT_STATUS_INTERNAL_DB_ERROR; >+ } >+ } > return NT_STATUS_OK; > } > >@@ -541,6 +554,44 @@ done: > return status; > } > >+static NTSTATUS idmap_autorid_allocate_id(struct idmap_domain *dom, >+ struct unixid *xid) { >+ >+ struct autorid_global_config *globalcfg; >+ NTSTATUS ret; >+ uint32_t hwm; >+ >+ if (!strequal(dom->name, "*")) { >+ DEBUG(3, ("idmap_autorid_allocate_id: " >+ "Refusing creation of mapping for domain'%s'. " >+ "Currently only supported for the default " >+ "domain \"*\".\n", >+ dom->name)); >+ return NT_STATUS_NOT_IMPLEMENTED; >+ } >+ >+ globalcfg = talloc_get_type(dom->private_data, >+ struct autorid_global_config); >+ >+ if (!dbwrap_fetch_uint32(autorid_db, ALLOC_HWM, &hwm)) { >+ DEBUG(1, ("Failed to fetch current allocation HWM value!\n")); >+ return NT_STATUS_INTERNAL_ERROR; >+ } >+ >+ if (hwm > ALLOC_POOL_SIZE) { >+ DEBUG(1, ("allocation pool is depleted!\n")); >+ return NT_STATUS_NO_MEMORY; >+ } >+ >+ ret = dbwrap_change_uint32_atomic(autorid_db, ALLOC_HWM, &(xid->id), 1); >+ if (!NT_STATUS_IS_OK(ret)) { >+ DEBUG(1, ("Fatal error while allocating new ID!\n")); >+ } >+ xid->id = (xid->id)+(globalcfg->minvalue); >+ >+ return ret; >+} >+ > /* > Close the idmap tdb instance > */ >@@ -548,6 +599,7 @@ static struct idmap_methods autorid_methods = { > .init = idmap_autorid_initialize, > .unixids_to_sids = idmap_autorid_unixids_to_sids, > .sids_to_unixids = idmap_autorid_sids_to_unixids, >+ .allocate_id = idmap_autorid_allocate_id > }; > > NTSTATUS idmap_autorid_init(void) >-- >1.7.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 8444
:
6867
|
7025