File: chpass-principal-v2.exp

package info (click to toggle)
krb5 1.17-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 55,116 kB
  • sloc: ansic: 303,225; exp: 13,198; cpp: 9,731; python: 8,927; makefile: 7,178; sh: 6,279; perl: 2,289; asm: 1,460; yacc: 1,005; awk: 396; csh: 147; xml: 135; lisp: 104; sed: 41
file content (68 lines) | stat: -rw-r--r-- 1,696 bytes parent folder | download
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
load_lib lib.t
api_exit
api_start

test "chpass-principal 200"
proc test200 {} {
    global test prompt

    if {! (( ! [principal_exists "$test/a"]) ||
	   [delete_principal "$test/a"])} {
	    error_and_restart "$test: couldn't create principal \"$test/a\""
	    return
    }
    if {! [create_principal "$test/a"]} {
	error_and_restart "$test: creating principal"
	return
    }

    # I'd like to specify a long list of keysalt tuples and make sure
    # that chpass does the right thing, but we can only use those
    # enctypes that krbtgt has a key for: the des3 enctypes, according to
    # the prototype kdc.conf.
    if {! [cmd [format {
	kadm5_init admin admin $KADM5_ADMIN_SERVICE null \
		$KADM5_STRUCT_VERSION $KADM5_API_VERSION_3 \
		server_handle
    }]]} {
	perror "$test: unexpected failure in init"
	return
    }
    if {! [cmd [format {
	kadm5_chpass_principal $server_handle "%s/a" newpassword
    } $test]]} {
	perror "$test: unexpected failure in chpass_principal"
    }
    if {! [cmd [format {
	kadm5_get_principal $server_handle  "%s/a" p \
		{KADM5_PRINCIPAL_NORMAL_MASK KADM5_KEY_DATA}
    } $test]]} {
	perror "$test: unexpected failure in get_principal"
    }
    send "lindex \$p 16\n"
    expect {
	-re "(\[0-9\]+)\n$prompt" { set num_keys $expect_out(1,string) }
	timeout {
	    error_and_restart "$test: timeout getting num_keys"
	    return
	}
	eof {
	    error_and_restart "$test: eof getting num_keys"
	    return
	}
    }

    if {$num_keys == 1} {
	pass "$test"
    } else {
	fail "$test: $num_keys keys, should be 5"

    }
    if { ! [cmd {kadm5_destroy $server_handle}]} {
	perror "$test: unexpected failure in destroy"
	return
    }
}
test200

return ""