~ubuntu-branches/ubuntu/oneiric/likewise-open/oneiric

« back to all changes in this revision

Viewing changes to krb5/src/lib/kadm5/unit-test/api.0/mod-policy.exp

  • Committer: Bazaar Package Importer
  • Author(s): Scott Salley
  • Date: 2010-11-22 12:06:00 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20101122120600-8lba1fpceot71wlb
Tags: 6.0.0.53010-1
Likewise Open 6.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
load_lib lib.t
 
2
api_exit
 
3
api_start
 
4
 
 
5
test "modify-policy 2"
 
6
proc test2 {} {
 
7
    global test
 
8
 
 
9
    if {! ((  [policy_exists "$test/a"]) ||
 
10
           [create_policy "$test/a"])} {
 
11
            error_and_restart "$test: couldn't create policy \"$test/a\""
 
12
            return
 
13
    }
 
14
 
 
15
    if {! [cmd {
 
16
        ovsec_kadm_init admin admin $OVSEC_KADM_CHANGEPW_SERVICE null \
 
17
                $OVSEC_KADM_STRUCT_VERSION $OVSEC_KADM_API_VERSION_1 \
 
18
                server_handle
 
19
    }]} {
 
20
        perror "$test: unexpected failure in init"
 
21
        return
 
22
    }
 
23
    one_line_fail_test [format {
 
24
        ovsec_kadm_modify_policy $server_handle [simple_policy "%s/a"] \
 
25
                {OVSEC_KADM_PW_MAX_LIFE}
 
26
    } $test] "AUTH_MODIFY"
 
27
    if { ! [cmd {ovsec_kadm_destroy $server_handle}]} {
 
28
        perror "$test: unexpected failure in destroy"
 
29
        return
 
30
    }
 
31
}
 
32
if {$RPC} { test2 }
 
33
 
 
34
test "modify-policy 4"
 
35
proc test4 {} {
 
36
    global test
 
37
    
 
38
    if {! ([policy_exists "$test/a"] ||
 
39
           [create_policy "$test/a"])} {
 
40
            error_and_restart "$test: couldn't create policy \"$test/a\""
 
41
            return
 
42
    }
 
43
    if {! [cmd {
 
44
        ovsec_kadm_init admin admin $OVSEC_KADM_ADMIN_SERVICE null \
 
45
                $OVSEC_KADM_STRUCT_VERSION $OVSEC_KADM_API_VERSION_1 \
 
46
                server_handle
 
47
    }]} {
 
48
        perror "$test: unexpected failure in init"
 
49
        return
 
50
    }
 
51
    one_line_fail_test [format {
 
52
        ovsec_kadm_modify_policy $server_handle [simple_policy "%s/a"] \
 
53
                {OVSEC_KADM_REF_COUNT}
 
54
    } $test] "BAD_MASK"
 
55
    if { ! [cmd {ovsec_kadm_destroy $server_handle}]} {
 
56
        perror "$test: unexpected failure in destroy"
 
57
        return
 
58
    }
 
59
}
 
60
test4
 
61
 
 
62
test "modify-policy 8"
 
63
proc test8 {} {
 
64
    global test
 
65
#    set prms_id 744
 
66
#    setup_xfail {*-*-*} $prms_id
 
67
 
 
68
    if {! ((  [policy_exists "$test/a"]) ||
 
69
           [create_policy "$test/a"])} {
 
70
            error_and_restart "$test: couldn't create policy \"$test/a\""
 
71
            return
 
72
    }
 
73
 
 
74
    if {! [cmd {
 
75
        ovsec_kadm_init admin admin $OVSEC_KADM_ADMIN_SERVICE null \
 
76
                $OVSEC_KADM_STRUCT_VERSION $OVSEC_KADM_API_VERSION_1 \
 
77
                server_handle
 
78
    }]} {
 
79
        perror "$test: unexpected failure in init"
 
80
        return
 
81
    }
 
82
    one_line_fail_test {
 
83
        ovsec_kadm_modify_policy $server_handle [simple_policy ""] \
 
84
                {OVSEC_KADM_PW_MAX_LIFE}
 
85
    } "BAD_POLICY"
 
86
    if { ! [cmd {ovsec_kadm_destroy $server_handle}]} {
 
87
        perror "$test: unexpected failure in destroy"
 
88
        return
 
89
    }
 
90
}
 
