From e49534debf728e8a07c6eca457c47d67e617e3d2 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Fri, 8 Oct 2010 08:21:33 -0400 Subject: Make sdap_save_users_send handle zero users gracefully If we send a zero num_users value, we should just immediately return success, rather than starting a useless transaction --- src/providers/ldap/sdap_async_accounts.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/providers/ldap/sdap_async_accounts.c b/src/providers/ldap/sdap_async_accounts.c index 0b739c467..55e392ee5 100644 --- a/src/providers/ldap/sdap_async_accounts.c +++ b/src/providers/ldap/sdap_async_accounts.c @@ -381,6 +381,15 @@ struct tevent_req *sdap_save_users_send(TALLOC_CTX *memctx, state->handle = NULL; state->higher_timestamp = NULL; + if (num_users == 0) { + /* Nothing to do if there are no + * users + */ + tevent_req_done(req); + tevent_req_post(req, ev); + return req; + } + subreq = sysdb_transaction_send(state, state->ev, state->sysdb); if (!subreq) { tevent_req_error(req, ENOMEM); -- cgit