This file is indexed.

/usr/bin/rsbac_dev_menu is in rsbac-admin 1.4.0-repack-0ubuntu3.

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
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
#!/bin/bash
# 
# This script is used for Administration of RSBAC general file/dir 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 object_category data_type mac_check \
            pm_object_type pm_object_class rc_type \
            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 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
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='/dev'

# 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 Device Administration"
HELPTITLE="`whoami`@`hostname`: RSBAC Device Administration Help"
ERRTITLE="RSBAC Device Administration - ERROR"

RCTYPEINHPAR=4294967294

## no changes below this line!

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

    'File/Dir List:')
        echo "Choose new device object from list."
      ;;

    "Dev special file:")
        echo "Enter new device object special file name."
      ;;

    'Dev Major List:')
        echo "Choose major device specification from list."
      ;;

    "Dev specification:")
        echo "Enter a device specification {b|c}major[:minor],"
        echo "e.g. b8:1 for /dev/sda1 or c2 for pseudo tty masters."
      ;;

    "Follow")
        echo "Follow this symbolic link."
      ;;

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

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

    'MAC Check:')
        echo "Toggle, whether access to this device should be controlled by MAC model."
        echo ""
        $RSBACPATH""attr_get_file_dir -A mac_check
      ;;

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

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

    'RC Type:')
        echo "Select the RC model device type."
        echo ""
        $RSBACPATH""attr_get_file_dir -A rc_type
      ;;

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

    'File/Dir Attributes:')
        echo "Go to File/Dir/Fifo/Symlink attribute menu."
      ;;

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

    'Reset Attributes:')
        echo "Call attr_rm_fd to get the attribute object for this device 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 -L "$FILE"
           then TYPE=SYMLINK
                SYMLINK="`ls -l \"$FILE\"|cut -d '>' -f 2|cut -c 2-`"
         elif test -b "$FILE"
           then TYPE=BLOCK
         elif test -c "$FILE"
           then TYPE=CHAR
         elif test -d "$FILE"
           then TYPE=DIR
                LASTDIR=`(cd "$FILE" ; pwd)`
                if test -n "$RSBACLOGFILE"
                then
                  echo "cd `pwd`" >>"$RSBACLOGFILE"
                fi
         else TYPE=NONE
         fi
         if test -z "$DEVSPEC"
         then
              SECLEVEL=""
              MACCAT=""
              OBJCAT=""
              DATATYPE=""
              MACCHECK=""
              PMOBJTYPE=""
              PMCLASS=""
              RCTYPE=""
              LOGLOW=""
              LOGHIGH=""
              return
         fi
         if test "$SHOW_MAC" = "yes"
         then
           SECLEVEL=`$RSBACPATH""attr_get_file_dir -d DEV $DEVSPEC security_level`
           MACCAT=`$RSBACPATH""attr_get_file_dir -d DEV $DEVSPEC mac_categories`
           MACCHECK=`$RSBACPATH""attr_get_file_dir -d DEV $DEVSPEC mac_check`
         fi
         if test "$SHOW_PM" = "yes"
         then
           PMOBJTYPE=`$RSBACPATH""attr_get_file_dir -d DEV $DEVSPEC pm_object_type`
           PMCLASS=`$RSBACPATH""attr_get_file_dir -d DEV $DEVSPEC pm_object_class`
         fi
         if test "$SHOW_RC" = "yes"
         then
           RCTYPE=`$RSBACPATH""attr_get_file_dir -d DEV $DEVSPEC rc_type`
         fi
         if test "$SHOW_GEN" = "yes"
         then
           LOGLOW=`$RSBACPATH""attr_get_file_dir -d DEV $DEVSPEC log_array_low`
           LOGHIGH=`$RSBACPATH""attr_get_file_dir -d DEV $DEVSPEC log_array_high`
         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
}

list_item () {
   if test -L "$1"
   then echo $1 "SYMLINK->`ls -l \"$1\"|cut -d '>' -f 2|cut -c 2-`"
   elif test -b "$1"
   then echo $1 BLOCK
   elif test -c "$1"
   then echo $1 CHAR
   elif test -d "$1"
   then echo $1 DIR
   else echo $1 NONE
   fi
}

