From 83ebf2b6b282926930dc2c5dee3b5f18447d6e81 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 6 Sep 2001 22:43:21 +0000 Subject: 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) --- source3/smbd/reply.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'source3/smbd') 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 @@ -4041,6 +4041,38 @@ SMB_BIG_UINT get_lock_count( char *data, int data_offset, BOOL large_file_format return count; } +/**************************************************************************** + 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. ****************************************************************************/ -- cgit