Add a -F option to the builtin ident service, which allows .fakeid files

to contain the name of other valid users.

PR:		22837
Submitted by:	Andreas Gerstenberg <andy@andy.de>
Reviewed by:	green
Reviewed by:	sheldonh
This commit is contained in:
dwmalone 2000-12-05 13:56:01 +00:00
parent 3339f5cc67
commit 1144f3ac9a
2 changed files with 17 additions and 3 deletions

View File

@ -351,7 +351,7 @@ ident_stream(s, sep) /* Ident service (AKA "auth") */
ssize_t ssize;
size_t size, bufsiz;
int c, fflag = 0, nflag = 0, rflag = 0, argc = 0, usedfallback = 0;
int gflag = 0, getcredfail = 0, onreadlen;
int gflag = 0, Fflag = 0, getcredfail = 0, onreadlen;
u_short lport, fport;
inetd_setproctitle(sep->se_service, s);
@ -373,7 +373,7 @@ ident_stream(s, sep) /* Ident service (AKA "auth") */
size_t i;
u_int32_t random;
while ((c = getopt(argc, sep->se_argv, "d:fgno:rt:")) != -1)
while ((c = getopt(argc, sep->se_argv, "d:fFgno:rt:")) != -1)
switch (c) {
case 'd':
fallback = optarg;
@ -381,6 +381,10 @@ ident_stream(s, sep) /* Ident service (AKA "auth") */
case 'f':
fflag = 1;
break;
case 'F':
fflag = 1;
Fflag=1;
break;
case 'g':
gflag = 1;
random = 0; /* Shush, compiler. */
@ -627,7 +631,7 @@ ident_stream(s, sep) /* Ident service (AKA "auth") */
* we will return their real identity instead.
*/
if (!*cp || getpwnam(cp)) {
if (!*cp || (!Fflag && getpwnam(cp))) {
errno = 0;
pw = getpwuid(uc.cr_uid);
if (pw == NULL)

View File

@ -469,6 +469,16 @@ If the file
.Pa .fakeid
exists in the home directory of the identified user, report the username
found in that file instead of the real username.
If the the username found in
.Pa .fakeid
is that of an existing user,
then the real username is reported.
.It Fl F
same as
.Fl f
but without the restriction that the username in
.Pa .fakeid
must not match an existing user.
.It Fl g
Instead of returning the user's name to the ident requester, report a
username made up of random alphanumeric characters, e.g.