choose_major () {
  if $DIALOG --title "$TITLE" \
             --backtitle "$BACKTITLE" \
             --default-item "$(echo "$DEVSPEC"|cut -d ':' -f 1)" \
             --menu "Select Device Major" $BL $BC $MAXLINES \
  c0 "char  Unnamed devices (e.g. non-device mounts)" \
  b0 "block Unnamed devices (e.g. non-device mounts)" \
  c1 "char  Memory devices" \
  b1 "block RAM disk" \
  c2 "char  Pseudo-TTY masters" \
  b2 "block Floppy disks" \
  c3 "char  Pseudo-TTY slaves" \
  b3 "block First MFM, RLL and IDE hard disk/CD-ROM interface" \
  c4 "char  TTY devices" \
  c5 "char  Alternate TTY devices" \
  c6 "char  Parallel printer devices" \
  c7 "char  Virtual console capture devices" \
  b7 "block Loopback devices" \
  b8 "block SCSI disk devices (0-15)" \
  c9 "char  SCSI tape devices" \
  b9 "block Metadisk (RAID) devices" \
 c10 "char  Non-serial mice, misc features" \
 c11 "char  Raw keyboard device" \
 b11 "block SCSI CD-ROM devices" \
 c12 "char  QIC-02 tape" \
 b12 "block MSCDEX CD-ROM callback support {2.6}" \
 c13 "char  Input core" \
 b13 "block 8-bit MFM/RLL/IDE controller" \
 c14 "char  Open Sound System (OSS)" \
 b14 "block BIOS harddrive callback support {2.6}" \
 c15 "char  Joystick" \
 b15 "block Sony CDU-31A/CDU-33A CD-ROM" \
 c16 "char  Non-SCSI scanners" \
 b16 "block GoldStar CD-ROM" \
 c17 "char  Chase serial card" \
 b17 "block Optics Storage CD-ROM" \
 c18 "char  Chase serial card - alternate devices" \
 b18 "block Sanyo CD-ROM" \
 c19 "char  Cyclades serial card" \
 b19 "block Double compressed disk" \
 c20 "char  Cyclades serial card - alternate devices" \
 b20 "block Hitachi CD-ROM (under development)" \
 c21 "char  Generic SCSI access" \
 b21 "block Acorn MFM hard drive interface" \
 c22 "char  Digiboard serial card" \
 b22 "block Second IDE hard disk/CD-ROM interface" \
 c23 "char  Digiboard serial card - alternate devices" \
 b23 "block Mitsumi proprietary CD-ROM" \
 c24 "char  Stallion serial card" \
 b24 "block Sony CDU-535 CD-ROM" \
 c25 "char  Stallion serial card - alternate devices" \
 b25 "block First Matsushita (Panasonic/SoundBlaster) CD-ROM" \
 c26 "char  Quanta WinVision frame grabber {2.6}" \
 b26 "block Second Matsushita (Panasonic/SoundBlaster) CD-ROM" \
 c27 "char  QIC-117 tape" \
 b27 "block Third Matsushita (Panasonic/SoundBlaster) CD-ROM" \
 c28 "char  Stallion serial card - card programming" \
 c28 "char  Atari SLM ACSI laser printer (68k/Atari)" \
 b28 "block Fourth Matsushita (Panasonic/SoundBlaster) CD-ROM" \
 b28 "block ACSI disk (68k/Atari)" \
 c29 "char  Universal frame buffer" \
 b29 "block Aztech/Orchid/Okano/Wearnes CD-ROM" \
 c30 "char  iBCS-2 compatibility devices" \
 b30 "block Philips LMS CM-205 CD-ROM" \
 c31 "char  MPU-401 MIDI" \
 b31 "block ROM/flash memory card" \
 c32 "char  Specialix serial card" \
 b32 "block Philips LMS CM-206 CD-ROM" \
 c33 "char  Specialix serial card - alternate devices" \
 b33 "block Third IDE hard disk/CD-ROM interface" \
 c34 "char  Z8530 HDLC driver" \
 b34 "block Fourth IDE hard disk/CD-ROM interface" \
 c35 "char  tclmidi MIDI driver" \
 b35 "block Slow memory ramdisk" \
 c36 "char  Netlink support" \
 b36 "block MCA ESDI hard disk" \
 c37 "char  IDE tape" \
 b37 "block Zorro II ramdisk" \
 c38 "char  Myricom PCI Myrinet board" \
 b38 "block Reserved for Linux/AP+" \
 c39 "char  ML-16P experimental I/O board" \
 b39 "block Reserved for Linux/AP+" \
 c40 "char  Matrox Meteor frame grabber {2.6}" \
 b40 "block Syquest EZ135 parallel port removable drive" \
 c41 "char  Yet Another Micro Monitor" \
 b41 "block MicroSolutions BackPack parallel port CD-ROM" \
 c42 "char  Demo/sample use" \
 b42 "block Demo/sample use" \
 c43 "char  isdn4linux virtual modem" \
 b43 "block Network block devices" \
 c44 "char  isdn4linux virtual modem - alternate devices" \
 b44 "block Flash Translatio Layer (FTL) filesystems" \
 c45 "char  isdn4linux ISDN BRI driver" \
 b45 "block Parallel port IDE disk devices" \
 c46 "char  Comtrol Rocketport serial card" \
 b46 "block Parallel port ATAPI CD-ROM devices" \
 c47 "char  Comtrol Rocketport serial card - alternate devices" \
 b47 "block Parallel port ATAPI disk devices" \
 c48 "char  SDL RISCom serial card" \
 b48 "block Mylex DAC960 PCI RAID controller; first controller" \
 c49 "char  SDL RISCom serial card - alternate devices" \
 b49 "block Mylex DAC960 PCI RAID controller; second controller" \
 c50 "char  Reserved for GLINT" \
 b50 "block Mylex DAC960 PCI RAID controller; third controller" \
 c51 "char  Baycom radio modem" \
 b51 "block Mylex DAC960 PCI RAID controller; fourth controller" \
 c52 "char  Spellcaster DataComm/BRI ISDN card" \
 b52 "block Mylex DAC960 PCI RAID controller; fifth controller" \
 c53 "char  BDM interface for remote debugging MC683xx microcontrollers" \
 b53 "block Mylex DAC960 PCI RAID controller; sixth controller" \
 c54 "char  Electrocardiognosis Holter serial card" \
 b54 "block Mylex DAC960 PCI RAID controller; seventh controller" \
 c55 "char  DSP56001 digital signal processor" \
 b55 "block Mylex DAC960 PCI RAID controller; eigth controller" \
 c56 "char  Apple Desktop Bus" \
 b56 "block Fifth IDE hard disk/CD-ROM interface" \
 c57 "char  Hayes ESP serial card" \
 b57 "block Sixth IDE hard disk/CD-ROM interface" \
 c58 "char  Hayes ESP serial card - alternate devices" \
 b58 "block Reserved for logical volume manager" \
 c59 "char  sf firewall package" \
 b59 "block Generic PDA filesystem device" \
 c60 "char  LOCAL/EXPERIMENTAL USE" \
 b60 "block LOCAL/EXPERIMENTAL USE" \
 c61 "char  LOCAL/EXPERIMENTAL USE" \
 b61 "block LOCAL/EXPERIMENTAL USE" \
 c62 "char  LOCAL/EXPERIMENTAL USE" \
 b62 "block LOCAL/EXPERIMENTAL USE" \
 c63 "char  LOCAL/EXPERIMENTAL USE" \
 b63 "block LOCAL/EXPERIMENTAL USE" \
 c64 "char  ENskip kernel encryption package" \
 c65 "char  Sundance plink Transputer boards" \
 b65 "block SCSI disk devices (16-31)" \
 c66 "char  YARC PowerPC PCI coprocessor card" \
 b66 "block SCSI disk devices (32-47)" \
 c67 "char  Coda network file system" \
 b67 "block SCSI disk devices (48-63)" \
 c68 "char  CAPI 2.0 interface" \
 b68 "block SCSI disk devices (64-79)" \
 c69 "char  MA16 numeric accelerator card" \
 b69 "block SCSI disk devices (80-95)" \
 c70 "char  SpellCaster Protocol Services Interface" \
 b70 "block SCSI disk devices (96-111)" \
 c71 "char  Computone IntelliPort II serial card" \
 b71 "block SCSI disk devices (112-127)" \
 c72 "char  Computone IntelliPort II serial card - alternate devices" \
 b72 "block Compaq Intelligent Drive Array, first controller" \
 c73 "char  Computone IntelliPort II serial card - control devices" \
 b73 "block Compaq Intelligent Drive Array, second controller" \
 c74 "char  SCI bridge" \
 b74 "block Compaq Intelligent Drive Array, third controller" \
 c75 "char  Specialix IO8+ serial card" \
 b75 "block Compaq Intelligent Drive Array, fourth controller" \
 c76 "char  Specialix IO8+ serial card - alternate devices" \
 b76 "block Compaq Intelligent Drive Array, fifth controller" \
 c77 "char  ComScire Quantum Noise Generator" \
 b77 "block Compaq Intelligent Drive Array, sixth controller" \
 c78 "char  PAM Software multimodem boards" \
 b78 "block Compaq Intelligent Drive Array, seventh controller" \
 c79 "char  PAM Software multimodem boards - alternate devices" \
 b79 "block Compaq Intelligent Drive Array, eigth controller" \
 c80 "char  Photometrics AT200 CCD camera" \
 b80 "block I2O hard disk" \
 c81 "char  video4linux" \
 b81 "block I2O hard disk" \
 c82 "char  WiNRADiO communications receiver card" \
 b82 "block I2O hard disk" \
 c83 "char  Teletext/videotext interfaces {2.6}" \
 b83 "block I2O hard disk" \
 c84 "char  Ikon 1011[57] Versatec Greensheet Interface" \
 b84 "block I2O hard disk" \
 c85 "char  Linux/SGI shared memory input queue" \
 b85 "block I2O hard disk" \
 c86 "char  SCSI media changer" \
 b86 "block I2O hard disk" \
 c87 "char  Sony Control-A1 stereo control bus" \
 b87 "block I2O hard disk" \
 c88 "char  COMX synchronous serial card" \
 b88 "block Seventh IDE hard disk/CD-ROM interface" \
 c89 "char  I2C bus interface" \
 b89 "block Eighth IDE hard disk/CD-ROM interface" \
 c90 "char  Memory Technology Device (RAM, ROM, Flash)" \
 b90 "block Ninth IDE hard disk/CD-ROM interface" \
 c91 "char  CAN-Bus devices" \
 b91 "block Tenth IDE hard disk/CD-ROM interface" \
 c92 "char  Reserved for ith Kommunikationstechnik MIC ISDN card" \
 b92 "block PPDD encrypted disk driver" \
 c93 "char  IBM Smart Capture Card frame grabber {2.6}" \
 b93 "block NAND Flash Translation Layer filesystem" \
 c94 "char  miroVIDEO DC10/30 capture/playback device {2.6}" \
 b94 "block IBM S/390 DASD block storage" \
 c95 "char  IP filter" \
 b95 "block IBM S/390 VM/ESA minidisk" \
 c96 "char  Parallel port ATAPI tape devices" \
 c97 "char  Parallel port generic ATAPI interface" \
 b97 "block Packet writing for CD/DVD devices" \
 c98 "char  Control and Measurement Device (comedi)" \
 b98 "block User-mode virtual block device" \
 c99 "char  Raw parallel ports" \
 b99 "block JavaStation flash disk" \
c100 "char  Telephony for Linux" \
c101 "char  Motorola DSP 56xxx board" \
b101 "block AMI HyperDisk RAID controller" \
c102 "char  Philips SAA5249 Teletext signal decoder {2.6}" \
b102 "block Compressed block device" \
c103 "char  Arla network file system" \
b103 "block Audit device" \
c104 "char  Flash BIOS support" \
b104 "block Compaq Next Generation Drive Array, first controller" \
c105 "char  Comtrol VS-1000 serial controller" \
b105 "block Compaq Next Generation Drive Array, second controller" \
c106 "char  Comtrol VS-1000 serial controller - alternate devices" \
b106 "block Compaq Next Generation Drive Array, third controller" \
c107 "char  3Dfx Voodoo Graphics device" \
b107 "block Compaq Next Generation Drive Array, fourth controller" \
c108 "char  Device independent PPP interface" \
b108 "block Compaq Next Generation Drive Array, fifth controller" \
c109 "char  Reserved for logical volume manager" \
b109 "block Compaq Next Generation Drive Array, sixth controller" \
c110 "char  miroMEDIA Surround board" \
b110 "block Compaq Next Generation Drive Array, seventh controller" \
c111 "char  Philips SAA7146-based audio/video card {2.6}" \
b111 "block Compaq Next Generation Drive Array, eigth controller" \
c112 "char  ISI serial card" \
b112 "block IBM iSeries virtual disk" \
c113 "char  ISI serial card - alternate devices" \
b113 "block IBM iSeries virtual CD-ROM" \
c114 "char  Picture Elements ISE board" \
c115 "char  Console driver speaker" \
c116 "char  Advanced Linux Sound Driver (ALSA)" \
c117 "char  COSA/SRP synchronous serial card" \
c118 "char  Solidum ???" \
c119 "char  VMware virtual network control" \
c120 "char  LOCAL/EXPERIMENTAL USE" \
b120 "block LOCAL/EXPERIMENTAL USE" \
c120 "char  LOCAL/EXPERIMENTAL USE" \
b120 "block LOCAL/EXPERIMENTAL USE" \
c121 "char  LOCAL/EXPERIMENTAL USE" \
b121 "block LOCAL/EXPERIMENTAL USE" \
c122 "char  LOCAL/EXPERIMENTAL USE" \
b122 "block LOCAL/EXPERIMENTAL USE" \
c123 "char  LOCAL/EXPERIMENTAL USE" \
b123 "block LOCAL/EXPERIMENTAL USE" \
c124 "char  LOCAL/EXPERIMENTAL USE" \
b124 "block LOCAL/EXPERIMENTAL USE" \
c125 "char  LOCAL/EXPERIMENTAL USE" \
b125 "block LOCAL/EXPERIMENTAL USE" \
c126 "char  LOCAL/EXPERIMENTAL USE" \
b126 "block LOCAL/EXPERIMENTAL USE" \
c127 "char  LOCAL/EXPERIMENTAL USE" \
b127 "block LOCAL/EXPERIMENTAL USE" \
c128 "char  Unix98 PTY masters" \
c129 "char  Unix98 PTY masters" \
c130 "char  Unix98 PTY masters" \
c131 "char  Unix98 PTY masters" \
c132 "char  Unix98 PTY masters" \
c133 "char  Unix98 PTY masters" \
c134 "char  Unix98 PTY masters" \
c135 "char  Unix98 PTY masters" \
c136 "char  Unix98 PTY slaves" \
c137 "char  Unix98 PTY slaves" \
c138 "char  Unix98 PTY slaves" \
c139 "char  Unix98 PTY slaves" \
c140 "char  Unix98 PTY slaves" \
c141 "char  Unix98 PTY slaves" \
c142 "char  Unix98 PTY slaves" \
c143 "char  Unix98 PTY slaves" \
c144 "char  Encapsulated PPP" \
c145 "char  SAM9407-based soundcard" \
c146 "char  SYSTRAM SCRAMNet mirrored-memory network" \
c147 "char  Aueral Semiconductor Vortex Audio device" \
c148 "char  Technology Concepts serial card" \
c149 "char  Technology Concepts serial card - alternate devices" \
c150 "char  Real-Time Linux FIFOs" \
c151 "char  DPT I2O SmartRaid V controller" \
c154 "char  Specialix RIO serial card" \
c155 "char  Specialix RIO serial card - alternate devices" \
c156 "char  Specialix RIO serial card" \
c157 "char  Specialix RIO serial card - alternate devices" \
c158 "char  Dialogic GammaLink fax driver" \
c160 "char  General Purpose Instrument Bus (GPIB)" \
c161 "char  IrCOMM devices (IrDA serial/parallel emulation)" \
c162 "char  Raw block device interface" \
c163 "char  Radio Tech BIM-XXX-RS232 radio modem" \
c164 "char  Chase Research AT/PCI-Fast serial card" \
c165 "char  Chase Research AT/PCI-Fast serial card - alternate devices" \
c166 "char  ACM USB modems" \
c167 "char  ACM USB modems - alternate devices" \
c168 "char  Eracom CSA7000 PCI encryption adaptor" \
c169 "char  Eracom CSA8000 PCI encryption adaptor" \
c170 "char  AMI MegaRAC remote access controller" \
c171 "char  Reserved for IEEE 1394 (Firewire)" \
c172 "char  Moxa Intellio serial card" \
c173 "char  Moxa Intellio serial card - alternate devices" \
c174 "char  SmartIO serial card" \
c175 "char  SmartIO serial card - alternate devices" \
c176 "char  nCipher nFast PCI crypto accelerator" \
c177 "char  TI PCILynx memory spaces" \
c178 "char  Giganet cLAN1xxx virtual interface adapter" \
c179 "char  CCube DVXChip-based PCI products" \
c180 "char  USB devices" \
c181 "char  Conrad Electronic parallel port radio clocks" \
c182 "char  Picture Elements THR2 binarizer" \
c183 "char  SST 5136-DN DeviceNet interface" \
c184 "char  Picture Elements video simulator/sender" \
c185 "char  InterMezzo high availability file system" \
c186 "char  Object-based storage control device" \
c187 "char  DESkey hardware encryption device" \
c188 "char  USB serial converters" \
c189 "char  USB serial converters - alternate devices" \
c190 "char  Kansas City tracker/tuner card" \
c191 "char  Reserved for PCMCIA" \
c192 "char  Kernel profiling interface" \
c193 "char  Kernel event-tracing interface" \
c194 "char  linVideoStreams (LINVS)" \
c195 "char  Nvidia graphics devices" \
c196 "char  Tormenta T1 card" \
c197 "char  OpenTNF tracing facility" \
c198 "char  Total Impact TPMP2 quad coprocessor PCI card" \
c199 "char  Veritas volume manager (VxVM) volumes" \
b199 "block Veritas volume manager (VxVM) volumes" \
c200 "char  Veritas VxVM configuration interface" \
c201 "char  Veritas VxVM dynamic multipathing driver" \
b201 "block Veritas VxVM dynamic multipathing driver" \
c202 "char  CPU model-specific registers" \
c203 "char  CPU CPUID information" \
c204 "char  Low-density serial ports" \
c205 "char  Low-density serial ports (alternate device)" \
c206 "char  OnStream SC-x0 tape devices" \
c207 "char  Compaq ProLiant health feature indicate" \
c208 "char  User space serial ports" \
c209 "char  User space serial ports (alternate devices)" \
c210 "char  SBE, Inc. sync/async serial card" \
c211 "char  Addinum CPCI1500 digital I/O card" \
c216 "char  USB BlueTooth devices" \
c217 "char  USB BlueTooth devices (alternate devices)" \
c218 "char  The Logical Company bus Unibus/Qbus adapters" \
c219 "char  The Logical Company DCI-1300 digital I/O card" \
c220 "char  Myricom Myrinet GM board" \
c221 "char  VME bus" \
c224 "char  A2232 serial card" \
c225 "char  A2232 serial card (alternate devices)" \
c226 "char  Direct Rendering Infrastructure (DRI)" \
c227 "char  IBM 3270 terminal Unix tty access" \
c228 "char  IBM 3270 terminal block-mode access" \
c229 "char  IBM iSeries virtual console" \
c230 "char  IBM iSeries virtual tape" \
           2>$TMPFILE
  then
    DEVSPEC=`cat $TMPFILE`
    FILE=
    get_attributes
  fi
}

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

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

  case $1 in
    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 
      ;;
    maccheck)
      case $2 in
        0) echo Off
          ;;
        1) echo On
          ;;
        *) 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
          ;;
        $RCTYPEINHPAR) echo Inherit Dev Major
          ;;
        *) if ! $RSBACPATH""rc_get_item TYPE $2 type_dev_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() {
  if test -e ${TMPFILE}.2
    then rm ${TMPFILE}.2
  fi
  for i in $REQUESTS
  do TMP=`$RSBACPATH""attr_get_file_dir -d DEV $DEVSPEC log_level $i`
     echo $i `get_vname loglevel $TMP`>>${TMPFILE}.2
  done
}

