Realm for server lookup.

This commit is contained in:
Mats Erik Andersson
2012-08-20 23:08:20 +02:00
parent 4168cfe85d
commit df22b0e7de
3 changed files with 38 additions and 1 deletions

View File

@@ -1,3 +1,13 @@
2012-08-20 Mats Erik Andersson <gnu@gisladisker.se>
Server realm pairing: Let server name determine
realm to be contacted, as per library configuration.
* libinetutils/shishi.c (shishi_auth): Whenever realm
is not explicit, call shishi_realm_for_server() to get
a usable realm; pass on to shishi_realm_default_set().
* libtelnet/shishi.c (krb5shishi_send): Likewise.
2012-08-17 Mats Erik Andersson <gnu@gisladisker.se>
telnet: Selectable principal name.

View File

@@ -28,7 +28,7 @@
# include <unistd.h>
# include <shishi_def.h>
/* shishi authentication */
/* shishi authentication, client side */
int
shishi_auth (Shishi ** handle, int verbose, char **cname,
const char *sname, int sock, char *cmd,
@@ -130,6 +130,19 @@ shishi_auth (Shishi ** handle, int verbose, char **cname,
else
sprintf (tmpserver, "%s/%s", SERVICE, sname + (p ? 1 : 0));
/* Retrieve realm assigned to this server as per configuration,
* unless an explicit domain was passed in the call.
*/
if (!realm)
{
if (!p)
p = sname;
else if (*p == '/')
++p;
shishi_realm_default_set (h, shishi_realm_for_server (h, p));
}
hint.client = (char *) *cname;
hint.server = (char *) tmpserver;
@@ -254,6 +267,7 @@ senderror (int s, char type, char *buf)
write (s, buf, strlen (buf));
}
/* shishi authentication, server side */
int
get_auth (int infd, Shishi ** handle, Shishi_ap ** ap,
Shishi_key ** enckey, const char **err_msg, int *protoversion,

View File

@@ -186,6 +186,19 @@ krb5shishi_send (TN_Authenticator * ap)
if (dest_realm && *dest_realm)
shishi_realm_default_set (shishi_handle, dest_realm);
else
{
/* Retrieve realm assigned to this server as per configuration. */
char *p = strchr (RemoteHostName, '/');
if (p)
++p;
else
p = RemoteHostName;
shishi_realm_default_set (shishi_handle,
shishi_realm_for_server (shishi_handle, p));
}
tkt = shishi_tkts_get (shishi_tkts_default (shishi_handle), &hint);
free (tmp);