91
test8
 
92
 
 
93
test "modify-policy 9"
 
94
proc test9 {} {
 
95
    global test
 
96
    global prompt
 
97
    if {! ((  [policy_exists "$test/a"]) ||
 
98
           [create_policy "$test/a"])} {
 
99
            error_and_restart "$test: couldn't create policy \"$test/a\""
 
100
            return
 
101
    }
 
102
 
 
103
    if {! [cmd {
 
104
        ovsec_kadm_init admin admin $OVSEC_KADM_ADMIN_SERVICE null \
 
105
                $OVSEC_KADM_STRUCT_VERSION $OVSEC_KADM_API_VERSION_1 \
 
106
                server_handle
 
107
    }]} {
 
108
        perror "$test: unexpected failure in init"
 
109
        return
 
110
    }
 
111
    if {! [cmd [format {
 
112
        ovsec_kadm_modify_policy $server_handle [simple_policy "%s/a"] \
 
113
                {OVSEC_KADM_PW_MIN_LIFE}
 
114
    } $test]]} {
 
115
        fail $test
 
116
        return
 
117
    }
 
118
    if {! [cmd [format {
 
119
        ovsec_kadm_get_policy $server_handle "%s/a" policy
 
120
    } $test]]} {
 
121
        fail "$test: can not retrieve policy"
 
122
        return
 
123
    }
 
124
    send "lindex \$policy 1\n"
 
125
    expect {
 
126
        -re "0\n$prompt$"               { pass "$test" }
 
127
        timeout                         { fail "$test" }
 
128
    }
 
129
    
 
130
    if { ! [cmd {ovsec_kadm_destroy $server_handle}]} {
 
131
        perror "$test: unexpected failure in destroy"
 
132
        return
 
133
    }
 
134
}
 
135
test9
 
136
 
 
137
test "modify-policy 10"
 
138
proc test10 {} {
 
139
    global test
 
140
    global prompt
 
141
    if {! ((  [policy_exists "$test/a"]) ||
 
142
           [create_policy "$test/a"])} {
 
143
            error_and_restart "$test: couldn't create policy \"$test/a\""
 
144
            return
 
145
    }
 
146
    if {! [cmd {
 
147
        ovsec_kadm_init admin admin $OVSEC_KADM_ADMIN_SERVICE null \
 
148
                $OVSEC_KADM_STRUCT_VERSION $OVSEC_KADM_API_VERSION_1 \
 
149
                server_handle
 
150
    }]} {
 
151
        perror "$test: unexpected failure in init"
 
152
        return
 
153
    }
 
154
    if {! [cmd [format {
 
155
        ovsec_kadm_modify_policy $server_handle {"%s/a" 32 0 0 0 0 0} \
 
156
                {OVSEC_KADM_PW_MIN_LIFE}
 
157
    } $test]]} {
 
158
        fail $test
 
159
        return
 
160
    }
 
161
    if {! [cmd [format {
 
162
        ovsec_kadm_get_policy $server_handle "%s/a" policy
 
163
    } $test]]} {
 
164
        fail "$test: can not retrieve policy"
 
165
        return
 
166
    }
 
167
    send "lindex \$policy 1\n"
 
168
    expect {
 
169
        -re "32\n$prompt$"              { pass "$test" }
 
170
        timeout                         { fail "$test" }
 
171
    }
 
172
    if { ! [cmd {ovsec_kadm_destroy $server_handle}]} {
 
173
        perror "$test: unexpected failure in destroy"
 
174
        return
 
175
    }
 
176
}
 
177
test10
 
178
 
 
179
 
 
180
test "modify-policy 11"
 
