sudo/sudo-1.6.9p2-prompt.diff

43 lines
860 B
Diff

--- 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
@@ -893,6 +893,11 @@
.el .IP "\f(CW%h\fR" 8
.IX Item "%h"
expanded to the local hostname without the domain name
+.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 "%U" 8
.el .IP "\f(CW%U\fR" 8
.IX Item "%U"