1 #
   2 # CDDL HEADER START
   3 #
   4 # The contents of this file are subject to the terms of the
   5 # Common Development and Distribution License (the "License").
   6 # You may not use this file except in compliance with the License.
   7 #
   8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9 # or http://www.opensolaris.org/os/licensing.
  10 # See the License for the specific language governing permissions
  11 # and limitations under the License.
  12 #
  13 # When distributing Covered Code, include this CDDL HEADER in each
  14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15 # If applicable, add the following below this CDDL HEADER, with the
  16 # fields enclosed by brackets "[]" replaced with your own identifying
  17 # information: Portions Copyright [yyyy] [name of copyright owner]
  18 #
  19 # CDDL HEADER END
  20 #
  21 
  22 #
  23 # Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  24 # Use is subject to license terms.
  25 #
  26 # NFSv4 SECINFO operation test - negative tests
  27 #       Verify server returns correct errors with negative requests.
  28 
  29 # include all test enironment
  30 source SECINFO.env
  31 
  32 # connect to the test server
  33 Connect
  34 
  35 # setting local variables
  36 set TNAME $argv0
  37 set bfh [get_fh $BASEDIRS]
  38 
  39 # Start testing
  40 # --------------------------------------------------------------
  41 # a: Secinfo without Putrootfh, expect NOFILEHANDLE
  42 set expcode "NOFILEHANDLE"
  43 set ASSERTION "Secinfo without Putrootfh, expect $expcode"
  44 putmsg stdout 0 "$TNAME{a}: $ASSERTION"
  45 set res [compound {Secinfo $env(DIR0777)}]
  46 ckres "Secinfo" $status $expcode $res $PASS
  47 
  48 
  49 # b: Secinfo an obj under dir_noperm, expect ACCESS
  50 set expcode "ACCESS"
  51 set ASSERTION "Secinfo an obj under dir_noperm, expect $expcode"
  52 putmsg stdout 0 "$TNAME{b}: $ASSERTION"
  53 compound {Putfh $bfh; Lookup $env(DNOPERM); Secinfo $env(RWFILE)}
  54 ckres "Secinfo" $status $expcode $res $PASS
  55 
  56 
  57 # c: Secinfo with a Bad-FH, expect BADHANDLE
  58 set expcode "BADHANDLE"
  59 set ASSERTION "Secinfo with a Bad-FH, expect $expcode"
  60 #putmsg stdout 0 "$TNAME{c}: $ASSERTION"
  61 #set res [compound {Secinfo $env(DIR0777)}]
  62 #ckres "Secinfo" $status $expcode $res $PASS
  63 #puts "\t Test UNTESTED: XXX Need server hook to set Bad-FH for this test.\n"
  64 
  65 
  66 # d: Secinfo '.', expect INVAL|NOENT
  67 set expcode "INVAL|NOENT"
  68 set ASSERTION "Secinfo '.', expect $expcode"
  69 putmsg stdout 0 "$TNAME{d}: $ASSERTION"
  70 set res [compound {Putfh $bfh; Secinfo "."; Getfh}]
  71 ckres "Secinfo" $status $expcode $res $PASS
  72 
  73 
  74 # f: Secinfo with zero length component, expect INVAL
  75 set expcode "INVAL"
  76 set ASSERTION "Secinfo with zero length component, expect $expcode"
  77 putmsg stdout 0 "$TNAME{f}: $ASSERTION"
  78 set res [compound {Putfh $bfh; Secinfo ""; Getfh}]
  79 ckres "Secinfo" $status $expcode $res $PASS
  80 
  81 
  82 # g: Secinfo w/name includes path delimiter, expect INVAL|NOENT
  83 set expcode "INVAL|NOENT"
  84 set ASSERTION "Secinfo w/name include path delimiter, expect $expcode"
  85 putmsg stdout 0 "$TNAME{g}: $ASSERTION"
  86 set res [compound {Putfh $bfh; Secinfo "XX${DELM}xx"}]
  87 ckres "Secinfo" $status $expcode $res $PASS
  88 
  89 
  90 # m: try to Secinfo while dir is removed, expect STALE
  91 set expcode "STALE"
  92 set ASSERTION "try to Secinfo while dir is removed, expect $expcode"
  93 #putmsg stdout 0 "$TNAME{m}: $ASSERTION"
  94 #puts "\t Test UNTESTED: XXX Need different thread to remove <cfh> in server.\n"
  95 
  96 
  97 # --------------------------------------------------------------
  98 # disconnect and exit
  99 Disconnect
 100 exit $PASS