From 19285c0d37065cdc998e9ce6b1861e4dd165ebe1 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek@redhat.com>
Date: Wed, 15 Jul 2009 12:43:08 +0200
Subject: [PATCH] Fix saving new nextID

---
 server/db/sysdb_ops.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/server/db/sysdb_ops.c b/server/db/sysdb_ops.c
index ad4a63e..8e566aa 100644
--- a/server/db/sysdb_ops.c
+++ b/server/db/sysdb_ops.c
@@ -1448,7 +1448,16 @@ static void sysdb_get_new_id_verify(struct tevent_req *subreq)
         tevent_req_error(req, ENOMEM);
         return;
     }
-    msg->dn = state->base->dn;
+
+    if (state->base) {
+        msg->dn = state->base->dn;
+    } else {
+        msg->dn = sysdb_domain_dn(state->handle->ctx, state, state->domain->name);
+        if(!msg->dn) {
+            tevent_req_error(req, ENOMEM);
+            return;
+        }
+    }
 
     ret = add_ulong(msg, LDB_FLAG_MOD_REPLACE,
                     SYSDB_NEXTID, state->new_id + 1);
-- 
1.6.2.5

