for (auth = auth_switch; auth->name; auth++) {
if (auth->init && IS_CONFIGURED(auth)) {
if (NEEDS_USER(auth))
- set_perms(PERM_USER, 0);
+ set_perms(PERM_USER);
status = (auth->init)(pw, &prompt, auth);
if (status == AUTH_FAILURE)
exit(1); /* assume error msg already printed */
if (NEEDS_USER(auth))
- set_perms(PERM_ROOT, 0);
+ set_perms(PERM_ROOT);
}
}
for (auth = auth_switch; auth->name; auth++) {
if (auth->setup && IS_CONFIGURED(auth)) {
if (NEEDS_USER(auth))
- set_perms(PERM_USER, 0);
+ set_perms(PERM_USER);
status = (auth->setup)(pw, &prompt, auth);
if (status == AUTH_FAILURE)
exit(1); /* assume error msg already printed */
if (NEEDS_USER(auth))
- set_perms(PERM_ROOT, 0);
+ set_perms(PERM_ROOT);
}
}
continue;
if (NEEDS_USER(auth))
- set_perms(PERM_USER, 0);
+ set_perms(PERM_USER);
success = auth->status = (auth->verify)(pw, p, auth);
if (NEEDS_USER(auth))
- set_perms(PERM_ROOT, 0);
+ set_perms(PERM_ROOT);
if (auth->status != AUTH_FAILURE)
goto cleanup;
for (auth = auth_switch; auth->name; auth++) {
if (auth->cleanup && IS_CONFIGURED(auth)) {
if (NEEDS_USER(auth))
- set_perms(PERM_USER, 0);
+ set_perms(PERM_USER);
status = (auth->cleanup)(pw, auth);
if (status == AUTH_FATAL) /* XXX log */
exit(1); /* assume error msg already printed */
if (NEEDS_USER(auth))
- set_perms(PERM_ROOT, 0);
+ set_perms(PERM_ROOT);
}
}
char *timestampfile;
{
- set_perms(PERM_TIMESTAMP, 0);
+ set_perms(PERM_TIMESTAMP);
if (touch(timestampfile ? timestampfile : timestampdir, time(NULL)) == -1) {
if (timestampfile) {
int fd = open(timestampfile, O_WRONLY|O_CREAT|O_TRUNC, 0600);
log_error(NO_EXIT|USE_ERRNO, "Can't mkdir %s", timestampdir);
}
}
- set_perms(PERM_ROOT, 0);
+ set_perms(PERM_ROOT);
}
/*
char *dirparent = def_str(I_TIMESTAMPDIR);
int status = TS_ERROR; /* assume the worst */
- set_perms(PERM_TIMESTAMP, 0);
+ set_perms(PERM_TIMESTAMP);
/*
* Sanity check dirparent and make it if it doesn't already exist.
}
}
if (status == TS_ERROR) {
- set_perms(PERM_ROOT, 0);
+ set_perms(PERM_ROOT);
return(status);
}
}
}
- set_perms(PERM_ROOT, 0);
+ set_perms(PERM_ROOT);
return(status);
}
/* Become root if we are not already to avoid user control */
if (geteuid() != 0)
- set_perms(PERM_ROOT, 0);
+ set_perms(PERM_ROOT);
/* Expand printf-style format + args. */
evasprintf(&message, fmt, ap);
* (so user cannot kill it) or as the user (for the paranoid).
*/
#ifndef NO_ROOT_MAILER
- set_perms(PERM_FULL_ROOT, 0);
+ set_perms(PERM_FULL_ROOT);
execve(mpath, argv, root_envp);
#else
- set_perms(PERM_FULL_USER, 0);
+ set_perms(PERM_FULL_USER);
execv(mpath, argv);
#endif /* NO_ROOT_MAILER */
_exit(127);
int nopass;
/* Become sudoers file owner */
- set_perms(PERM_SUDOERS, 0);
+ set_perms(PERM_SUDOERS);
/* We opened _PATH_SUDOERS in check_sudoers() so just rewind it. */
rewind(sudoers_fp);
keepall = TRUE;
/* Need to be root while stat'ing things in the parser. */
- set_perms(PERM_ROOT, 0);
+ set_perms(PERM_ROOT);
error = yyparse();
/* Close the sudoers file now that we are done with it. */
* toggling the effective uid/gid unless we are headed for an exec().
*/
void
-set_perms_posix(perm, sudo_mode)
+set_perms_posix(perm)
int perm;
- int sudo_mode;
{
int error;
* we are headed for an exec().
*/
void
-set_perms_fallback(perm, sudo_mode)
+set_perms_fallback(perm)
int perm;
- int sudo_mode;
{
int error;
* NOTE: does not support the "stay_setuid" option.
*/
void
-set_perms_fallback(perm, sudo_mode)
+set_perms_fallback(perm)
int perm;
- int sudo_mode;
{
/*
#ifdef HAVE_BSD_AUTH_H
char *login_style;
#endif /* HAVE_BSD_AUTH_H */
-void (*set_perms) __P((int, int));
+void (*set_perms) __P((int));
int
#endif /* RLIMIT_CORE */
/* Become specified user or root. */
- set_perms(PERM_RUNAS, sudo_mode);
+ set_perms(PERM_RUNAS);
/* Close the password and group files */
endpwent();
/*
* Get current working directory. Try as user, fall back to root.
*/
- set_perms(PERM_USER, sudo_mode);
+ set_perms(PERM_USER);
if (!getcwd(user_cwd, sizeof(user_cwd))) {
- set_perms(PERM_ROOT, sudo_mode);
+ set_perms(PERM_ROOT);
if (!getcwd(user_cwd, sizeof(user_cwd))) {
(void) fprintf(stderr, "%s: Can't get working directory!\n",
Argv[0]);
(void) strcpy(user_cwd, "unknown");
}
} else
- set_perms(PERM_ROOT, sudo_mode);
+ set_perms(PERM_ROOT);
/*
* If we were given the '-s' option (run shell) we need to redo
rval = find_path(NewArgv[0], &user_cmnd, user_path);
if (rval != FOUND) {
/* Failed as root, try as invoking user. */
- set_perms(PERM_USER, sudo_mode);
+ set_perms(PERM_USER);
rval = find_path(NewArgv[0], &user_cmnd, user_path);
- set_perms(PERM_ROOT, sudo_mode);
+ set_perms(PERM_ROOT);
}
/* set user_args */
* file owner. We already did a stat as root, so use that
* data if we can't stat as sudoers file owner.
*/
- set_perms(PERM_SUDOERS, 0);
+ set_perms(PERM_SUDOERS);
if (rootstat != 0 && lstat(_PATH_SUDOERS, &statbuf) != 0)
log_error(USE_ERRNO, "can't stat %s", _PATH_SUDOERS);
log_error(USE_ERRNO, "can't open %s", _PATH_SUDOERS);
}
- set_perms(PERM_ROOT, 0); /* change back to root */
+ set_perms(PERM_ROOT); /* change back to root */
}
/*
void check_user __P((void));
void verify_user __P((struct passwd *, char *));
int sudoers_lookup __P((int));
-void set_perms_posix __P((int, int));
-void set_perms_fallback __P((int, int));
+void set_perms_posix __P((int));
+void set_perms_fallback __P((int));
void remove_timestamp __P((int));
int check_secureware __P((char *));
void sia_attempt_auth __P((void));
extern int tgetpass_flags;
extern int timestamp_uid;
-extern void (*set_perms) __P((int, int));
+extern void (*set_perms) __P((int));
#endif
extern int errno;
*/
void init_parser __P((void));
void dumpaliases __P((void));
-void set_perms_dummy __P((int, int));
+void set_perms_dummy __P((int));
/*
* Globals
int num_interfaces;
struct interface *interfaces;
struct sudo_user sudo_user;
-void (*set_perms) __P((int, int)) = set_perms_dummy;
+void (*set_perms) __P((int)) = set_perms_dummy;
extern int clearaliases;
extern int pedantic;
}
void
-set_perms_dummy(i, j)
- int i, j;
+set_perms_dummy(i)
+ int i;
{
return;
}