* api.2/init-v2.exp: add test 117, for default max_life
authorBarry Jaspan <bjaspan@mit.edu>
Fri, 18 Oct 1996 17:22:18 +0000 (17:22 +0000)
committerBarry Jaspan <bjaspan@mit.edu>
Fri, 18 Oct 1996 17:22:18 +0000 (17:22 +0000)
  [krb5-admin/18]

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9195 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/kadm5/unit-test/ChangeLog
src/lib/kadm5/unit-test/api.2/init-v2.exp

index d304338eb6f446712ce71174f7271ced93f9e315..f3413bba60339d3dd3d9ea7338d62bce05f8a186 100644 (file)
@@ -1,3 +1,8 @@
+Fri Oct 18 13:21:08 1996  Barry Jaspan  <bjaspan@mit.edu>
+
+       * api.2/init-v2.exp: add test 117, for default max_life
+       [krb5-admin/18]
+
 Thu Oct 17 16:14:11 1996  Barry Jaspan  <bjaspan@mit.edu>
 
        * config/unix.exp, lib/lib.t: begin in process of making these
index 38ddcf5d61515c4bb04fbc33a7abdf11c1b2f3c0..8927e6b5bf4dcecc76f8714e944f1753d45f1b46 100644 (file)
@@ -427,6 +427,68 @@ proc test116 {} {
     }
 }
 if {$RPC} test116
+
+test "init 117"
+proc test117 {} {
+    global test env prompt
+
+    if {[catch "exec grep max_life $env(KRB5_KDC_PROFILE)"] != 1} {
+       warning \
+          "$test: max_life in $env(KRB5_KDC_PROFILE), cannot perform test"
+       return
+    }
+
+    if {! (( ! [principal_exists "$test/a"]) ||
+        [delete_principal "$test/a"])} {
+        error_and_restart "$test: couldn't delete principal \"$test/a\""
+       return
+    }
+
+    if {! [cmd {
+       kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
+               $KADM5_STRUCT_VERSION $KADM5_API_VERSION_2 \
+               server_handle
+    }]} {
+       fail "$test: unexpected failure in init"
+       return
+    }
+
+    if {! [cmd [format {
+       kadm5_create_principal $server_handle [simple_principal "%s/a"] \
+               {KADM5_PRINCIPAL} "%s/a"
+    } $test $test]]} {
+       error "$test: unexpected failure creating principal"
+    }
+    if {! [cmd [format {
+       kadm5_get_principal $server_handle "%s/a" principal KADM5_MAX_LIFE
+    } $test]]} {
+       error_and_restart "$test: could not retrieve principal"
+       return
+    }
+    send "lindex \$principal 4\n"
+    expect {
+       -re "(\[0-9\]+)\n$prompt" {set max_life $expect_out(1,string) }
+       timeout {
+           error_and_restart "$test: timeout getting max_life"
+           return
+       }
+       eof {
+           error_and_restart "$test: eof getting max_life"
+           return
+       }
+    }
+    
+    if {$max_life == 36000} {
+       pass "$test"
+    } else {
+       fail "$test: max_life $max_life should be 36000"
+    }
+
+    if {! [cmd {kadm5_destroy $server_handle}]} {
+       error_and_restart "$test: couldn't close server_handle"
+    }
+}
+test117
     
 send "puts \$KADM5_ADMIN_SERVICE\n"
 expect {