authenticate/authvlib.h
changeset 0 6f7a81934006
equal deleted inserted replaced
-1:000000000000 0:6f7a81934006
       
     1 #ifndef VMAILMGR__VMAILMGR_AUTH_LIBRARY__H__
       
     2 #define VMAILMGR__VMAILMGR_AUTH_LIBRARY__H__
       
     3 
       
     4 #include "mystring/mystring.h"
       
     5 #include "misc/pwentry.h"
       
     6 
       
     7 struct user_data
       
     8 {
       
     9   uid_t uid;
       
    10   gid_t gid;
       
    11   mystring name;
       
    12   mystring home;
       
    13   mystring maildir;
       
    14   mystring vname;
       
    15   
       
    16   user_data(pwentry* pw, mystring md, mystring v)
       
    17     : uid(pw->uid), gid(pw->gid), name(pw->name), home(pw->home),
       
    18       maildir(md), vname(v)
       
    19   {
       
    20   }
       
    21   
       
    22   ~user_data() { }
       
    23 
       
    24   bool non_virtual() const { return !vname; }
       
    25 };
       
    26 
       
    27 // The following routines are defined in authvlib.cc
       
    28 void set_domain(mystring& name, mystring& domain);
       
    29 user_data* authenticate(mystring name, mystring pass, mystring domain,
       
    30 			bool virtual_only = false);
       
    31 void set_user(const pwentry* pw);
       
    32 
       
    33 // The following must be defined by the authentication module.
       
    34 extern const mystring exec_presetuid;
       
    35 extern const mystring exec_postsetuid;
       
    36 extern void fail_login(const char* msg);
       
    37 extern void fail_baddata(const char* msg);
       
    38 extern void fail_temporary(const char* msg);
       
    39 
       
    40 #endif // VMAILMGR__VMAILMGR_AUTH_LIBRARY__H__