Make WvStreams compile with gcc 4.4.
[wvstreams.git] / include / wvpam.h
blob1cdf9482a820daa99c0fcb681a9e2238df34aece
1 /* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2004 Net Integration Technologies, Inc.
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.
10 * For now, this only works for PAM modules that don't require any user
11 * interaction (not even a password!), such as ssoya.
13 #ifndef __WVPAM_H
14 #define __WVPAM_H
16 #include "wvstringlist.h"
17 #include "wvlog.h"
19 class WvPamData;
21 class WvPam
23 private:
24 bool init();
25 WvPamData *d;
26 WvLog log;
27 WvString appname;
29 /**
30 * Log the result of the last PAM step, based on the pam_status flag,and
31 * write a failure message to the cloned stream on error. step is the
32 * name to use in the log message. Returns true if the last step
33 * succeeded, false if it failed.
35 bool check_pam_status(WvStringParm step);
37 public:
38 /**
39 * Start up PAM (presumably you will want to call authenticate()
40 * later.
41 */
42 WvPam(WvStringParm svcname);
44 /**
45 * Start up PAM, and authenticate user from rhost with password
47 WvPam(WvStringParm svcname, WvStringParm rhost,
48 WvStringParm user = WvString::null,
49 WvStringParm password = WvString::null);
51 virtual ~WvPam();
53 /**
54 * Authenticate the user from rhost with password.
56 bool authenticate(WvStringParm rhost = WvString::null,
57 WvStringParm user = WvString::null,
58 WvStringParm password = WvString::null);
60 /**
61 * Get the groups that the currently sessioned user is logged
62 * in with
63 */
64 void getgroups(WvStringList &groups) const;
66 /**
67 * Get the user's name
69 WvString getuser() const;
71 /**
72 * Check here to see if the user is validated or not
74 WvError err;
77 #endif // __WVPAM_H