Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

MODULE_ldapconf Class Reference

#include <ldapconf.h>

Inheritance diagram for MODULE_ldapconf:

LINUXCONF_MODULE List of all members.

Public Methods

 MODULE_ldapconf (void)
int dohtml (const char *key)
int domenu (MENU_CONTEXT context, const char *key)
int execmain (int argc, char *argv[], bool sa)
int message (const char *msg, int argc, const char *argv[])
void setmenu (DIALOG&dia, MENU_CONTEXT context)
void usage (SSTRINGS&tb)

Constructor & Destructor Documentation

PUBLIC MODULE_ldapconf::MODULE_ldapconf ( void )
 

Definition at line 89 of file ldapconf.cc.

00090     : LINUXCONF_MODULE("ldapconf")
00091 {
00092     linuxconf_loadmsg ("ldapconf",PACKAGE_REV);
00093     ldapconf_setup_read();
00094 
00095     /*
00096       Configure the logfiles before use - we need one mainlog and one debuglog for now.
00097       use logf(level,0,msg,...) for ordinary logs
00098       use D(debugf(level,0,msg,...)) for debug
00099       level can go from 0 to 7: 1 is serious problems/short messages, 
00100       7 is info/long messages/many messages in loop for instance.
00101       level 0 will always be written. See loghandler.h and .cc for more info. 
00102     */
00103     loghandler_init(0,mode_logfile.get(),MAIN_LOG,mode_loglevel,SHOW_DATE | SHOW_TIME | SHOW_LEVEL);
00104     D(loghandler_init(1,"/tmp/ldapconf.debug",MAIN_LOG,mode_ldap_debug + 8, SHOW_CLASS | SHOW_LEVEL));
00105 }


Member Function Documentation

PUBLIC int MODULE_ldapconf::dohtml ( const char * key )
 

Definition at line 187 of file ldapconf.cc.

00188 {
00189     int ret = LNCF_NOT_APPLICABLE;
00190 
00191     if (strcmp(key,"ldapconf")==0){
00192         profile_select();
00193         ret = 0;
00194     }
00195 
00196     return ret;
00197 }

PUBLIC int MODULE_ldapconf::domenu ( MENU_CONTEXT context,
const char * key )
 

Definition at line 145 of file ldapconf.cc.

00149 {
00150     if (context == MENU_MISCSERV){
00151         if (key == key_ldap_main){
00152             ldap_mainmenu();
00153         }
00154     } else if (context == MENU_NETWORK_CLIENT){
00155         if (key == key_ldap_client_config){
00156             ldap_client_config();
00157         } else if (key == key_ldap_system_config){
00158             ldap_system_config();
00159         }
00160     } else if (context == MENU_NETWORK_SERVER){
00161         if (key == key_ldap_server_config){
00162             ldap_mainmenu_server();
00163         }
00164     } else if (context == MENU_CONTROL_PANEL){
00165         if (key == key_ldap_server_control){
00166             ldap_server_control();
00167         }
00168     } else if (context == MENU_SYS_STATUS){
00169         if (key == key_ldap_server_status){
00170             ldap_status();
00171         }
00172     }
00173     else if (context == MENU_USER_POLICIES){
00174         if (key == key_userinfo_config){
00175             profile_edit("userinfo");
00176         }
00177     }   
00178     else if (context == MENU_USER_SPC){
00179         if (key == key_ldap_useradmin){
00180             profile_select();
00181         }
00182     }
00183 
00184     return 0;
00185 }

PUBLIC int MODULE_ldapconf::execmain ( int argc,
char * argv[],
bool sa )
 

Definition at line 213 of file ldapconf.cc.

00214 {
00215     int ret = LNCF_NOT_APPLICABLE;
00216     const char *pt = strrchr(argv[0],'/');
00217     if (pt != NULL){
00218         pt++;
00219     }else{
00220         pt = argv[0];
00221     }
00222     if (strcmp(pt,"ldapconf")==0){
00223         ret = -1;
00224         if (argc == 1){
00225             ldap_mainmenu();
00226         }else{
00227             // ### Add some option parsing for the module
00228             ::usage();
00229         }
00230     }
00231     else if (strcmp(pt,"ldapuser")==0){
00232         ret = -1;
00233         if (argc == 1){
00234             profile_select();
00235         }else{
00236             // ### Add some option parsing for the module
00237             ::usage();
00238         }
00239     }
00240     return ret;
00241 }

