From: Todd C. Miller Date: Fri, 9 Mar 2012 22:28:59 +0000 (-0500) Subject: Fix compilation if no seteuid/setreuid/setresuid available. X-Git-Tag: SUDO_1_8_5~1^2~163 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9c2dd5eec61c91a6b2b3d17872a483e546332603;p=sudo Fix compilation if no seteuid/setreuid/setresuid available. --- diff --git a/plugins/sudoers/set_perms.c b/plugins/sudoers/set_perms.c index 4c5570edf..6b8780c89 100644 --- a/plugins/sudoers/set_perms.c +++ b/plugins/sudoers/set_perms.c @@ -53,7 +53,9 @@ /* * Prototypes */ +#if defined(HAVE_SETRESUID) || defined(HAVE_SETREUID) || defined(HAVE_SETEUID) static struct group_list *runas_setgroups(void); +#endif /* * We keep track of the current permisstions and use a stack to restore @@ -1417,7 +1419,7 @@ set_perms(int perm) grlist_addref(state->grlist); if (state->grlist != ostate->grlist) { if (sudo_setgroups(state->grlist->ngids, state->grlist->gids)) { - strlcpy(errbuf, "PERM_FULL_USER: setgroups", sizeof(errbuf)) + strlcpy(errbuf, "PERM_FULL_USER: setgroups", sizeof(errbuf)); goto bad; } } @@ -1436,6 +1438,7 @@ set_perms(int perm) case PERM_RUNAS: case PERM_TIMESTAMP: /* Unsupported since we can't set euid. */ + perm_stack_depth--; break; } @@ -1464,7 +1467,7 @@ restore_perms(void) perm_stack_depth--; sudo_debug_printf(SUDO_DEBUG_INFO, "%s: uid: [%d] -> [%d]", - __func__, (int)state->ruid, (int)ostate->ruid) + __func__, (int)state->ruid, (int)ostate->ruid); sudo_debug_printf(SUDO_DEBUG_INFO, "%s: gid: [%d] -> [%d]", __func__, (int)state->rgid, (int)ostate->rgid); @@ -1490,6 +1493,7 @@ bad: } #endif /* HAVE_SETRESUID || HAVE_SETREUID || HAVE_SETEUID */ +#if defined(HAVE_SETRESUID) || defined(HAVE_SETREUID) || defined(HAVE_SETEUID) static struct group_list * runas_setgroups(void) { @@ -1514,3 +1518,4 @@ runas_setgroups(void) log_error(USE_ERRNO|MSG_ONLY, _("unable to set runas group vector")); debug_return_ptr(grlist); } +#endif /* HAVE_SETRESUID || HAVE_SETREUID || HAVE_SETEUID */