This file is indexed.

/usr/bin/rsbac_nettemp_menu is in rsbac-admin 1.4.0-repack-0ubuntu5.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
#!/bin/bash
# 
# This script is used for Administration of RSBAC Network Template attributes
#
#
# Make sure we're really running bash.
#
[ -z "$BASH" ] && { echo "This menu requires bash" 1>&2; exit 1; }

#
# Cache function definitions, turn off posix compliance
#
set -h +o posix

# not used
ATTRIBUTES="security_level mac_categories object_category data_type \
            pm_object_type pm_ipc_purpose pm_object_class rc_type rc_type_nt \
            log_array_low log_array_high"

# Set conf filename
RSBACCONF=/etc/rsbac.conf
# Read settings
if test -f $RSBACCONF
then . $RSBACCONF
fi
if test -f ~/.rsbacrc
then . ~/.rsbacrc
fi
if test -z "$RSBACMOD"
then RSBACMOD='GEN MAC PM DAZ FF RC AUTH ACL CAP JAIL RES PAX'
fi
for i in $RSBACMOD
do
  export SHOW_${i}=yes
done

# The dir for tmp files
if test -z "$TMPDIR" ; then TMPDIR=/tmp ; fi

# This must be a unique temporary filename
if ! TMPFILE=`mktemp -q $TMPDIR/rsbac_dialog.XXXXXX`
then
  TMPFILE=$TMPDIR/rsbac_dialog.$$
  if test -e $TMPFILE
  then rm $TMPFILE
  fi
  touch $TMPFILE
  chmod 600 $TMPFILE
fi

# set this to rsbac bin dir, if not in path (trailing / is mandatory!)
#
#if test -z "$RSBACPATH" ; then RSBACPATH=./ ; fi

# set this to initial dir on script startup
LASTDIR='/proc'

# which dialog tool to use - dialog or kdialog or xdialog...
if test -z $DIALOG
then DIALOG=${RSBACPATH}dialog
fi
if ! $DIALOG --clear
then
  echo $DIALOG menu program required! >&2
  exit
fi
if ! $DIALOG --help 2>&1 | grep -q "help-button"
then
  echo "Newer dialog menu version >= 0.9a-20020309a with '--help-button' option" >&2
  echo "required, please use dialog from admin tools contrib dir or set" >&2
  echo "\$DIALOG to another dialog program, e.g. with rsbac_settings_menu!" >&2
  exit
fi

set_geometry ()
{
        BL=${1:-24}
        BC=${2:-80}
        [ $BL = 0 ] && BL=24
        [ $BC = 0 ] && BC=80
        export LINES=$BL
        export COLUMNS=$BC
        BL=$((BL-4))
        BC=$((BC-5))
        MAXLINES=$((LINES-10))
}

set_geometry `stty size 2>/dev/null`

gl ()
{
        if test $1 -gt $MAXLINES
        then echo $MAXLINES
        else echo $1
        fi
}

if test -z "$LINES" ; then LINES=25 ; fi
if test -z "$COLUMNS" ; then COLUMNS=80 ; fi
export LINES
export COLUMNS
declare -i BL=$LINES-4
declare -i BC=$COLUMNS-4
declare -i MAXLINES=$LINES-10

if test -z "$BACKTITLE"
then BACKTITLE="RSBAC Administration Tools 1.4.0"
fi
TITLE="`whoami`@`hostname`: RSBAC Network Object Administration"
HELPTITLE="$TITLE Help"
ERRTITLE="RSBAC Net Object Administration - ERROR"

## no changes below this line!

TYPE=NETTEMP

show_help () {
  case "$RSBACLANG" in
    DE)
      show_help_german "$1"
      ;;
    RU)
      show_help_russian "$1"
      ;;
    *)
      show_help_english "$1"
      ;;
  esac
}

