openbsd-ports/security/heimdal/patches/patch-lib_sqlite_sqlite3_c
ajacoutot 4308a01205 Import heimdal-1.5.3; aka resurrect security/heimdal.
Heimdal is an implementation of Kerberos 5 (and some more stuff) largely
written in Sweden.

ok sthen@

Note that it is not enabled yet because none of the requesters for this
port stood up to give me any feedback nor OK. Also this is still a WIP, it
may not even build with all the recent changes in base.
2014-07-13 14:10:13 +00:00

20 lines
780 B
Plaintext

$OpenBSD: patch-lib_sqlite_sqlite3_c,v 1.1 2014/07/13 14:10:14 ajacoutot Exp $
Use HAVE_ARC4RANDOM and choose to call arc4random() instead of srand()
and rand() and friends.
--- lib/sqlite/sqlite3.c.orig Sun Dec 9 23:06:44 2012
+++ lib/sqlite/sqlite3.c Thu Apr 24 14:16:00 2014
@@ -27259,7 +27259,11 @@ static int afpLock(sqlite3_file *id, int eFileLock){
mask = (sizeof(long)==8) ? LARGEST_INT64 : 0x7fffffff;
/* Now get the read-lock SHARED_LOCK */
/* note that the quality of the randomness doesn't matter that much */
+#ifdef HAVE_ARC4RANDOM
+ lk = arc4random();
+#else
lk = random();
+#endif
pInode->sharedByte = (lk & mask)%(SHARED_SIZE - 1);
lrc1 = afpSetLock(context->dbPath, pFile,
SHARED_FIRST+pInode->sharedByte, 1, 1);