2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 01:49:11 +00:00

We still want to recognize %{seq} for the SUDOERS_NO_SEQ case but

just leave it as-is.
This commit is contained in:
Todd C. Miller 2013-03-29 10:54:46 -04:00
parent a2ce6fd296
commit a17d171155
2 changed files with 12 additions and 10 deletions

4
NEWS
View File

@ -77,6 +77,10 @@ What's new in Sudo 1.8.7?
* On HP-UX systems, sudo will now use the pstat() function to
determine the tty instead of ttyname().
* Turkish translation for sudo from translationproject.org.
* Dutch translation for sudo and sudoers from translationproject.org.
What's new in Sudo 1.8.6p7?
* A time stamp file with the date set to the epoch by "sudo -k"

View File

@ -46,13 +46,16 @@ struct path_escape {
size_t (*copy_fn)(char *, size_t, char *);
};
#ifndef SUDOERS_NO_SEQ
static size_t
fill_seq(char *str, size_t strsize, char *logdir)
{
#ifdef SUDOERS_NO_SEQ
debug_decl(fill_seq, SUDO_DEBUG_UTIL)
debug_return_size_t(strlcpy(str, "%{seq}", strsize));
#else
static char sessid[7];
int len;
debug_decl(sudoers_io_version, SUDO_DEBUG_UTIL)
debug_decl(fill_seq, SUDO_DEBUG_UTIL)
if (sessid[0] == '\0')
io_nextid(logdir, def_iolog_dir, sessid);
@ -63,8 +66,8 @@ fill_seq(char *str, size_t strsize, char *logdir)
if (len < 0)
debug_return_size_t(strsize); /* handle non-standard snprintf() */
debug_return_size_t(len);
}
#endif /* SUDOERS_NO_SEQ */
}
static size_t
fill_user(char *str, size_t strsize, char *unused)
@ -136,9 +139,7 @@ fill_command(char *str, size_t strsize, char *unused)
/* Note: "seq" must be first in the list. */
static struct path_escape io_path_escapes[] = {
#ifndef SUDOERS_NO_SEQ
{ "seq", fill_seq },
#endif
{ "user", fill_user },
{ "group", fill_group },
{ "runas_user", fill_runas_user },
@ -161,7 +162,7 @@ expand_iolog_path(const char *prefix, const char *dir, const char *file,
char *dst, *dst0, *path, *pathend, tmpbuf[PATH_MAX];
char *slash = NULL;
const char *endbrace, *src = dir;
static struct path_escape *escapes;
struct path_escape *escapes = NULL;
int pass, oldlocale;
bool strfit;
debug_decl(expand_iolog_path, SUDO_DEBUG_UTIL)
@ -189,10 +190,7 @@ expand_iolog_path(const char *prefix, const char *dir, const char *file,
switch (pass) {
case 0:
src = dir;
escapes = io_path_escapes;
#ifndef SUDOERS_NO_SEQ
escapes++; /* skip "${seq}" */
#endif
escapes = io_path_escapes + 1; /* skip "%{seq}" */
break;
case 1:
/* Trim trailing slashes from dir component. */