key_generic.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 1997 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <errno.h>
#ifdef SYSLOG
#else
#define LOG_ERR 3
#endif /* SYSLOG */
#include <netconfig.h>
#include <netdir.h>
extern char *strdup();
/*
* The highest level interface for server creation.
* It tries for all the nettokens in that particular class of token
*
* It creates a link list of all the handles it could create.
* If svc_create() is called multiple times, it uses the handle
* created earlier instead of creating a new handle every time.
*
* Copied from svc_generic.c
*/
int
void (*dispatch) (); /* Dispatch function */
char *nettype; /* Networktype token */
char *servname; /* name of the service */
{
struct xlist {
} *l;
int num = 0;
void *handle;
int fd;
struct nd_hostserv ns;
struct nd_addrlist *nas;
"svc_create: could not read netconfig database");
return (0);
}
continue;
/* Found an old one, use it */
"svc_create: could not register prog %d vers %d on %s",
else
num++;
break;
}
}
if (l)
continue;
/* It was not found. Now create a new one */
"svc_create: %s: cannot open connection: %s",
continue;
}
/*
* Negotiate for returning the uid of the caller.
* This should be done before enabling the endpoint for
* service via t_bind() (called in svc_tli_create())
* so that requests to keyserv contain the uid.
*/
if (__rpc_negotiate_uid(fd) != 0) {
"Couldn't negotiate for uid with loopback transport %s",
continue;
}
continue;
}
/* Copy the address */
} else {
"svc_create: no well known address for %s on transport %s",
}
if (bind_addr)
if (xprt) {
"svc_create: could not register prog %d vers %d on %s",
continue;
}
"svc_create: no memory");
return (num);
}
xprtlist = l;
num++;
}
}
return (num);
}