@@ -666,13 +666,22 @@ NORETURN
666666static void
667667fail_exit (int code , bool process_selinux )
668668{
669- if (gr_locked ) {
670- if (gr_unlock (process_selinux ) == 0 ) {
671- fprintf (stderr , _ ("%s: failed to unlock %s\n" ), Prog , gr_dbname ());
672- SYSLOG (LOG_ERR , "failed to unlock %s" , gr_dbname ());
669+ #ifdef ENABLE_SUBIDS
670+ if (sub_gid_locked ) {
671+ if (sub_gid_unlock (process_selinux ) == 0 ) {
672+ fprintf (stderr , _ ("%s: failed to unlock %s\n" ), Prog , sub_gid_dbname ());
673+ SYSLOG (LOG_ERR , "failed to unlock %s" , sub_gid_dbname ());
674+ /* continue */
675+ }
676+ }
677+ if (sub_uid_locked ) {
678+ if (sub_uid_unlock (process_selinux ) == 0 ) {
679+ fprintf (stderr , _ ("%s: failed to unlock %s\n" ), Prog , sub_uid_dbname ());
680+ SYSLOG (LOG_ERR , "failed to unlock %s" , sub_uid_dbname ());
673681 /* continue */
674682 }
675683 }
684+ #endif /* ENABLE_SUBIDS */
676685#ifdef SHADOWGRP
677686 if (sgr_locked ) {
678687 if (sgr_unlock (process_selinux ) == 0 ) {
@@ -682,6 +691,13 @@ fail_exit (int code, bool process_selinux)
682691 }
683692 }
684693#endif
694+ if (gr_locked ) {
695+ if (gr_unlock (process_selinux ) == 0 ) {
696+ fprintf (stderr , _ ("%s: failed to unlock %s\n" ), Prog , gr_dbname ());
697+ SYSLOG (LOG_ERR , "failed to unlock %s" , gr_dbname ());
698+ /* continue */
699+ }
700+ }
685701 if (spw_locked ) {
686702 if (spw_unlock (process_selinux ) == 0 ) {
687703 fprintf (stderr , _ ("%s: failed to unlock %s\n" ), Prog , spw_dbname ());
@@ -696,22 +712,6 @@ fail_exit (int code, bool process_selinux)
696712 /* continue */
697713 }
698714 }
699- #ifdef ENABLE_SUBIDS
700- if (sub_uid_locked ) {
701- if (sub_uid_unlock (process_selinux ) == 0 ) {
702- fprintf (stderr , _ ("%s: failed to unlock %s\n" ), Prog , sub_uid_dbname ());
703- SYSLOG (LOG_ERR , "failed to unlock %s" , sub_uid_dbname ());
704- /* continue */
705- }
706- }
707- if (sub_gid_locked ) {
708- if (sub_gid_unlock (process_selinux ) == 0 ) {
709- fprintf (stderr , _ ("%s: failed to unlock %s\n" ), Prog , sub_gid_dbname ());
710- SYSLOG (LOG_ERR , "failed to unlock %s" , sub_gid_dbname ());
711- /* continue */
712- }
713- }
714- #endif /* ENABLE_SUBIDS */
715715
716716#ifdef WITH_AUDIT
717717 audit_logger (AUDIT_USER_MGMT ,
0 commit comments