diff --git a/ChangeLog b/ChangeLog index 3026b18..5b5ebf0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2012-07-05 Niibe Yutaka + + * src/openpgp.c (cmd_change_password): Call ac_reset_admin when + admin-less mode. + (cmd_reset_user_password): Likewise. + + * src/ac.c (ac_reset_admin, ac_fini): Clear ADMIN_AUTHORIZED. + 2012-07-04 Niibe Yutaka Bug fixes. diff --git a/src/ac.c b/src/ac.c index ec87c22..fa7b518 100644 --- a/src/ac.c +++ b/src/ac.c @@ -290,6 +290,7 @@ ac_reset_admin (void) { memset (keystring_md_pw3, 0, KEYSTRING_MD_SIZE); auth_status &= ~AC_ADMIN_AUTHORIZED; + admin_authorized = 0; } void @@ -300,4 +301,5 @@ ac_fini (void) gpg_do_clear_prvkey (GPG_KEY_FOR_DECRYPTION); gpg_do_clear_prvkey (GPG_KEY_FOR_AUTHENTICATION); auth_status = AC_NONE_AUTHORIZED; + admin_authorized = 0; } diff --git a/src/openpgp-do.c b/src/openpgp-do.c index f75a2c6..567e089 100644 --- a/src/openpgp-do.c +++ b/src/openpgp-do.c @@ -959,7 +959,7 @@ proc_key_import (const uint8_t *data, int len) ac_reset_pso_cds (); ac_reset_other (); - if (keystring_admin == NULL) + if (admin_authorized == BY_USER) ac_reset_admin (); } diff --git a/src/openpgp.c b/src/openpgp.c index 81111a8..bc03b44 100644 --- a/src/openpgp.c +++ b/src/openpgp.c @@ -315,6 +315,8 @@ cmd_change_password (void) gpg_do_write_simple (NR_DO_KEYSTRING_PW1, new_ks0, KEYSTRING_SIZE_PW1); ac_reset_pso_cds (); ac_reset_other (); + if (admin_authorized == BY_USER) + ac_reset_admin (); DEBUG_INFO ("Changed DO_KEYSTRING_PW1.\r\n"); GPG_SUCCESS (); } @@ -323,6 +325,8 @@ cmd_change_password (void) gpg_do_write_simple (NR_DO_KEYSTRING_PW1, new_ks0, 1); ac_reset_pso_cds (); ac_reset_other (); + if (admin_authorized == BY_USER) + ac_reset_admin (); DEBUG_INFO ("Changed length of DO_KEYSTRING_PW1.\r\n"); GPG_SUCCESS (); } @@ -422,6 +426,8 @@ cmd_reset_user_password (void) KEYSTRING_SIZE_PW1); ac_reset_pso_cds (); ac_reset_other (); + if (admin_authorized == BY_USER) + ac_reset_admin (); gpg_pw_reset_err_counter (PW_ERR_RC); gpg_pw_reset_err_counter (PW_ERR_PW1); GPG_SUCCESS (); @@ -432,6 +438,8 @@ cmd_reset_user_password (void) gpg_do_write_simple (NR_DO_KEYSTRING_PW1, new_ks0, 1); ac_reset_pso_cds (); ac_reset_other (); + if (admin_authorized == BY_USER) + ac_reset_admin (); gpg_pw_reset_err_counter (PW_ERR_RC); gpg_pw_reset_err_counter (PW_ERR_PW1); GPG_SUCCESS (); @@ -470,6 +478,8 @@ cmd_reset_user_password (void) KEYSTRING_SIZE_PW1); ac_reset_pso_cds (); ac_reset_other (); + if (admin_authorized == BY_USER) + ac_reset_admin (); gpg_pw_reset_err_counter (PW_ERR_PW1); GPG_SUCCESS (); } @@ -479,6 +489,8 @@ cmd_reset_user_password (void) gpg_do_write_simple (NR_DO_KEYSTRING_PW1, new_ks0, 1); ac_reset_pso_cds (); ac_reset_other (); + if (admin_authorized == BY_USER) + ac_reset_admin (); gpg_pw_reset_err_counter (PW_ERR_PW1); GPG_SUCCESS (); }