2
Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin
3
Copyright (C) 2005- The University of Notre Dame
4
This software is distributed under the GNU General Public License.
5
See the file COPYING for details.
10
#include "domain_name_cache.h"
18
static int auth_hostname_assert( struct link *link, struct hash_table *t, time_t stoptime )
20
char line[AUTH_LINE_MAX];
22
if(!link_readline(link,line,sizeof(line),stoptime)) {
23
debug(D_AUTH,"hostname: lost connection");
27
if(!strcmp(line,"yes")) {
28
debug(D_AUTH,"hostname: accepted");
35
static int auth_hostname_accept( struct link *link, char **subject, struct hash_table *t, time_t stoptime )
37
char addr[LINK_ADDRESS_MAX];
38
char name[DOMAIN_NAME_MAX];
41
if(!link_address_remote(link,addr,&port)) {
42
debug(D_AUTH,"hostname: couldn't get address of link");
46
if(!domain_name_cache_lookup_reverse(addr,name)) {
47
debug(D_AUTH,"hostname: couldn't look up name of %s",name);
51
*subject = strdup(name);
53
debug(D_AUTH,"hostname: out of memory");
57
link_putliteral(link,"yes\n",stoptime);
61
link_putliteral(link,"no\n",stoptime);
65
int auth_hostname_register()
67
debug(D_AUTH,"hostname: registered");
68
return auth_register( "hostname", auth_hostname_assert, auth_hostname_accept );