log_menu () {
  if test -z "$REQUESTS"
    then REQUESTS=`$RSBACPATH""attr_get_file_dir -d DEV $DEVSPEC log_level NONE 2>/dev/null|grep -v types`
  fi
  gen_log_menu_items
  while true ; do \
    if ! \
    $DIALOG --title "$TITLE" \
           --backtitle "$BACKTITLE" \
           --default-item "$REQ" \
           --menu "$DEVSPEC: Log Levels for Requests" $BL $BC `gl 37` \
                `cat ${TMPFILE}.2` \
                "Quit" "" \
         2>$TMPFILE
     then rm ${TMPFILE}.2
          LOGLOW=`$RSBACPATH""attr_get_file_dir -d DEV $DEVSPEC log_array_low`
          LOGHIGH=`$RSBACPATH""attr_get_file_dir -d DEV $DEVSPEC log_array_high`
          return
    fi
    REQ=`cat $TMPFILE`
    case "$REQ" in
      Quit)
        rm ${TMPFILE}.2
        LOGLOW=`$RSBACPATH""attr_get_file_dir -d DEV $DEVSPEC log_array_low`
        LOGHIGH=`$RSBACPATH""attr_get_file_dir -d DEV $DEVSPEC log_array_high`
        return
        ;;
      *)
        VAL=`grep "^$REQ " ${TMPFILE}.2|cut -f 2 -d ' '`
        if $DIALOG --title "$TITLE" \
                   --backtitle "$BACKTITLE" \
                   --radiolist "Choose Log Level for $DEVSPEC / $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_file_dir -d DEV "$DEVSPEC" log_level $REQ $TMP &>$TMPFILE
             then
               gen_log_menu_items
               if test -n "$RSBACLOGFILE"
               then
                 echo $RSBACPATH""attr_set_file_dir -d DEV \"$DEVSPEC\" log_level $REQ $TMP >>"$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_file_dir -d DEV $DEVSPEC mac_categories $i`
      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
}

gen_follow_symlink () {
    case $1 in
      1)
        if test "$TYPE" = "SYMLINK"
        then
          echo 'Follow'
        fi
        ;;
      2)
        if test "$TYPE" = "SYMLINK"
        then
          echo "`name_print \"$SYMLINK\"`"
        fi
        ;;
    esac
}

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

