WvStreams
wvpam.h
1/* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2004 Net Integration Technologies, Inc.
4 *
5 * A WvStream that authenticates with PAM. If WvStreams is compiled without
6 * PAM, it just fails. Note that if you don't check isok, you can still read
7 * and write to the stream - in particular, anything written in the
8 * constructor will go through before authentication begins.
9 *
10 * For now, this only works for PAM modules that don't require any user
11 * interaction (not even a password!), such as ssoya.
12 */
13#ifndef __WVPAM_H
14#define __WVPAM_H
15
16#include "wvstringlist.h"
17#include "wvlog.h"
18
19class WvPamData;
20
21class WvPam
22{
23private:
24 bool init();
25 WvPamData *d;
26 WvLog log;
27 WvString appname;
28
35 bool check_pam_status(WvStringParm step);
36
37public:
42 WvPam(WvStringParm svcname);
43
47 WvPam(WvStringParm svcname, WvStringParm rhost,
48 WvStringParm user = WvString::null,
49 WvStringParm password = WvString::null);
50
51 virtual ~WvPam();
52
56 bool authenticate(WvStringParm rhost = WvString::null,
57 WvStringParm user = WvString::null,
58 WvStringParm password = WvString::null);
59
64 void getgroups(WvStringList &groups) const;
65
69 WvString getuser() const;
70
75};
76
77#endif // __WVPAM_H
A variant of WvErrorBase suitable for embedding as a member of your own object, preferably called 'er...
Definition: wverror.h:90
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
Definition: wvstring.h:94
A WvLog stream accepts log messages from applications and forwards them to all registered WvLogRcv's.
Definition: wvlog.h:57
Definition: wvpam.h:22
WvString getuser() const
Get the user's name.
Definition: wvpam.cc:39
void getgroups(WvStringList &groups) const
Get the groups that the currently sessioned user is logged in with.
Definition: wvpam.cc:45
WvPam(WvStringParm svcname)
Start up PAM (presumably you will want to call authenticate() later.
Definition: wvpam.cc:15
bool authenticate(WvStringParm rhost=WvString::null, WvStringParm user=WvString::null, WvStringParm password=WvString::null)
Authenticate the user from rhost with password.
Definition: wvpam.cc:34
WvError err
Check here to see if the user is validated or not.
Definition: wvpam.h:74
This is a WvList of WvStrings, and is a really handy way to parse strings.
Definition: wvstringlist.h:28
WvString is an implementation of a simple and efficient printable-string class.
Definition: wvstring.h:330