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 
19 class WvPamData;
20 
21 class WvPam
22 {
23 private:
24  bool init();
25  WvPamData *d;
26  WvLog log;
27  WvString appname;
28 
35  bool check_pam_status(WvStringParm step);
36 
37 public:
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