]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
DAFS: fssync online requires a partition name argument
authorMichael Meffie <mmeffie@sinenomine.net>
Thu, 13 Oct 2011 16:23:35 +0000 (12:23 -0400)
committerDerrick Brashear <shadow@dementix.org>
Wed, 26 Oct 2011 22:55:43 +0000 (15:55 -0700)
fssync-debug online silently fails when run without a partition name.
Check for the required partition name on the server side and the client
side.  Report errors back to the client when the server side fails to
pre-attach the volume.

Reviewed-on: http://gerrit.openafs.org/5615
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit d171a5e059566cc99c5dd980039dd56233f91a67)

Change-Id: Id8776c71cd1712ecb779c76565cfb9e685e54a19
Reviewed-on: http://gerrit.openafs.org/5721
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: Derrick Brashear <shadow@dementix.org>
src/vol/fssync-debug.c
src/vol/fssync-server.c

index fcedca899f6d441d777b46a65484b8dee35a2973..95f5818a99e2e86a80b6f5921200f604d3c4ec56 100644 (file)
@@ -456,6 +456,10 @@ VolOnline(struct cmd_syndesc * as, void * rock)
     common_prolog(as, &state);
     common_volop_prolog(as, &state);
 
+    if (state.vop->partName==0 || *(state.vop->partName)==0) {
+       fprintf(stderr, "required argument -partition not given\n");
+       return -1;
+    }
     do_volop(&state, FSYNC_VOL_ON, NULL);
 
     return 0;
index f456afd022ccb016a000066e4ad92572fe65bcba..caa1efc25a3e635af12622c302e92cf0afcb254e 100644 (file)
@@ -691,6 +691,7 @@ FSYNC_com_VolOn(FSSYNC_VolOp_command * vcom, SYNC_response * res)
     Volume * vp;
     Error error;
 
+    /* Verify the partition name is null terminated. */
     if (SYNC_verifyProtocolString(vcom->vop->partName, sizeof(vcom->vop->partName))) {
        res->hdr.reason = SYNC_REASON_MALFORMED_PACKET;
        code = SYNC_FAILED;
@@ -700,6 +701,13 @@ FSYNC_com_VolOn(FSSYNC_VolOp_command * vcom, SYNC_response * res)
     /* so, we need to attach the volume */
 
 #ifdef AFS_DEMAND_ATTACH_FS
+    /* Verify the partition name is not empty. */
+    if (*vcom->vop->partName == 0) {
+       res->hdr.reason = FSYNC_BAD_PART;
+       code = SYNC_FAILED;
+       goto done;
+    }
+
     /* check DAFS permissions */
     vp = VLookupVolume_r(&error, vcom->vop->volume, NULL);
     if (vp &&
@@ -780,11 +788,11 @@ FSYNC_com_VolOn(FSSYNC_VolOp_command * vcom, SYNC_response * res)
                               V_VOLUPD);
     if (vp)
        VPutVolume_r(vp);
+#endif /* !AFS_DEMAND_ATTACH_FS */
     if (error) {
        code = SYNC_DENIED;
        res->hdr.reason = error;
     }
-#endif /* !AFS_DEMAND_ATTACH_FS */
 
  done:
     return code;