Windows: correct "fs quota" pioctl validation check
authorJeffrey Altman <jaltman@your-file-system.com>
Sun, 2 May 2010 13:21:48 +0000 (09:21 -0400)
committerJeffrey Altman <jaltman@openafs.org>
Sun, 2 May 2010 17:40:04 +0000 (10:40 -0700)
The validation check for the response from the GetVolumeStatus
pioctl is incorrect.  The response is not simply a VolumeStatus
structure but also several C strings appended to it.

LICENSE MIT

Change-Id: Ieb0c0cd166f85e073431890f51f735958776eb74
Reviewed-on: http://gerrit.openafs.org/1883
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

src/WINNT/afsd/fs.c

index fd9d915..340c34d 100644 (file)
@@ -1891,12 +1891,16 @@ QuotaCmd(struct cmd_syndesc *as, void *arock)
        blob.in_size = 0;
        blob.out = space;
        code = pioctl_utf8(ti->data, VIOCGETVOLSTAT, &blob, 1);
-       if (code || blob.out_size != sizeof(*status)) {
+        /*
+         * The response is VolumeStatus, volume name, offline message, and motd
+         */
+       if (code || blob.out_size < sizeof(*status)) {
            Die(errno, ti->data);
             error = 1;
            continue;
        }
-       status = (VolumeStatus *)space;
+
+        status = (VolumeStatus *)space;
        if (status->MaxQuota) 
             quotaPct = ((((double)status->BlocksInUse)/status->MaxQuota) * 100.0);
        else