diff options
author | Volker Lendecke <vl@samba.org> | 2009-12-03 18:43:49 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2010-02-12 23:12:10 +0100 |
commit | ebc08b9938a4d266be16ca7e06d27813952cd00f (patch) | |
tree | 5f00401b0046d7ff362e5cca39a5256fcd67c1b1 /lib/util | |
parent | a035062f11f831875e397b16e0e4c6e2d7ba5c76 (diff) | |
download | samba-ebc08b9938a4d266be16ca7e06d27813952cd00f.tar.gz samba-ebc08b9938a4d266be16ca7e06d27813952cd00f.tar.bz2 samba-ebc08b9938a4d266be16ca7e06d27813952cd00f.zip |
s3: Add tdb_data_equal
Diffstat (limited to 'lib/util')
-rw-r--r-- | lib/util/util_tdb.c | 8 | ||||
-rw-r--r-- | lib/util/util_tdb.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/util/util_tdb.c b/lib/util/util_tdb.c index cda8dc75b2..46dbf6d324 100644 --- a/lib/util/util_tdb.c +++ b/lib/util/util_tdb.c @@ -38,6 +38,14 @@ TDB_DATA make_tdb_data(const uint8_t *dptr, size_t dsize) return ret; } +bool tdb_data_equal(TDB_DATA t1, TDB_DATA t2) +{ + if (t1.dsize != t2.dsize) { + return false; + } + return (memcmp(t1.dptr, t2.dptr, t1.dsize) == 0); +} + TDB_DATA string_tdb_data(const char *string) { return make_tdb_data((const uint8_t *)string, string ? strlen(string) : 0 ); diff --git a/lib/util/util_tdb.h b/lib/util/util_tdb.h index da6378ee6a..79c46714f9 100644 --- a/lib/util/util_tdb.h +++ b/lib/util/util_tdb.h @@ -6,6 +6,7 @@ Make a TDB_DATA and keep the const warning in one place ****************************************************************/ TDB_DATA make_tdb_data(const uint8_t *dptr, size_t dsize); +bool tdb_data_equal(TDB_DATA t1, TDB_DATA t2); TDB_DATA string_tdb_data(const char *string); TDB_DATA string_term_tdb_data(const char *string); |