Skip to content
Snippets Groups Projects
Commit f3b5fd23 authored by Nicolas Joly's avatar Nicolas Joly Committed by David Bigagli
Browse files

Test where su is located.

parent 44aea2fa
No related branches found
No related tags found
No related merge requests found
...@@ -110,6 +110,8 @@ PKG_PROG_PKG_CONFIG([0.9.0]) ...@@ -110,6 +110,8 @@ PKG_PROG_PKG_CONFIG([0.9.0])
AM_CONDITIONAL(WITH_CXX, test -n "$ac_ct_CXX") AM_CONDITIONAL(WITH_CXX, test -n "$ac_ct_CXX")
AM_CONDITIONAL(WITH_GNU_LD, test "$with_gnu_ld" = "yes") AM_CONDITIONAL(WITH_GNU_LD, test "$with_gnu_ld" = "yes")
AC_PATH_PROG([SUCMD], [su], [/bin/su])
AC_DEFINE_UNQUOTED([SUCMD], ["$SUCMD"], [Define path to su command])
dnl Checks for libraries dnl Checks for libraries
dnl dnl
......
...@@ -1861,8 +1861,8 @@ char **env_array_user_default(const char *username, int timeout, int mode) ...@@ -1861,8 +1861,8 @@ char **env_array_user_default(const char *username, int timeout, int mode)
if (config_timeout == 0) /* just read directly from cache */ if (config_timeout == 0) /* just read directly from cache */
return _load_env_cache(username); return _load_env_cache(username);
if (stat("/bin/su", &buf)) if (stat(SUCMD, &buf))
fatal("Could not locate command: /bin/su"); fatal("Could not locate command: "SUCMD);
if (stat("/bin/echo", &buf)) if (stat("/bin/echo", &buf))
fatal("Could not locate command: /bin/echo"); fatal("Could not locate command: /bin/echo");
if (stat(stepd_path, &buf) == 0) { if (stat(stepd_path, &buf) == 0) {
...@@ -1898,14 +1898,14 @@ char **env_array_user_default(const char *username, int timeout, int mode) ...@@ -1898,14 +1898,14 @@ char **env_array_user_default(const char *username, int timeout, int mode)
close(2); close(2);
open("/dev/null", O_WRONLY); open("/dev/null", O_WRONLY);
if (mode == 1) if (mode == 1)
execl("/bin/su", "su", username, "-c", cmdstr, NULL); execl(SUCMD, "su", username, "-c", cmdstr, NULL);
else if (mode == 2) else if (mode == 2)
execl("/bin/su", "su", "-", username, "-c", cmdstr, NULL); execl(SUCMD, "su", "-", username, "-c", cmdstr, NULL);
else { /* Default system configuration */ else { /* Default system configuration */
#ifdef LOAD_ENV_NO_LOGIN #ifdef LOAD_ENV_NO_LOGIN
execl("/bin/su", "su", username, "-c", cmdstr, NULL); execl(SUCMD, "su", username, "-c", cmdstr, NULL);
#else #else
execl("/bin/su", "su", "-", username, "-c", cmdstr, NULL); execl(SUCMD, "su", "-", username, "-c", cmdstr, NULL);
#endif #endif
} }
exit(1); exit(1);
...@@ -1933,13 +1933,13 @@ char **env_array_user_default(const char *username, int timeout, int mode) ...@@ -1933,13 +1933,13 @@ char **env_array_user_default(const char *username, int timeout, int mode)
timeleft -= (now.tv_sec - begin.tv_sec) * 1000; timeleft -= (now.tv_sec - begin.tv_sec) * 1000;
timeleft -= (now.tv_usec - begin.tv_usec) / 1000; timeleft -= (now.tv_usec - begin.tv_usec) / 1000;
if (timeleft <= 0) { if (timeleft <= 0) {
verbose("timeout waiting for /bin/su to complete"); verbose("timeout waiting for "SUCMD" to complete");
kill(-child, 9); kill(-child, 9);
break; break;
} }
if ((rc = poll(&ufds, 1, timeleft)) <= 0) { if ((rc = poll(&ufds, 1, timeleft)) <= 0) {
if (rc == 0) { if (rc == 0) {
verbose("timeout waiting for /bin/su to complete"); verbose("timeout waiting for "SUCMD" to complete");
break; break;
} }
if ((errno == EINTR) || (errno == EAGAIN)) if ((errno == EINTR) || (errno == EAGAIN))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment