pam_info.c revision 92289
165123Speter/*-
265123Speter * Copyright (c) 2002 Networks Associates Technology, Inc.
365123Speter * All rights reserved.
465123Speter *
565123Speter * This software was developed for the FreeBSD Project by ThinkSec AS and
665123Speter * NAI Labs, the Security Research Division of Network Associates, Inc.
765123Speter * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
865123Speter * DARPA CHATS research program.
965123Speter *
1065123Speter * Redistribution and use in source and binary forms, with or without
1165123Speter * modification, are permitted provided that the following conditions
1265123Speter * are met:
1365123Speter * 1. Redistributions of source code must retain the above copyright
1465123Speter *    notice, this list of conditions and the following disclaimer.
1565123Speter * 2. Redistributions in binary form must reproduce the above copyright
1665123Speter *    notice, this list of conditions and the following disclaimer in the
1765123Speter *    documentation and/or other materials provided with the distribution.
1865123Speter * 3. The name of the author may not be used to endorse or promote
1965123Speter *    products derived from this software without specific prior written
2065123Speter *    permission.
2165123Speter *
2265123Speter * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
2365123Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2465123Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2565123Speter * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2665123Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2765123Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2865177Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2999112Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3099112Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3165123Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32113277Smike * SUCH DAMAGE.
3365123Speter *
34192896Sjamie * $P4: //depot/projects/openpam/lib/pam_info.c#6 $
3565123Speter */
3665123Speter
37200462Sdelphij#include <stdarg.h>
38200462Sdelphij#include <stdio.h>
39194869Sjamie#include <stdlib.h>
4065123Speter
4165123Speter#include <security/pam_appl.h>
4265123Speter#include <security/openpam.h>
4365123Speter
4465123Speter/*
4565123Speter * OpenPAM extension
4665123Speter *
4765123Speter * Display an information message
4865123Speter */
4965123Speter
50132191Stjrint
5165123Speterpam_info(pam_handle_t *pamh,
5265177Speter	const char *fmt,
5365123Speter	...)
5465123Speter{
5565123Speter	va_list ap;
56252428Smjg	char *rsp;
57113277Smike	int r;
58124681Smaxim
5965123Speter	va_start(ap, fmt);
6065123Speter	r = pam_vprompt(pamh, PAM_TEXT_INFO, &rsp, fmt, ap);
6165123Speter	va_end(ap);
6265123Speter	free(rsp); /* ignore response */
6365123Speter	return (r);
6465123Speter}
6565123Speter
6665123Speter/*
6765123Speter * Error codes:
6865123Speter *
6965123Speter *     !PAM_SYMBOL_ERR
7065123Speter *	PAM_SYSTEM_ERR
7165123Speter *	PAM_BUF_ERR
72219347Sjilles *	PAM_CONV_ERR
7365123Speter */
7465123Speter
7565123Speter/**
7665123Speter * The =pam_info function displays an informational message through the
7765123Speter * intermediary of the given PAM context's conversation function.
7865123Speter *
7965123Speter * >pam_error
8065123Speter * >pam_prompt
8165123Speter * >pam_vinfo
8265123Speter */
8365123Speter