dbwrap: use DBWRAP_LOCK_ORDER_VALID() in db_open()
authorMichael Adam <obnox@samba.org>
Tue, 28 Jan 2014 10:58:05 +0000 (11:58 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 7 Feb 2014 17:05:51 +0000 (18:05 +0100)
instead of the hand written test.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Feb  7 18:05:51 CET 2014 on sn-devel-104

source3/lib/dbwrap/dbwrap_open.c

index ee5ec749831308557262cef9cdecf8a145836abb..3c8756b0bcef978ac898a7536fe65a4dc7427dc3 100644 (file)
@@ -68,15 +68,7 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
        const char *sockname;
 #endif
 
-       switch (lock_order) {
-       case DBWRAP_LOCK_ORDER_1:
-       case DBWRAP_LOCK_ORDER_2:
-       case DBWRAP_LOCK_ORDER_3:
-               break;
-       default:
-               /*
-                * Only allow the 3 levels ctdb gives us.
-                */
+       if (!DBWRAP_LOCK_ORDER_VALID(lock_order)) {
                errno = EINVAL;
                return NULL;
        }