/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Helper routines for nfsmapid and autod daemon
* to translate hostname to IP address and Netinfo.
*/
#include <stdio.h>
#include <stdlib.h>
#include <alloca.h>
#include <signal.h>
#include <libintl.h>
#include <limits.h>
#include <errno.h>
#include <string.h>
#include <memory.h>
#include <pwd.h>
#include <grp.h>
#include <door.h>
#include <syslog.h>
#include <fcntl.h>
#include <unistd.h>
#include <assert.h>
#include <deflt.h>
#include <netdir.h>
#include <nfs/nfsid_map.h>
#include <idmap.h>
#include "nfs_resolve.h"
void
{
if (k == NULL)
return;
if (k->knc_protofmly)
free(k->knc_protofmly);
if (k->knc_proto)
free(k);
}
struct knetconfig *
{
struct knetconfig *k = NULL;
int len;
return (NULL);
}
k = (struct knetconfig *)malloc(sizeof (*k));
if (k == NULL)
goto nomem;
if (len <= 0)
goto err_out;
if (k->knc_protofmly == NULL)
goto nomem;
if (len <= 0)
goto err_out;
goto nomem;
return (k);
if (k != NULL)
(void) free_knconf(k);
return (NULL);
}
/*
* Get the information needed for an NFSv4.x referral. This
* information includes the netbuf, netname and knconfig.
*/
struct nfs_fsl_info *
{
return (NULL);
}
return (NULL);
}
return (NULL);
}
goto done;
goto done;
(KNC_STRSIZE * 2));
return (fsl_retp);
done:
return (NULL);
}
void
{
return;
}
}
void
{
}
if (fd >= 0)
fd = -1;
}
struct netbuf *
{
nc = setnetpath();
goto done;
if ((nconf->nc_semantics ==
NC_TPI_COTS_ORD) ||
(nconf->nc_semantics ==
NC_TPI_COTS)) {
if (port == 0)
break;
NC_INET) == 0 ||
NC_INET6) == 0) &&
NC_TCP) == 0))
break;
}
}
if (nthtry == SECOND_TRY) {
if (nconf->nc_semantics ==
NC_TPI_CLTS) {
if (port == 0)
break;
NC_INET) == 0 ||
NC_INET6) == 0) &&
NC_UDP) == 0))
break;
}
}
}
} /* while */
if (++nthtry <= MNT_PREF_LISTLEN) {
endnetpath(nc);
goto done;
goto retry;
} else
return (NULL);
} else {
if (cstat != RPC_SUCCESS)
goto retry;
}
done:
if (nc)
endnetpath(nc);
return (nb);
}
int
{
return (-1);
}
if (direct_to_server == TRUE) {
if (port == 0)
else
return (-1);
}
if (port) {
/* LINTED pointer alignment */
((struct sockaddr_in *)
((struct sockaddr_in6 *)
}
if (file_handle) {
NULL) == -1)
return (-1);
}
} else if (!file_handle) {
if (port) {
/* LINTED pointer alignment */
((struct sockaddr_in *)
((struct sockaddr_in6 *)
}
} else {
return (-1);
}
return (1);
}
/*
* Sets up TLI interface and finds the address withe netdir_getbyname().
* returns the address returned from the call.
* Caller frees up the memory allocated here.
*/
struct netbuf *
{
goto done;
goto done;
goto done;
goto done;
goto done;
}
goto done;
}
cs = RPC_SUCCESS;
done:
return (nb);
}