summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-09-06 22:43:21 +0000
committerJeremy Allison <jra@samba.org>2001-09-06 22:43:21 +0000
commit83ebf2b6b282926930dc2c5dee3b5f18447d6e81 (patch)
tree8ce4ca96b3f18fa7be87b8b42b26d0e998c384b9 /source3/smbd
parent9a9ac2739bbdc993ecdfa78298bdd9c059328378 (diff)
downloadsamba-83ebf2b6b282926930dc2c5dee3b5f18447d6e81.tar.gz
samba-83ebf2b6b282926930dc2c5dee3b5f18447d6e81.tar.bz2
samba-83ebf2b6b282926930dc2c5dee3b5f18447d6e81.zip
Fix the 62bit locking onto 32 bit NFS mounts problem generically for HPUX.
Don. please check this out. Jeremy. (This used to be commit ce9f95996498f7795aaef069e1443ea1c7d524b3)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/reply.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 2af1f62356..26bd0b4714 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -4042,6 +4042,38 @@ SMB_BIG_UINT get_lock_count( char *data, int data_offset, BOOL large_file_format
}
/****************************************************************************
+ Pathetically try and map a 64 bit lock offset into 31 bits. I hate Windows :-).
+****************************************************************************/
+
+static uint32 map_lock_offset(uint32 high, uint32 low)
+{
+ unsigned int i;
+ uint32 mask = 0;
+ uint32 highcopy = high;
+
+ /*
+ * Try and find out how many significant bits there are in high.
+ */
+
+ for(i = 0; highcopy; i++)
+ highcopy >>= 1;
+
+ /*
+ * We use 31 bits not 32 here as POSIX
+ * lock offsets may not be negative.
+ */
+
+ mask = (~0) << (31 - i);
+
+ if(low & mask)
+ return 0; /* Fail. */
+
+ high <<= (31 - i);
+
+ return (high|low);
+}
+
+/****************************************************************************
Get a lock offset, dealing with large offset requests.
****************************************************************************/