181
proc test11 {} {
 
182
    global test
 
183
    global prompt
 
184
    
 
185
    if {! ((  [policy_exists "$test/a"]) ||
 
186
           [create_policy "$test/a"])} {
 
187
            error_and_restart "$test: couldn't create policy \"$test/a\""
 
188
            return
 
189
    }
 
190
 
 
191
    if {! [cmd {
 
192
        ovsec_kadm_init admin admin $OVSEC_KADM_ADMIN_SERVICE null \
 
193
                $OVSEC_KADM_STRUCT_VERSION $OVSEC_KADM_API_VERSION_1 \
 
194
                server_handle
 
195
    }]} {
 
196
        perror "$test: unexpected failure in init"
 
197
        return
 
198
    }
 
199
    if {! [cmd [format {
 
200
        ovsec_kadm_modify_policy $server_handle [simple_policy "%s/a"] \
 
201
                {OVSEC_KADM_PW_MAX_LIFE}
 
202
    } $test]]} {
 
203
        fail $test
 
204
        return
 
205
    }
 
206
    if {! [cmd [format {
 
207
        ovsec_kadm_get_policy $server_handle "%s/a" policy
 
208
    } $test]]} {
 
209
        fail "$test: can not retrieve policy"
 
210
        return
 
211
    }
 
212
    send "lindex \$policy 2\n"
 
213
    expect {
 
214
        -re "0\n$prompt$"               { pass "$test" }
 
215
        timeout                         { fail "$test" }
 
216
    }
 
217
    if { ! [cmd {ovsec_kadm_destroy $server_handle}]} {
 
218
        perror "$test: unexpected failure in destroy"
 
219
        return
 
220
    }
 
221
}
 
222
test11
 
223
 
 
224
test "modify-policy 12"
 
225
proc test12 {} {
 
226
    global test
 
227
    global prompt
 
228
    
 
229
    if {! ((  [policy_exists "$test/a"]) ||
 
230
           [create_policy "$test/a"])} {
 
231
            error_and_restart "$test: couldn't create policy \"$test/a\""
 
232
            return
 
233
    }
 
234
 
 
235
    if {! [cmd {
 
236
        ovsec_kadm_init admin admin $OVSEC_KADM_ADMIN_SERVICE null \
 
237
                $OVSEC_KADM_STRUCT_VERSION $OVSEC_KADM_API_VERSION_1 \
 
238
                server_handle
 
239
    }]} {
 
240
        perror "$test: unexpected failure in init"
 
241
        return
 
242
    }
 
243
    if {! [cmd [format {
 
244
        ovsec_kadm_modify_policy $server_handle {"%s/a" 0 32 0 0 0 0} \
 
245
                {OVSEC_KADM_PW_MAX_LIFE}
 
246
    } $test]]} {
 
247
        fail $test
 
248
        return
 
249
    }
 
250
    if {! [cmd [format {
 
251
        ovsec_kadm_get_policy $server_handle "%s/a" policy
 
252
    } $test]]} {
 
253
        fail "$test: can not retrieve policy"
 
254
        return
 
255
    }
 
256
    send "lindex \$policy 2\n"
 
257
    expect {
 
258
        -re "32\n$prompt$"              { pass "$test" }
 
259
        timeout                         { fail "$test" }
 
260
    }
 
261
    if { ! [cmd {ovsec_kadm_destroy $server_handle}]} {
 
262
        perror "$test: unexpected failure in destroy"
 
263
        return
 
264
    }
 
265
}
 
266
test12
 
267
 
 
268
test "modify-policy 13"
 
269
proc test13 {} {
 
270
    global test
 
271
    if {! ((  [policy_exists "$test/a"]) ||
 
272
           [create_policy "$test/a"])} {
 
273
            error_and_restart "$test: couldn't create policy \"$test/a\""
 
274
            return
 
275
    }
 
276
 
 
277
    if {! [cmd {
 
278
        ovsec_kadm_init admin admin $OVSEC_KADM_ADMIN_SERVICE null \
 
279
                $OVSEC_KADM_STRUCT_VERSION $OVSEC_KADM_API_VERSION_1 \
 
280
                server_handle
 
281
    }]} {
 
282
        perror "$test: unexpected failure in init"
 
283
        return
 
284
    }
 
285
    one_line_fail_test [format {
 
286
        ovsec_kadm_modify_policy $server_handle [simple_policy "%s/a"] \
 
287
                {OVSEC_KADM_PW_MIN_LENGTH}
 
288
    } $test] "BAD_LENGTH"
 
289
    if { ! [cmd {ovsec_kadm_destroy $server_handle}]} {
 
290
        perror "$test: unexpected failure in destroy"
 
291
        return
 
292
    }
 
293
}
 
294
test13
 
295
 
 
296
test "modify-policy 14"
 
