Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

wvpam.h

Go to the documentation of this file.
00001 /* -*- Mode: C++ -*-
00002  * Worldvisions Weaver Software:
00003  *   Copyright (C) 1997-2003 Net Integration Technologies, Inc.
00004  *
00005  * A WvStream that authenticates with PAM.  If WvStreams is compiled without
00006  * PAM, it just fails.  Note that if you don't check isok, you can still read
00007  * and write to the stream - in particular, anything written in the
00008  * constructor will go through before authentication begins.
00009  *
00010  * For now, this only works for PAM modules that don't require any user
00011  * interaction.
00012  */
00013 #ifndef __WVPAM_H
00014 #define __WVPAM_H
00015 
00016 #include "wvstreamclone.h"
00017 #include "wvstringlist.h"
00018 
00019 class WvPamData;
00020 
00021 class WvPamStream : public WvStreamClone
00022 {
00023     WvPamData *d;
00024 
00025 public:
00026     
00027     /**
00028      * Require PAM authentication for the cloned stream.  name is the PAM
00029      * service name.  success and fail are optional messages to write to the
00030      * cloned stream on success or failure.
00031      */
00032     WvPamStream(WvStream *cloned, WvStringParm name, WvStringParm success =
00033             WvString::null, WvStringParm fail = WvString::null);
00034     virtual ~WvPamStream();
00035 
00036     /** Goes not ok if authentication fails */
00037     virtual bool isok() const;
00038 
00039     /** Return the user */
00040     WvString getuser() const;
00041 
00042     /** Return the list of groups */
00043     void getgroups(WvStringList &l) const;
00044 
00045 private:
00046 
00047     /**
00048      * Log the result of the last PAM step, based on the pam_status flag,and
00049      * write a failure message to the cloned stream on error.  step is the
00050      * name to use in the log message.  Returns true if the last step
00051      * succeeded, false if it failed.
00052      */
00053     bool check_pam_status(WvStringParm step);
00054 };
00055 
00056 #endif // __WVPAM_H

Generated on Sat Mar 13 14:55:50 2004 for WvStreams by doxygen 1.3.6-20040222