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, 10 Mar 2010 12:21:45 +0000 (13:21 +0100)
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 7a1b4905e1a585af8195fb5c7b399ed16d1885a1..6fce6a895d748c7076e482431d2d8942551894bf 100644 (file)
@@ -464,6 +464,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 929eb12ea9c9bd619b0bcae948a2476b4297f726..3b4cc69aecbdba63de5677f1ffb61de4555b51e8 100644 (file)
@@ -375,3 +375,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;
+}