diff --git a/kadmin/util.c b/kadmin/util.c index 201abc452..8561693f2 100644 --- a/kadmin/util.c +++ b/kadmin/util.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -103,9 +103,7 @@ parse_attributes (const char *resp, krb5_flags *attr, int *mask, int bit) { krb5_flags tmp = *attr; - if (resp[0] == '\0') - return 0; - else if (str2attributes(resp, &tmp) == 0) { + if (str2attributes(resp, &tmp) == 0) { *attr = tmp; if (mask) *mask |= bit; @@ -133,6 +131,8 @@ edit_attributes (const char *prompt, krb5_flags *attr, int *mask, int bit) attributes2str(*attr, buf, sizeof(buf)); for (;;) { get_response("Attributes", buf, resp, sizeof(resp)); + if (resp[0] == '\0') + break; if (parse_attributes (resp, attr, mask, bit) == 0) break; } @@ -342,27 +342,37 @@ int edit_entry(kadm5_principal_ent_t ent, int *mask, kadm5_principal_ent_t default_ent, int default_mask) { - if (default_ent && (default_mask & KADM5_MAX_LIFE)) + if (default_ent + && (default_mask & KADM5_MAX_LIFE) + && !(*mask & KADM5_MAX_LIFE)) ent->max_life = default_ent->max_life; edit_deltat ("Max ticket life", &ent->max_life, mask, KADM5_MAX_LIFE); - if (default_ent && (default_mask & KADM5_MAX_RLIFE)) + if (default_ent + && (default_mask & KADM5_MAX_RLIFE) + && !(*mask & KADM5_MAX_RLIFE)) ent->max_renewable_life = default_ent->max_renewable_life; edit_deltat ("Max renewable life", &ent->max_renewable_life, mask, KADM5_MAX_RLIFE); - if (default_ent && (default_mask & KADM5_PRINC_EXPIRE_TIME)) + if (default_ent + && (default_mask & KADM5_PRINC_EXPIRE_TIME) + && !(*mask & KADM5_PRINC_EXPIRE_TIME)) ent->princ_expire_time = default_ent->princ_expire_time; edit_timet ("Principal expiration time", &ent->princ_expire_time, mask, KADM5_PRINC_EXPIRE_TIME); - if (default_ent && (default_mask & KADM5_PW_EXPIRATION)) + if (default_ent + && (default_mask & KADM5_PW_EXPIRATION) + && !(*mask & KADM5_PW_EXPIRATION)) ent->pw_expiration = default_ent->pw_expiration; edit_timet ("Password expiration time", &ent->pw_expiration, mask, KADM5_PW_EXPIRATION); - if (default_ent && (default_mask & KADM5_ATTRIBUTES)) + if (default_ent + && (default_mask & KADM5_ATTRIBUTES) + && !(*mask & KADM5_ATTRIBUTES)) ent->attributes = default_ent->attributes & ~KRB5_KDB_DISALLOW_ALL_TIX; edit_attributes ("Attributes", &ent->attributes, mask, KADM5_ATTRIBUTES);