s3:libsmb: make use of BVAL() and remove ugly LARGE_SMB_OFF_T ifdef's
authorStefan Metzmacher <metze@samba.org>
Sat, 23 Apr 2011 08:22:32 +0000 (10:22 +0200)
committerStefan Metzmacher <metze@samba.org>
Sat, 23 Apr 2011 08:37:49 +0000 (10:37 +0200)
We rely on uint64_t for a long time now...

metze

source3/libsmb/cliquota.c

index e05b64e686b8ff5854f4e3f044a41c83b473dbeb..e5c8c831b739480a0ac5afb212a9b63bc776e8ee 100644 (file)
@@ -80,43 +80,13 @@ static bool parse_user_quota_record(const uint8_t *rdata,
         */
 
        /* the used space 8 bytes (uint64_t)*/
         */
 
        /* the used space 8 bytes (uint64_t)*/
-       qt.usedspace = (uint64_t)IVAL(rdata,16);
-#ifdef LARGE_SMB_OFF_T
-       qt.usedspace |= (((uint64_t)IVAL(rdata,20)) << 32);
-#else /* LARGE_SMB_OFF_T */
-       if ((IVAL(rdata,20) != 0)&&
-               ((qt.usedspace != 0xFFFFFFFF)||
-                (IVAL(rdata,20)!=0xFFFFFFFF))) {
-               /* more than 32 bits? */
-               return False;
-       }
-#endif /* LARGE_SMB_OFF_T */
+       qt.usedspace = BVAL(rdata,16);
 
        /* the soft quotas 8 bytes (uint64_t)*/
 
        /* the soft quotas 8 bytes (uint64_t)*/
-       qt.softlim = (uint64_t)IVAL(rdata,24);
-#ifdef LARGE_SMB_OFF_T
-       qt.softlim |= (((uint64_t)IVAL(rdata,28)) << 32);
-#else /* LARGE_SMB_OFF_T */
-       if ((IVAL(rdata,28) != 0)&&
-               ((qt.softlim != 0xFFFFFFFF)||
-                (IVAL(rdata,28)!=0xFFFFFFFF))) {
-               /* more than 32 bits? */
-               return False;
-       }
-#endif /* LARGE_SMB_OFF_T */
+       qt.softlim = BVAL(rdata,24);
 
        /* the hard quotas 8 bytes (uint64_t)*/
 
        /* the hard quotas 8 bytes (uint64_t)*/
-       qt.hardlim = (uint64_t)IVAL(rdata,32);
-#ifdef LARGE_SMB_OFF_T
-       qt.hardlim |= (((uint64_t)IVAL(rdata,36)) << 32);
-#else /* LARGE_SMB_OFF_T */
-       if ((IVAL(rdata,36) != 0)&&
-               ((qt.hardlim != 0xFFFFFFFF)||
-                (IVAL(rdata,36)!=0xFFFFFFFF))) {
-               /* more than 32 bits? */
-               return False;
-       }
-#endif /* LARGE_SMB_OFF_T */
+       qt.hardlim = BVAL(rdata,32);
 
        if (!sid_parse((char *)rdata+40,sid_len,&qt.sid)) {
                return false;
 
        if (!sid_parse((char *)rdata+40,sid_len,&qt.sid)) {
                return false;
@@ -421,32 +391,10 @@ NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
        /* unknown_1 24 NULL bytes in pdata*/
 
        /* the soft quotas 8 bytes (uint64_t)*/
        /* unknown_1 24 NULL bytes in pdata*/
 
        /* the soft quotas 8 bytes (uint64_t)*/
-       qt.softlim = (uint64_t)IVAL(rdata,24);
-#ifdef LARGE_SMB_OFF_T
-       qt.softlim |= (((uint64_t)IVAL(rdata,28)) << 32);
-#else /* LARGE_SMB_OFF_T */
-       if ((IVAL(rdata,28) != 0)&&
-               ((qt.softlim != 0xFFFFFFFF)||
-                (IVAL(rdata,28)!=0xFFFFFFFF))) {
-               /* more than 32 bits? */
-               status = NT_STATUS_INVALID_NETWORK_RESPONSE;
-               goto cleanup;
-       }
-#endif /* LARGE_SMB_OFF_T */
+       qt.softlim = BVAL(rdata,24);
 
        /* the hard quotas 8 bytes (uint64_t)*/
 
        /* the hard quotas 8 bytes (uint64_t)*/
-       qt.hardlim = (uint64_t)IVAL(rdata,32);
-#ifdef LARGE_SMB_OFF_T
-       qt.hardlim |= (((uint64_t)IVAL(rdata,36)) << 32);
-#else /* LARGE_SMB_OFF_T */
-       if ((IVAL(rdata,36) != 0)&&
-               ((qt.hardlim != 0xFFFFFFFF)||
-                (IVAL(rdata,36)!=0xFFFFFFFF))) {
-               /* more than 32 bits? */
-               status = NT_STATUS_INVALID_NETWORK_RESPONSE;
-               goto cleanup;
-       }
-#endif /* LARGE_SMB_OFF_T */
+       qt.hardlim = BVAL(rdata,32);
 
        /* quota_flags 2 bytes **/
        qt.qflags = SVAL(rdata,40);
 
        /* quota_flags 2 bytes **/
        qt.qflags = SVAL(rdata,40);