show_help_english () {
 {
  echo "$1"
  echo ""
  case "$1" in
    Quit)
        echo "Quit this menu."
      ;;

    'NetTemp List:')
      echo "Choose Network Template from list."
      ;;

    "Template number:")
      echo "Enter Network Template number."
      ;;

    'Template Definition:')
      echo "Go to Definition of this Network Template."
      ;;

    'Network Templates:')
      echo "Go to Network Template Definition menu."
      ;;

    'MAC Security Level:')
        echo "Set the MAC model security level."
        echo ""
        $RSBACPATH""attr_get_net -A security_level
      ;;

    'MAC Categories:')
        echo "Set the MAC model categories."
        echo ""
        $RSBACPATH""attr_get_net -A mac_categories
      ;;

    'PM Object Type:')
        echo "Set object type for PM model."
        echo ""
        $RSBACPATH""attr_get_net -A pm_object_type
      ;;

    'PM IPC Purpose:')
        echo "Set IPC purpose for PM model."
        echo ""
        $RSBACPATH""attr_get_net -A pm_ipc_purpose
      ;;

    'PM Object Class:')
        echo "Select the PM model object class."
        echo ""
        $RSBACPATH""attr_get_net -A pm_object_class
      ;;

    'RC Type:')
        echo "Select the RC model NETOBJ type for this template. This value will be"
        echo "inherited to the network objects."
        echo ""
        $RSBACPATH""attr_get_net -A rc_type
      ;;

    'RC Type NT:')
        echo "Select the RC model NETTEMP type. This value is used for accesses to"
        echo "the Network Template definition."
        echo ""
        $RSBACPATH""attr_get_net -A rc_type_nt
      ;;

    'Log Array Low:' | 'Log Array High:')
        echo "Choose object based logging levels for this object."
        echo ""
        $RSBACPATH""attr_get_net -A log_array_low
      ;;

    'ACL Menu:')
        echo "Go to ACL menu."
      ;;

    'Reset Attributes:')
        echo "Call \'attr_set_net -m\' to get the attribute object for this object"
        echo "removed. As result, all attribute values will be reset to their"
        echo "default values. Use with care!"
      ;;

    *)
        echo "No help for $1 available!"
  esac
 } > $TMPFILE
  $DIALOG --title "$HELPTITLE" \
          --backtitle "$BACKTITLE" \
          --textbox $TMPFILE $BL $BC
#  sleep 1
}

show_help_german () {
 {
  echo "$1"
  echo ""
  case "$1" in
    Quit)
        echo "Beende dieses Menü."
      ;;

    'NetTemp List:')
      echo "Wähle Netzwerk-Template aus einer Liste."
      ;;

    "Template number:")
      echo "Nummer des Netzwerk-Templates eingeben."
      ;;

    'Template Definition:')
      echo "Gehe zur Definition dieses Netzwerk-Templates."
      ;;

    'Network Templates:')
      echo "Gehe zum Netzwerk-Template-Definitions-Menü."
      ;;

    'MAC Security Level:')
        echo "Setze den Sicherheitslevel für das MAC-Modell."
        echo ""
        $RSBACPATH""attr_get_net -A security_level
      ;;

    'MAC Categories:')
        echo "Wähle die Kategorien für das MAC-Modell."
        echo ""
        $RSBACPATH""attr_get_net -A mac_categories
      ;;

    'PM Object Type:')
        echo "Setze den Objekttyp für das PM-Modell."
        echo ""
        $RSBACPATH""attr_get_net -A pm_object_type
      ;;

    'PM IPC Purpose:')
        echo "Setze den IPC-Zweck für das PM-Modell."
        echo ""
        $RSBACPATH""attr_get_net -A pm_ipc_purpose
      ;;

    'PM Object Class:')
        echo "Wähle die Objekt-Klasse für das PM-Modell."
        echo ""
        $RSBACPATH""attr_get_net -A pm_object_class
      ;;

    'RC Type:')
        echo "Wähle den RC-NETOBJ-Typ für dieses Template. Dieser Wert wird auf"
        echo "die Netzwerk-Objekte vererbt."
        echo ""
        $RSBACPATH""attr_get_net -A rc_type
      ;;

    'RC Type NT:')
        echo "Wähle den RC-NETTEMP-Typ für dieses Template. Dieser Wert wird"
        echo "für Zugriffe auf die Netzwerk-Template-Definition verwendet."
        echo ""
        $RSBACPATH""attr_get_net -A rc_type_nt
      ;;

    'Log Array Low:' | 'Log Array High:')
        echo 'Wähle objektabhängige Logging-Stufen für dieses Objekt.'
        echo ""
        $RSBACPATH""attr_get_net -A log_array_low
      ;;

    'ACL Menu:')
        echo "Gehe zum ACL-Menü."
      ;;

    'Reset Attributes:')
        echo "Rufe \'attr_set_net -m\' auf, um die Attribut-Objekte für dieses"
        echo "Objekt zu entfernen. Als Ergebnis werden alle Attribute auf ihre"
        echo "Standardwerte zurückgesetzt. Mit Vorsicht verwenden!"
      ;;

    *)
        echo "Keine Hilfe für $1 verfügbar!"
  esac
 } > $TMPFILE
  $DIALOG --title "$HELPTITLE" \
          --backtitle "$BACKTITLE" \
          --textbox $TMPFILE $BL $BC
#  sleep 1
}

