1 #!/bin/ksh
   2 #
   3 # This file and its contents are supplied under the terms of the
   4 # Common Development and Distribution License ("CDDL"), version 1.0.
   5 # You may only use this file in accordance with the terms of version
   6 # 1.0 of the CDDL.
   7 #
   8 # A full copy of the text of the CDDL should have accompanied this
   9 # source.  A copy of the CDDL is also available via the Internet at
  10 # http://www.illumos.org/license/CDDL.
  11 #
  12 
  13 #
  14 # Copyright 2017 Gordon W. Ross
  15 #
  16 
  17 errs=
  18 UAKEY=$ROOT/opt/util-tests/bin/oamu_uakey
  19 if [ -n "$ROOT" ] ; then
  20   export LD_LIBRARY_PATH=$ROOT/usr/lib
  21 fi
  22 
  23 #
  24 # Make test data files
  25 #
  26 # uakey.tst (what we should get)
  27 echo '
  28 defrid=123
  29 defgroup=456
  30 defgname=TestGroup
  31 defparent=TestDefParent
  32 defskel=TestDefSkel
  33 defshell=TestDefShell
  34 definact=3
  35 defexpire=TestDefExpire
  36 defauthorization=TestAuths
  37 defprofile=TestProfiles
  38 defrole=TestRoles
  39 defproj=7
  40 defprojname=TestProject
  41 deflimitpriv=TestLimPriv
  42 defdefaultpriv=TestDefPriv
  43 deflock_after_retries=TestLAR' > user.tst
  44 
  45 
  46 #
  47 # Run some tests
  48 #
  49 # Override all the values we can with non-defaults.
  50 #define USERATTR_TYPE_KW                "type"
  51 #define USERATTR_AUTHS_KW               "auths"
  52 #define USERATTR_PROFILES_KW            "profiles"
  53 #define USERATTR_ROLES_KW               "roles"
  54 #define USERATTR_DEFAULTPROJ_KW         "project"
  55 #define USERATTR_LIMPRIV_KW             "limitpriv"
  56 #define USERATTR_DFLTPRIV_KW            "defaultpriv"
  57 #define USERATTR_LOCK_AFTER_RETRIES_KW  "lock_after_retries"
  58 #
  59 
  60 $UAKEY  -K auths=TestAuths \
  61         -K profiles=TestProfiles \
  62         -K roles=TestRoles \
  63         -K limitpriv=TestLimPriv \
  64         -K defaultpriv=TestDefPriv \
  65         -K lock_after_retries=TestLAR |
  66   tail +2 > user1.out
  67 
  68 if cmp -s user.tst user1.out ; then
  69     echo "PASS: user1.out"
  70 else
  71     echo "FAIL: user1.out is wrong"
  72     errs="$errs user1.out"
  73 fi
  74 
  75 rm -f user.tst user1.out