Author: idra
Date: 2005-08-18 10:23:53 +0000 (Thu, 18 Aug 2005)
New Revision: 9385

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9385

Log:

Remove unused functions


Modified:
   branches/SAMBA_4_0/source/dsdb/samdb/samdb.c


Changeset:
Modified: branches/SAMBA_4_0/source/dsdb/samdb/samdb.c
===================================================================
--- branches/SAMBA_4_0/source/dsdb/samdb/samdb.c        2005-08-18 10:12:55 UTC 
(rev 9384)
+++ branches/SAMBA_4_0/source/dsdb/samdb/samdb.c        2005-08-18 10:23:53 UTC 
(rev 9385)
@@ -656,103 +656,6 @@
 
 
 /*
-  allocate a new id, attempting to do it atomically
-  return 0 on failure, the id on success
-*/
-static NTSTATUS _samdb_allocate_next_id(struct ldb_context *sam_ldb, 
TALLOC_CTX *mem_ctx, const char *dn, 
-                                       const char *attr, uint32_t *id)
-{
-       struct ldb_message msg;
-       int ret;
-       const char *str;
-       struct ldb_val vals[2];
-       struct ldb_message_element els[2];
-
-       str = samdb_search_string(sam_ldb, mem_ctx, dn, attr, "dn=%s", dn);
-       if (!str) {
-               DEBUG(1,("id not found at %s %s\n", dn, attr));
-               return NT_STATUS_OBJECT_NAME_INVALID;
-       }
-
-       *id = strtol(str, NULL, 0);
-       if ((*id)+1 == 0) {
-               /* out of IDs ! */
-               return NT_STATUS_INSUFFICIENT_RESOURCES;
-       }
-
-       /* we do a delete and add as a single operation. That prevents
-          a race */
-       ZERO_STRUCT(msg);
-       msg.dn = talloc_strdup(mem_ctx, dn);
-       if (!msg.dn) {
-               return NT_STATUS_NO_MEMORY;
-       }
-       msg.num_elements = 2;
-       msg.elements = els;
-
-       els[0].num_values = 1;
-       els[0].values = &vals[0];
-       els[0].flags = LDB_FLAG_MOD_DELETE;
-       els[0].name = talloc_strdup(mem_ctx, attr);
-       if (!els[0].name) {
-               return NT_STATUS_NO_MEMORY;
-       }
-
-       els[1].num_values = 1;
-       els[1].values = &vals[1];
-       els[1].flags = LDB_FLAG_MOD_ADD;
-       els[1].name = els[0].name;
-
-       vals[0].data = (uint8_t *)talloc_asprintf(mem_ctx, "%u", *id);
-       if (!vals[0].data) {
-               return NT_STATUS_NO_MEMORY;
-       }
-       vals[0].length = strlen((const char *)vals[0].data);
-
-       vals[1].data =  (uint8_t *)talloc_asprintf(mem_ctx, "%u", (*id)+1);
-       if (!vals[1].data) {
-               return NT_STATUS_NO_MEMORY;
-       }
-       vals[1].length = strlen((const char *)vals[1].data);
-
-       ret = ldb_modify(sam_ldb, &msg);
-       if (ret != 0) {
-               return NT_STATUS_UNEXPECTED_IO_ERROR;
-       }
-
-       (*id)++;
-
-       return NT_STATUS_OK;
-}
-
-/*
-  allocate a new id, attempting to do it atomically
-  return 0 on failure, the id on success
-*/
-NTSTATUS samdb_allocate_next_id(struct ldb_context *sam_ldb, TALLOC_CTX 
*mem_ctx, const char *dn, const char *attr,
-                               uint32_t *id)
-{
-       int tries = 10;
-       NTSTATUS status;
-
-       /* we need to try multiple times to cope with two account
-          creations at the same time */
-       while (tries--) {
-               status = _samdb_allocate_next_id(sam_ldb, mem_ctx, dn, attr, 
id);
-               if (!NT_STATUS_EQUAL(NT_STATUS_UNEXPECTED_IO_ERROR, status)) {
-                       break;
-               }
-       }
-
-       if (NT_STATUS_EQUAL(NT_STATUS_UNEXPECTED_IO_ERROR, status)) {
-               DEBUG(1,("Failed to increment id %s at %s\n", attr, dn));
-       }
-
-       return status;
-}
-
-
-/*
   add a string element to a message
 */
 int samdb_msg_add_string(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, 
struct ldb_message *msg,

Reply via email to