/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Portions Copyright 2005 Juergen Keil */
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <ndbm.h>
#include <syslog.h>
#include "ypxfrd.h"
#include "ypsym.h"
#include "ypdefs.h"
/*
* Because this code hacks into DBM underneath its API it can't use the N2L
* shim in it's normal way. It thus includes shim.h instead of shim_hooks.h
* and has knowledge of shim internals. While copying the DBM files it does
* not lock them. This reflects the behavior of the pre N2L code.
*/
#include "shim.h"
#include "yptol.h"
#endif
/* per connection stuff */
struct mycon {
int lblk;
int firstd;
};
extern void get_secure_nets(char *);
extern int check_secure_net_ti(struct netbuf *, char *);
extern int _main(int, char **);
int
{
/* load up the securenet file */
get_secure_nets(argv[0]);
/*
* Set non-blocking mode and maximum record size for
* connection oriented RPC transports.
*/
"unable to set maximum RPC record size");
}
/* Initialize file locking etc. */
if (!init_lock_system(TRUE))
/* An detailed error will already have been logged */
exit(-1);
}
/*
* In yptol mode we may start a cache update thread within a child process.
* It is thus important that child processes do not exit, killing any such
* threads, before the thread has completed. They must thus call this version
* of the exit() function.
*/
void
{
if (yptol_mode) {
}
}
dbmfyl *
{
int pid;
int res;
struct mycon m;
/*
* Build up path name. If we are working in N2L mode also conv
* to the new N2L style mapname.
*
* Do not allow any path as a domain name or map name.
*/
res = GETDBM_ERROR;
}
return (NULL);
}
if (pid < 0) {
perror("fork");
res = GETDBM_ERROR;
}
return (NULL);
}
if (pid != 0)
return (NULL);
res = GETDBM_ERROR;
}
yptol_exit(0);
return (NULL);
}
/* Do the security thing */
res = GETDBM_ERROR;
}
yptol_exit(0);
return (NULL);
}
res = GETDBM_ERROR;
}
yptol_exit(1);
return (NULL);
}
res = GETDBM_ERROR;
}
yptol_exit(1);
return (NULL);
}
}
/* OK, we're through */
m.lblk = -1;
m.firstd = 0;
}
yptol_exit(0);
return (&result);
}
{
return (FALSE);
return (FALSE);
return (FALSE);
return (TRUE);
}
{
#ifdef DOSWAB
short *s;
int i;
int cnt;
#endif
#ifdef DOSWAB
cnt = s[0];
for (i = 0; i <= cnt; i++)
s[i] = ntohs(s[i]);
}
#endif
return (FALSE);
return (FALSE);
#ifdef DOSWAB
cnt = s[0];
for (i = 0; i <= cnt; i++)
s[i] = ntohs(s[i]);
}
#endif
return (FALSE);
}
}
int
{
int status;
int len;
if (m->firstd == 0) {
m->firstd = 1;
} else
m->firstd++;
/*
* printf("dir block %d\n", (m->firstd) - 1);
*/
if (len < 0) {
perror("read directory");
} else if (len == 0) {
status = GETDBM_EOF;
/*
* printf("dir EOF\n");
*/
}
return (status);
}
{
return (FALSE);
return (FALSE);
return (FALSE);
}
}
int
{
/*
* printf("block=%d lblk=%d\n",
* m->map->entries->dbm_pagbno,
* m->lblk);
*/
/* advance key on first try */
return (OK);
}
}
/*
* printf("EOF\n");
*/
return (GETDBM_EOF);
}
{
register char *buf;
int n;
register short *sp;
register short t;
#if defined(_XPG4_2)
register size_t m;
#else
register long m;
#endif
/* find the maximum key in cmpdatum order */
if ((unsigned)0 >= sp[0]) {
return (okey);
} else {
}
for (n = 2; ; n += 2) {
if ((unsigned)n >= sp[0]) {
return (okey);
} else {
return (ans);
}
} else {
t = PBLKSIZ;
if (n > 0)
t = sp[n];
}
} else if (m == 0) {
} else {
do
break;
}
while (--m);
}
}
}