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

nssconf.cc

Go to the documentation of this file.
00001 /**************
00002 
00003 NSSCONF
00004 
00005 License: Linuxconf/GPL (see the file COPYING for details)
00006 Author: Stein Vråle <stein@terminator.net>
00007 
00008 ***************/
00009 
00010 #include "ldapconf_defs.h"
00011 
00012 /* 
00013     NSS config
00014 */
00015 
00016 void nss_config()
00017 {   
00018 /* Init config*/
00019     SSTRING nss_passwd="files";
00020     SSTRING nss_group="files";
00021     SSTRING nss_shadow="files";
00022     SSTRING nss_hosts="files";
00023     SSTRING nss_services="files";
00024     SSTRING nss_networks="files";
00025     SSTRING nss_protocols="files";
00026     SSTRING nss_rpc="files";
00027     SSTRING nss_ethers="files";
00028     SSTRING nss_netmasks="files";
00029     SSTRING nss_bootparams="files";
00030     SSTRING nss_publickey="files";
00031     SSTRING nss_automount="files";
00032     SSTRING nss_aliases="files";
00033     SSTRING nss_sendmailvars="files";
00034     SSTRING nss_netgroup="files";
00035 
00036 /* Read config */
00037 
00038     VIEWITEMS v_nss_conf;
00039     v_nss_conf.read (f_nss_conf);
00040 
00041     nss_passwd.setfrom (get_keyval(v_nss_conf,"passwd:"));
00042     nss_group.setfrom (get_keyval(v_nss_conf,"group:"));
00043     nss_shadow.setfrom (get_keyval(v_nss_conf,"shadow:"));
00044     nss_hosts.setfrom (get_keyval(v_nss_conf,"hosts:"));
00045     nss_services.setfrom (get_keyval(v_nss_conf,"services:"));
00046     nss_networks.setfrom (get_keyval(v_nss_conf,"networks:"));
00047     nss_protocols.setfrom (get_keyval(v_nss_conf,"protocols:"));
00048     nss_rpc.setfrom (get_keyval(v_nss_conf,"rpc:"));
00049     nss_ethers.setfrom (get_keyval(v_nss_conf,"ethers:"));
00050     nss_netmasks.setfrom (get_keyval(v_nss_conf,"netmasks:"));
00051     nss_bootparams.setfrom (get_keyval(v_nss_conf,"bootparams:"));
00052     nss_publickey.setfrom (get_keyval(v_nss_conf,"publickey:"));
00053     nss_automount.setfrom (get_keyval(v_nss_conf,"automount:"));
00054     nss_aliases.setfrom (get_keyval(v_nss_conf,"aliases:"));
00055     nss_sendmailvars.setfrom (get_keyval(v_nss_conf,"sendmailvars:"));
00056     nss_netgroup.setfrom (get_keyval(v_nss_conf,"netgroup:"));
00057 
00058 /* Dialog */
00059 
00060     DIALOG dia;
00061     dia.newf_str (MSG_U(F_NSS_PASSWD,"passwd"), nss_passwd);
00062     dia.newf_str (MSG_U(F_NSS_GROUP,"group"), nss_group);
00063     dia.newf_str (MSG_U(F_NSS_SHADOW,"shadow"), nss_shadow);
00064     dia.newf_str (MSG_U(F_NSS_HOSTS,"hosts"), nss_hosts);
00065     dia.newf_str (MSG_U(F_NSS_SERVICES,"services"),nss_services);
00066     dia.newf_str (MSG_U(F_NSS_NETWORKS,"networks"),nss_networks);
00067     dia.newf_str (MSG_U(F_NSS_PROTOCOLS,"protocols"), nss_protocols);
00068     dia.newf_str (MSG_U(F_NSS_RPC,"rpc"), nss_rpc);
00069     dia.newf_str (MSG_U(F_NSS_ETHERS,"ethers"),nss_ethers);
00070     dia.newf_str (MSG_U(F_NSS_NETMASK,"netmask"), nss_netmasks);
00071     dia.newf_str (MSG_U(F_NSS_BOOTPARAMS,"bootparams"),nss_bootparams);
00072     dia.newf_str (MSG_U(F_NSS_PUBLICKEY,"publickey"), nss_publickey);
00073     dia.newf_str (MSG_U(F_NSS_AUTOMOUNT,"automount"), nss_automount);
00074     dia.newf_str (MSG_U(F_NSS_ALIASES,"aliases"), nss_aliases);
00075     dia.newf_str (MSG_U(F_NSS_SENDMAILVARS,"sendmailvars"), nss_sendmailvars);
00076     dia.newf_str (MSG_U(F_NSS_NETGROUP,"netgroup"), nss_netgroup);
00077 
00078     int nof = 0;
00079 
00080     while (1){
00081         MENU_STATUS code = dia.edit (MSG_U(T_NSS_CONFIG,"NSS configuration")
00082                                      ,MSG_U(I_NSS_CONFIG
00083                                             ,"This is the current NSS settings")                
00084                                      ,help_ldap
00085                                      ,nof
00086                                      ,MENUBUT_ACCEPT|MENUBUT_CANCEL);
00087         if (code == MENU_CANCEL || code == MENU_ESCAPE){
00088             break;
00089         }
00090 /* Save */
00091         else if (code == MENU_ACCEPT){  
00092             set_keyval(v_nss_conf,"passwd:",nss_passwd.get());
00093             set_keyval(v_nss_conf,"group:",nss_group.get());
00094             set_keyval(v_nss_conf,"shadow:",nss_shadow.get());
00095             set_keyval(v_nss_conf,"hosts:",nss_hosts.get());
00096             set_keyval(v_nss_conf,"services:",nss_services.get());
00097             set_keyval(v_nss_conf,"networks:",nss_networks.get());
00098             set_keyval(v_nss_conf,"protocols:",nss_protocols.get());
00099             set_keyval(v_nss_conf,"rpc:",nss_rpc.get());
00100             set_keyval(v_nss_conf,"ethers:",nss_ethers.get());
00101             set_keyval(v_nss_conf,"netmasks:",nss_netmasks.get());
00102             set_keyval(v_nss_conf,"bootparams:",nss_bootparams.get());
00103             set_keyval(v_nss_conf,"publickey:",nss_publickey.get());
00104             set_keyval(v_nss_conf,"automount:",nss_automount.get());
00105             set_keyval(v_nss_conf,"aliases:",nss_aliases.get());
00106             set_keyval(v_nss_conf,"sendmailsvars:",nss_sendmailvars.get());
00107             set_keyval(v_nss_conf,"netgroup:",nss_netgroup.get());
00108             v_nss_conf.write (f_nss_conf,&p_ldap_admin);
00109             break;
00110         }
00111     }
00112 
00113 }

Generated at Mon Jan 22 08:35:12 2001 for ldapconf by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000