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

ldapnss.cc File Reference

#include "ldapconf_defs.h"
#include <unistd.h>
#include "modregister.h"

Go to the source code of this file.

Functions

void ldap_system_config ()
REGISTER_VARIABLES ldapconf_registry ("ldapconf",ldapconf_var_list)

Variables

char ID_AUTH [] = "auth"
REGISTER_VARIABLE_LOOKUP_MSG ldapconf_var_list []


Function Documentation

void ldap_system_config ( )
 

Definition at line 11 of file ldapnss.cc.

Referenced by MODULE_ldapconf::domenu(), and ldap_mainmenu_system().

00012 {
00013 
00014     VIEWITEMS v_ldap_sec;
00015 
00016     LDAPPROFILE profile;
00017 
00018 /* Set default */
00019     SSTRING client_host = "ldap";
00020     SSTRING client_port= "389";
00021     SSTRING client_suffix = "dc=your,dc=domain";
00022     SSTRING client_binddn = "cn=root,dc=your,dc=domain";
00023     SSTRING client_bindpw = "";
00024     SSTRING client_scope = "sub";
00025     SSTRING nss_crypt = "des";
00026     SSTRING pam_filter = "objectclass=account";
00027     SSTRING pam_login = "uid";
00028     SSTRING pam_lookup = "no";
00029     SSTRING pam_group = "cn=PAM,ou=Groups,dc=your,dc=domain";
00030     SSTRING pam_member = "uniquemember";
00031     SSTRING pam_crypt = "local";
00032 
00033     char buf[256];
00034 
00035 /* Default base */  
00036     gethostname(buf,sizeof(buf));
00037     dns2dc(buf,sizeof(buf),1);
00038 
00039 /* Read conf */
00040     v_ldap_sec.read (f_ldap_sec);
00041     profile.host.setfrom (get_keyval(v_ldap_sec,"host","ldap"));
00042     profile.port.setfrom (get_keyval(v_ldap_sec,"port","389"));
00043     profile.base.setfrom (get_keyval(v_ldap_sec,"base",buf));
00044     profile.dn.setfrom (get_keyval(v_ldap_sec,"binddn"));
00045     profile.pw.setfrom (get_keyval(v_ldap_sec,"bindpw"));
00046     profile.scope.setfrom (get_keyval(v_ldap_sec,"scope"));
00047     nss_crypt.setfrom (get_keyval(v_ldap_sec,"crypt"));
00048     pam_filter.setfrom (get_keyval(v_ldap_sec,"pam_filter"));
00049     pam_login.setfrom (get_keyval(v_ldap_sec,"pam_login_attribute"));
00050     pam_lookup.setfrom (get_keyval(v_ldap_sec,"pam_lookup_policy"));
00051     pam_group.setfrom (get_keyval(v_ldap_sec,"pam_groupdn"));
00052     pam_member.setfrom (get_keyval(v_ldap_sec,"pam_member_attribute"));
00053     pam_crypt.setfrom (get_keyval(v_ldap_sec,"pam_crypt"));
00054     
00055 /* Draw dialog */
00056     DIALOG dia;
00057 
00058     dia.set_registry_id (ID_AUTH);
00059     
00060     dia.newf_title (MSG_R(I_GENERAL),1,"","");
00061     dia.newf_str (MSG_R(F_API_HOST),profile.host);
00062     dia.newf_str (MSG_R(F_API_BASE),profile.base);
00063     dia.newf_title (MSG_R(I_LDAPBIND),1,"","");
00064     dia.newf_str (MSG_R(F_API_DN),profile.dn);
00065     dia.newf_str (MSG_R(F_API_PW),profile.pw);
00066     dia.newf_str (MSG_R(F_API_PORT),profile.port);
00067     FIELD_COMBO *scopelist = dia.newf_combo(MSG_R(F_API_SCOPE),profile.scope);
00068     scopelist->addopt ("one");
00069     scopelist->addopt ("base");
00070     scopelist->addopt ("sub");
00071     dia.newf_title (MSG_U(I_NSS_OPTIONS,"NSS"),1,"","");
00072     FIELD_COMBO *cryptlist = dia.newf_combo(MSG_U(F_NSS_CRYPT,"libc hash"),nss_crypt);
00073     cryptlist->addopt ("des");
00074     cryptlist->addopt ("sha");
00075     cryptlist->addopt ("md5");
00076     dia.newf_title (MSG_U(I_PAM_OPTIONS,"PAM"),1,"","");
00077     dia.newf_str (MSG_U(F_PAM_FILTER,"PAM filter"),pam_filter);
00078     dia.newf_str (MSG_U(F_PAM_LOGIN,"PAM login attr"),pam_login);
00079     dia.newf_str (MSG_U(F_PAM_LOOKUP,"PAM lookup policy"),pam_lookup);
00080     dia.newf_str (MSG_U(F_PAM_GRUOP,"PAM group"),pam_group);
00081     dia.newf_str (MSG_U(F_PAM_MEMBER,"PAM member attr"),pam_member);
00082     dia.newf_str (MSG_U(F_PAM_CRYPT,"PAM crypt"),pam_crypt);
00083 /* Wait for dialog */
00084     
00085     int nof = 0;
00086 
00087     while (1){
00088         MENU_STATUS code = dia.edit (MSG_U(T_SYSTEM_MENU,"LDAP auth")
00089                                      ,MSG_U(I_SYSTEM_MENU
00090                                             ,"This is the binding for the system client.\nThey will be used by the system\nif you enable the LDAP NSS/PAM system.\nBe careful when configuring this.")              
00091                                      ,help_ldapsystem
00092                                      ,nof);
00093 /* Exit */
00094         if (code == MENU_CANCEL || code == MENU_ESCAPE){
00095             break;
00096         }
00097 /* Save */
00098         else if (code == MENU_ACCEPT){
00099             set_keyval(v_ldap_sec,"host",profile.host.get());
00100             set_keyval(v_ldap_sec,"port",profile.port.get());
00101             set_keyval(v_ldap_sec,"base",profile.base.get());
00102             set_keyval(v_ldap_sec,"binddn",profile.dn.get());
00103             set_keyval(v_ldap_sec,"bindpw",profile.pw.get());
00104             set_keyval(v_ldap_sec,"scope",profile.scope.get());
00105             set_keyval(v_ldap_sec,"crypt",nss_crypt.get());
00106             set_keyval(v_ldap_sec,"pam_filter",pam_filter.get());
00107             set_keyval(v_ldap_sec,"pam_login_attribute",pam_login.get());
00108             set_keyval(v_ldap_sec,"pam_lookup_policy",pam_lookup.get());
00109             set_keyval(v_ldap_sec,"pam_groupdn",pam_group.get());
00110             set_keyval(v_ldap_sec,"pam_member_attribute",pam_member.get());
00111             set_keyval(v_ldap_sec,"pam_crypt",pam_crypt.get());         
00112             v_ldap_sec.write (f_ldap_sec,&p_ldap_admin);
00113             break;
00114         }
00115     }
00116 }

REGISTER_VARIABLES ldapconf_registry ( "ldapconf",
ldapconf_var_list ) [static]
 


Variable Documentation

char ID_AUTH[] = "auth" [static]
 

Definition at line 4 of file ldapnss.cc.

REGISTER_VARIABLE_LOOKUP_MSG ldapconf_var_list[] [static]
 

Initializer:

{
    {"auth.host",ID_AUTH,P_MSG_R(F_API_HOST),ldap_system_config,NULL},
    {"auth.base",ID_AUTH,P_MSG_R(F_API_BASE),ldap_system_config,NULL},
    { NULL, NULL, NULL, NULL }
}
VREGISTRY support:

vregistry --set ldapconf.client.host = <host> vregistry --set ldapconf.client.base = <base>

Definition at line 284 of file openldap.cc.


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