--- check.c +++ check.c @@ -207,6 +207,11 @@ len += strlen(*user_runas) - 2; subst = 1; break; + case 'p': + p++; + len += strlen(auth_pw->pw_name) - 2; + subst = 1; + break; case '%': p++; len--; @@ -252,6 +257,13 @@ goto oflow; np += n; continue; + case 'p': + p++; + n = strlcpy(np, auth_pw->pw_name, np - endp); + if (n >= np - endp) + goto oflow; + np += n; + continue; case '%': /* convert %% -> % */ p++; --- sudoers.man.in +++ sudoers.man.in @@ -663,6 +663,11 @@ .IX Item "%U" expanded to the login name of the user the command will be run as (defaults to root) +.ie n .IP "%p" 8 +.el .IP "\f(CW%p\fR" 8 +.IX Item "%p" +expanded to the login name of the user whose password +is requested .ie n .IP "%h" 8 .el .IP "\f(CW%h\fR" 8 .IX Item "%h"