corruption, this option will probably retrieve more principals
than the **-rev** option will.
- .. note::
- The **-recurse** option currently doesn't modify the dump
- functionality as described above; it does a normal dump.
+ .. versionchanged:: 1.15
+ Release 1.15 restored the functionality of the **-recurse**
+ option.
- .. deprecated:: 1.5
+ .. versionchanged:: 1.5
+ The **-recurse** option ceased working until release 1.15,
+ doing a normal dump instead of a recursive traversal.
.. _kdb5_util_dump_end:
/* KDB iteration flags */
#define KRB5_DB_ITER_WRITE 0x00000001
#define KRB5_DB_ITER_REV 0x00000002
+#define KRB5_DB_ITER_RECURSE 0x00000004
/* String attribute names recognized by krb5 */
#define KRB5_KDB_SK_SESSION_ENCTYPES "session_enctypes"
} else if (!strcmp(argv[aindex], "-rev")) {
iterflags |= KRB5_DB_ITER_REV;
} else if (!strcmp(argv[aindex], "-recurse")) {
- /* Accept this for compatibility, but do nothing since
- * krb5_db_iterate doesn't support it. */
- fprintf(stderr,
- _("%s: WARNING: the -recurse option is currently "
- "unimplemented\n"), progname);
+ iterflags |= KRB5_DB_ITER_RECURSE;
} else {
break;
}
curs_init(iter_curs *curs, krb5_context ctx, krb5_db2_context *dbc,
krb5_flags iterflags)
{
+ int isrecurse = iterflags & KRB5_DB_ITER_RECURSE;
+ unsigned int prevflag = R_PREV;
+ unsigned int nextflag = R_NEXT;
+
curs->keycopy.size = 0;
curs->keycopy.data = NULL;
curs->islocked = FALSE;
else
curs->lockmode = KRB5_LOCKMODE_SHARED;
+ if (isrecurse) {
+#ifdef R_RNEXT
+ if (dbc->hashfirst) {
+ k5_setmsg(ctx, EINVAL, _("Recursive iteration is not supported "
+ "for hash databases"));
+ return EINVAL;
+ }
+ prevflag = R_RPREV;
+ nextflag = R_RNEXT;
+#else
+ k5_setmsg(ctx, EINVAL, _("Recursive iteration not supported "
+ "in this version of libdb"));
+ return EINVAL;
+#endif
+ }
if (iterflags & KRB5_DB_ITER_REV) {
curs->startflag = R_LAST;
- curs->stepflag = R_PREV;
+ curs->stepflag = prevflag;
} else {
curs->startflag = R_FIRST;
- curs->stepflag = R_NEXT;
+ curs->stepflag = nextflag;
}
return curs_lock(curs);
}