297
proc test14 {} {
 
298
    global test
 
299
    global prompt
 
300
    
 
301
    if {! ((  [policy_exists "$test/a"]) ||
 
302
           [create_policy "$test/a"])} {
 
303
            error_and_restart "$test: couldn't create policy \"$test/a\""
 
304
            return
 
305
    }
 
306
 
 
307
    if {! [cmd {
 
308
        ovsec_kadm_init admin admin $OVSEC_KADM_ADMIN_SERVICE null \
 
309
                $OVSEC_KADM_STRUCT_VERSION $OVSEC_KADM_API_VERSION_1 \
 
310
                server_handle
 
311
    }]} {
 
312
        perror "$test: unexpected failure in init"
 
313
        return
 
314
    }
 
315
    if {! [cmd [format {
 
316
        ovsec_kadm_modify_policy $server_handle {"%s/a" 0 0 8 0 0 0} \
 
317
                {OVSEC_KADM_PW_MIN_LENGTH}
 
318
    } $test]]} {
 
319
        fail $test
 
320
        return
 
321
    }
 
322
    if {! [cmd [format {
 
323
        ovsec_kadm_get_policy $server_handle "%s/a" policy
 
324
    } $test]]} {
 
325
        fail "$test: can not retrieve policy"
 
326
        return
 
327
    }
 
328
    send "lindex \$policy 3\n"
 
329
    expect {
 
330
        -re "8\n$prompt$"               { pass "$test" }
 
331
        timeout                         { fail "$test" }
 
332
    }
 
333
    if { ! [cmd {ovsec_kadm_destroy $server_handle}]} {
 
334
        perror "$test: unexpected failure in destroy"
 
335
        return
 
336
    }
 
337
}
 
338
test14
 
339
 
 
340
test "modify-policy 15"
 
341
proc test15 {} {
 
342
    global test
 
343
    if {! ((  [policy_exists "$test/a"]) ||
 
344
           [create_policy "$test/a"])} {
 
345
            error_and_restart "$test: couldn't create policy \"$test/a\""
 
346
            return
 
347
    }
 
348
 
 
349
    if {! [cmd {
 
350
        ovsec_kadm_init admin admin $OVSEC_KADM_ADMIN_SERVICE null \
 
351
                $OVSEC_KADM_STRUCT_VERSION $OVSEC_KADM_API_VERSION_1 \
 
352
                server_handle
 
353
    }]} {
 
354
        perror "$test: unexpected failure in init"
 
355
        return
 
356
    }
 
357
    one_line_fail_test [format {
 
358
        ovsec_kadm_modify_policy $server_handle [simple_policy "%s/a"] \
 
359
                {OVSEC_KADM_PW_MIN_CLASSES}
 
360
    } $test] "BAD_CLASS"
 
361
    if { ! [cmd {ovsec_kadm_destroy $server_handle}]} {
 
362
        perror "$test: unexpected failure in destroy"
 
363
        return
 
364
    }
 
365
}
 
366
test15
 
367
 
 
368
test "modify-policy 16"
 
369
proc test16 {} {
 
370
    global test
 
371
    global prompt
 
372
    
 
373
    if {! ((  [policy_exists "$test/a"]) ||
 
374
           [create_policy "$test/a"])} {
 
375
            error_and_restart "$test: couldn't create policy \"$test/a\""
 
376
            return
 
377
    }
 
378
 
 
379
    if {! [cmd {
 
380
        ovsec_kadm_init admin admin $OVSEC_KADM_ADMIN_SERVICE null \
 
381
                $OVSEC_KADM_STRUCT_VERSION $OVSEC_KADM_API_VERSION_1 \
 
382
                server_handle
 
383
    }]} {
 
384
        perror "$test: unexpected failure in init"
 
385
        return
 
386
    }
 
387
    if {! [cmd [format {
 
388
        ovsec_kadm_modify_policy $server_handle {"%s/a" 0 0 0 1 0 0} \
 
389
                {OVSEC_KADM_PW_MIN_CLASSES}
 
390
    } $test]]} {
 
391
        fail $test
 
392
        return
 
393
    }
 
394
    if {! [cmd [format {
 
395
        ovsec_kadm_get_policy $server_handle "%s/a" policy
 
396
    } $test]]} {
 
397
        fail "$test: can not retrieve policy"
 
398
        return
 
399
    }
 
400
    send "lindex \$policy 4\n"
 
401
    expect {
 
402
        -re "1\n$prompt$"               { pass "$test" }
 
403
        timeout                         { fail "$test" }
 
404
    }
 
405
    
 
406
    
 
407
    if { ! [cmd {ovsec_kadm_destroy $server_handle}]} {
 
408
        perror "$test: unexpected failure in destroy"
 
409
        return
 
410
    }
 
411
}
 
412
test16
 
413
 
 
414
test "modify-policy 17"
 
415
proc test17 {} {
 
416
    global test
 
417
    global prompt
 
418
    
 
419
    if {! ((  [policy_exists "$test/a"]) ||
 
420
           [create_policy "$test/a"])} {
 
421
            error_and_restart "$test: couldn't create policy \"$test/a\""
 
422
            return
 
423
    }
 
424
 
 
425
    if {! [cmd {
 
426
        ovsec_kadm_init admin admin $OVSEC_KADM_ADMIN_SERVICE null \
 
427
                $OVSEC_KADM_STRUCT_VERSION $OVSEC_KADM_API_VERSION_1 \
 
428
                server_handle
 
429
    }]} {
 
430
        perror "$test: unexpected failure in init"
 
431
        return
 
432
    }
 
433
    if {! [cmd [format {
 
434
        ovsec_kadm_modify_policy $server_handle {"%s/a" 0 0 0 5 0 0} \
 
435
                {OVSEC_KADM_PW_MIN_CLASSES}
 
436
    } $test]]} {
 
437
        fail $test
 
438
        return
 
439
    }
 
440
    if {! [cmd [format {
 
441
        ovsec_kadm_get_policy $server_handle "%s/a" policy
 
442
    } $test]]} {
 
443
        fail "$test: can not retrieve policy"
 
444
        return
 
445
    }
 
446
    send "lindex \$policy 4\n"
 
447
    expect {
 
448
        -re "5\n$prompt$"               { pass "$test" }
 
449
        timeout                         { fail "$test" }
 
450
    }
 
451
    
 
452
    if { ! [cmd {ovsec_kadm_destroy $server_handle}]} {
 
453
        perror "$test: unexpected failure in destroy"
 
454
        return
 
455
    }
 
456
}
 
457
test17
 
458
 
 
459
test "modify-policy 18"
 
460
proc test18 {} {
 
461
    global test
 
462
    global prompt
 
463
    
 
464
    if {! ((  [policy_exists "$test/a"]) ||
 
465
           [create_policy "$test/a" ])} {
 
466
            error_and_restart "$test: couldn't create policy \"$test/a\""
 
467
            return
 
468
    }
 
469
 
 
470
    if {! [cmd {
 
471
        ovsec_kadm_init admin admin $OVSEC_KADM_ADMIN_SERVICE null \
 
472
                $OVSEC_KADM_STRUCT_VERSION $OVSEC_KADM_API_VERSION_1 \
 
473
                server_handle
 
474
    }]} {
 
475
        perror "$test: unexpected failure in init"
 
476
        return
 
477
    }
 
478
    one_line_fail_test [format {
 
479
        ovsec_kadm_modify_policy $server_handle {"%s/a" 0 0 0 6 0 0} \
 
480
                {OVSEC_KADM_PW_MIN_CLASSES}
 
481
    } $test] "BAD_CLASS"
 
482
    if { ! [cmd {ovsec_kadm_destroy $server_handle}]} {
 
483
        perror "$test: unexpected failure in destroy"
 
484
        return
 
485
    }
 
486
}
 
487
test18
 
488
 
 
489
test "modify-policy 19"
 
