/*
* Copyright 2001 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Routines for controlled evaluation of host names, user names, and so on.
* They are, in fact, wrappers around the functions that are specific for
* the sockets or TLI programming interfaces. The request_info and host_info
* structures are used for result cacheing.
*
* These routines allows us to postpone expensive operations until their
* results are really needed. Examples are hostname lookups and double
* checks, or username lookups. Information that cannot be retrieved is
* given the value "unknown" ("paranoid" in case of hostname problems).
*
* When ALWAYS_HOSTNAME is off, hostname lookup is done only when required by
* tcpd paranoid mode, by access control patterns, or by %letter expansions.
*
* When ALWAYS_RFC931 mode is off, user lookup is done only when required by
* access control patterns or %letter expansions.
*
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
*/
#ifndef lint
#endif
/* System libraries. */
#include <stdio.h>
#include <string.h>
/* Local stuff. */
#include "tcpd.h"
/*
* When a string has the value STRING_UNKNOWN, it means: don't bother, I
* tried to look up the data but it was unavailable for some reason. When a
* conflict.
*/
/* eval_user - look up user name */
struct request_info *request;
{
}
}
/* eval_hostaddr - look up printable address */
{
}
}
/* eval_hostname - look up host name */
{
}
}
/* eval_hostinfo - return string with host name (preferred) or address */
{
char *hostname;
#ifndef ALWAYS_HOSTNAME /* no implicit host lookups */
return (eval_hostaddr(host));
#endif
if (HOSTNAME_KNOWN(hostname)) {
} else {
return (eval_hostaddr(host));
}
}
/* eval_client - return string with as much about the client as we know */
struct request_info *request;
{
#ifndef ALWAYS_RFC931 /* no implicit user lookups */
return (hostinfo);
#endif
return (both);
} else {
return (hostinfo);
}
}
/* eval_server - return string with as much about the server as we know */
struct request_info *request;
{
return (both);
} else {
return (daemon);
}
}