show_help_russian () {
 {
  echo "$1"
  echo ""
  case "$1" in
    Quit)
        echo "Quit this menu."
      ;;

    'NetTemp List:')
      echo "Choose Network Template from list."
      ;;

    "Template number:")
      echo "Enter Network Template number."
      ;;

    'Template Definition:')
      echo "Go to Definition of this Network Template."
      ;;

    'Network Templates:')
      echo "Go to Network Template Definition menu."
      ;;

    'MAC Security Level:')
        echo "Set the MAC model security level."
        echo ""
        $RSBACPATH""attr_get_net -A security_level
      ;;

    'MAC Categories:')
        echo "Set the MAC model categories."
        echo ""
        $RSBACPATH""attr_get_net -A mac_categories
      ;;

    'PM Object Type:')
        echo "Set object type for PM model."
        echo ""
        $RSBACPATH""attr_get_net -A pm_object_type
      ;;

    'PM IPC Purpose:')
        echo "Set IPC purpose for PM model."
        echo ""
        $RSBACPATH""attr_get_net -A pm_ipc_purpose
      ;;

    'PM Object Class:')
        echo "Select the PM model object class."
        echo ""
        $RSBACPATH""attr_get_net -A pm_object_class
      ;;

    'RC Type:')
        echo "Select the RC model NETOBJ type for this template. This value will be"
        echo "inherited to the network objects."
        echo ""
        $RSBACPATH""attr_get_net -A rc_type
      ;;

    'RC Type NT:')
        echo "Select the RC model NETTEMP type. This value is used for accesses to"
        echo "the Network Template definition."
        echo ""
        $RSBACPATH""attr_get_net -A rc_type_nt
      ;;

    'Log Array Low:' | 'Log Array High:')
        echo "Choose object based logging levels for this object."
        echo ""
        $RSBACPATH""attr_get_net -A log_array_low
      ;;

    'ACL Menu:')
        echo "Go to ACL menu."
      ;;

    'Reset Attributes:')
        echo "Call \'attr_set_net -m\' to get the attribute object for this object"
        echo "removed. As result, all attribute values will be reset to their"
        echo "default values. Use with care!"
      ;;

    *)
        echo "No help for $1 available!"
  esac
 } > $TMPFILE
  $DIALOG --title "$HELPTITLE" \
          --backtitle "$BACKTITLE" \
          --textbox $TMPFILE $BL $BC
#  sleep 1
}

get_attributes () {
  if test "$OBJECT" != "" 
    then
         OBJNAME=`get_vname nettemp $OBJECT`
         if test "$SHOW_MAC" = "yes"
         then
           SECLEVEL=`$RSBACPATH""attr_get_net MAC $TYPE security_level $OBJECT`
           MACCAT=`$RSBACPATH""attr_get_net MAC $TYPE mac_categories $OBJECT`
         fi
         if test "$SHOW_PM" = "yes"
         then
           PMOBJTYPE=`$RSBACPATH""attr_get_net PM $TYPE pm_object_type $OBJECT`
           PMIPCP=`$RSBACPATH""attr_get_net PM $TYPE pm_ipc_purpose $OBJECT`
           PMCLASS=`$RSBACPATH""attr_get_net PM $TYPE pm_object_class $OBJECT`
         fi
         if test "$SHOW_RC" = "yes"
         then
           RCTYPE=`$RSBACPATH""attr_get_net RC $TYPE rc_type $OBJECT`
           RCTYPENT=`$RSBACPATH""attr_get_net RC $TYPE rc_type_nt $OBJECT`
         fi
         if test "$SHOW_GEN" = "yes"
         then
           LOGLOW=`$RSBACPATH""attr_get_net GEN $TYPE log_array_low $OBJECT`
           LOGHIGH=`$RSBACPATH""attr_get_net GEN $TYPE log_array_high $OBJECT`
         fi
  else
    OBJNAME=""
    SECLEVEL=""
    MACCAT=""
    OBJCAT=""
    DATATYPE=""
    PMOBJTYPE=""
    PMIPCP=""
    PMCLASS=""
    RCTYPE=""
    RCTYPENT=""
    LOGLOW=""
    LOGHIGH=""
  fi
}

onoff () {
   if test "$1" = "$2"
     then echo on
   else echo off
   fi
}

onoffb () {
   if test "$1" = "1"
     then echo on
   else echo off
   fi
}

type_name () {
  if test "$TYPE" = "NONE" -o -z "$1"
  then echo " "
  else if ! $RSBACPATH""rc_get_item TYPE $1 type_nettemp_name
       then echo "(unknown)"
       fi
  fi
}

