123d232d7SDag-Erling Smørgrav /*- 223d232d7SDag-Erling Smørgrav * Copyright (c) 2002 Networks Associates Technology, Inc. 323d232d7SDag-Erling Smørgrav * All rights reserved. 423d232d7SDag-Erling Smørgrav * 523d232d7SDag-Erling Smørgrav * This software was developed for the FreeBSD Project by ThinkSec AS and 623d232d7SDag-Erling Smørgrav * NAI Labs, the Security Research Division of Network Associates, Inc. 723d232d7SDag-Erling Smørgrav * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the 823d232d7SDag-Erling Smørgrav * DARPA CHATS research program. 923d232d7SDag-Erling Smørgrav * 1023d232d7SDag-Erling Smørgrav * Redistribution and use in source and binary forms, with or without 1123d232d7SDag-Erling Smørgrav * modification, are permitted provided that the following conditions 1223d232d7SDag-Erling Smørgrav * are met: 1323d232d7SDag-Erling Smørgrav * 1. Redistributions of source code must retain the above copyright 1423d232d7SDag-Erling Smørgrav * notice, this list of conditions and the following disclaimer. 1523d232d7SDag-Erling Smørgrav * 2. Redistributions in binary form must reproduce the above copyright 1623d232d7SDag-Erling Smørgrav * notice, this list of conditions and the following disclaimer in the 1723d232d7SDag-Erling Smørgrav * documentation and/or other materials provided with the distribution. 1823d232d7SDag-Erling Smørgrav * 3. The name of the author may not be used to endorse or promote 1923d232d7SDag-Erling Smørgrav * products derived from this software without specific prior written 2023d232d7SDag-Erling Smørgrav * permission. 2123d232d7SDag-Erling Smørgrav * 2223d232d7SDag-Erling Smørgrav * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 2323d232d7SDag-Erling Smørgrav * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2423d232d7SDag-Erling Smørgrav * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2523d232d7SDag-Erling Smørgrav * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2623d232d7SDag-Erling Smørgrav * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2723d232d7SDag-Erling Smørgrav * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2823d232d7SDag-Erling Smørgrav * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2923d232d7SDag-Erling Smørgrav * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3023d232d7SDag-Erling Smørgrav * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3123d232d7SDag-Erling Smørgrav * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3223d232d7SDag-Erling Smørgrav * SUCH DAMAGE. 3323d232d7SDag-Erling Smørgrav * 3423d232d7SDag-Erling Smørgrav * $FreeBSD$ 3523d232d7SDag-Erling Smørgrav */ 3623d232d7SDag-Erling Smørgrav 3723d232d7SDag-Erling Smørgrav #ifndef _YPCLNT_H_INCLUDED 3823d232d7SDag-Erling Smørgrav 3923d232d7SDag-Erling Smørgrav typedef struct ypclnt ypclnt_t; 4023d232d7SDag-Erling Smørgrav struct ypclnt { 4123d232d7SDag-Erling Smørgrav char *domain; /* Domain name */ 4223d232d7SDag-Erling Smørgrav char *map; /* Map name */ 4323d232d7SDag-Erling Smørgrav char *server; /* Server name */ 4423d232d7SDag-Erling Smørgrav char *error; /* Error message */ 4523d232d7SDag-Erling Smørgrav }; 4623d232d7SDag-Erling Smørgrav 4723d232d7SDag-Erling Smørgrav struct passwd; 4823d232d7SDag-Erling Smørgrav 4923d232d7SDag-Erling Smørgrav ypclnt_t *ypclnt_new(const char *, const char *, const char *); 5023d232d7SDag-Erling Smørgrav void ypclnt_free(ypclnt_t *); 5123d232d7SDag-Erling Smørgrav void ypclnt_error(ypclnt_t *, const char *, const char *, ...); 5223d232d7SDag-Erling Smørgrav int ypclnt_connect(ypclnt_t *); 53c744e752SDag-Erling Smørgrav int ypclnt_havepasswdd(ypclnt_t *); 5423d232d7SDag-Erling Smørgrav int ypclnt_passwd(ypclnt_t *, const struct passwd *, const char *); 5523d232d7SDag-Erling Smørgrav 5623d232d7SDag-Erling Smørgrav #if defined(DEBUG) && defined(__GNUC__) 5723d232d7SDag-Erling Smørgrav #define YPCLNT_DEBUG(fmt...) warnx(__FUNCTION__ ": " fmt, ##fmt) 5823d232d7SDag-Erling Smørgrav #else 5923d232d7SDag-Erling Smørgrav #define YPCLNT_DEBUG(fmt...) 6023d232d7SDag-Erling Smørgrav #endif 6123d232d7SDag-Erling Smørgrav 6223d232d7SDag-Erling Smørgrav #endif 63