pam_prompt.c revision 91100
195604Sjake/*-
295604Sjake * Copyright (c) 2002 Networks Associates Technologies, Inc.
395604Sjake * All rights reserved.
495604Sjake *
595604Sjake * This software was developed for the FreeBSD Project by ThinkSec AS and
695604Sjake * NAI Labs, the Security Research Division of Network Associates, Inc.
795604Sjake * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
895604Sjake * DARPA CHATS research program.
995604Sjake *
1095604Sjake * Redistribution and use in source and binary forms, with or without
1195604Sjake * modification, are permitted provided that the following conditions
1295604Sjake * are met:
1395604Sjake * 1. Redistributions of source code must retain the above copyright
1495604Sjake *    notice, this list of conditions and the following disclaimer.
1595604Sjake * 2. Redistributions in binary form must reproduce the above copyright
1695604Sjake *    notice, this list of conditions and the following disclaimer in the
1795604Sjake *    documentation and/or other materials provided with the distribution.
1895604Sjake * 3. The name of the author may not be used to endorse or promote
1995604Sjake *    products derived from this software without specific prior written
2095604Sjake *    permission.
2195604Sjake *
2295604Sjake * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
2395604Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2495604Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2595604Sjake * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2695604Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2795604Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2895604Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2995604Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3095604Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3195604Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3295604Sjake * SUCH DAMAGE.
3395604Sjake *
3495604Sjake * $Id$
3595604Sjake */
3695604Sjake
3795604Sjake#include <stdarg.h>
3895604Sjake
3995604Sjake#include <security/pam_appl.h>
4095604Sjake#include <security/openpam.h>
4195604Sjake
4295604Sjake/*
4395604Sjake * OpenPAM extension
4495604Sjake *
4595604Sjake * Call the conversation function
4695604Sjake */
4795604Sjake
4895604Sjakeint
4995604Sjakepam_prompt(pam_handle_t *pamh,
5095604Sjake	int style,
5195604Sjake	char **resp,
5295604Sjake	const char *fmt,
5395604Sjake	...)
54146673Sstefanf{
5595604Sjake	va_list ap;
5695604Sjake	int r;
5795604Sjake
5895604Sjake	va_start(ap, fmt);
5995604Sjake	r = pam_vprompt(pamh, style, resp, fmt, ap);
60127091Sdes	va_end(ap);
6195604Sjake	return (r);
62146673Sstefanf}
6395604Sjake
6495604Sjake/*
6595604Sjake * Error codes:
6695604Sjake *
6795604Sjake *     !PAM_SYMBOL_ERR
6895604Sjake *	PAM_SYSTEM_ERR
6995604Sjake *	PAM_BUF_ERR
7095604Sjake *	PAM_CONV_ERR
7195604Sjake */
7295604Sjake
7395604Sjake/**
74127091Sdes * The =pam_prompt function constructs a message from the specified format
7595604Sjake * string and arguments and passes it to the given PAM context's
7695604Sjake * conversation function.
7795604Sjake *
7895604Sjake * A pointer to the response, or =NULL if the conversation function did
79127091Sdes * not return one, is stored in the location pointed to by the =resp
80127091Sdes * argument.
8195604Sjake *
8295604Sjake * See =pam_vprompt for further details.
8395604Sjake *
8495604Sjake * >pam_error
8595604Sjake * >pam_info
8695604Sjake * >pam_vprompt
8795604Sjake */
8895604Sjake