/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#if !defined(LINT) && !defined(CODECENTER)
#endif
/*! \file
* \brief
* this is the top level dispatcher
*
* The dispatcher is implemented as an accessor class; it is an
* accessor class that calls other accessor classes, as controlled by a
* configuration file.
*
* A big difference between this accessor class and others is that the
* map class initializers are NULL, and the map classes are already
* filled in with method functions that will do the right thing.
*/
/* Imports */
#include "port_before.h"
#include <isc/assertions.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <resolv.h>
#include <isc/memcluster.h>
#include <irs.h>
#include "port_after.h"
#include "irs_p.h"
#include "gen_p.h"
#ifdef SUNW_HOSTS_FALLBACK
extern int __res_no_hosts_fallback(void);
#endif /* SUNW_HOSTS_FALLBACK */
/* Definitions */
struct nameval {
const char * name;
int val;
};
{ "local", irs_lcl },
{ "dns", irs_dns },
{ "nis", irs_nis },
{ "irp", irs_irp },
};
#ifdef WANT_IRS_NIS
#else
NULL,
#endif
};
{ "group", irs_gr },
{ "passwd", irs_pw },
{ "services", irs_sv },
{ "protocols", irs_pr },
{ "hosts", irs_ho },
{ "networks", irs_nw },
{ "netgroup", irs_ng },
};
{ "merge", IRS_MERGE },
{ "continue", IRS_CONTINUE },
{ NULL, 0 }
};
/* Forward */
void (*)(void *));
enum irs_map_id, enum irs_acc_id,
const char *);
/* Public */
struct irs_acc *
return (NULL);
}
return (NULL);
}
#ifdef WANT_IRS_GR
#else
#endif
#ifdef WANT_IRS_PW
#else
#endif
return (acc);
}
/* Methods */
static struct __res_state *
return (NULL);
}
return (NULL);
}
static void
void (*free_res)(void *)) {
#if 0
#endif
}
#if 0
}
}
#endif
}
static void
int n;
/* Search rules. */
for (n = 0; n < irs_nmap; n++)
/* Access methods. */
for (n = 0; n < irs_nacc; n++) {
/* Map objects. */
/* Enclosing accessor. */
}
/* The options string was strdup'd. */
/* The private data container. */
/* The object. */
}
/* Private */
static int
int n;
return (-1);
}
static struct irs_rule *
return (next);
}
static int
const char *options)
{
const char *cp;
int n;
#ifndef WANT_IRS_GR
return (-1);
#endif
#ifndef WANT_IRS_PW
return (-1);
#endif
#ifndef WANT_IRS_NIS
return (-1);
#endif
return (-1);
if (next)
else
n = sizeof option - 1;
option[n] = '\0';
if (n >= 0)
}
(void)NULL;
else
/* Try to instantiate map accessors for this if necessary & approp. */
}
return (0);
}
static void
/* Install time honoured and proved BSD style rules as default. */
#ifdef SUNW_HOSTS_FALLBACK
if (__res_no_hosts_fallback())
else {
}
#else /* SUNW_HOSTS_FALLBACK */
#endif /* SUNW_HOSTS_FALLBACK */
}
static void
#ifdef SUNW_HOSTS_FALLBACK
if (__res_no_hosts_fallback()) {
return;
}
#endif /* SUNW_HOSTS_FALLBACK */
/* A conf file of "" means compiled in defaults. Irpd wants this */
return;
}
(unsigned long)sizeof mapname,
(unsigned long)sizeof accname,
(unsigned long)sizeof options);
char *tmp;
int n;
tmp++)
(void)NULL;
continue;
if (n < 2)
continue;
if (n < 3)
options[0] = '\0';
if (n < 0)
continue;
map = (enum irs_map_id) n;
if (n < 0)
continue;
acc = (enum irs_acc_id) n;
}
}