From c8bacba561b1467ecbe88ca6f1a6dabad1db5cca Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Wed, 9 Apr 2003 23:42:06 +0000 Subject: [PATCH] Thanks, patch applied * kerberos.c (kerberos4_status): Always copy in username if present. Patch from Nathan Neulinger to make "-a user" work. * kerberos5.c (kerberos5_status): Always copy in username if present. Patch from Nathan Neulinger to make "-a user" work. ticket: 1362 tags: pullup status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15338 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/telnet/libtelnet/ChangeLog | 8 ++++++++ src/appl/telnet/libtelnet/kerberos.c | 9 ++++++++- src/appl/telnet/libtelnet/kerberos5.c | 13 ++++++++++--- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/appl/telnet/libtelnet/ChangeLog b/src/appl/telnet/libtelnet/ChangeLog index 11380530f..03d794b14 100644 --- a/src/appl/telnet/libtelnet/ChangeLog +++ b/src/appl/telnet/libtelnet/ChangeLog @@ -1,3 +1,11 @@ +2003-04-09 Tom Yu + + * kerberos.c (kerberos4_status): Always copy in username if + present. Patch from Nathan Neulinger to make "-a user" work. + + * kerberos5.c (kerberos5_status): Always copy in username if + present. Patch from Nathan Neulinger to make "-a user" work. + 2003-04-01 Nalin Dahyabhai * kerberos5.c (kerberos5_is): Check principal name length before diff --git a/src/appl/telnet/libtelnet/kerberos.c b/src/appl/telnet/libtelnet/kerberos.c index 56a073191..8d4c7f330 100644 --- a/src/appl/telnet/libtelnet/kerberos.c +++ b/src/appl/telnet/libtelnet/kerberos.c @@ -612,10 +612,17 @@ kerberos4_status(ap, kname, level) if (level < AUTH_USER) return(level); - if (UserNameRequested && !kuserok(&adat, UserNameRequested)) { + /* + * Always copy in UserNameRequested if the authentication + * is valid, because the higher level routines need it. + */ + if (UserNameRequested) { /* the name buffer comes from telnetd/telnetd{-ktd}.c */ strncpy(kname, UserNameRequested, 255); name[255] = '\0'; + } + + if (UserNameRequested && !kuserok(&adat, UserNameRequested)) { return(AUTH_VALID); } else return(AUTH_USER); diff --git a/src/appl/telnet/libtelnet/kerberos5.c b/src/appl/telnet/libtelnet/kerberos5.c index eb150a7c0..59982d3bf 100644 --- a/src/appl/telnet/libtelnet/kerberos5.c +++ b/src/appl/telnet/libtelnet/kerberos5.c @@ -731,13 +731,20 @@ kerberos5_status(ap, name, level) if (level < AUTH_USER) return(level); + /* + * Always copy in UserNameRequested if the authentication + * is valid, because the higher level routines need it. + * the name buffer comes from telnetd/telnetd{-ktd}.c + */ + if (UserNameRequested) { + strncpy(name, UserNameRequested, 255); + name[255] = '\0'; + } + if (UserNameRequested && krb5_kuserok(telnet_context, ticket->enc_part2->client, UserNameRequested)) { - /* the name buffer comes from telnetd/telnetd{-ktd}.c */ - strncpy(name, UserNameRequested, 255); - name[255] = '\0'; return(AUTH_VALID); } else return(AUTH_USER); -- 2.26.2