get_vname () {
  if test "$TYPE" = "NONE"
    then echo " "
         return
  fi
  if test -z "$2"
    then echo "N/A"
         return
  fi

  case $1 in
    nettemp)
      case $2 in
        Error*) echo N/A
          ;;
        Use*) echo N/A
          ;;
        *) if ! $RSBACPATH""net_temp get_name $2 2>/dev/null
           then echo $2
           fi
          ;;
      esac 
      ;;
    seclevel)
      case $2 in
        0) echo unclassified
          ;;
        1) echo confidential
          ;;
        2) echo secret
          ;;
        3) echo top secret
          ;;
        252) echo max. level
          ;;
        254) echo inherit
          ;;
        *) echo N/A
          ;;
      esac 
      ;;
    objcat)
      case $2 in
        0) echo General
          ;;
        1) echo Security
          ;;
        2) echo System
          ;;
        *) echo N/A
          ;;
      esac 
      ;;
    datatype)
      case $2 in
        0) echo None
          ;;
        1) echo SI
          ;;
        *) echo N/A
          ;;
      esac 
      ;;
    pmobjtype)
      case $2 in
        0) echo None
          ;;
        1) echo TP
          ;;
        2) echo Personal Data
          ;;
        3) echo Non-Personal Data
          ;;
        4) echo IPC
          ;;
        5) echo Directory
          ;;
        *) echo N/A
          ;;
      esac 
      ;;
    rctype)
      case $2 in
        Error*) echo N/A
          ;;
        Use*) echo N/A
          ;;
        *) if ! $RSBACPATH""rc_get_item TYPE $2 type_netobj_name 2>/dev/null
           then echo $2
           fi
          ;;
      esac 
      ;;
    rctypent)
      case $2 in
        Error*) echo N/A
          ;;
        Use*) echo N/A
          ;;
        *) if ! $RSBACPATH""rc_get_item TYPE $2 type_nettemp_name 2>/dev/null
           then echo $2
           fi
          ;;
      esac 
      ;;
    loglevel)
      case $2 in
        0) echo None
          ;;
        1) echo Denied
          ;;
        2) echo Full
          ;;
        3) echo Request
          ;;
        *) echo N/A
          ;;
      esac 
      ;;
    *) echo ERROR!
      ;;
  esac
}

gen_log_menu_items() {
  echo -n "" >${TMPFILE}.2
  for i in $REQUESTS
  do TMP=`$RSBACPATH""attr_get_net $TYPE log_array_low $i $OBJECT`
     echo $i `get_vname loglevel $TMP`>>${TMPFILE}.2
  done
}

log_menu () {
  if test -z "$REQUESTS"
    then REQUESTS=`$RSBACPATH""attr_get_net -n NET`
  fi
  gen_log_menu_items
  while true ; do \
    if ! \
    $DIALOG --title "$TITLE" \
           --backtitle "$BACKTITLE" \
           --default-item "$REQ" \
           --menu "$OBJECT / $OBJNAME: Log Levels for Requests" $BL $BC `gl 45` \
                `cat ${TMPFILE}.2` \
                "Quit" "" \
         2>$TMPFILE
     then rm ${TMPFILE}.2
          LOGLOW=`$RSBACPATH""attr_get_net $TYPE log_array_low $OBJECT`
          LOGHIGH=`$RSBACPATH""attr_get_net $TYPE log_array_high $OBJECT`
          return
    fi
    REQ=`cat $TMPFILE`
    case "$REQ" in
      Quit)
        rm ${TMPFILE}.2
        LOGLOW=`$RSBACPATH""attr_get_net $TYPE log_array_low $OBJECT`
        LOGHIGH=`$RSBACPATH""attr_get_net $TYPE log_array_high $OBJECT`
        return
        ;;
      *)
        VAL=`grep "^$REQ " ${TMPFILE}.2|cut -f 2 -d ' '`
        if $DIALOG --title "$TITLE" \
                   --backtitle "$BACKTITLE" \
                   --radiolist "Choose Log Level for $OBJECT / $REQ" $BL $BC 5 \
                          0 `get_vname loglevel 0` `onoff None $VAL` \
                          1 `get_vname loglevel 1` `onoff Denied $VAL` \
                          2 `get_vname loglevel 2` `onoff Full $VAL` \
                          3 `get_vname loglevel 3` `onoff Request $VAL` \
          2>$TMPFILE
        then TMP=`cat $TMPFILE`
             if $RSBACPATH""attr_set_net $TYPE log_array_low $REQ $TMP $OBJECT &>$TMPFILE
             then
               gen_log_menu_items
               if test -n "$RSBACLOGFILE"
               then
                 echo $RSBACPATH""attr_set_net $TYPE log_array_low $REQ $TMP $OBJECT >>"$RSBACLOGFILE"
               fi
             else \
               $DIALOG --title "$ERRTITLE" \
                       --backtitle "$BACKTITLE" \
                       --msgbox "`head -n 1 $TMPFILE`" $BL $BC
             fi
        fi
    esac
done
}

declare -i MAXCATLEN=$BC-38
cat_print () {
  if test $MAXCATLEN -ge 64
  then echo $1
  else echo "(too long)"
  fi
}

gen_cat_list () {
    for i in $*
    do
      TMP=`$RSBACPATH""attr_get_net $TYPE mac_categories CAT $i $OBJECT`
      echo $i `onoffb $TMP` `onoffb $TMP`
    done
}

