5 # Description: (1) Fails for mask with undefined bit set.
6 # 01/24/94: pshuang: untried.
10 if {! (( ! [policy_exists "$test/a"]) ||
11 [delete_policy "$test/a"])} {
12 error_and_restart "$test: couldn't delete policy \"$test/a\""
16 kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
17 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
20 perror "$test: unexpected failure in init"
23 one_line_fail_test [format {
24 kadm5_create_policy $server_handle [simple_policy "%s/a"] \
27 if { ! [cmd {kadm5_destroy $server_handle}]} {
28 perror "$test: unexpected failure in destroy"
34 # Description: (2) Fails if caller connected with CHANGEPW_SERVICE.
35 test "create-policy 2"
38 if {! (( ! [policy_exists "$test/a"]) ||
39 [delete_policy "$test/a"])} {
40 error_and_restart "$test: couldn't delete principal \"$test/a\""
44 kadm5_init admin admin $KADM5_CHANGEPW_SERVICE null \
45 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
48 perror "$test: unexpected failure in init"
51 one_line_fail_test [format {
52 kadm5_create_policy $server_handle [simple_policy "%s/a"] \
55 if { ! [cmd {kadm5_destroy $server_handle}]} {
56 perror "$test: unexpected failure in destroy";
62 # Description: (3) Fails for mask without POLICY bit set.
63 # 01/24/94: pshuang: untried.
64 test "create-policy 3"
67 if {! (( ! [policy_exists "$test/a"]) ||
68 [delete_policy "$test/a"])} {
69 error_and_restart "$test: couldn't delete policy \"$test/a\""
73 kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
74 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
77 perror "$test: unexpected failure in init"
80 one_line_fail_test [format {
81 kadm5_create_policy $server_handle [simple_policy "%s/a"] \
84 if { ! [cmd {kadm5_destroy $server_handle}]} {
85 perror "$test: unexpected failure in destroy"
91 # Description: (5) Fails for invalid policy name.
92 # 01/24/94: pshuang: untried.
93 test "create-policy 5"
97 kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
98 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
101 perror "$test: unexpected failure in init"
104 one_line_fail_test [format {
105 kadm5_create_policy $server_handle [simple_policy "%s/
\a"] \
107 } $test] "BAD_POLICY"
108 if { ! [cmd {kadm5_destroy $server_handle}]} {
109 perror "$test: unexpected failure in destroy"
115 # Description: (6) Fails for existing policy name.
116 test "create-policy 6"
120 # setup_xfail {*-*-*} $prms_id
123 kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
124 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
127 perror "$test: unexpected failure in init"
131 kadm5_create_policy $server_handle [simple_policy test-pol] \
134 if { ! [cmd {kadm5_destroy $server_handle}]} {
135 perror "$test: unexpected failure in destroy"
141 # Description: (7) Fails for null policy name.
142 # 01/24/94: pshuang: untried.
143 test "create-policy 7"
147 # setup_xfail {*-*-*} $prms_id
150 kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
151 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
154 perror "$test: unexpected failure in init"
158 kadm5_create_policy $server_handle [simple_policy null] \
161 if { ! [cmd {kadm5_destroy $server_handle}]} {
162 perror "$test: unexpected failure in destroy"
168 # Description: (8) Fails for empty-string policy name.
169 test "create-policy 8"
174 kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
175 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
178 perror "$test: unexpected failure in init"
182 kadm5_create_policy $server_handle [simple_policy ""] \
185 if { ! [cmd {kadm5_destroy $server_handle}]} {
186 perror "$test: unexpected failure in destroy"
192 # Description: (9) Accepts 0 for pw_min_life.
193 test "create-policy 9"
198 if {! (( ! [policy_exists "$test/a"]) ||
199 [delete_policy "$test/a"])} {
200 error_and_restart "$test: couldn't delete principal \"$test/a\""
205 kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
206 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
209 perror "$test: unexpected failure in init"
212 if { ! [cmd [format {
213 kadm5_create_policy $server_handle [simple_policy "%s/a"] \
214 {KADM5_POLICY KADM5_PW_MIN_LIFE}
216 fail "$test: create failed"
220 kadm5_get_policy $server_handle "%s/a" policy
222 fail "$test: can not retrieve policy"
225 send "lindex \$policy 1\n"
227 -re "0\n$prompt$" { pass "$test" }
228 timeout { fail "$test" }
230 if { ! [cmd {kadm5_destroy $server_handle}]} {
231 perror "$test: unexpected failure in destroy"
237 # Description: (10) Accepts non-zero for pw_min_life.
238 test "create-policy 10"
243 if {! (( ! [policy_exists "$test/a"]) ||
244 [delete_policy "$test/a"])} {
245 error_and_restart "$test: couldn't delete principal \"$test/a\""
250 kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
251 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
254 perror "$test: unexpected failure in init"
257 if { ! [cmd [format {
258 kadm5_create_policy $server_handle {"%s/a" 32 0 0 0 0 0 } \
259 {KADM5_POLICY KADM5_PW_MIN_LIFE}
265 kadm5_get_policy $server_handle "%s/a" policy
267 fail "$test: can not retreuve policy"
270 send "lindex \$policy 1\n"
272 -re "32\n$prompt$" { pass "$test" }
273 timeout { fail "$test" }
275 if { ! [cmd {kadm5_destroy $server_handle}]} {
276 perror "$test: unexpected failure in destroy"
282 # Description: (11) Accepts 0 for pw_max_life.
283 test "create-policy 11"
288 if {! (( ! [policy_exists "$test/a"]) ||
289 [delete_policy "$test/a"])} {
290 error_and_restart "$test: couldn't delete principal \"$test/a\""
295 kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
296 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
299 perror "$test: unexpected failure in init"
303 kadm5_create_policy $server_handle [simple_policy "%s/a"] \
304 {KADM5_POLICY KADM5_PW_MAX_LIFE}
310 kadm5_get_policy $server_handle "%s/a" policy
312 fail "$test: can not retreuve policy"
315 send "lindex \$policy 2\n"
317 -re "0\n$prompt$" { pass "$test" }
318 timeout { fail "$test" }
321 if { ! [cmd {kadm5_destroy $server_handle}]} {
322 perror "$test: unexpected failure in destroy"
328 # Description: (12) Accepts non-zero for pw_max_life.
329 test "create-policy 12"
334 if {! (( ! [policy_exists "$test/a"]) ||
335 [delete_policy "$test/a"])} {
336 error_and_restart "$test: couldn't delete principal \"$test/a\""
341 kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
342 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
345 perror "$test: unexpected failure in init"
349 kadm5_create_policy $server_handle {"%s/a" 0 32 0 0 0 0 } \
350 {KADM5_POLICY KADM5_PW_MAX_LIFE}
356 kadm5_get_policy $server_handle "%s/a" policy
358 fail "$test: can not retreuve policy"
361 send "lindex \$policy 2\n"
363 -re "32\n$prompt$" { pass "$test" }
364 timeout { fail "$test" }
366 if { ! [cmd {kadm5_destroy $server_handle}]} {
367 perror "$test: unexpected failure in destroy"
373 # Description: (13) Rejects 0 for pw_min_length.
374 test "create-policy 13"
380 if {! (( ! [policy_exists "$test/a"]) ||
381 [delete_policy "$test/a"])} {
382 error_and_restart "$test: couldn't delete principal \"$test/a\""
386 kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
387 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
390 perror "$test: unexpected failure in init"
393 one_line_fail_test [format {
394 kadm5_create_policy $server_handle [simple_policy "%s/a"] \
395 {KADM5_POLICY KADM5_PW_MIN_LENGTH}
396 } $test] "BAD_LENGTH"
397 if { ! [cmd {kadm5_destroy $server_handle}]} {
398 perror "$test: unexpected failure in destroy"
404 # Description: (14) Accepts non-zero for pw_min_length.
405 test "create-policy 14"
410 if {! (( ! [policy_exists "$test/a"]) ||
411 [delete_policy "$test/a"])} {
412 error_and_restart "$test: couldn't delete principal \"$test/a\""
417 kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
418 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
421 perror "$test: unexpected failure in init"
425 kadm5_create_policy $server_handle {"%s/a" 0 0 8 0 0 0 } \
426 {KADM5_POLICY KADM5_PW_MIN_LENGTH}
432 kadm5_get_policy $server_handle "%s/a" policy
434 fail "$test: can not retreuve policy"
437 send "lindex \$policy 3\n"
439 -re "8\n$prompt$" { pass "$test" }
440 timeout { fail "$test" }
443 if { ! [cmd {kadm5_destroy $server_handle}]} {
444 perror "$test: unexpected failure in destroy"
450 # Description: (15) Rejects 0 for pw_min_classes.
451 test "create-policy 15"
455 if {! (( ! [policy_exists "$test/a"]) ||
456 [delete_policy "$test/a"])} {
457 error_and_restart "$test: couldn't delete principal \"$test/a\""
462 kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
463 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
466 perror "$test: unexpected failure in init"
469 one_line_fail_test [format {
470 kadm5_create_policy $server_handle [simple_policy "%s/a"] \
471 {KADM5_POLICY KADM5_PW_MIN_CLASSES}
473 if { ! [cmd {kadm5_destroy $server_handle}]} {
474 perror "$test: unexpected failure in destroy"
480 # Description: (16) Accepts 1 for pw_min_classes.
481 test "create-policy 16"
486 if {! (( ! [policy_exists "$test/a"]) ||
487 [delete_policy "$test/a"])} {
488 error_and_restart "$test: couldn't delete principal \"$test/a\""
493 kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
494 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
497 perror "$test: unexpected failure in init"
501 kadm5_create_policy $server_handle {"%s/a" 0 0 0 1 0 0 } \
502 {KADM5_POLICY KADM5_PW_MIN_CLASSES}
508 kadm5_get_policy $server_handle "%s/a" policy
510 fail "$test: can not retreuve policy"
513 send "lindex \$policy 4\n"
515 -re "1\n$prompt$" { pass "$test" }
516 timeout { fail "$test" }
519 if { ! [cmd {kadm5_destroy $server_handle}]} {
520 perror "$test: unexpected failure in destroy"
526 # Description: (17) Accepts 4 for pw_min_classes.
527 test "create-policy 17"
532 if {! (( ! [policy_exists "$test/a"]) ||
533 [delete_policy "$test/a"])} {
534 error_and_restart "$test: couldn't delete principal \"$test/a\""
538 kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
539 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
542 perror "$test: unexpected failure in init"
546 kadm5_create_policy $server_handle {"%s/a" 0 0 0 5 0 0} \
547 {KADM5_POLICY KADM5_PW_MIN_CLASSES}
553 kadm5_get_policy $server_handle "%s/a" policy
555 fail "$test: can not retreuve policy"
558 send "lindex \$policy 4\n"
560 -re "5\n$prompt$" { pass "$test" }
561 timeout { fail "$test" }
563 if { ! [cmd {kadm5_destroy $server_handle}]} {
564 perror "$test: unexpected failure in destroy"
570 # Description: (18) Rejects 5 for pw_min_classes.
571 test "create-policy 18"
575 if {! (( ! [policy_exists "$test/a"]) ||
576 [delete_policy "$test/a"])} {
577 error_and_restart "$test: couldn't delete principal \"$test/a\""
581 kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
582 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
585 perror "$test: unexpected failure in init"
588 one_line_fail_test [format {
589 kadm5_create_policy $server_handle {"%s/a" 0 0 0 6 0 0} \
590 {KADM5_POLICY KADM5_PW_MIN_CLASSES}
592 if { ! [cmd {kadm5_destroy $server_handle}]} {
593 perror "$test: unexpected failure in destroy"
599 # Description: (19) Rejects 0 for pw_history_num.
600 test "create-policy 19"
604 if {! (( ! [policy_exists "$test/a"]) ||
605 [delete_policy "$test/a"])} {
606 error_and_restart "$test: couldn't delete principal \"$test/a\""
610 kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
611 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
614 perror "$test: unexpected failure in init"
617 one_line_fail_test [format {
618 kadm5_create_policy $server_handle [simple_policy "%s/a"] \
619 {KADM5_POLICY KADM5_PW_HISTORY_NUM}
620 } $test] "BAD_HISTORY"
621 if { ! [cmd {kadm5_destroy $server_handle}]} {
622 perror "$test: unexpected failure in destroy"
628 # Description: (20) Accepts 1 for pw_history_num.
629 test "create-policy 20"
634 if {! (( ! [policy_exists "$test/a"]) ||
635 [delete_policy "$test/a"])} {
636 error_and_restart "$test: couldn't delete principal \"$test/a\""
640 kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
641 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
644 perror "$test: unexpected failure in init"
648 kadm5_create_policy $server_handle {"%s/a" 0 0 0 0 1 0} \
649 {KADM5_POLICY KADM5_PW_HISTORY_NUM}
655 kadm5_get_policy $server_handle "%s/a" policy
657 fail "$test: can not retreuve policy"
660 send "lindex \$policy 5\n"
662 -re "1\n$prompt$" { pass "$test" }
663 timeout { fail "$test" }
665 if { ! [cmd {kadm5_destroy $server_handle}]} {
666 perror "$test: unexpected failure in destroy"
672 # Description: (21) Accepts 10 for pw_history_num.
673 test "create-policy 21"
678 if {! (( ! [policy_exists "$test/a"]) ||
679 [delete_policy "$test/a"])} {
680 error_and_restart "$test: couldn't delete principal \"$test/a\""
685 kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
686 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
689 perror "$test: unexpected failure in init"
693 kadm5_create_policy $server_handle {"%s/a" 0 0 0 0 10 0} \
694 {KADM5_POLICY KADM5_PW_HISTORY_NUM}
700 kadm5_get_policy $server_handle "%s/a" policy
702 fail "$test: can not retrieve policy"
705 send "lindex \$policy 5\n"
707 -re "10\n$prompt$" { pass "$test" }
708 timeout { fail "$test" }
710 if { ! [cmd {kadm5_destroy $server_handle}]} {
711 perror "$test: unexpected failure in destroy"
717 # Description: (22) Fails for user with no access bits.
718 test "create-policy 22"
721 if {! (( ! [policy_exists "$test/a"]) ||
722 [delete_policy "$test/a"])} {
723 error_and_restart "$test: couldn't delete principal \"$test/a\""
728 kadm5_init admin/none admin $KADM5_ADMIN_SERVICE null \
729 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
732 perror "$test: unexpected failure in init"
735 one_line_fail_test [format {
736 kadm5_create_policy $server_handle [simple_policy "%s/a"] \
739 if { ! [cmd {kadm5_destroy $server_handle}]} {
740 perror "$test: unexpected failure in destroy"
746 # Description: (23) Fails for user with "get" but not "add".
747 test "create-policy 23"
750 if {! (( ! [policy_exists "$test/a"]) ||
751 [delete_policy "$test/a"])} {
752 error_and_restart "$test: couldn't delete principal \"$test/a\""
757 kadm5_init admin/get admin $KADM5_ADMIN_SERVICE null \
758 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
761 perror "$test: unexpected failure in init"
764 one_line_fail_test [format {
765 kadm5_create_policy $server_handle [simple_policy "%s/a"] \
768 if { ! [cmd {kadm5_destroy $server_handle}]} {
769 perror "$test: unexpected failure in destroy"
775 # Description: (24) Fails for user with "modify" but not "add".
776 # 01/24/94: pshuang: untried.
777 test "create-policy 24"
780 if {! (( ! [policy_exists "$test/a"]) ||
781 [delete_policy "$test/a"])} {
782 error_and_restart "$test: couldn't delete principal \"$test/a\""
787 kadm5_init admin/modify admin $KADM5_ADMIN_SERVICE null \
788 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
791 perror "$test: unexpected failure in init"
794 one_line_fail_test [format {
795 kadm5_create_policy $server_handle [simple_policy "%s/a"] \
798 if { ! [cmd {kadm5_destroy $server_handle}]} {
799 perror "$test: unexpected failure in destroy"
805 # Description: (25) Fails for user with "delete" but not "add".
806 # 01/24/94: pshuang: untried.
807 test "create-policy 25"
810 if {! (( ! [policy_exists "$test/a"]) ||
811 [delete_policy "$test/a"])} {
812 error_and_restart "$test: couldn't delete principal \"$test/a\""
817 kadm5_init admin/delete admin $KADM5_ADMIN_SERVICE null \
818 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
821 perror "$test: unexpected failure in init"
824 one_line_fail_test [format {
825 kadm5_create_policy $server_handle [simple_policy "%s/a"] \
828 if { ! [cmd {kadm5_destroy $server_handle}]} {
829 perror "$test: unexpected failure in destroy"
835 # Description: Succeeds for user with "add".
836 test "create-policy 26"
840 if {! (( ! [policy_exists "$test/a"]) ||
841 [delete_policy "$test/a"])} {
842 error_and_restart "$test: couldn't delete principal \"$test/a\""
846 kadm5_init admin/add admin $KADM5_ADMIN_SERVICE null \
847 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
850 perror "$test: unexpected failure in init"
853 one_line_succeed_test [format {
854 kadm5_create_policy $server_handle [simple_policy "%s/a"] \
857 if { ! [cmd {kadm5_destroy $server_handle}]} {
858 perror "$test: unexpected failure in destroy"
864 # Description: Succeeds for user with "get" and "add".
865 # 01/24/94: pshuang: untried.
866 test "create-policy 27"
870 if {! (( ! [policy_exists "$test/a"]) ||
871 [delete_policy "$test/a"])} {
872 error_and_restart "$test: couldn't delete principal \"$test/a\""
876 kadm5_init admin/get-add admin $KADM5_ADMIN_SERVICE null \
877 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
880 perror "$test: unexpected failure in init"
883 one_line_succeed_test [format {
884 kadm5_create_policy $server_handle [simple_policy "%s/a"] \
887 if { ! [cmd {kadm5_destroy $server_handle}]} {
888 perror "$test: unexpected failure in destroy"
894 # Description: (28) Rejects null policy argument.
895 # 01/24/94: pshuang: untried.
896 test "create-policy 28"
900 kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
901 $KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
904 perror "$test: unexpected failure in init"
908 kadm5_create_policy $server_handle null {KADM5_POLICY}
910 if { ! [cmd {kadm5_destroy $server_handle}]} {
911 perror "$test: unexpected failure in destroy"
917 test "create-policy 30"
920 one_line_fail_test [format {
921 kadm5_create_policy null [simple_policy "%s/a"] \
923 } $test] "BAD_SERVER_HANDLE"