Merge pull request #1021 from opensourcerouting/privs-terminate

zprivs terminate
This commit is contained in:
Lou Berger 2017-08-21 16:55:33 -04:00 committed by GitHub
commit 16e07d14e8
2 changed files with 4 additions and 5 deletions

View File

@ -140,11 +140,8 @@ __attribute__((__noreturn__)) void sigint(void)
{
zlog_notice("Terminating on signal");
if (!retain_mode) {
if (!retain_mode)
bgp_terminate();
if (bgpd_privs.user) /* NULL if skip_runas flag set */
zprivs_terminate(&bgpd_privs);
}
bgp_exit(0);

View File

@ -856,7 +856,9 @@ void zprivs_terminate(struct zebra_privs_t *zprivs)
}
#ifdef HAVE_CAPABILITIES
zprivs_caps_terminate();
if (zprivs->user || zprivs->group || zprivs->cap_num_p
|| zprivs->cap_num_i)
zprivs_caps_terminate();
#else /* !HAVE_CAPABILITIES */
/* only change uid if we don't have the correct one */
if ((zprivs_state.zuid) && (zprivs_state.zsuid != zprivs_state.zuid)) {