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 DEFS=$ROOT/opt/util-tests/bin/oamu_defs
  19 if [ -n "$ROOT" ] ; then
  20   export LD_LIBRARY_PATH=$ROOT/usr/lib
  21 fi
  22 
  23 #
  24 # Make test data files
  25 #
  26 
  27 # user.def (same as compiled-in defaults)
  28 echo '
  29 defrid=99
  30 defgroup=1
  31 defgname=other
  32 defparent=/home
  33 defskel=/etc/skel
  34 defshell=/bin/sh
  35 definact=0
  36 defexpire=
  37 defauthorization=
  38 defprofile=
  39 defrole=
  40 defproj=3
  41 defprojname=default
  42 deflimitpriv=
  43 defdefaultpriv=
  44 deflock_after_retries=' > user.def
  45 
  46 # user.tst (different from defaults)
  47 echo '
  48 defrid=1001
  49 defgroup=20
  50 defgname=test20group
  51 defparent=/tank/home
  52 defskel=/etc/skel.testuser
  53 defshell=/bin/pfsh.testuser
  54 definact=0
  55 defexpire=
  56 defauthorization=
  57 defprofile=TestUser
  58 defrole=TestRole
  59 defproj=4
  60 defprojname=TestProj
  61 deflimitpriv=TestLimPriv
  62 defdefaultpriv=TestDefPriv
  63 deflock_after_retries=' > user.tst
  64 
  65 #
  66 # Run some tests
  67 #
  68 
  69 # Override compiled-in user defaults
  70 $DEFS user.def |tail +2 > user1.out
  71 if cmp -s user.def user1.out ; then
  72     echo "PASS: user1.out"
  73 else
  74     echo "FAIL: user1.out is wrong"
  75     errs="$errs user1.out"
  76 fi
  77 
  78 # Override user.def values
  79 $DEFS user.def user.tst |tail +2 > user2.out
  80 if cmp -s user.tst user2.out ; then
  81     echo "PASS: user2.out"
  82 else
  83     echo "FAIL: user2.out is wrong"
  84     errs="$errs user2.out"
  85 fi
  86 
  87 rm -f user.def user.tst user1.out user2.out