s3:dbwrap: add dbwrap_fetch_bystring_upper().
authorMichael Adam <obnox@samba.org>
Wed, 8 Jul 2009 14:13:07 +0000 (16:13 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 15 Jul 2009 12:01:39 +0000 (14:01 +0200)
To fetch a key whose name is stored but not given in upper case.

Michael

source3/include/proto.h
source3/lib/dbwrap_util.c

index 81892f294d2fba649568f1a107b58a56fb2cede0..56bffd5ce703d39efaa1ffc244b03718bb4a1c55 100644 (file)
@@ -460,6 +460,8 @@ NTSTATUS dbwrap_trans_do(struct db_context *db,
 NTSTATUS dbwrap_delete_bystring_upper(struct db_context *db, const char *key);
 NTSTATUS dbwrap_store_bystring_upper(struct db_context *db, const char *key,
                                     TDB_DATA data, int flags);
+TDB_DATA dbwrap_fetch_bystring_upper(struct db_context *db, TALLOC_CTX *mem_ctx,
+                                    const char *key);
 
 /* The following definitions come from lib/debug.c  */
 
index 154bf6b553160e5d1072ad0c17b33192ad8553ef..01c18439c3e83607e144a12b8ec9c4ec6dae2ecf 100644 (file)
@@ -373,3 +373,20 @@ NTSTATUS dbwrap_store_bystring_upper(struct db_context *db, const char *key,
        talloc_free(key_upper);
        return status;
 }
+
+TDB_DATA dbwrap_fetch_bystring_upper(struct db_context *db, TALLOC_CTX *mem_ctx,
+                                    const char *key)
+{
+       char *key_upper;
+       TDB_DATA result;
+
+       key_upper = talloc_strdup_upper(talloc_tos(), key);
+       if (key_upper == NULL) {
+               return make_tdb_data(NULL, 0);
+       }
+
+       result = dbwrap_fetch_bystring(db, mem_ctx, key_upper);
+
+       talloc_free(key_upper);
+       return result;
+}