Add optional default entry to get some values from.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3816 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -40,46 +40,53 @@
|
|||||||
|
|
||||||
RCSID("$Id$");
|
RCSID("$Id$");
|
||||||
|
|
||||||
#define set_value(X, V) do { if((X) == NULL) (X) = malloc(sizeof(*(X))); *(X) = V; } while(0);
|
#define set_value(X, V) do { if((X) == NULL) (X) = malloc(sizeof(*(X))); *(X) = V; } while(0)
|
||||||
|
|
||||||
|
static void
|
||||||
|
attr_to_flags(unsigned attr, HDBFlags *flags)
|
||||||
|
{
|
||||||
|
flags->postdate = !(attr & KRB5_KDB_DISALLOW_POSTDATED);
|
||||||
|
flags->forwardable = !(attr & KRB5_KDB_DISALLOW_FORWARDABLE);
|
||||||
|
flags->initial = !!(attr & KRB5_KDB_DISALLOW_TGT_BASED);
|
||||||
|
flags->renewable = !(attr & KRB5_KDB_DISALLOW_RENEWABLE);
|
||||||
|
flags->proxiable = !(attr & KRB5_KDB_DISALLOW_PROXIABLE);
|
||||||
|
/* DUP_SKEY */
|
||||||
|
flags->invalid = !!(attr & KRB5_KDB_DISALLOW_ALL_TIX);
|
||||||
|
flags->require_preauth = !!(attr & KRB5_KDB_REQUIRES_PRE_AUTH);
|
||||||
|
/* HW_AUTH */
|
||||||
|
flags->server = !(attr & KRB5_KDB_DISALLOW_SVR);
|
||||||
|
flags->change_pw = !!(attr & KRB5_KDB_PWCHANGE_SERVICE);
|
||||||
|
}
|
||||||
|
|
||||||
kadm5_ret_t
|
kadm5_ret_t
|
||||||
_kadm5_setup_entry(hdb_entry *ent, kadm5_principal_ent_t princ, u_int32_t mask)
|
_kadm5_setup_entry(hdb_entry *ent, kadm5_principal_ent_t princ,
|
||||||
|
kadm5_principal_ent_t def, u_int32_t mask)
|
||||||
{
|
{
|
||||||
if(mask & KADM5_PRINC_EXPIRE_TIME)
|
if(mask & KADM5_PRINC_EXPIRE_TIME)
|
||||||
set_value(ent->valid_end, princ->princ_expire_time);
|
set_value(ent->valid_end, princ->princ_expire_time);
|
||||||
if(mask & KADM5_PW_EXPIRATION)
|
if(mask & KADM5_PW_EXPIRATION)
|
||||||
set_value(ent->pw_end, princ->pw_expiration);
|
set_value(ent->pw_end, princ->pw_expiration);
|
||||||
if(mask & KADM5_ATTRIBUTES){
|
if(mask & KADM5_ATTRIBUTES)
|
||||||
ent->flags.postdate =
|
attr_to_flags(princ->attributes, &ent->flags);
|
||||||
!(princ->attributes & KRB5_KDB_DISALLOW_POSTDATED);
|
else if(def){
|
||||||
ent->flags.forwardable =
|
/* attr_to_flags(def->attributes, &ent->flags); */
|
||||||
!(princ->attributes & KRB5_KDB_DISALLOW_FORWARDABLE);
|
ent->flags.client = 1;
|
||||||
ent->flags.initial =
|
ent->flags.server = 1;
|
||||||
!!(princ->attributes & KRB5_KDB_DISALLOW_TGT_BASED);
|
ent->flags.forwardable = 1;
|
||||||
ent->flags.renewable =
|
ent->flags.proxiable = 1;
|
||||||
!(princ->attributes & KRB5_KDB_DISALLOW_RENEWABLE);
|
ent->flags.renewable = 1;
|
||||||
ent->flags.proxiable =
|
ent->flags.postdate = 1;
|
||||||
!(princ->attributes & KRB5_KDB_DISALLOW_PROXIABLE);
|
|
||||||
/* DUP_SKEY */
|
|
||||||
ent->flags.invalid =
|
|
||||||
!!(princ->attributes & KRB5_KDB_DISALLOW_ALL_TIX);
|
|
||||||
ent->flags.require_preauth =
|
|
||||||
!!(princ->attributes & KRB5_KDB_REQUIRES_PRE_AUTH);
|
|
||||||
/* HW_AUTH */
|
|
||||||
ent->flags.server =
|
|
||||||
!(princ->attributes & KRB5_KDB_DISALLOW_SVR);
|
|
||||||
ent->flags.change_pw =
|
|
||||||
!!(princ->attributes & KRB5_KDB_PWCHANGE_SERVICE);
|
|
||||||
/* SUPPPORT_DESMD5 */
|
|
||||||
/* NEW_PRINC */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if(mask & KADM5_MAX_LIFE)
|
if(mask & KADM5_MAX_LIFE)
|
||||||
set_value(ent->max_life, princ->max_life);
|
set_value(ent->max_life, princ->max_life);
|
||||||
|
else if(def && def->max_life)
|
||||||
|
set_value(ent->max_life, def->max_life);
|
||||||
if(mask & KADM5_KVNO)
|
if(mask & KADM5_KVNO)
|
||||||
ent->kvno = princ->kvno;
|
ent->kvno = princ->kvno;
|
||||||
if(mask & KADM5_MAX_RLIFE)
|
if(mask & KADM5_MAX_RLIFE)
|
||||||
set_value(ent->max_renew, princ->max_renewable_life);
|
set_value(ent->max_renew, princ->max_renewable_life);
|
||||||
|
else if(def && def->max_renewable_life)
|
||||||
|
set_value(ent->max_renew, def->max_renewable_life);
|
||||||
if(mask & KADM5_TL_DATA){
|
if(mask & KADM5_TL_DATA){
|
||||||
/* XXX */
|
/* XXX */
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user