ypxfrd_client.c revision a506a34ceb0e9dcc6c61bf0560202f8538928650
/*
* 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <errno.h>
#include <netconfig.h>
#include <netdir.h>
#include "ypxfrd.h"
#include <ndbm.h>
#if defined(_LITTLE_ENDIAN)
#define DOSWAB 1
#endif
extern bool secure_map;
/* delete the dbm file with name file */
static int
char *file;
{
char pag1[MAXPATHLEN];
char dir1[MAXPATHLEN];
int err;
err = 0;
perror("unlinkpag");
err = -1;
}
perror("unlinkdir");
return (-1);
}
return (err);
}
/* xdr just the .pag file of a dbm file */
static bool_t
{
#ifdef DOSWAB
short *s;
int i;
#endif
return (FALSE);
while (1) {
#ifdef DOSWAB
s[0] = ntohs(s[0]);
for (i = 1; i <= s[0]; i++)
s[i] = ntohs(s[i]);
#endif
errno = 0;
if (errno != 0) {
perror("seek");
exit(-1);
}
perror("write");
exit(-1);
}
printf("clnt call getpag GETDBM_ERROR\n");
exit(-1);
return (FALSE);
return (goteof);
return (FALSE);
}
}
/* xdr just the .dir part of a dbm file */
static bool_t
{
return (FALSE);
while (1) {
errno = 0;
if (errno != 0) {
perror("seek");
exit(-1);
}
perror("write");
exit(-1);
}
printf("clnt call getdir GETDBM_ERROR\n");
exit(-1);
return (FALSE);
return (goteof);
return (FALSE);
}
}
/*
* xdr a dbm file from ypxfrd
* note that if the client or server do not support ndbm
* we may not use this optional protocol
*/
int
int *objp;
{
return (FALSE);
return (TRUE);
return (FALSE);
return (FALSE);
return (TRUE);
}
int
char *tempmap;
char *master;
char *domain;
char *map;
{
int res;
int fd;
for (i = 0; i <= lastnetid; i++) {
if (i != lastnetid)
continue;
logprintf("ypxfr: tcp transport not supported\n");
return (-1);
}
if (i != lastnetid)
continue;
logprintf("ypxfr: TLI problems\n");
return (-1);
}
if (secure_map == TRUE) {
NULL) == -1) {
if (i != lastnetid)
continue;
"ypxfr: cannot bind to reserved port for %s\n%s\n",
return (-1);
}
}
NULL) {
if (i != lastnetid)
continue;
logprintf("ypxfr: TLI problems\n");
return (-1);
}
== FALSE) {
if (i != lastnetid)
continue;
return (-1);
}
if (i != lastnetid)
continue;
"ypxfr (get_map) - TCP channel create failure");
return (-1);
}
break;
}
return (-2);
}
logprintf("clnt call to ypxfrd getdbm failed.\n");
return (-3);
}
logprintf("clnt call %s ypxfrd getdbm NOTOK %s %s code=%d\n",
return (-4);
}
return (0);
}