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 - more of negative tests
  27 
  28 # include all test enironment
  29 source SECINFO.env
  30 
  31 # connect to the test server
  32 Connect
  33 
  34 # setting local variables
  35 set TNAME $argv0
  36 set bfh [get_fh "$BASEDIRS"]
  37 
  38 
  39 # Start testing
  40 # --------------------------------------------------------------
  41 # a: Secinfo with 'name' not exist, expect NOENT
  42 set expcode "NOENT"
  43 set ASSERTION "Secinfo with the 'name' not exist, expect $expcode"
  44 putmsg stdout 0 "$TNAME{a}: $ASSERTION"
  45 set res [compound {Putfh $bfh; Secinfo "NOENT.[pid]"}]
  46 ckres "Secinfo" $status $expcode $res $PASS
  47 
  48 
  49 # b: Secinfo with 'name' not in namespace, expect NOENT
  50 set expcode "NOENT"
  51 set ASSERTION "Secinfo with the 'name' not in namespace, expect $expcode"
  52 putmsg stdout 0 "$TNAME{b}: $ASSERTION"
  53 set res [compound {Putrootfh; Secinfo "usr"}]
  54 ckres "Secinfo" $status $expcode $res $PASS
  55 
  56 
  57 # d: Secinfo with CFH is a file, expect NOTDIR
  58 set expcode "NOTDIR"
  59 set ASSERTION "Secinfo with CFH is a file, expect $expcode"
  60 putmsg stdout 0 "$TNAME{d}: $ASSERTION"
  61 set res [compound {Putfh $bfh; Lookup "$env(RWFILE)";
  62         Secinfo XXX; Getfh}]
  63 ckres "Secinfo" $status $expcode $res $PASS
  64 
  65 
  66 # e: Secinfo with CFH as a fifo, expect NOTDIR
  67 set expcode "NOTDIR"
  68 set ASSERTION "Secinfo with CFH as a fifo, expect $expcode"
  69 putmsg stdout 0 "$TNAME{e}: $ASSERTION"
  70 set res [compound {Putfh $bfh; Lookup "$env(FIFOFILE)";
  71         Secinfo notdir; Getfh}]
  72 ckres "Secinfo" $status $expcode $res $PASS
  73 
  74 
  75 # h: Secinfo with component name too long, expect NAMETOOLONG
  76 set expcode "NAMETOOLONG"
  77 set ASSERTION "Secinfo with component name too long, expect $expcode"
  78 putmsg stdout 0 "$TNAME{h}: $ASSERTION"
  79 set nli [set_maxname $bfh]
  80 set res [compound {Putfh $bfh; Secinfo $nli}]
  81 ckres "Rename" $status $expcode $res $PASS
  82 
  83 
  84 # m: try to Secinfo of expired FH, expect FHEXPIRED
  85 set expcode "FHEXPIRED"
  86 set ASSERTION "Secinfo an expired FH, expect $expcode"
  87 #putmsg stdout 0 "$TNAME{m}: $ASSERTION"
  88 #puts "\t Test UNTESTED: XXX need hook to get FH expired.\n"
  89 
  90 
  91 # x: Secinfo with WrongSec, expect WRONGSEC
  92 # XXX Need more setup with w/Security
  93 set expcode "WRONGSEC"
  94 #set ASSERTION "Secinfo with wrongSec, expect $expcode"
  95 #puts "\t Test UNTESTED: XXX should SECINFO generates WRONGSEC?\n"
  96 
  97 
  98 # y: XXX need a way to simulate these server errors:
  99 #       NFS4ERR_MOVED
 100 #       NFS4ERR_SERVERFAULT
 101 #       NFS4ERR_RESOURCE
 102 
 103 
 104 # --------------------------------------------------------------
 105 # disconnect and exit
 106 Disconnect
 107 exit $PASS