Make DAFS 'bos salvage' work in restricted mode
authorAndrew Deason <adeason@sinenomine.net>
Wed, 30 Dec 2009 16:44:39 +0000 (11:44 -0500)
committerDerrick Brashear <shadow|account-1000005@unknown>
Thu, 31 Dec 2009 12:56:10 +0000 (04:56 -0800)
bosserver currently has code to specifically allow 'bos
salvage'-initiated salvages to run when in restricted mode. This only
specifically tests for running salvager, though, and so fails when 'bos
salvage' is run against a DAFS fileserver and tries to run
'salvageserver -client' instead.

Test for 'salvageserver -client' as well, so we can run 'bos salvage'
for DAFS fileservers in restricted mode.

Change-Id: I27052a440ea8d6347a9d86e4a1f1a7131a277b0b
Reviewed-on: http://gerrit.openafs.org/1048
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/bozo/bosoprocs.c

index 66e10f5..90e9350 100644 (file)
@@ -775,10 +775,16 @@ SBOZO_CreateBnode(struct rx_call *acall, char *atype, char *ainstance,
        goto fail;
     }
     if (bozo_isrestricted) {
+       const char *salvpath = AFSDIR_CANONICAL_SERVER_SALVAGER_FILEPATH;
+       /* for DAFS, 'bos salvage' will pass "salvageserver -client" instead */
+       const char *salsrvpath = AFSDIR_CANONICAL_SERVER_SALSRV_FILEPATH " -client ";
+
+       /* still allow 'bos salvage' to work */
        if (strcmp(atype, "cron") || strcmp(ainstance, "salvage-tmp")
            || strcmp(ap2, "now")
-           || strncmp(ap1, AFSDIR_CANONICAL_SERVER_SALVAGER_FILEPATH,
-                      strlen(AFSDIR_CANONICAL_SERVER_SALVAGER_FILEPATH))) {
+           || (strncmp(ap1, salvpath, strlen(salvpath))
+               && strncmp(ap1, salsrvpath, strlen(salsrvpath)))) {
+
            code = BZACCESS;
            goto fail;
        }