svn commit: samba r15894 - in trunk/source/passdb: .
jra at samba.org
jra at samba.org
Fri May 26 00:12:53 GMT 2006
Author: jra
Date: 2006-05-26 00:12:52 +0000 (Fri, 26 May 2006)
New Revision: 15894
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15894
Log:
Ensure all new rid allocation goes through
the same function (deals with races).
Jeremy.
Modified:
trunk/source/passdb/pdb_ldap.c
Changeset:
Modified: trunk/source/passdb/pdb_ldap.c
===================================================================
--- trunk/source/passdb/pdb_ldap.c 2006-05-25 21:04:29 UTC (rev 15893)
+++ trunk/source/passdb/pdb_ldap.c 2006-05-26 00:12:52 UTC (rev 15894)
@@ -4439,7 +4439,7 @@
return status;
}
-static BOOL ldapsam_new_rid(struct pdb_methods *methods, uint32 *rid)
+static NTSTATUS ldapsam_new_rid_internal(struct pdb_methods *methods, uint32 *rid)
{
int i;
@@ -4447,20 +4447,26 @@
NTSTATUS result = ldapsam_get_new_rid(methods->private_data,
rid);
if (NT_STATUS_IS_OK(result)) {
- return True;
+ return result;
}
if (!NT_STATUS_EQUAL(result, NT_STATUS_ACCESS_DENIED)) {
- return False;
+ return result;
}
/* The ldap update failed (maybe a race condition), retry */
}
/* Tried 10 times, fail. */
- return False;
+ return NT_STATUS_ACCESS_DENIED;
}
+static BOOL ldapsam_new_rid(struct pdb_methods *methods, uint32 *rid)
+{
+ NTSTATUS result = ldapsam_new_rid_internal(methods, rid);
+ return NT_STATUS_IS_OK(result) ? True : False;
+}
+
static BOOL ldapsam_sid_to_id(struct pdb_methods *methods,
const DOM_SID *sid,
union unid_t *id, enum SID_NAME_USE *type)
@@ -4645,7 +4651,7 @@
}
/* Create the basic samu structure and generate the mods for the ldap commit */
- if (!NT_STATUS_IS_OK((ret = ldapsam_get_new_rid(ldap_state, rid)))) {
+ if (!NT_STATUS_IS_OK((ret = ldapsam_new_rid_internal(my_methods, rid)))) {
DEBUG(1, ("ldapsam_create_user: Could not allocate a new RID\n"));
return ret;
}
@@ -4934,7 +4940,7 @@
smbldap_set_mod(&mods, LDAP_MOD_ADD, "gidNumber", gidstr);
}
- if (!NT_STATUS_IS_OK((ret = ldapsam_get_new_rid(ldap_state, rid)))) {
+ if (!NT_STATUS_IS_OK((ret = ldapsam_new_rid_internal(my_methods, rid)))) {
DEBUG(1, ("ldapsam_create_group: Could not allocate a new RID\n"));
return ret;
}
More information about the samba-cvs
mailing list