summaryrefslogtreecommitdiffstats
path: root/src/sudo.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sudo.c')
-rw-r--r--src/sudo.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/sudo.c b/src/sudo.c
index 5f346ba..e1307da 100644
--- a/src/sudo.c
+++ b/src/sudo.c
@@ -23,6 +23,11 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+
+#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(DJGPP) || !defined(HAVE_GETEUID)
+#undef SUDO_BIN
+#endif
+
#ifdef SUDO_BIN
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
@@ -38,16 +43,28 @@
#include "types.h"
#include "common.h"
#include "sudo.h"
+#include "log.h"
-void run_sudo(int argc, char **argv)
+void run_sudo(const int argc, char **argv, const int create_log)
{
- int i;
char **argv2;
- argv2 = (char **)MALLOC(sizeof(char *) * (argc + 2));
- argv2[0]=strdup(SUDO_BIN);
- for (i=0; i < argc; i++)
- argv2[i+1] = argv[i];
- argv2[i+1]=NULL;
+ if(argc==1)
+ {
+ argv2 = (char **)MALLOC(sizeof(char *) * 4);
+ argv2[0] = strdup(SUDO_BIN);
+ argv2[1] = argv[0];
+ argv2[2] = strdup(create_log==TD_LOG_NONE?"/nolog":"/debug");
+ argv2[3] = NULL;
+ }
+ else
+ {
+ int i;
+ argv2 = (char **)MALLOC(sizeof(char *) * (argc + 2));
+ argv2[0]=strdup(SUDO_BIN);
+ for (i=0; i < argc; i++)
+ argv2[i+1] = argv[i];
+ argv2[i+1]=NULL;
+ }
printf("sudo may ask your user password, it doesn't ask for the root password.\n");
printf("Usually there is no echo or '*' displayed when you type your password.\n");
printf("\n");