490
proc test19 {} {
 
491
    global test
 
492
    
 
493
    if {! ((  [policy_exists "$test/a"]) ||
 
494
           [create_policy "$test/a" ])} {
 
495
            error_and_restart "$test: couldn't create policy \"$test/a\""
 
496
            return
 
497
    }
 
498
 
 
499
    if {! [cmd {
 
500
        ovsec_kadm_init admin admin $OVSEC_KADM_ADMIN_SERVICE null \
 
501
                $OVSEC_KADM_STRUCT_VERSION $OVSEC_KADM_API_VERSION_1 \
 
502
                server_handle
 
503
    }]} {
 
504
        perror "$test: unexpected failure in init"
 
505
        return
 
506
    }
 
507
    one_line_fail_test [format {
 
508
        ovsec_kadm_modify_policy $server_handle [simple_policy "%s/a"] \
 
509
                {OVSEC_KADM_PW_HISTORY_NUM}
 
510
    } $test] "BAD_HISTORY"
 
511
    if { ! [cmd {ovsec_kadm_destroy $server_handle}]} {
 
512
        perror "$test: unexpected failure in destroy"
 
513
        return
 
514
    }
 
515
}
 
516
test19
 
517
 
 
518
test "modify-policy 20"
 
519
proc test20 {} {
 
520
    global test
 
521
    global prompt
 
522
    
 
523
    if {! ((  [policy_exists "$test/a"]) ||
 
524
           [create_policy "$test/a" ])} {
 
525
            error_and_restart "$test: couldn't create policy \"$test/a\""
 
526
            return
 
527
    }
 
528
 
 
529
    if {! [cmd {
 
530
        ovsec_kadm_init admin admin $OVSEC_KADM_ADMIN_SERVICE null \
 
531
                $OVSEC_KADM_STRUCT_VERSION $OVSEC_KADM_API_VERSION_1 \
 
532
                server_handle
 
533
    }]} {
 
534
        perror "$test: unexpected failure in init"
 
535
        return
 
536
    }
 
537
    if {! [cmd [format {
 
538
        ovsec_kadm_modify_policy $server_handle {"%s/a" 0 0 0 0 1 0} \
 
539
                {OVSEC_KADM_PW_HISTORY_NUM}
 
540
    } $test]]} {
 
541
        fail $test
 
542
        return
 
543
    }
 
544
    if {! [cmd [format {
 
545
        ovsec_kadm_get_policy $server_handle "%s/a" policy
 
546
    } $test]]} {
 
547
        fail "$test: can not retrieve policy"
 
548
        return
 
549
    }
 
550
    send "lindex \$policy 5\n"
 
551
    expect {
 
552
        -re "1\n$prompt$"               { pass "$test" }
 
553
        timeout                         { fail "$test" }
 
554
    }
 
555
    
 
556
    if { ! [cmd {ovsec_kadm_destroy $server_handle}]} {
 
557
        perror "$test: unexpected failure in destroy"
 
558
        return
 
559
    }
 
560
}
 
561
test20
 
562
 
 
563
test "modify-policy 21"
 
564
proc test21 {} {
 
565
    global test
 
566
    global prompt
 
567
    
 
568
    if {! ((  [policy_exists "$test/a"]) ||
 
569
           [create_policy "$test/a" ])} {
 
570
            error_and_restart "$test: couldn't create policy \"$test/a\""
 
571
            return
 
572
    }
 
573
 
 
574
    if {! [cmd {
 
575
        ovsec_kadm_init admin admin $OVSEC_KADM_ADMIN_SERVICE null \
 
576
                $OVSEC_KADM_STRUCT_VERSION $OVSEC_KADM_API_VERSION_1 \
 
577
                server_handle
 
578
    }]} {
 
579
        perror "$test: unexpected failure in init"
 
580
        return
 
581
    }
 
582
    if {! [cmd [format {
 
583
        ovsec_kadm_modify_policy $server_handle {"%s/a" 0 0 0 0 10 0} \
 
584
                {OVSEC_KADM_PW_HISTORY_NUM}
 
585
    } $test]]} {
 
586
        fail $test
 
587
        return
 
588
    }
 
589
    if {! [cmd [format {
 
590
        ovsec_kadm_get_policy $server_handle "%s/a" policy
 
591
    } $test]]} {
 
592
        fail "$test: can not retrieve policy"
 
593
        return
 
594
    }
 
595
    send "lindex \$policy 5\n"
 
596
    expect {
 
597
        -re "10\n$prompt$"              { pass "$test" }
 
598
        timeout                         { fail "$test" }
 
599
    }
 
600
    
 
601
    if { ! [cmd {ovsec_kadm_destroy $server_handle}]} {
 
602
        perror "$test: unexpected failure in destroy"
 
603
        return
 
604
    }
 
605
}
 
