diff options
author | Michael Adam <obnox@samba.org> | 2009-07-08 16:13:07 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2009-07-15 14:01:39 +0200 |
commit | 3b3125fc23dc4b7a403d17af2ad2d5c592d3d090 (patch) | |
tree | 97879e0b5dc78e52bfbb6e0dca191f971d9e1040 /source3 | |
parent | 32a3275344819cfcbcb4540a1909617b8db6dc63 (diff) | |
download | samba-3b3125fc23dc4b7a403d17af2ad2d5c592d3d090.tar.gz samba-3b3125fc23dc4b7a403d17af2ad2d5c592d3d090.tar.bz2 samba-3b3125fc23dc4b7a403d17af2ad2d5c592d3d090.zip |
s3:dbwrap: add dbwrap_fetch_bystring_upper().
To fetch a key whose name is stored but not given in upper case.
Michael
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/proto.h | 2 | ||||
-rw-r--r-- | source3/lib/dbwrap_util.c | 17 |
2 files changed, 19 insertions, 0 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 81892f294d..56bffd5ce7 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -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 */ diff --git a/source3/lib/dbwrap_util.c b/source3/lib/dbwrap_util.c index 154bf6b553..01c18439c3 100644 --- a/source3/lib/dbwrap_util.c +++ b/source3/lib/dbwrap_util.c @@ -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; +} |