Author: tridge Date: 2006-09-14 18:50:12 +0000 (Thu, 14 Sep 2006) New Revision: 18536
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18536 Log: fixed the loading of external binary files from ldif into ldb Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_ldif.c branches/SAMBA_4_0/source/lib/ldb/tests/test-generic.sh Changeset: Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_ldif.c =================================================================== --- branches/SAMBA_4_0/source/lib/ldb/common/ldb_ldif.c 2006-09-14 18:46:10 UTC (rev 18535) +++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_ldif.c 2006-09-14 18:50:12 UTC (rev 18536) @@ -50,8 +50,14 @@ int count, size, bytes; int ret; int f; + const char *fname = (const char *)value->data; - f = open((const char *)value->data, O_RDONLY); + if (strncmp(fname, "file://", 7) != 0) { + return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX; + } + fname += 7; + + f = open(fname, O_RDONLY); if (f == -1) { return -1; } Modified: branches/SAMBA_4_0/source/lib/ldb/tests/test-generic.sh =================================================================== --- branches/SAMBA_4_0/source/lib/ldb/tests/test-generic.sh 2006-09-14 18:46:10 UTC (rev 18535) +++ branches/SAMBA_4_0/source/lib/ldb/tests/test-generic.sh 2006-09-14 18:50:12 UTC (rev 18536) @@ -73,9 +73,12 @@ echo "Testing binary file attribute value" cp $LDBDIR/tests/samba4.png tests/tmp/samba4.png -#$VALGRIND ldbmodify $LDBDIR/tests/photo.ldif || exit 1 -#exit 1 -#$VALGRIND ldbsearch '(cn=Hampster Ursula)' jpegPhoto +$VALGRIND ldbmodify $LDBDIR/tests/photo.ldif || exit 1 +count=`$VALGRIND ldbsearch '(cn=Hampster Ursula)' jpegPhoto || grep '^dn' | wc -l` +if [ $count != 1 ]; then + echo returned $count records - expected 1 + exit 1 +fi rm -f tests/tmp/samba4.png echo "*TODO* Testing UTF8 upper lower case searches !!"