606
test21
 
607
 
 
608
test "modify-policy 22"
 
609
proc test22 {} {
 
610
    global test
 
611
    if {! ((  [policy_exists "$test/a"]) ||
 
612
           [create_policy "$test/a" ])} {
 
613
            error_and_restart "$test: couldn't create policy \"$test/a\""
 
614
            return
 
615
    }
 
616
 
 
617
    if {! [cmd {
 
618
        ovsec_kadm_init admin/none admin $OVSEC_KADM_ADMIN_SERVICE null \
 
619
                $OVSEC_KADM_STRUCT_VERSION $OVSEC_KADM_API_VERSION_1 \
 
620
                server_handle
 
621
    }]} {
 
622
        perror "$test: unexpected failure in init"
 
623
        return
 
624
    }
 
625
    one_line_fail_test [format {
 
626
        ovsec_kadm_modify_policy $server_handle [simple_policy "%s/a"] \
 
627
                {OVSEC_KADM_PW_MAX_LIFE}
 
628
    } $test] "AUTH_MODIFY"
 
629
    if { ! [cmd {ovsec_kadm_destroy $server_handle}]} {
 
630
        perror "$test: unexpected failure in destroy"
 
631
        return
 
632
    }
 
633
}
 
634
if {$RPC} test22
 
635
 
 
636
test "modify-policy 23"
 
637
proc test23 {} {
 
638
    global test
 
639
    if {! ((  [policy_exists "$test/a"]) ||
 
640
           [create_policy "$test/a" ])} {
 
641
            error_and_restart "$test: couldn't create policy \"$test/a\""
 
642
            return
 
643
    }
 
644
 
 
645
    if {! [cmd {
 
646
        ovsec_kadm_init admin/get admin $OVSEC_KADM_ADMIN_SERVICE null \
 
647
                $OVSEC_KADM_STRUCT_VERSION $OVSEC_KADM_API_VERSION_1 \
 
648
                server_handle
 
649
    }]} {
 
650
        perror "$test: unexpected failure in init"
 
651
        return
 
652
    }
 
653
    one_line_fail_test [format {
 
654
        ovsec_kadm_modify_policy $server_handle [simple_policy "%s/a"] \
 
655
                {OVSEC_KADM_PW_MAX_LIFE}
 
656
    } $test] "AUTH_MODIFY"
 
657
    if { ! [cmd {ovsec_kadm_destroy $server_handle}]} {
 
658
        perror "$test: unexpected failure in destroy"
 
659
        return
 
660
    }
 
661
}
 
662
if {$RPC} test23
 
663
 
 
664
test "modify-policy 26"
 
665
proc test26 {} {
 
666
    global test
 
667
    if {! ((  [policy_exists "$test/a"]) ||
 
668
           [create_policy "$test/a" ])} {
 
669
            error_and_restart "$test: couldn't create policy \"$test/a\""
 
670
            return
 
671
    }
 
672
 
 
673
    if {! [cmd {
 
674
        ovsec_kadm_init admin/modify admin $OVSEC_KADM_ADMIN_SERVICE null \
 
675
                $OVSEC_KADM_STRUCT_VERSION $OVSEC_KADM_API_VERSION_1 \
 
676
                server_handle
 
677
    }]} {
 
678
        perror "$test: unexpected failure in init"
 
679
        return
 
680
    }
 
681
    one_line_succeed_test [format {
 
682
        ovsec_kadm_modify_policy $server_handle [simple_policy "%s/a"] \
 
683
                {OVSEC_KADM_PW_MAX_LIFE}
 
684
    } $test]
 
685
    if { ! [cmd {ovsec_kadm_destroy $server_handle}]} {
 
686
        perror "$test: unexpected failure in destroy"
 
687
        return
 
688
    }
 
689
}
 
690
test26
 
691
 
 
692
test "modify-policy 30"
 
693
proc test30 {} {
 
694
    global test
 
695
 
 
696
    one_line_fail_test [format {
 
697
        ovsec_kadm_modify_policy null [simple_policy "%s/a"] \
 
698
                {OVSEC_KADM_PW_MAX_LIFE}
 
699
    } $test] "BAD_SERVER_HANDLE"
 
700
}
 
701
test30
 
702
 
 
703
return ""