pam_open_session.c revision 99158
1195098Sed/*-
2195098Sed * Copyright (c) 2002 Networks Associates Technology, Inc.
3195098Sed * All rights reserved.
4195098Sed *
5195098Sed * This software was developed for the FreeBSD Project by ThinkSec AS and
6195098Sed * Network Associates Laboratories, the Security Research Division of
7195098Sed * Network Associates, Inc.  under DARPA/SPAWAR contract N66001-01-C-8035
8195098Sed * ("CBOSS"), as part of the DARPA CHATS research program.
9195098Sed *
10249423Sdim * Redistribution and use in source and binary forms, with or without
11249423Sdim * modification, are permitted provided that the following conditions
12249423Sdim * are met:
13218893Sdim * 1. Redistributions of source code must retain the above copyright
14218893Sdim *    notice, this list of conditions and the following disclaimer.
15202878Srdivacky * 2. Redistributions in binary form must reproduce the above copyright
16218893Sdim *    notice, this list of conditions and the following disclaimer in the
17221345Sdim *    documentation and/or other materials provided with the distribution.
18218893Sdim * 3. The name of the author may not be used to endorse or promote
19249423Sdim *    products derived from this software without specific prior written
20202878Srdivacky *    permission.
21206274Srdivacky *
22195098Sed * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
23195098Sed * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24249423Sdim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25249423Sdim * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
26249423Sdim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27251662Sdim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28195098Sed * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29195098Sed * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30195098Sed * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31223017Sdim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32223017Sdim * SUCH DAMAGE.
33195098Sed *
34202878Srdivacky * $P4: //depot/projects/openpam/lib/pam_open_session.c#9 $
35249423Sdim */
36249423Sdim
37249423Sdim#include <sys/param.h>
38251662Sdim
39249423Sdim#include <security/pam_appl.h>
40249423Sdim
41249423Sdim#include "openpam_impl.h"
42249423Sdim
43249423Sdim/*
44251662Sdim * XSSO 4.2.1
45249423Sdim * XSSO 6 page 54
46249423Sdim *
47221345Sdim * Open a user session
48221345Sdim */
49221345Sdim
50221345Sdimint
51221345Sdimpam_open_session(pam_handle_t *pamh,
52221345Sdim	int flags)
53221345Sdim{
54221345Sdim
55221345Sdim	if (flags & ~(PAM_SILENT))
56221345Sdim		return (PAM_SYMBOL_ERR);
57221345Sdim	return (openpam_dispatch(pamh, PAM_SM_OPEN_SESSION, flags));
58221345Sdim}
59221345Sdim
60223017Sdim/*
61223017Sdim * Error codes:
62223017Sdim *
63223017Sdim *	=openpam_dispatch
64221345Sdim *	=pam_sm_open_session
65223017Sdim *	!PAM_IGNORE
66223017Sdim *	PAM_SYMBOL_ERR
67223017Sdim */
68221345Sdim
69221345Sdim/**
70202878Srdivacky * The =pam_open_session sets up a user session for a previously
71202878Srdivacky * authenticated user.  The session should later be torn down by a call to
72202878Srdivacky * =pam_close_session.
73202878Srdivacky *
74202878Srdivacky * The =flags argument is the binary or of zero or more of the following
75218893Sdim * values:
76218893Sdim *
77218893Sdim *	=PAM_SILENT:
78218893Sdim *		Do not emit any messages.
79218893Sdim *
80218893Sdim * If any other bits are set, =pam_open_session will return
81218893Sdim * =PAM_SYMBOL_ERR.
82202878Srdivacky */
83218893Sdim