PUBLIC int MODULE_ldapconf::message ( const char * msg,
int argc,
const char * argv[] )
 

Definition at line 243 of file ldapconf.cc.

00247 {
00248     int ret = LNCF_NOT_APPLICABLE;
00249     if (strcmp(msg,"listspc")==0 && mode_ldap_wwwclient){
00250         ret = 0;
00251         html_printf ("<hr>\n");
00252         html_printf ("<center><a href=/htmlmod:ldapconf:>%s"
00253                      ,MSG_U(T_HTMLMENU,"LDAP tools"));
00254         html_printf ("</A></center><P>\n");
00255     } else if (strcmp(msg,"chgpasswd")==0 && mode_ldap_pwsync){
00256         const char *username = NULL;
00257         const char *newpassword = NULL;
00258         const char *locked = NULL;
00259         const char *domain = NULL;
00260         if (argc >= 1) username = argv[0];
00261         if (argc >= 2) newpassword = argv[1];
00262         if (argc >= 3) locked = argv[2];
00263         if (argc >= 4) domain = argv[3];
00264         ret = ldap_pwsync(username,domain,newpassword);
00265     }       
00266     return ret;
00267 }

PUBLIC void MODULE_ldapconf::setmenu ( DIALOG & dia,
MENU_CONTEXT context )
 

Definition at line 107 of file ldapconf.cc.

00110 {
00111     if (context == MENU_MISCSERV){
00112         key_ldap_main = MSG_U(M_LDAP_MAIN,"LDAPconf");
00113         dia.new_menuitem ("ldapconf","",key_ldap_main);
00114     } 
00115     if (context == MENU_NETWORK_CLIENT && mode_ldap_system){
00116         key_ldap_system_config = MSG_U(M_LDAP_SYSTEM_CONFIG,"LDAP auth");
00117         dia.new_menuitem ("ldapconf","",key_ldap_system_config);
00118     }
00119     if (context == MENU_NETWORK_CLIENT && mode_ldap_client){
00120         key_ldap_client_config = MSG_U(M_LDAP_CLIENT_CONFIG,"LDAP client");
00121         dia.new_menuitem ("ldapconf","",key_ldap_client_config);
00122     }
00123     if (context == MENU_NETWORK_SERVER && mode_ldap_server){
00124         key_ldap_server_config = MSG_U(M_LDAP_SERVER_CONFIG,"LDAP server");
00125         dia.new_menuitem ("ldapconf","",key_ldap_server_config);
00126     }
00127     if (context == MENU_CONTROL_PANEL && mode_ldap_server){
00128         key_ldap_server_control = MSG_U(M_LDAP_SERVER_CONTROL,"LDAP control");
00129         dia.new_menuitem ("ldapconf","",key_ldap_server_control);
00130     }
00131     if (context == MENU_SYS_STATUS && mode_ldap_server){
00132         key_ldap_server_status = MSG_U(M_LDAP_STATUS,"LDAP status");
00133         dia.new_menuitem ("ldapconf","",key_ldap_server_status);
00134     }
00135     if (context == MENU_USER_POLICIES && mode_ldap_userinfo){
00136         key_userinfo_config = MSG_U(M_LDAP_USERINFO,"LDAP userconf");
00137         dia.new_menuitem ("ldapconf","",key_userinfo_config);
00138     }
00139     if (context == MENU_USER_SPC && mode_ldap_formclient){
00140         key_ldap_useradmin = MSG_U(M_LDAP_USERS,"LDAP accounts");
00141         dia.new_menuitem ("ldapconf","",key_ldap_useradmin);
00142     }
00143 }

PUBLIC void MODULE_ldapconf::usage ( SSTRINGS & tb )
 

Definition at line 208 of file ldapconf.cc.

00209 {
00210     tb.add (new SSTRING (MSG_R(T_USAGE)));
00211 }


The documentation for this class was generated from the following files:
Generated at Mon Jan 22 08:35:18 2001 for ldapconf by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000