if test -n "$1"
then
  if test -b "$1" -o -c "$1"
  then
    FILE=$1
    DEVSPEC=$($RSBACPATH""attr_get_file_dir -C "$FILE")
  else
    FILE=
    DEVSPEC="$1"
  fi
else
  FILE=$LASTDIR
  DEVSPEC=
fi
get_attributes

if test -n "$RSBACLOGFILE"
then
  {
    echo ""
    echo "# $0 start `date`"
    echo "cd `pwd`"
  } >>"$RSBACLOGFILE"
fi

  {
    echo 'dev_menu ()'
    echo '  {'    
    echo "    $DIALOG --title \"$TITLE\" \\"
    echo '       --backtitle "$BACKTITLE" \'
    echo '       --help-button --default-item "$CHOICE" \'
    echo '       --menu "Main DEV Menu" $BL $BC `gl 20` \'
    echo '         "File/Dir List:" "Choose from listing of last dir" \'
    echo '         "Dev Major List:" "Choose from list of major numbers" \'
    echo '              "-------------------" " " \'
    echo '            "Dev special file:" "$FILE" \'
    echo '            "Dev specification:" "$DEVSPEC" \'
    echo '            `gen_follow_symlink 1` `gen_follow_symlink 2` \'
    echo '            "----------------" " " \'
    if test "$SHOW_MAC" = "yes"
    then
      echo '            "MAC Security Level:" "$SECLEVEL / `get_vname seclevel $SECLEVEL`" \'
      echo '            "MAC Categories:" "`cat_print $MACCAT`" \'
      echo '            "MAC Check:" "$MACCHECK / `get_vname maccheck $MACCHECK`" \'
    fi
    if test "$SHOW_PM" = "yes"
    then
      echo '              "PM Object Class:" "$PMCLASS" \'
      echo '              "PM Object Type:" "$PMOBJTYPE / `get_vname pmobjtype $PMOBJTYPE`" \'
    fi
    if test "$SHOW_RC" = "yes"
    then
      echo '              "RC Type:" "$RCTYPE / `get_vname rctype $RCTYPE`" \'
    fi
    if test "$SHOW_GEN" = "yes"
    then
      echo '              "Log Array Low:" "$LOGLOW" \'
      echo '              "Log Array High:" "$LOGHIGH" \'
    fi
    echo '            "----------------" " " \'
    echo '            "File/Dir Attributes:" "Go to File/Dir attribute menu" \'
    if test "$SHOW_ACL" = "yes"
    then
      echo '            "ACL Menu:" "Go to ACL menu" \'
    fi
    echo '            "Reset Attributes:" "Reset all values to default values" \'
    echo '            "Quit" ""'
    echo '  }'
  } > $TMPFILE