declare -i MAXNAMELEN=$BC-34
name_print () {
  if test ${#1} -gt $MAXNAMELEN
  then
    declare -i START=${#1}-$MAXNAMELEN
    echo "$1" | cut -c$START-${#1}
  else
    echo "$1"
  fi
}

###################### Menu #################

if test -n "$RSBACLOGFILE"
then
  {
    echo ""
    echo "# $0 start `date`"
  } >>"$RSBACLOGFILE"
fi
if test "$1" != ""
then OBJECT=$1
else
  if $DIALOG --title "$TITLE" \
             --backtitle "$BACKTITLE" \
             --menu "Network Template" $BL $BC $MAXLINES \
                    `$RSBACPATH""net_temp list_temp_names` \
    2>$TMPFILE
  then OBJECT=`cat $TMPFILE`
  fi
fi
get_attributes $OBJECT

  {
    echo 'nettemp_menu ()'
    echo '  {'    
    echo "    $DIALOG --title \"$TITLE\" \\"
    echo '       --backtitle "$BACKTITLE" \'
    echo '       --help-button --default-item "$CHOICE" \'
    echo '       --menu "Main NETTEMP Menu" $BL $BC `gl 21` \'
    echo '         "NetTemp List:" "Choose from listing of templates" \'
    echo '              "-------------------" " " \'
    echo '            "Template number:" "$OBJECT / $OBJNAME" \'
    echo '            "Template Definition:" "Go to Network Template Definition" \'
    echo '            "----------------" " " \'
    if test "$SHOW_MAC" = "yes"
    then
      echo '            "MAC Security Level:" "$SECLEVEL / `get_vname seclevel $SECLEVEL`" \'
      echo '            "MAC Categories:" "`cat_print $MACCAT`" \'
    fi
    if test "$SHOW_PM" = "yes"
    then
      echo '              "PM Object Class:" "$PMCLASS" \'
      echo '              "PM IPC Purpose:" "$PMIPCP" \'
      echo '              "PM Object Type:" "$PMOBJTYPE / `get_vname pmobjtype $PMOBJTYPE`" \'
    fi
    if test "$SHOW_RC" = "yes"
    then
      echo '              "RC Type:" "$RCTYPE / `get_vname rctype $RCTYPE`" \'
      echo '              "RC Type NT:" "$RCTYPENT / `get_vname rctypent $RCTYPENT`" \'
    fi
    if test "$SHOW_GEN" = "yes"
    then
      echo '              "Log Array Low:" "$LOGLOW" \'
      echo '              "Log Array High:" "$LOGHIGH" \'
    fi
    echo '            "----------------" " " \'
    if test "$SHOW_ACL" = "yes"
    then
      echo '            "ACL Menu:" "Go to ACL menu" \'
    fi
    echo '            "Network Templates:" "Go to Network Template Definition Menu" \'
    echo '            "Reset Attributes:" "Reset all values to default values" \'
    echo '            "Quit" ""'
    echo '  }'
  } > $TMPFILE

. $TMPFILE

#cp $TMPFILE /tmp/menu

while true
  do
    if ! nettemp_menu 2>$TMPFILE
     then rm $TMPFILE ; exit
    fi


  CHOICE=`cat $TMPFILE`
  case "$CHOICE" in
    HELP*)
        show_help "${CHOICE:5}"
        CHOICE="${CHOICE:5}"
      ;;
    'NetTemp List:')
        if $DIALOG --title "$TITLE" \
                   --backtitle "$BACKTITLE" \
                   --default-item "$OBJECT" \
                   --menu "Network Template" $BL $BC $MAXLINES \
                         `$RSBACPATH""net_temp list_temp_names` \
           2>$TMPFILE
        then OBJECT=`cat $TMPFILE`
             get_attributes
        fi
      ;;

    "Template number:")
        if $DIALOG --title "$TITLE" \
                  --backtitle "$BACKTITLE" \
                  --inputbox "Template Number:" $BL $BC $OBJECT \
           2>$TMPFILE
        then OBJECT=`cat $TMPFILE`
             get_attributes
        fi
      ;;

    'Template Definition:')
        $RSBACPATH""rsbac_nettemp_def_menu "$OBJECT"
      ;;

    'MAC Security Level:')
        if test "$TYPE" != "NONE"
        then \
          if $DIALOG --title "$TITLE" \
                    --backtitle "$BACKTITLE" \
                    --radiolist "Choose Security Level for $OBJECT / $OBJNAME (old value: $SECLEVEL)" $BL $BC 7 \
                                "Enter" "Numeric Value" off \
                                0 "`get_vname seclevel 0`" `onoff 0 $SECLEVEL` \
                                1 "`get_vname seclevel 1`" `onoff 1 $SECLEVEL` \
                                2 "`get_vname seclevel 2`" `onoff 2 $SECLEVEL` \
                                3 "`get_vname seclevel 3`" `onoff 3 $SECLEVEL` \
                                252 "`get_vname seclevel 252`" `onoff 252 $SECLEVEL` \
                                254 "`get_vname seclevel 254`" `onoff 254 $SECLEVEL` \
             2>$TMPFILE
          then TMP=`cat $TMPFILE`
               if test "$TMP" = "Enter"
               then
                 if $DIALOG --title "$TITLE" \
                           --backtitle "$BACKTITLE" \
                           --inputbox "MAC security level" $BL $BC "$SECLEVEL" \
                   2>$TMPFILE
                 then
                   TMP="`cat $TMPFILE`"
                   if test $TMP -gt 254
                   then
                     $DIALOG --title "$ERRTITLE" \
                            --backtitle "$BACKTITLE" \
                            --msgbox "Invalid security level value $TMP!" $BL $BC
                     TMP=""
                   fi
                 else
                   TMP=""
                 fi
               fi
               if test -n "$TMP"
               then
                 if $RSBACPATH""attr_set_net $TYPE security_level $TMP $OBJECT &>$TMPFILE
                 then
                   SECLEVEL=$TMP
                   if test -n "$RSBACLOGFILE"
                   then
                     echo $RSBACPATH""attr_set_net $TYPE security_level $TMP $OBJECT >>"$RSBACLOGFILE"
                   fi
                 else \
                   $DIALOG --title "$ERRTITLE" \
                          --backtitle "$BACKTITLE" \
                          --msgbox "`head -n 1 $TMPFILE`" $BL $BC
                 fi
               fi
          fi
        else
                 $DIALOG --title "$ERRTITLE" \
                        --backtitle "$BACKTITLE" \
                        --msgbox "Security Level: No object specified!" 5 $BC
        fi
      ;;

    'MAC Categories:')
        if test "$TYPE" != "NONE"
        then \
          ALLCATNR=`$RSBACPATH""attr_get_file_dir list_category_nr`
          if $DIALOG --title "MAC Categories for NetTemp $OBJECT / $OBJNAME" \
                    --backtitle "$BACKTITLE" \
                    --checklist "Bits: $MACCAT" $BL $BC $MAXLINES \
                    `gen_cat_list $ALLCATNR` \
             2>$TMPFILE
          then TMP=`cat $TMPFILE|tr -d '"'`
               for i in $ALLCATNR
               do
                 if $RSBACPATH""attr_set_net $TYPE mac_categories CAT $i 0 $OBJECT &>$TMPFILE
                 then
                   if test -n "$RSBACLOGFILE"
                   then
                     echo $RSBACPATH""attr_set_net $TYPE mac_categories CAT $i 0 $OBJECT >>"$RSBACLOGFILE"
                   fi
                 else 
                   $DIALOG --title "$ERRTITLE" \
                          --backtitle "$BACKTITLE" \
                          --msgbox "`head -n 1 $TMPFILE`" $BL $BC
                   continue
                 fi
               done
               for i in $TMP
               do
                 if $RSBACPATH""attr_set_net $TYPE mac_categories CAT $i 1 $OBJECT &>$TMPFILE
                 then
                   if test -n "$RSBACLOGFILE"
                   then
                     echo $RSBACPATH""attr_set_net $TYPE mac_categories CAT $i 1 $OBJECT >>"$RSBACLOGFILE"
                   fi
                 else
                   $DIALOG --title "$ERRTITLE" \
                          --backtitle "$BACKTITLE" \
                          --msgbox "`head -n 1 $TMPFILE`" $BL $BC
                   continue
                 fi
               done
               MACCAT=`$RSBACPATH""attr_get_net $TYPE mac_categories $OBJECT`
          fi
        else
                 $DIALOG --title "$ERRTITLE" \
                        --backtitle "$BACKTITLE" \
                        --msgbox "MAC Categories: No user specified!" 5 $BC
        fi
      ;;

    'PM Object Type:')
        if test "$TYPE" != "NONE"
        then \
          if $DIALOG --title "$TITLE" \
                    --backtitle "$BACKTITLE" \
                    --radiolist "Choose PM Object Type for $OBJECT / $OBJNAME" $BL $BC 6 \
                                0 "`get_vname pmobjtype 0`" `onoff 0 $PMOBJTYPE` \
                                1 "`get_vname pmobjtype 1`" `onoff 1 $PMOBJTYPE` \
                                2 "`get_vname pmobjtype 2`" `onoff 2 $PMOBJTYPE` \
                                3 "`get_vname pmobjtype 3`" `onoff 3 $PMOBJTYPE` \
                                4 "`get_vname pmobjtype 4`" `onoff 4 $PMOBJTYPE` \
                                5 "`get_vname pmobjtype 5`" `onoff 5 $PMOBJTYPE` \
             2>$TMPFILE
          then TMP=`cat $TMPFILE`
               if $RSBACPATH""attr_set_net $TYPE pm_object_type $TMP $OBJECT &>$TMPFILE
               then
                 PMOBJTYPE=$TMP
                 if test -n "$RSBACLOGFILE"
                 then
                   echo $RSBACPATH""attr_set_net $TYPE pm_object_type $TMP $OBJECT >>"$RSBACLOGFILE"
                 fi
               else
                 $DIALOG --title "$ERRTITLE" \
                        --backtitle "$BACKTITLE" \
                        --msgbox "`head -n 1 $TMPFILE`" $BL $BC
               fi
          fi
        else
                 $DIALOG --title "$ERRTITLE" \
                        --backtitle "$BACKTITLE" \
                        --msgbox "PM Object Type: No object specified!" 5 $BC
        fi
      ;;

    'PM Object Class:')
        if test "$TYPE" != "NONE"
        then \
           if $DIALOG --title "$TITLE" \
                     --backtitle "$BACKTITLE" \
                     --inputbox "PM Object Class (long integer) for $OBJECT / $OBJNAME" \
                                $BL $BC "$PMCLASS" \
              2>$TMPFILE
          then TMP=`cat $TMPFILE`
               if $RSBACPATH""attr_set_net $TYPE pm_object_class $TMP $OBJECT &>$TMPFILE
               then
                 PMCLASS=$TMP
                 if test -n "$RSBACLOGFILE"
                 then
                   echo $RSBACPATH""attr_set_net $TYPE pm_object_class $TMP $OBJECT >>"$RSBACLOGFILE"
                 fi
               else
                 $DIALOG --title "$ERRTITLE" \
                        --backtitle "$BACKTITLE" \
                        --msgbox "`head -n 1 $TMPFILE`" $BL $BC
               fi
          fi
        else
                 $DIALOG --title "$ERRTITLE" \
                        --backtitle "$BACKTITLE" \
                        --msgbox "PM Object Class: No object specified!" 5 $BC
        fi
      ;;

    'PM IPC Purpose:')
        if test "$TYPE" != "NONE"
        then \
           if $DIALOG --title "$TITLE" \
                     --backtitle "$BACKTITLE" \
                     --inputbox "PM IPC Purpose (long integer) for $OBJECT / $OBJNAME" \
                                $BL $BC "$PMIPCP" \
              2>$TMPFILE
          then TMP=`cat $TMPFILE`
               if $RSBACPATH""attr_set_net $TYPE pm_ipc_purpose $TMP $OBJECT &>$TMPFILE
               then PMIPCP=$TMP
               if test -n "$RSBACLOGFILE"
               then
                 echo $RSBACPATH""attr_set_net $TYPE pm_ipc_purpose $TMP $OBJECT >>"$RSBACLOGFILE"
               fi
               else
                 $DIALOG --title "$ERRTITLE" \
                        --backtitle "$BACKTITLE" \
                        --msgbox "`head -n 1 $TMPFILE`" $BL $BC
               fi
          fi
        else
                 $DIALOG --title "$ERRTITLE" \
                        --backtitle "$BACKTITLE" \
                        --msgbox "PM Object Class: No object specified!" 5 $BC
        fi
      ;;

    'RC Type:')
        if test "$TYPE" != "NONE"
        then \
          if $RSBACPATH""rc_get_item list_netobj_types >$TMPFILE
          then \
            if $DIALOG --title "$TITLE" \
                      --backtitle "$BACKTITLE" \
                      --default-item "$RCTYPE" \
                      --menu "Choose RC Type for $OBJECT / $OBJNAME" $BL $BC $MAXLINES \
                      `cat $TMPFILE` \
               2>$TMPFILE
            then TMP=`cat $TMPFILE`
              if $RSBACPATH""attr_set_net $TYPE rc_type $TMP $OBJECT &>$TMPFILE
              then
                RCTYPE=$TMP
                if test -n "$RSBACLOGFILE"
                then
                  echo $RSBACPATH""attr_set_net $TYPE rc_type $TMP $OBJECT >>"$RSBACLOGFILE"
                fi
              else
                $DIALOG --title "$ERRTITLE" \
                        --backtitle "$BACKTITLE" \
                        --msgbox "`head -n 1 $TMPFILE`" $BL $BC
              fi
            fi
          else \
            if $DIALOG --title "$TITLE" \
                      --backtitle "$BACKTITLE" \
                      --inputbox "RC Type (integer) for $OBJECT / $OBJNAME" \
                                 $BL $BC "$RCTYPE" \
                2>$TMPFILE
            then TMP=`cat $TMPFILE`
                 if $RSBACPATH""attr_set_net $TYPE rc_type $TMP $OBJECT &>$TMPFILE
                 then
                   RCTYPE=$TMP
                   if test -n "$RSBACLOGFILE"
                   then
                     echo $RSBACPATH""attr_set_net $TYPE rc_type $TMP $OBJECT >>"$RSBACLOGFILE"
                   fi
                 else
                   $DIALOG --title "$ERRTITLE" \
                          --backtitle "$BACKTITLE" \
                          --msgbox "`head -n 1 $TMPFILE`" $BL $BC
                 fi
            fi
          fi
        else
                 $DIALOG --title "$ERRTITLE" \
                        --backtitle "$BACKTITLE" \
                        --msgbox "RC Type: No object specified!" 5 $BC
        fi
      ;;

    'RC Type NT:')
        if test "$TYPE" != "NONE"
        then \
          if $RSBACPATH""rc_get_item list_nettemp_types >$TMPFILE
          then \
            if $DIALOG --title "$TITLE" \
                      --backtitle "$BACKTITLE" \
                      --default-item "$RCTYPENT" \
                      --menu "Choose RC Type NetTemp for $OBJECT / $OBJNAME" $BL $BC $MAXLINES \
                      `cat $TMPFILE` \
               2>$TMPFILE
            then TMP=`cat $TMPFILE`
              if $RSBACPATH""attr_set_net $TYPE rc_type_nt $TMP $OBJECT &>$TMPFILE
              then
                RCTYPENT=$TMP
                if test -n "$RSBACLOGFILE"
                then
                  echo $RSBACPATH""attr_set_net $TYPE rc_type_nt $TMP $OBJECT >>"$RSBACLOGFILE"
                fi
              else
                $DIALOG --title "$ERRTITLE" \
                        --backtitle "$BACKTITLE" \
                        --msgbox "`head -n 1 $TMPFILE`" $BL $BC
              fi
            fi
          else \
            if $DIALOG --title "$TITLE" \
                      --backtitle "$BACKTITLE" \
                      --inputbox "RC Type NetTemp (integer) for $OBJECT / $OBJNAME" \
                                 $BL $BC "$RCTYPENT" \
                2>$TMPFILE
            then TMP=`cat $TMPFILE`
                 if $RSBACPATH""attr_set_net $TYPE rc_type_nt $TMP $OBJECT &>$TMPFILE
                 then
                   RCTYPENT=$TMP
                   if test -n "$RSBACLOGFILE"
                   then
                     echo $RSBACPATH""attr_set_net $TYPE rc_type_nt $TMP $OBJECT >>"$RSBACLOGFILE"
                   fi
                 else
                   $DIALOG --title "$ERRTITLE" \
                          --backtitle "$BACKTITLE" \
                          --msgbox "`head -n 1 $TMPFILE`" $BL $BC
                 fi
            fi
          fi
        else
                 $DIALOG --title "$ERRTITLE" \
                        --backtitle "$BACKTITLE" \
                        --msgbox "RC Type NT: No object specified!" 5 $BC
        fi
      ;;

    'Log Array Low:')
        if test "$TYPE" != "NONE"
        then \
          log_menu
        else
                 $DIALOG --title "$ERRTITLE" \
                        --backtitle "$BACKTITLE" \
                        --msgbox "Log Array Low: No object specified!" 5 $BC
        fi
      ;;

    'Log Array High:')
        if test "$TYPE" != "NONE"
        then \
          log_menu
        else
                 $DIALOG --title "$ERRTITLE" \
                        --backtitle "$BACKTITLE" \
                        --msgbox "Log Array High: No object specified!" 5 $BC
        fi
      ;;

    'ACL Menu:')
        $RSBACPATH""rsbac_acl_menu NETTEMP "$OBJECT"
      ;;

    'Network Templates:')
        $RSBACPATH""rsbac_nettemp_def_menu
      ;;

    'Reset Attributes:')
        if test "$TYPE" != "NONE"
        then \
          if $DIALOG --title "$TITLE" \
                    --backtitle "$BACKTITLE" \
                    --yesno "Reset all attributes to default values?" 5 $BC \
             2>/dev/null
          then
            if $RSBACPATH""attr_set_net -m NETTEMP $OBJECT &>$TMPFILE
            then get_attributes
              if test -n "$RSBACLOGFILE"
              then
                echo $RSBACPATH""attr_set_net -m NETTEMP $OBJECT >>"$RSBACLOGFILE"
              fi
            else
              $DIALOG --title "$ERRTITLE" \
                     --backtitle "$BACKTITLE" \
                     --msgbox "`head -n 1 $TMPFILE`" $BL $BC
            fi
          fi
        else
                 $DIALOG --title "$ERRTITLE" \
                        --backtitle "$BACKTITLE" \
                        --msgbox "Reset Attributes: No object specified!" 5 $BC
        fi
      ;;

    Quit)
        rm $TMPFILE ; exit
      ;;

    *)
        $DIALOG --title "$ERRTITLE" \
               --backtitle "$BACKTITLE" \
               --msgbox "Main Menu: Selection Error!" 5 $BC
  esac
# sleep 2
done