3 * kadmin/ldap_util/kdb5_ldap_policy.c
7 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
8 * Use is subject to license terms.
11 /* Copyright (c) 2004-2005, Novell, Inc.
12 * All rights reserved.
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions are met:
17 * * Redistributions of source code must retain the above copyright notice,
18 * this list of conditions and the following disclaimer.
19 * * Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 * * The copyright holder's name is not used to endorse or promote products
23 * derived from this software without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
39 * Create / Delete / Modify / View / List policy objects.
45 #include <kadm5/admin.h>
48 #include "kdb5_ldap_util.h"
49 #include "kdb5_ldap_list.h"
50 #include "ldap_tkt_policy.h"
51 extern time_t get_date(char *); /* kadmin/cli/getdate.o */
53 static void print_policy_params(krb5_ldap_policy_params
*policyparams
, int mask
);
54 static char *strdur(time_t duration
);
57 extern kadm5_config_params global_params
;
59 static krb5_error_code
init_ldap_realm (int argc
, char *argv
[]) {
60 /* This operation is being performed in the context of a realm. So,
61 * initialize the realm */
63 krb5_error_code retval
= 0;
64 kdb5_dal_handle
*dal_handle
= NULL
;
65 krb5_ldap_context
*ldap_context
=NULL
;
67 dal_handle
= (kdb5_dal_handle
*) util_context
->db_context
;
68 ldap_context
= (krb5_ldap_context
*) dal_handle
->db_context
;
74 if (ldap_context
->krbcontainer
== NULL
) {
75 retval
= krb5_ldap_read_krbcontainer_params (util_context
,
76 &(ldap_context
->krbcontainer
));
78 /* Solaris Kerberos */
79 com_err(progname
, retval
, gettext("while reading kerberos container information"));
84 if (ldap_context
->lrparams
== NULL
) {
85 retval
= krb5_ldap_read_realm_params(util_context
,
87 &(ldap_context
->lrparams
),
99 * This function will create a ticket policy object with the
100 * specified attributes.
103 kdb5_ldap_create_policy(argc
, argv
)
107 /* Solaris Kerberos */
110 krb5_error_code retval
= 0;
111 krb5_ldap_policy_params
*policyparams
= NULL
;
112 krb5_boolean print_usage
= FALSE
;
113 krb5_boolean no_msg
= FALSE
;
119 /* Check for number of arguments */
120 if ((argc
< 2) || (argc
> 16)) {
124 /* Allocate memory for policy parameters structure */
125 policyparams
= (krb5_ldap_policy_params
*) calloc(1, sizeof(krb5_ldap_policy_params
));
126 if (policyparams
== NULL
) {
131 /* Get current time */
134 /* Parse all arguments */
135 for (i
= 1; i
< argc
; i
++) {
136 if (!strcmp(argv
[i
], "-maxtktlife")) {
140 date
= get_date(argv
[i
]);
141 if (date
== (time_t)(-1)) {
143 com_err (me
, retval
, gettext("while providing time specification"));
147 policyparams
->maxtktlife
= date
- now
;
149 mask
|= LDAP_POLICY_MAXTKTLIFE
;
150 } else if (!strcmp(argv
[i
], "-maxrenewlife")) {
154 date
= get_date(argv
[i
]);
155 if (date
== (time_t)(-1)) {
157 com_err (me
, retval
, gettext("while providing time specification"));
161 policyparams
->maxrenewlife
= date
- now
;
163 mask
|= LDAP_POLICY_MAXRENEWLIFE
;
164 } else if (!strcmp((argv
[i
] + 1), "allow_postdated")) {
165 if (*(argv
[i
]) == '+')
166 policyparams
->tktflags
&= (int)(~KRB5_KDB_DISALLOW_POSTDATED
);
167 else if (*(argv
[i
]) == '-')
168 policyparams
->tktflags
|= KRB5_KDB_DISALLOW_POSTDATED
;
172 mask
|= LDAP_POLICY_TKTFLAGS
;
173 } else if (!strcmp((argv
[i
] + 1), "allow_forwardable")) {
174 if (*(argv
[i
]) == '+')
175 policyparams
->tktflags
&= (int)(~KRB5_KDB_DISALLOW_FORWARDABLE
);
176 else if (*(argv
[i
]) == '-')
177 policyparams
->tktflags
|= KRB5_KDB_DISALLOW_FORWARDABLE
;
181 mask
|= LDAP_POLICY_TKTFLAGS
;
182 } else if (!strcmp((argv
[i
] + 1), "allow_renewable")) {
183 if (*(argv
[i
]) == '+')
184 policyparams
->tktflags
&= (int)(~KRB5_KDB_DISALLOW_RENEWABLE
);
185 else if (*(argv
[i
]) == '-')
186 policyparams
->tktflags
|= KRB5_KDB_DISALLOW_RENEWABLE
;
190 mask
|= LDAP_POLICY_TKTFLAGS
;
191 } else if (!strcmp((argv
[i
] + 1), "allow_proxiable")) {
192 if (*(argv
[i
]) == '+')
193 policyparams
->tktflags
&= (int)(~KRB5_KDB_DISALLOW_PROXIABLE
);
194 else if (*(argv
[i
]) == '-')
195 policyparams
->tktflags
|= KRB5_KDB_DISALLOW_PROXIABLE
;
199 mask
|= LDAP_POLICY_TKTFLAGS
;
200 } else if (!strcmp((argv
[i
] + 1), "allow_dup_skey")) {
201 if (*(argv
[i
]) == '+')
202 policyparams
->tktflags
&= (int)(~KRB5_KDB_DISALLOW_DUP_SKEY
);
203 else if (*(argv
[i
]) == '-')
204 policyparams
->tktflags
|= KRB5_KDB_DISALLOW_DUP_SKEY
;
208 mask
|= LDAP_POLICY_TKTFLAGS
;
209 } else if (!strcmp((argv
[i
] + 1), "requires_preauth")) {
210 if (*(argv
[i
]) == '+')
211 policyparams
->tktflags
|= KRB5_KDB_REQUIRES_PRE_AUTH
;
212 else if (*(argv
[i
]) == '-')
213 policyparams
->tktflags
&= (int)(~KRB5_KDB_REQUIRES_PRE_AUTH
);
217 mask
|= LDAP_POLICY_TKTFLAGS
;
218 } else if (!strcmp((argv
[i
] + 1), "requires_hwauth")) {
219 if (*(argv
[i
]) == '+')
220 policyparams
->tktflags
|= KRB5_KDB_REQUIRES_HW_AUTH
;
221 else if (*(argv
[i
]) == '-')
222 policyparams
->tktflags
&= (int)(~KRB5_KDB_REQUIRES_HW_AUTH
);
226 mask
|= LDAP_POLICY_TKTFLAGS
;
227 } else if (!strcmp((argv
[i
] + 1), "allow_svr")) {
228 if (*(argv
[i
]) == '+')
229 policyparams
->tktflags
&= (int)(~KRB5_KDB_DISALLOW_SVR
);
230 else if (*(argv
[i
]) == '-')
231 policyparams
->tktflags
|= KRB5_KDB_DISALLOW_SVR
;
235 mask
|= LDAP_POLICY_TKTFLAGS
;
236 } else if (!strcmp((argv
[i
] + 1), "allow_tgs_req")) {
237 if (*(argv
[i
]) == '+')
238 policyparams
->tktflags
&= (int)(~KRB5_KDB_DISALLOW_TGT_BASED
);
239 else if (*(argv
[i
]) == '-')
240 policyparams
->tktflags
|= KRB5_KDB_DISALLOW_TGT_BASED
;
244 mask
|= LDAP_POLICY_TKTFLAGS
;
245 } else if (!strcmp((argv
[i
] + 1), "allow_tix")) {
246 if (*(argv
[i
]) == '+')
247 policyparams
->tktflags
&= (int)(~KRB5_KDB_DISALLOW_ALL_TIX
);
248 else if (*(argv
[i
]) == '-')
249 policyparams
->tktflags
|= KRB5_KDB_DISALLOW_ALL_TIX
;
253 mask
|= LDAP_POLICY_TKTFLAGS
;
254 } else if (!strcmp((argv
[i
] + 1), "needchange")) {
255 if (*(argv
[i
]) == '+')
256 policyparams
->tktflags
|= KRB5_KDB_REQUIRES_PWCHANGE
;
257 else if (*(argv
[i
]) == '-')
258 policyparams
->tktflags
&= (int)(~KRB5_KDB_REQUIRES_PWCHANGE
);
262 mask
|= LDAP_POLICY_TKTFLAGS
;
263 } else if (!strcmp((argv
[i
] + 1), "password_changing_service")) {
264 if (*(argv
[i
]) == '+')
265 policyparams
->tktflags
|= KRB5_KDB_PWCHANGE_SERVICE
;
266 else if (*(argv
[i
]) == '-')
267 policyparams
->tktflags
&= (int)(~KRB5_KDB_PWCHANGE_SERVICE
);
271 mask
|= LDAP_POLICY_TKTFLAGS
;
272 } else { /* Any other argument must be policy DN */
273 /* First check if policy DN is already provided --
274 if so, there's a usage error */
275 if (policyparams
->policy
!= NULL
)
278 /* If not present already, fill up policy DN */
279 policyparams
->policy
= strdup(argv
[i
]);
280 if (policyparams
->policy
== NULL
) {
282 com_err(me
, retval
, gettext("while creating policy object"));
288 /* policy DN is a mandatory argument. If not provided, print usage */
289 if (policyparams
->policy
== NULL
)
292 if ((retval
= init_ldap_realm (argc
, argv
))) {
293 com_err(me
, retval
, gettext("while reading realm information"));
297 /* Create object with all attributes provided */
298 if ((retval
= krb5_ldap_create_policy(util_context
, policyparams
, mask
)) != 0)
310 /* Clean-up structure */
311 krb5_ldap_free_policy (util_context
, policyparams
);
314 db_usage(CREATE_POLICY
);
318 com_err(me
, retval
, gettext("while creating policy object"));
328 * This function will destroy the specified ticket policy
329 * object interactively, unless forced through an option.
332 kdb5_ldap_destroy_policy(argc
, argv
)
336 /* Solaris Kerberos */
339 krb5_error_code retval
= 0;
340 krb5_ldap_policy_params
*policyparams
= NULL
;
341 krb5_boolean print_usage
= FALSE
;
342 krb5_boolean no_msg
= FALSE
;
344 unsigned int mask
= 0;
349 if ((argc
< 2) || (argc
> 3)) {
353 for (i
= 1; i
< argc
; i
++) {
354 if (strcmp(argv
[i
], "-force") == 0) {
356 } else { /* Any other argument must be policy DN */
357 /* First check if policy DN is already provided --
358 if so, there's a usage error */
362 /* If not present already, fill up policy DN */
363 policy
= strdup(argv
[i
]);
364 if (policy
== NULL
) {
366 com_err(me
, retval
, gettext("while destroying policy object"));
376 printf(gettext("This will delete the policy object '%s', are you sure?\n"), policy
);
377 printf(gettext("(type 'yes' to confirm)? "));
379 if (fgets(buf
, sizeof(buf
), stdin
) == NULL
) {
384 if (strcmp(buf
, yes
)) {
390 if ((retval
= init_ldap_realm (argc
, argv
)))
393 if ((retval
= krb5_ldap_read_policy(util_context
, policy
, &policyparams
, &mask
)))
397 if ((retval
= krb5_ldap_delete_policy(util_context
, policy
)))
400 printf(gettext("** policy object '%s' deleted.\n"), policy
);
411 /* Clean-up structure */
412 krb5_ldap_free_policy (util_context
, policyparams
);
419 db_usage(DESTROY_POLICY
);
424 com_err(me
, retval
, gettext("while destroying policy object"));
434 * This function will modify the attributes of a given ticket
438 kdb5_ldap_modify_policy(argc
, argv
)
442 /* Solaris Kerberos */
445 krb5_error_code retval
= 0;
446 krb5_ldap_policy_params
*policyparams
= NULL
;
447 krb5_boolean print_usage
= FALSE
;
448 krb5_boolean no_msg
= FALSE
;
450 unsigned int in_mask
= 0, out_mask
= 0;
455 /* Check for number of arguments -- minimum is 3
456 since atleast one parameter should be given in
457 addition to 'modify_policy' and policy DN */
458 if ((argc
< 3) || (argc
> 16)) {
462 /* Parse all arguments, only to pick up policy DN (Pass 1) */
463 for (i
= 1; i
< argc
; i
++) {
464 /* Skip arguments next to 'maxtktlife'
465 and 'maxrenewlife' arguments */
466 if (!strcmp(argv
[i
], "-maxtktlife")) {
468 } else if (!strcmp(argv
[i
], "-maxrenewlife")) {
471 /* Do nothing for ticket flag arguments */
472 else if (!strcmp((argv
[i
] + 1), "allow_postdated") ||
473 !strcmp((argv
[i
] + 1), "allow_forwardable") ||
474 !strcmp((argv
[i
] + 1), "allow_renewable") ||
475 !strcmp((argv
[i
] + 1), "allow_proxiable") ||
476 !strcmp((argv
[i
] + 1), "allow_dup_skey") ||
477 !strcmp((argv
[i
] + 1), "requires_preauth") ||
478 !strcmp((argv
[i
] + 1), "requires_hwauth") ||
479 !strcmp((argv
[i
] + 1), "allow_svr") ||
480 !strcmp((argv
[i
] + 1), "allow_tgs_req") ||
481 !strcmp((argv
[i
] + 1), "allow_tix") ||
482 !strcmp((argv
[i
] + 1), "needchange") ||
483 !strcmp((argv
[i
] + 1), "password_changing_service")) {
484 } else { /* Any other argument must be policy DN */
485 /* First check if policy DN is already provided --
486 if so, there's a usage error */
490 /* If not present already, fill up policy DN */
491 policy
= strdup(argv
[i
]);
492 if (policy
== NULL
) {
494 com_err(me
, retval
, gettext("while modifying policy object"));
503 if ((retval
= init_ldap_realm (argc
, argv
)))
506 retval
= krb5_ldap_read_policy(util_context
, policy
, &policyparams
, &in_mask
);
508 com_err(me
, retval
, gettext("while reading information of policy '%s'"), policy
);
512 /* Get current time */
515 /* Parse all arguments, but skip policy DN (Pass 2) */
516 for (i
= 1; i
< argc
; i
++) {
517 if (!strcmp(argv
[i
], "-maxtktlife")) {
521 date
= get_date(argv
[i
]);
522 if (date
== (time_t)(-1)) {
524 com_err (me
, retval
, gettext("while providing time specification"));
528 policyparams
->maxtktlife
= date
- now
;
530 out_mask
|= LDAP_POLICY_MAXTKTLIFE
;
531 } else if (!strcmp(argv
[i
], "-maxrenewlife")) {
535 date
= get_date(argv
[i
]);
536 if (date
== (time_t)(-1)) {
538 com_err (me
, retval
, gettext("while providing time specification"));
542 policyparams
->maxrenewlife
= date
- now
;
544 out_mask
|= LDAP_POLICY_MAXRENEWLIFE
;
545 } else if (!strcmp((argv
[i
] + 1), "allow_postdated")) {
546 if (*(argv
[i
]) == '+')
547 policyparams
->tktflags
&= (int)(~KRB5_KDB_DISALLOW_POSTDATED
);
548 else if (*(argv
[i
]) == '-')
549 policyparams
->tktflags
|= KRB5_KDB_DISALLOW_POSTDATED
;
553 out_mask
|= LDAP_POLICY_TKTFLAGS
;
554 } else if (!strcmp((argv
[i
] + 1), "allow_forwardable")) {
555 if (*(argv
[i
]) == '+')
556 policyparams
->tktflags
&= (int)(~KRB5_KDB_DISALLOW_FORWARDABLE
);
557 else if (*(argv
[i
]) == '-')
558 policyparams
->tktflags
|= KRB5_KDB_DISALLOW_FORWARDABLE
;
562 out_mask
|= LDAP_POLICY_TKTFLAGS
;
563 } else if (!strcmp((argv
[i
] + 1), "allow_renewable")) {
564 if (*(argv
[i
]) == '+')
565 policyparams
->tktflags
&= (int)(~KRB5_KDB_DISALLOW_RENEWABLE
);
566 else if (*(argv
[i
]) == '-')
567 policyparams
->tktflags
|= KRB5_KDB_DISALLOW_RENEWABLE
;
571 out_mask
|= LDAP_POLICY_TKTFLAGS
;
572 } else if (!strcmp((argv
[i
] + 1), "allow_proxiable")) {
573 if (*(argv
[i
]) == '+')
574 policyparams
->tktflags
&= (int)(~KRB5_KDB_DISALLOW_PROXIABLE
);
575 else if (*(argv
[i
]) == '-')
576 policyparams
->tktflags
|= KRB5_KDB_DISALLOW_PROXIABLE
;
580 out_mask
|= LDAP_POLICY_TKTFLAGS
;
581 } else if (!strcmp((argv
[i
] + 1), "allow_dup_skey")) {
582 if (*(argv
[i
]) == '+')
583 policyparams
->tktflags
&= (int)(~KRB5_KDB_DISALLOW_DUP_SKEY
);
584 else if (*(argv
[i
]) == '-')
585 policyparams
->tktflags
|= KRB5_KDB_DISALLOW_DUP_SKEY
;
589 out_mask
|= LDAP_POLICY_TKTFLAGS
;
590 } else if (!strcmp((argv
[i
] + 1), "requires_preauth")) {
591 if (*(argv
[i
]) == '+')
592 policyparams
->tktflags
|= KRB5_KDB_REQUIRES_PRE_AUTH
;
593 else if (*(argv
[i
]) == '-')
594 policyparams
->tktflags
&= (int)(~KRB5_KDB_REQUIRES_PRE_AUTH
);
598 out_mask
|= LDAP_POLICY_TKTFLAGS
;
599 } else if (!strcmp((argv
[i
] + 1), "requires_hwauth")) {
600 if (*(argv
[i
]) == '+')
601 policyparams
->tktflags
|= KRB5_KDB_REQUIRES_HW_AUTH
;
602 else if (*(argv
[i
]) == '-')
603 policyparams
->tktflags
&= (int)(~KRB5_KDB_REQUIRES_HW_AUTH
);
607 out_mask
|= LDAP_POLICY_TKTFLAGS
;
608 } else if (!strcmp((argv
[i
] + 1), "allow_svr")) {
609 if (*(argv
[i
]) == '+')
610 policyparams
->tktflags
&= (int)(~KRB5_KDB_DISALLOW_SVR
);
611 else if (*(argv
[i
]) == '-')
612 policyparams
->tktflags
|= KRB5_KDB_DISALLOW_SVR
;
616 out_mask
|= LDAP_POLICY_TKTFLAGS
;
617 } else if (!strcmp((argv
[i
] + 1), "allow_tgs_req")) {
618 if (*(argv
[i
]) == '+')
619 policyparams
->tktflags
&= (int)(~KRB5_KDB_DISALLOW_TGT_BASED
);
620 else if (*(argv
[i
]) == '-')
621 policyparams
->tktflags
|= KRB5_KDB_DISALLOW_TGT_BASED
;
625 out_mask
|= LDAP_POLICY_TKTFLAGS
;
626 } else if (!strcmp((argv
[i
] + 1), "allow_tix")) {
627 if (*(argv
[i
]) == '+')
628 policyparams
->tktflags
&= (int)(~KRB5_KDB_DISALLOW_ALL_TIX
);
629 else if (*(argv
[i
]) == '-')
630 policyparams
->tktflags
|= KRB5_KDB_DISALLOW_ALL_TIX
;
634 out_mask
|= LDAP_POLICY_TKTFLAGS
;
635 } else if (!strcmp((argv
[i
] + 1), "needchange")) {
636 if (*(argv
[i
]) == '+')
637 policyparams
->tktflags
|= KRB5_KDB_REQUIRES_PWCHANGE
;
638 else if (*(argv
[i
]) == '-')
639 policyparams
->tktflags
&= (int)(~KRB5_KDB_REQUIRES_PWCHANGE
);
643 out_mask
|= LDAP_POLICY_TKTFLAGS
;
644 } else if (!strcmp((argv
[i
] + 1), "password_changing_service")) {
645 if (*(argv
[i
]) == '+')
646 policyparams
->tktflags
|= KRB5_KDB_PWCHANGE_SERVICE
;
647 else if (*(argv
[i
]) == '-')
648 policyparams
->tktflags
&= (int)(~KRB5_KDB_PWCHANGE_SERVICE
);
652 out_mask
|= LDAP_POLICY_TKTFLAGS
;
654 /* Any other argument must be policy DN
659 /* Modify attributes of object */
660 if ((retval
= krb5_ldap_modify_policy(util_context
, policyparams
, out_mask
)))
672 /* Clean-up structure */
673 krb5_ldap_free_policy (util_context
, policyparams
);
678 db_usage(MODIFY_POLICY
);
682 com_err(me
, retval
, gettext("while modifying policy object"));
692 * This function will display information about the given policy object,
693 * fetching the information from the LDAP Server.
696 kdb5_ldap_view_policy(argc
, argv
)
700 /* Solaris Kerberos */
703 krb5_ldap_policy_params
*policyparams
= NULL
;
704 krb5_error_code retval
= 0;
705 krb5_boolean print_usage
= FALSE
;
707 unsigned int mask
= 0;
713 policy
= strdup(argv
[1]);
714 if (policy
== NULL
) {
715 com_err(me
, ENOMEM
, gettext("while viewing policy"));
720 if ((retval
= init_ldap_realm (argc
, argv
)))
723 if ((retval
= krb5_ldap_read_policy(util_context
, policy
, &policyparams
, &mask
))) {
724 com_err(me
, retval
, gettext("while viewing policy '%s'"), policy
);
729 print_policy_params (policyparams
, mask
);
737 krb5_ldap_free_policy (util_context
, policyparams
);
742 db_usage(VIEW_POLICY
);
750 * This function will print the policy object information to the
754 print_policy_params(policyparams
, mask
)
755 krb5_ldap_policy_params
*policyparams
;
758 /* Print the policy DN */
759 printf("%25s: %s\n", gettext("Ticket policy"), policyparams
->policy
);
761 /* Print max. ticket life and max. renewable life, if present */
762 if (mask
& LDAP_POLICY_MAXTKTLIFE
)
763 printf("%25s: %s\n", gettext("Maximum ticket life"), strdur(policyparams
->maxtktlife
));
764 if (mask
& LDAP_POLICY_MAXRENEWLIFE
)
765 printf("%25s: %s\n", gettext("Maximum renewable life"), strdur(policyparams
->maxrenewlife
));
767 /* Service flags are printed */
768 printf("%25s: ", gettext("Ticket flags"));
769 if (mask
& LDAP_POLICY_TKTFLAGS
) {
770 int ticketflags
= policyparams
->tktflags
;
772 if (ticketflags
& KRB5_KDB_DISALLOW_POSTDATED
)
773 printf("%s ","DISALLOW_POSTDATED");
775 if (ticketflags
& KRB5_KDB_DISALLOW_FORWARDABLE
)
776 printf("%s ","DISALLOW_FORWARDABLE");
778 if (ticketflags
& KRB5_KDB_DISALLOW_RENEWABLE
)
779 printf("%s ","DISALLOW_RENEWABLE");
781 if (ticketflags
& KRB5_KDB_DISALLOW_PROXIABLE
)
782 printf("%s ","DISALLOW_PROXIABLE");
784 if (ticketflags
& KRB5_KDB_DISALLOW_DUP_SKEY
)
785 printf("%s ","DISALLOW_DUP_SKEY");
787 if (ticketflags
& KRB5_KDB_REQUIRES_PRE_AUTH
)
788 printf("%s ","REQUIRES_PRE_AUTH");
790 if (ticketflags
& KRB5_KDB_REQUIRES_HW_AUTH
)
791 printf("%s ","REQUIRES_HW_AUTH");
793 if (ticketflags
& KRB5_KDB_DISALLOW_SVR
)
794 printf("%s ","DISALLOW_SVR");
796 if (ticketflags
& KRB5_KDB_DISALLOW_TGT_BASED
)
797 printf("%s ","DISALLOW_TGT_BASED");
799 if (ticketflags
& KRB5_KDB_DISALLOW_ALL_TIX
)
800 printf("%s ","DISALLOW_ALL_TIX");
802 if (ticketflags
& KRB5_KDB_REQUIRES_PWCHANGE
)
803 printf("%s ","REQUIRES_PWCHANGE");
805 if (ticketflags
& KRB5_KDB_PWCHANGE_SERVICE
)
806 printf("%s ","PWCHANGE_SERVICE");
815 * This function will list the DNs of policy objects under a specific
816 * sub-tree (entire tree by default)
818 void kdb5_ldap_list_policies(argc
, argv
)
822 /* Solaris Kerberos */
825 krb5_error_code retval
= 0;
826 krb5_boolean print_usage
= FALSE
;
831 /* Check for number of arguments */
832 if ((argc
!= 1) && (argc
!= 3)) {
836 if ((retval
= init_ldap_realm (argc
, argv
)))
839 retval
= krb5_ldap_list_policy(util_context
, basedn
, &list
);
840 if ((retval
!= 0) || (list
== NULL
))
843 for (plist
= list
; *plist
!= NULL
; plist
++) {
844 printf("%s\n", *plist
);
854 krb5_free_list_entries (list
);
861 db_usage(LIST_POLICY
);
865 com_err(me
, retval
, gettext("while listing policy objects"));
873 /* Reproduced from kadmin.c, instead of linking
874 the entire kadmin.o */
875 static char *strdur(duration
)
879 int neg
, days
, hours
, minutes
, seconds
;
886 days
= duration
/ (24 * 3600);
887 duration
%= 24 * 3600;
888 hours
= duration
/ 3600;
890 minutes
= duration
/ 60;
893 snprintf(out
, sizeof(out
), "%s%d %s %02d:%02d:%02d", neg
? "-" : "",
894 days
, days
== 1 ? gettext("day") : gettext("days"),
895 hours
, minutes
, seconds
);