diff options
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_pack.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_pack.c b/source4/lib/ldb/ldb_tdb/ldb_pack.c index c6edf663ae..b2a004b99f 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_pack.c +++ b/source4/lib/ldb/ldb_tdb/ldb_pack.c @@ -155,6 +155,16 @@ int ltdb_pack_data(struct ldb_module *module, return 0; } +/* using this means we can compile standalone on broken systems like + MacOSX 10.4 */ +static size_t ldb_strnlen(const char *s, size_t n) +{ + int i; + for (i=0; s[i] && i<n; i++) + /* noop */ ; + return i; +} + /* unpack a ldb message from a linear buffer in TDB_DATA @@ -191,7 +201,7 @@ int ltdb_unpack_data(struct ldb_module *module, break; case LTDB_PACKING_FORMAT: - len = strnlen((char *)p, remaining); + len = ldb_strnlen((char *)p, remaining); if (len == remaining) { errno = EIO; goto failed; @@ -234,7 +244,7 @@ int ltdb_unpack_data(struct ldb_module *module, errno = EIO; goto failed; } - len = strnlen((char *)p, remaining-6); + len = ldb_strnlen((char *)p, remaining-6); if (len == remaining-6) { errno = EIO; goto failed; |