. $TMPFILE

#cp $TMPFILE /tmp/menu

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


  CHOICE=`cat $TMPFILE`
  case "$CHOICE" in
    HELP*)
        show_help "${CHOICE:5}"
        CHOICE="${CHOICE:5}"
      ;;
    'File/Dir List:')
        FILETMP="$FILE"
        if test ! -d $LASTDIR
        then $LASTDIR='/'
        fi
        TMP=`ls -1ad "$LASTDIR"/* "$LASTDIR"/.*`
        while $DIALOG --title "$TITLE" \
                  --backtitle "$BACKTITLE" \
                  --default-item "$FILETMP" \
                  --menu "Device Name (choose cancel for $FILE)" $BL $BC $MAXLINES \
                         `for i in $TMP ; do list_item "$i" ; done` \
           2>$TMPFILE
        do FILETMP=`cat $TMPFILE`
          case "$FILETMP" in
            *)
              FILE="$FILETMP"
              if test -b "$FILE" -o -c "$FILE"
              then
                DEVSPEC=$($RSBACPATH""attr_get_file_dir -C "$FILE")
              else
                DEVSPEC=
              fi
              get_attributes
              TMP=`ls -1ad "$LASTDIR"/* "$LASTDIR"/.*`
              if test -L "$FILE" -o ! -d "$FILE"
              then break
              fi
          esac
        done
      ;;

    'Dev Major List:')
        choose_major
      ;;

    "Dev special file:")
        if $DIALOG --title "$TITLE" \
                  --backtitle "$BACKTITLE" \
                  --inputbox "Filename" $BL $BC $FILE \
           2>$TMPFILE
        then
          FILE=`cat $TMPFILE`
          DEVSPEC=$($RSBACPATH""attr_get_file_dir -C "$FILE")
          get_attributes
        fi
      ;;

    "Dev specification:")
        if $DIALOG --title "$TITLE" \
                  --backtitle "$BACKTITLE" \
                  --inputbox "Device specification {b|c}major[:minor]" $BL $BC "$DEVSPEC" \
           2>$TMPFILE
        then
          DEVSPEC=`cat $TMPFILE`
          FILE=
          get_attributes
        fi
      ;;

    "Follow")
        case "$SYMLINK" in
          /*)
            FILE="$SYMLINK"
            ;;
          *)
            FILE="`dirname $FILE`/$SYMLINK"
            ;;
        esac
        get_attributes
      ;;

    'MAC Security Level:')
        if test -n "DEVSPEC"
        then \
          if $DIALOG --title "$TITLE" \
                    --backtitle "$BACKTITLE" \
                    --radiolist "Choose Security Level for $FILE (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_file_dir -d DEV "$DEVSPEC" security_level $TMP &>$TMPFILE
                 then
                   SECLEVEL=$TMP
                   if test -n "$RSBACLOGFILE"
                   then
                     echo $RSBACPATH""attr_set_file_dir -d DEV \"$DEVSPEC\" security_level $TMP >>"$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 dev special file specified!" 5 $BC
        fi
      ;;

    'MAC Categories:')
        if test -n "DEVSPEC"
        then \
          ALLCATNR=`$RSBACPATH""attr_get_file_dir list_category_nr`
          if $DIALOG --title "MAC Categories for device $FILE" \
                    --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_file_dir -d DEV "$DEVSPEC" mac_categories $i 0 &>$TMPFILE
                 then
                   if test -n "$RSBACLOGFILE"
                   then
                     echo $RSBACPATH""attr_set_file_dir -d DEV \"$DEVSPEC\" mac_categories $i 0 >>"$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_file_dir -d DEV "$DEVSPEC" mac_categories $i 1 &>$TMPFILE
                 then
                   if test -n "$RSBACLOGFILE"
                   then
                     echo $RSBACPATH""attr_set_file_dir -d DEV \"$DEVSPEC\" mac_categories $i 1 >>"$RSBACLOGFILE"
                   fi
                 else
                   $DIALOG --title "$ERRTITLE" \
                          --backtitle "$BACKTITLE" \
                          --msgbox "`head -n 1 $TMPFILE`" $BL $BC
                   continue
                 fi
               done
               MACCAT=`$RSBACPATH""attr_get_file_dir -d DEV $DEVSPEC mac_categories`
          fi
        else
                 $DIALOG --title "$ERRTITLE" \
                        --backtitle "$BACKTITLE" \
                        --msgbox "MAC Categories: No user specified!" 5 $BC
        fi
      ;;

    'MAC Check:')
        if test -n "DEVSPEC"
        then \
           if test $MACCHECK = "0"
           then TMP="1"
           else TMP="0"
           fi
           if $RSBACPATH""attr_set_file_dir -d DEV "$DEVSPEC" mac_check $TMP &>$TMPFILE
           then
             MACCHECK=$TMP
             if test -n "$RSBACLOGFILE"
             then
               echo $RSBACPATH""attr_set_file_dir -d DEV \"$DEVSPEC\" mac_check $TMP >>"$RSBACLOGFILE"
             fi
           else \
             $DIALOG --title "$ERRTITLE" \
                    --backtitle "$BACKTITLE" \
                    --msgbox "`head -n 1 $TMPFILE`" $BL $BC
           fi
        else
                 $DIALOG --title "$ERRTITLE" \
                        --backtitle "$BACKTITLE" \
                        --msgbox "Mac Check: No dev special file specified!" 5 $BC
        fi
      ;;


    'PM Object Type:')
        if test -n "DEVSPEC"
        then \
          if $DIALOG --title "$TITLE" \
                    --backtitle "$BACKTITLE" \
                    --radiolist "Choose PM Object Type for $FILE" $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_file_dir -d DEV "$DEVSPEC" pm_object_type $TMP &>$TMPFILE
               then
                 PMOBJTYPE=$TMP
                 if test -n "$RSBACLOGFILE"
                 then
                   echo $RSBACPATH""attr_set_file_dir -d DEV \"$DEVSPEC\" pm_object_type $TMP >>"$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 dev special file specified!" 5 $BC
        fi
      ;;

    'PM Object Class:')
        if test -n "DEVSPEC"
        then \
           if $DIALOG --title "$TITLE" \
                     --backtitle "$BACKTITLE" \
                     --inputbox "PM Object Class (long integer) for $FILE" \
                                $BL $BC "$PMCLASS" \
              2>$TMPFILE
          then TMP=`cat $TMPFILE`
               if $RSBACPATH""attr_set_file_dir -d DEV "$DEVSPEC" pm_object_class $TMP &>$TMPFILE
               then
                 PMCLASS=$TMP
                 if test -n "$RSBACLOGFILE"
                 then
                   echo $RSBACPATH""attr_set_file_dir -d DEV \"$DEVSPEC\" pm_object_class $TMP >>"$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 dev special file specified!" 5 $BC
        fi
      ;;

    'RC Type:')
        if test -n "DEVSPEC"
        then
          if $RSBACPATH""rc_get_item list_dev_types >$TMPFILE
          then
            if $DIALOG --title "$TITLE" \
                      --backtitle "$BACKTITLE" \
                      --default-item "$RCTYPE" \
                      --menu "Choose RC Type for $DEVSPEC - $FILE" $BL $BC $MAXLINES \
                      $RCTYPEINHPAR "Inherit from major" \
                      `cat $TMPFILE` \
               2>$TMPFILE
            then TMP=`cat $TMPFILE`
              if $RSBACPATH""attr_set_file_dir -d DEV "$DEVSPEC" rc_type $TMP &>$TMPFILE
              then
                RCTYPE=$TMP
                if test -n "$RSBACLOGFILE"
                then
                  echo $RSBACPATH""attr_set_file_dir -d DEV \"$DEVSPEC\" rc_type $TMP >>"$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 $FILE" \
                                 $BL $BC "$RCTYPE" \
                2>$TMPFILE
            then TMP=`cat $TMPFILE`
                 if $RSBACPATH""attr_set_file_dir -d DEV "$DEVSPEC" rc_type $TMP &>$TMPFILE
                 then
                   RCTYPE=$TMP
                   if test -n "$RSBACLOGFILE"
                   then
                     echo $RSBACPATH""attr_set_file_dir -d DEV \"$DEVSPEC\" rc_type $TMP >>"$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 device specified!" 5 $BC
        fi
      ;;

    'Log Array Low:')
        if test -n "DEVSPEC"
        then \
          log_menu
        else
                 $DIALOG --title "$ERRTITLE" \
                        --backtitle "$BACKTITLE" \
                        --msgbox "Log Array Low: No dev special file specified!" 5 $BC
        fi
      ;;

    'Log Array High:')
        if test -n "DEVSPEC"
        then \
          log_menu
        else
                 $DIALOG --title "$ERRTITLE" \
                        --backtitle "$BACKTITLE" \
                        --msgbox "Log Array High: No dev special file specified!" 5 $BC
        fi
      ;;

    'File/Dir Attributes:')
        $RSBACPATH""rsbac_fd_menu "$FILE"
      ;;

    'ACL Menu:')
        $RSBACPATH""rsbac_acl_menu DEV "$FILE"
      ;;

    'Reset Attributes:')
        if test -n "DEVSPEC"
        then \
          if $DIALOG --title "$TITLE" \
                    --backtitle "$BACKTITLE" \
                    --yesno "Reset all attributes to default values?" 5 $BC \
             2>/dev/null
          then
            if $RSBACPATH""attr_rm_file_dir -d DEV "$DEVSPEC" &>$TMPFILE
            then get_attributes
            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 file/dir specified!" 5 $BC
        fi
      ;;

    Quit)
        rm $TMPFILE ; exit
      ;;

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