2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-09-02 07:15:27 +00:00

Fix build error when --without-noexec configure option is used.

This commit is contained in:
Todd C. Miller
2011-07-05 12:20:10 -04:00
parent ae34052542
commit 76f427e8d7
2 changed files with 20 additions and 10 deletions

View File

@@ -52,7 +52,9 @@
# define RTLD_GLOBAL 0 # define RTLD_GLOBAL 0
#endif #endif
#ifdef _PATH_SUDO_NOEXEC
const char *noexec_path = _PATH_SUDO_NOEXEC; const char *noexec_path = _PATH_SUDO_NOEXEC;
#endif
/* /*
* Read in /etc/sudo.conf * Read in /etc/sudo.conf
@@ -83,8 +85,10 @@ sudo_read_conf(const char *conf_file)
} }
if (strcasecmp(name, "askpass") == 0) if (strcasecmp(name, "askpass") == 0)
askpass_path = estrdup(path); askpass_path = estrdup(path);
#ifdef _PATH_SUDO_NOEXEC
else if (strcasecmp(name, "noexec") == 0) else if (strcasecmp(name, "noexec") == 0)
noexec_path = estrdup(path); noexec_path = estrdup(path);
#endif
continue; continue;
} }

View File

@@ -512,11 +512,13 @@ command_info_to_details(char * const info[], struct command_details *details)
SET(details->flags, CD_NOEXEC); SET(details->flags, CD_NOEXEC);
break; break;
} }
#ifdef _PATH_SUDO_NOEXEC
/* XXX - deprecated */ /* XXX - deprecated */
if (strncmp("noexec_file=", info[i], sizeof("noexec_file=") - 1) == 0) { if (strncmp("noexec_file=", info[i], sizeof("noexec_file=") - 1) == 0) {
noexec_path = info[i] + sizeof("noexec_file=") - 1; noexec_path = info[i] + sizeof("noexec_file=") - 1;
break; break;
} }
#endif /* _PATH_SUDO_NOEXEC */
break; break;
case 'p': case 'p':
if (strncmp("preserve_groups=", info[i], sizeof("preserve_groups=") - 1) == 0) { if (strncmp("preserve_groups=", info[i], sizeof("preserve_groups=") - 1) == 0) {
@@ -781,8 +783,10 @@ set_project(struct passwd *pw)
static void static void
disable_execute(struct command_details *details) disable_execute(struct command_details *details)
{ {
#ifdef _PATH_SUDO_NOEXEC
char *cp, **ev, **nenvp; char *cp, **ev, **nenvp;
int env_len = 0, env_size = 128; int env_len = 0, env_size = 128;
#endif /* _PATH_SUDO_NOEXEC */
#ifdef HAVE_PRIV_SET #ifdef HAVE_PRIV_SET
/* Solaris privileges, remove PRIV_PROC_EXEC post-execve. */ /* Solaris privileges, remove PRIV_PROC_EXEC post-execve. */
@@ -791,6 +795,7 @@ disable_execute(struct command_details *details)
warning(_("unable to remove PRIV_PROC_EXEC from PRIV_LIMIT")); warning(_("unable to remove PRIV_PROC_EXEC from PRIV_LIMIT"));
#endif /* HAVE_PRIV_SET */ #endif /* HAVE_PRIV_SET */
#ifdef _PATH_SUDO_NOEXEC
nenvp = emalloc2(env_size, sizeof(char *)); nenvp = emalloc2(env_size, sizeof(char *));
for (ev = details->envp; *ev != NULL; ev++) { for (ev = details->envp; *ev != NULL; ev++) {
if (env_len + 2 > env_size) { if (env_len + 2 > env_size) {
@@ -840,6 +845,7 @@ disable_execute(struct command_details *details)
nenvp[env_len] = NULL; nenvp[env_len] = NULL;
details->envp = nenvp; details->envp = nenvp;
#endif /* _PATH_SUDO_NOEXEC */
} }
/* /*