/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley
* under license from the Regents of the University of
* California.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "mt.h"
#include <stdlib.h>
#include <unistd.h>
#include <syslog.h>
#include "yp_b.h"
#include <netdir.h>
#include <string.h>
extern int __yp_dobind_cflookup(char *, struct dom_binding **, int);
/*
* __yp_all_cflookup() is a variant of the yp_all() code,
* which adds a 'hardlookup' parameter. This parameter is passed
* to __yp_dobind_cflookup(), and determines whether the server
* binding attempt is hard (try forever) of soft (retry a compiled-
* in number of times).
*/
int
int hardlookup)
{
int reason;
enum clnt_stat s;
return (YPERR_BADARGS);
return (YPERR_BADARGS);
return (reason);
return (YPERR_VERS);
}
return (YPERR_RPC);
}
/*
* This is the case where ypbind is running in broadcast mode,
* we have to do the jugglery to get the
* ypserv's address on COTS transport based
* on the CLTS address ypbind gave us !
*/
"yp_all: failed to get server's name\n");
return (YPERR_RPC);
}
/* check server name again, some other thread may have set it */
nullstring) == 0) {
}
(void) strcpy(server_name,
}
return (YPERR_RPC);
}
if (s != RPC_SUCCESS && s != RPC_TIMEDOUT) {
"yp_all - RPC clnt_call (transport level) failure"));
}
switch (s) {
case RPC_SUCCESS:
return (0);
case RPC_TIMEDOUT:
return (YPERR_YPSERV);
default:
return (YPERR_RPC);
}
}
/*
* This does the "glommed enumeration" stuff. callback->foreach is the name
* of a function which gets called per decoded key-value pair:
*
* (*callback->foreach)(status, key, keylen, val, vallen, callback->data);
*
* If the server we get back from __yp_dobind speaks the old protocol, this
* returns YPERR_VERS, and does not attempt to emulate the new functionality
* by using the old protocol.
*/
int
{
}
/*
* This function is identical to 'yp_all' with the exception that it
* attempts to use reserve ports.
*/
int
{
int reason;
enum clnt_stat s;
return (YPERR_BADARGS);
return (YPERR_BADARGS);
return (reason);
/*
* Have to free the binding since the reserved
* port bindings are not cached.
*/
return (YPERR_VERS);
}
return (YPERR_RPC);
}
/*
* This is the case where ypbind is running in broadcast mode,
* we have to do the jugglery to get the
* ypserv's address on COTS transport based
* on the CLTS address ypbind gave us !
*/
"yp_all: failed to get server's name\n");
return (YPERR_RPC);
}
/* check server name again, some other thread may have set it */
nullstring) == 0) {
}
(void) strcpy(server_name,
}
"tcp6", 0, 0)) == NULL &&
"tcp", 0, 0)) == NULL) {
return (YPERR_RPC);
}
if (s != RPC_SUCCESS && s != RPC_TIMEDOUT) {
"yp_all - RPC clnt_call (transport level) failure"));
}
switch (s) {
case RPC_SUCCESS:
return (0);
case RPC_TIMEDOUT:
return (YPERR_YPSERV);
default:
return (YPERR_RPC);
}
}