/*
* 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 2014 Gary Mills
* Copyright 2001 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 4.3 BSD
* under license from the Regents of the University of California.
*/
/*
* Miscellaneous support routines for kernel implentation of AUTH_DES
*/
/*
* rtime - get time from remote machine
*
* sets time, obtaining value from host
* with time of day in seconds since Jan 1, 1900, must
* subtract 86400(365*70 + 17) to get time
* since Jan 1, 1970, which is what get/settimeofday
* uses.
*/
#include <sys/sysmacros.h>
#include <sys/systeminfo.h>
#include <rpc/rpcb_prot.h>
int
{
int error;
int timo;
int type;
int uderr;
int i;
int retries;
retries = 5;
if (calltype == 0) {
return (-1);
}
return (-1);
}
return (-1);
}
dummy = 0;
0) {
return (-1);
}
&type)) != 0) {
return (-1);
}
if (type == 0) {
return (-1);
}
if (error != 0) {
goto again;
return (-1);
}
/*
* Response comes from some other
* destination:
* ignore it since it's not related to the
* request we just sent out.
*/
goto again;
}
}
RPCLOG(1,
"rtime: t_krcvudata returned type %d\n",
type);
if (retries-- == 0)
return (-1);
goto again;
}
if (retries-- == 0)
return (-1);
goto again;
}
/* LINTED pointer alignment */
} else {
(char **)&server)) != 0) {
return (-1);
}
return (-1);
}
i = 0;
dummy = 0;
/* now read up to 4 bytes from the TIME server */
while (i < sizeof (dummy)) {
if (error != 0) {
error);
return (-1);
}
if (type == 0) {
RPCLOG0(1,
"rtime: t_kspoll timed out\n");
return (-1);
}
if (error != 0) {
error);
return (-1);
}
RPCLOG(1,
"rtime: wrong msg type: read %d"
" bytes\n", i);
return (-1);
}
/*
* The outer loop iterates until we reach the
* end of the mblk chain.
*/
/*
* The inner loop iterates until
* we've gotten 4 bytes or until
* the mblk is exhausted.
*/
while (i < sizeof (dummy) &&
i++;
/*
* We avoid big-endian/little-endian
* issues by serializing the result
* one byte at a time.
*/
dummy <<= 8;
0xFF);
}
}
}
}
} else {
/*
* We talk to rpcbind.
*/
if (error != 0) {
RPCLOG(1,
"rtime: clnt_tli_kcreate returned %d\n", error);
return (-1);
}
if (error == RPC_UDERROR) {
if (retries-- > 0)
goto new_again;
}
if (error != RPC_SUCCESS) {
error);
return (-1);
}
}
if (calltype != 0)
thetime);
return (-1);
}
return (0);
}
/*
* What is my network name?
* WARNING: this gets the network name in sun unix format.
* Other operating systems (non-unix) are free to put something else
* here.
*
* Return 0 on success
* Return RPC errors (non-zero values) if failed.
*/
enum clnt_stat
{
}