#include "ldapconf_defs.h" /* LDAPCONF Main Menu This is all the available submenus They will be linked into various places in the Linuxconf menutree, but will also be available in one main menu. Create a symlink from linuxconf to ldapconf and this main menu will show up. */ void ldap_mainmenu() { const char *key_ldapmain_server = MSG_U(M_LDAP_MAINMENU_SERVER,"Server"); const char *key_ldapmain_directory = MSG_U(M_LDAP_MAINMENU_DIRECTORY,"Directory"); const char *key_ldapmain_client = MSG_U(M_LDAP_MAINMENU_CLIENT,"Client"); const char *key_ldapmain_system = MSG_U(M_LDAP_MAINMENU_SYSTEM,"Auth"); const char *key_ldapmain_profile = MSG_U(M_LDAP_MAINMENU_PROFILE,"Profile"); const char *key_ldapmain_setup = MSG_U(M_LDAP_MAINMENU_SETUP,"Module setup"); DIALOG_MENU dia; if (mode_ldap_client) {dia.new_menuitem("ldapconf","",key_ldapmain_client);} if (mode_ldap_system) {dia.new_menuitem("ldapconf","",key_ldapmain_system);} if (mode_ldap_profile) {dia.new_menuitem("ldapconf","",key_ldapmain_profile);} if (mode_ldap_directory) {dia.new_menuitem("ldapconf","",key_ldapmain_directory);} if (mode_ldap_server) {dia.new_menuitem("ldapconf","",key_ldapmain_server);} dia.new_menuitem("ldapconf","",key_ldapmain_setup); int nof = 0; while (1){ MENU_STATUS code = dia.editmenu (MSG_U(T_LDAP_MENU,"LDAP") ,MSG_U(I_LDAP_MENU ,"LDAPconf submodules") ,help_index ,nof,0); if (code == MENU_ESCAPE || code == MENU_QUIT){ break; }else{ const char *key = dia.getmenustr(nof); if (key == key_ldapmain_server){ ldap_mainmenu_server(); }else if (key == key_ldapmain_directory){ // ldap_mainmenu_directory(); ldap_db_select(); }else if (key == key_ldapmain_client){ ldap_mainmenu_client(); }else if (key == key_ldapmain_system){ ldap_mainmenu_system(); }else if (key == key_ldapmain_profile){ ldap_mainmenu_profile(); }else if (key == key_ldapmain_setup){ ldapconf_setup(); } } } } /* LDAP mainmenu - client */ void ldap_mainmenu_client() { const char *key_useredit_tool = MSG_U(M_USERINFO_TOOL,"Directory manager"); // const char *key_ldapclient_user = MSG_U(M_LDAP_USER_TOOLS,"Tools"); const char *key_ldapclient_config = MSG_U(M_LDAP_MAIN_CLIENT_CONFIG,"Config"); DIALOG_MENU dia; dia.new_menuitem("ldapconf","",key_useredit_tool); // dia.new_menuitem("ldapconf","",key_ldapclient_user); dia.new_menuitem("ldapconf","",key_ldapclient_config); int nof = 0; while (1){ MENU_STATUS code = dia.editmenu (MSG_U(T_MAINMENU_CLIENT,"Client") ,MSG_U(I_MAINMENU_CLIENT,"LDAP client") ,help_ldap ,nof,0); if (code == MENU_ESCAPE || code == MENU_QUIT){ break; }else{ const char *key = dia.getmenustr(nof); if (key == key_useredit_tool){ profile_select(); }else if (key == key_ldapclient_config){ ldap_client_config(); // }else if (key == key_ldapclient_user){ // ldap_user_menu(); } } } } /* LDAP mainmenu - server */ void ldap_mainmenu_server() { const char *key_ldapserver_control = MSG_U(M_LDAP_MAIN_SERVER_CONTROL,"Control Server"); const char *key_ldapserver_config = MSG_U(M_LDAP_MAIN_SERVER_CONFIG,"Config Server"); DIALOG_MENU dia; dia.new_menuitem("ldapconf","",key_ldapserver_control); dia.new_menuitem("ldapconf","",key_ldapserver_config); int nof = 0; while (1){ MENU_STATUS code = dia.editmenu (MSG_U(T_MAINMENU_SERVER,"Server menu") ,MSG_U(I_MAINMENU_SERVER,"Server menu") ,help_ldap ,nof,0); if (code == MENU_ESCAPE || code == MENU_QUIT){ break; }else{ const char *key = dia.getmenustr(nof); if (key == key_ldapserver_config){ ldap_server_config(); }else if (key == key_ldapserver_control){ ldap_server_control(); } } } } /* LDAP mainmenu - directory */ void ldap_mainmenu_directory() { const char *key_ldapdb_config = MSG_U(M_LDAP_DB_CONFIG,"Directory config"); DIALOG_MENU dia; dia.new_menuitem("ldapconf","",key_ldapdb_config); int nof = 0; while (1){ MENU_STATUS code = dia.editmenu (MSG_U(T_MAINMENU_DIRECTORY,"Directory menu") ,MSG_U(I_MAINMENU_DIRECTORY,"Directory mode") ,help_ldap ,nof,0); if (code == MENU_ESCAPE || code == MENU_QUIT){ break; }else{ const char *key = dia.getmenustr(nof); if (key == key_ldapdb_config){ ldap_db_select(); } } } } /* LDAP mainmenu - system */ void ldap_mainmenu_system() { const char *key_ldapsystem_config = MSG_U(M_LDAP_MAIN_SYSTEM_CONFIG,"LDAP Auth"); const char *key_nss_config = MSG_U(M_NSS_CONFIG,"Config NSS"); DIALOG_MENU dia; dia.new_menuitem("ldapconf","",key_ldapsystem_config); if (mode_ldap_devel) {dia.new_menuitem("ldapconf","",key_nss_config);} int nof = 0; while (1){ MENU_STATUS code = dia.editmenu (MSG_U(T_MAINMENU_SYSTEM,"LDAP Auth") ,MSG_U(I_MAINMENU_SYSTEM,"Configuratin of LDAP NSS and PAM, used for system authentication.") ,help_ldap ,nof,0); if (code == MENU_ESCAPE || code == MENU_QUIT){ break; }else{ const char *key = dia.getmenustr(nof); if (key == key_ldapsystem_config){ ldap_system_config(); }else if (key == key_nss_config){ nss_config(); } } } } /* User Clients menu */ /* void ldap_user_menu() { const char *key_formclient = MSG_U(M_FORMCLIENT_TOOL,"Useradmin"); const char *key_search_tool = MSG_U(M_SEARCH_TOOL,"Search tool"); const char *key_edit_tool = MSG_U(M_EDIT_TOOL,"Edit tool"); const char *key_passwd_tool = MSG_U(M_PASSWD_TOOL,"Password"); DIALOG_MENU dia; if (mode_ldap_formclient) { dia.new_menuitem("",key_formclient); } if (mode_ldap_devel) { dia.new_menuitem("",key_search_tool); } if (mode_ldap_devel) { dia.new_menuitem("",key_edit_tool); } if (mode_ldap_devel) { dia.new_menuitem("",key_passwd_tool); } int nof = 0; while (1){ MENU_STATUS code = dia.editmenu (MSG_U(T_USERCLIENT_MENU,"LDAP clients") ,MSG_U(I_USERCLIENT_MENU ,"Select a client") ,help_formclient ,nof,0); const char *key = dia.getmenustr(nof); if (code == MENU_ESCAPE || code == MENU_QUIT){ break; }else{ if (key == key_useredit_tool){ ldap_useredit(); }else if (key == key_formclient ) { profile_select(); }else if (key == key_search_tool){ ldapsearch(); }else if (key == key_edit_tool){ ldapedit(); }else if (key == key_passwd_tool){ ldap_passwd_tool(); } } } } */ /* LDAP mainmenu - profiles */ void ldap_mainmenu_profile() { const char *key_client_profiles = MSG_U(M_LDAP_PROFILE_CONFIG,"Directory profiles"); const char *key_dbform_config = MSG_U(M_LDAP_DBFORM_CONFIG,"Form profiles"); const char *key_bind_config = MSG_U(M_LDAP_BIND_CONFIG,"Binding profiles"); // const char *key_userinfo_config = MSG_U(M_USERINFO_CONFIG,"Userinfo config"); DIALOG_MENU dia; int nof = 0; const char *key; dia.new_menuitem("ldapconf","",key_client_profiles); dia.new_menuitem("ldapconf","",key_dbform_config); dia.new_menuitem("ldapconf","",key_bind_config); // if (mode_ldap_userinfo) {dia.new_menuitem("ldapconf","",key_userinfo_config);} while (1){ MENU_STATUS code = dia.editmenu (MSG_U(T_MAINMENU_PROFILE,"Profile menu") ,MSG_U(I_MAINMENU_PROFILE,"Manage directory profiles") ,help_formclient ,nof,0); key = dia.getmenustr(nof); if (code == MENU_ESCAPE || code == MENU_QUIT){ break; }else if (key == key_dbform_config){ formprofile_edit(); }else if (key == key_bind_config){ bindprofile_edit(); }else if (key == key_client_profiles){ profile_edit("test"); // }else if (key == key_userinfo_config){ // profile_edit("userinfo"); } } } /* LDAP SERVER menu */ void ldap_server_menu() { const char *master_global = MSG_U(M_MASTER_GLOBAL,"Server"); const char *master_database = MSG_U(M_MASTER_DATABASE,"Directory"); DIALOG_MENU dia; dia.new_menuitem("ldapconf","",master_global); dia.new_menuitem("ldapconf","",master_database); int nof = 0; while (1){ MENU_STATUS code = dia.editmenu (MSG_U(T_MASTER_MENU,"LDAP server config") ,MSG_U(I_MASTER_MENU ,"Select server or directory settings") ,help_ldap ,nof,0); if (code == MENU_ESCAPE || code == MENU_QUIT){ break; }else{ const char *key = dia.getmenustr(nof); if (key == master_global){ ldap_server_config(); }else if (key == master_database){ ldap_db_select(); } } } }