sbuild-auth-conv-tty.h

Go to the documentation of this file.
00001 /* Copyright © 2005-2007  Roger Leigh <rleigh@debian.org>
00002  *
00003  * schroot is free software; you can redistribute it and/or modify it
00004  * under the terms of the GNU General Public License as published by
00005  * the Free Software Foundation; either version 2 of the License, or
00006  * (at your option) any later version.
00007  *
00008  * schroot is distributed in the hope that it will be useful, but
00009  * WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011  * General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00016  * MA  02111-1307  USA
00017  *
00018  *********************************************************************/
00019 
00020 #ifndef SBUILD_AUTH_CONV_TTY_H
00021 #define SBUILD_AUTH_CONV_TTY_H
00022 
00023 #include <sbuild/sbuild-auth-conv.h>
00024 #include <sbuild/sbuild-custom-error.h>
00025 
00026 #include <security/pam_appl.h>
00027 #include <security/pam_misc.h>
00028 
00029 namespace sbuild
00030 {
00044   class auth_conv_tty : public auth_conv
00045   {
00046   public:
00048     enum error_code
00049       {
00050         CTTY,            
00051         TIMEOUT,         
00052         TIMEOUT_PENDING, 
00053         TERMIOS,         
00054         CONV_TYPE        
00055       };
00056 
00058     typedef custom_error<error_code> error;
00059 
00061     auth_conv_tty ();
00063     virtual ~auth_conv_tty ();
00064 
00065     virtual time_t
00066     get_warning_timeout ();
00067 
00068     virtual void
00069     set_warning_timeout (time_t timeout);
00070 
00071     virtual time_t
00072     get_fatal_timeout ();
00073 
00074     virtual void
00075     set_fatal_timeout (time_t timeout);
00076 
00077     virtual void
00078     conversation (auth_conv::message_list& messages);
00079 
00080   private:
00090     int get_delay ();
00091 
00108     std::string
00109     read_string (std::string message,
00110                  bool        echo);
00111 
00113     time_t  warning_timeout;
00115     time_t  fatal_timeout;
00117     time_t  start_time;
00118   };
00119 
00120 }
00121 
00122 #endif /* SBUILD_AUTH_CONV_TTY_H */
00123 
00124 /*
00125  * Local Variables:
00126  * mode:C++
00127  * End:
00128  */

Generated on Sun Jul 8 21:23:21 2007 for sbuild by  doxygen 1.5.2