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

profile.cc File Reference

#include <stdlib.h>
#include <confdb.h>
#include <unistd.h>
#include "profiles.h"
#include "fields.h"
#include "ldapconf_defs.h"

Go to the source code of this file.

Functions

HELP_FILE help_profile ("ldapconf","profile")
PROFILES profiles (PROFILE_DIR,"Directory")
PROFILES bindings (DBBIND_DIR,"Binding")
PROFILES forms (DBFORM_DIR,"Form")
void profile_edit (const char *id)
void profile_select ()
void bindprofile_edit ()
void formprofile_edit ()


Function Documentation

HELP_FILE help_profile ( "ldapconf",
"profile" )
 

PROFILES profiles ( PROFILE_DIR,
"Directory" ) [static]
 

PROFILES bindings ( DBBIND_DIR,
"Binding" ) [static]
 

PROFILES forms ( DBFORM_DIR,
"Form" ) [static]
 

void profile_edit ( const char * id )
 

Definition at line 54 of file profile.cc.

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

00055 {
00056     while (profiles.dia_admin() != -1){
00057 
00058         CONFDB c_profile = *profiles.profile.data;
00059     
00060         D(debugf(2,"profile_edit profile.id = %s \n",profiles.id.get()));
00061 
00062         SSTRINGS tb;
00063         int n;
00064 
00065         SSTRING bind_name = c_profile.getval ("profile","bind","userinfo");
00066         SSTRING form_name = c_profile.getval ("profile","form","userinfo");
00067         SSTRING ldap_protocol = c_profile.getval ("profile","protocol",mode_ldap_protocol.get());
00068         SSTRING dn_prefix = c_profile.getval ("profile","prefix","ou=People");
00069         SSTRING primary_key = c_profile.getval ("profile","primarykey","uid");  
00070         SSTRING group_prefix = c_profile.getval ("profile","groupprefix","ou=Group");
00071         SSTRING member_key = c_profile.getval ("profile","memberkey","memberuid");
00072         char userconf_comng = c_profile.getvalnum ("profile","userconf_comng",0);
00073         char userconf_pwsync = c_profile.getvalnum ("profile","userconf_pwsync",0);     
00074         SSTRING crypt_hash = c_profile.getval ("profile","crypt_hash","crypt");
00075         SSTRING comment = c_profile.getval ("profile","comment","");
00076         char user_access = c_profile.getvalnum ("profile","useraccess",0);
00077         int max_uid = c_profile.getvalnum ("profile","max_uid",50000);
00078         int min_uid = c_profile.getvalnum ("profile","min_uid",10000);
00079 
00080         DIALOG dia;
00081 
00082         // General
00083         dia.newf_info("Profilename",profiles.profile.id.get());
00084         dia.newf_str (MSG_U(F_PROFILE_COMMENT,"Comment"),comment);
00085         char protocol = atoi(ldap_protocol.get()); 
00086         dia.newf_radio (MSG_U(F_PROFILE_PROTOCOL,"LDAP Protocol"),protocol,2,"v2");
00087         dia.newf_radio("",protocol,3,"v3");
00088         dia.newf_title(MSG_U(T_PROFILE_PERM,"Permission"),1,"",MSG_R(T_PROFILE_PERM));
00089         FIELD_COMBO *bindlist = dia.newf_combo(MSG_U(F_PROFILE_BIND,"Bind profile"),bind_name);
00090         tb.remove_all();
00091         n = bindings.get_list(tb);
00092         for (int i=0; i<n; i++){
00093             bindlist->addopt(tb.getitem(i)->get());
00094         }
00095         dia.newf_chk (MSG_U(F_PROFILE_ACCESS,"User access"),user_access,"Allow");
00096 
00097         dia.newf_title(MSG_U(T_PROFILE_FORM,"Form"),1,"",MSG_R(T_PROFILE_FORM));
00098         FIELD_COMBO *formlist = dia.newf_combo(MSG_U(F_PROFILE_FORM,"Form profile"),form_name);
00099         tb.remove_all();
00100         n = forms.get_list(tb);
00101         for (int i=0; i<n; i++){
00102             formlist->addopt(tb.getitem(i)->get());
00103         }
00104         // Accounts
00105         dia.newf_title(MSG_U(T_PROFILE_ACCOUNTS,"Accounts"),1,"",MSG_R(T_PROFILE_ACCOUNTS));
00106         dia.newf_str (MSG_U(F_PROFILE_KEY,"Account key attribute"),primary_key);
00107         dia.newf_str (MSG_U(F_PROFILE_PREFIX,"Account prefix component"),dn_prefix);
00108         dia.newf_chk (MSG_U(F_PROFILE_COMNG,"Userconf comanager"),userconf_comng,"Enable");
00109         dia.newf_chk (MSG_U(F_PROFILE_PWSYNC,"Userconf password sync"),userconf_pwsync,"Enable");
00110         FIELD_COMBO *hashlist = dia.newf_combo(MSG_U(F_CRYPT_HASH,"Password crypt algorithm"),crypt_hash);
00111         hashlist->addopt ("none");
00112         hashlist->addopt ("crypt");
00113         hashlist->addopt ("md5");
00114         hashlist->addopt ("smd5");
00115         hashlist->addopt ("sha");
00116         hashlist->addopt ("ssha");
00117         dia.newf_num (MSG_U(F_PROFILE_MAXUID,"Max uid"),max_uid);
00118         dia.newf_num (MSG_U(F_PROFILE_MINUID,"Min uid"),min_uid);
00119         // Groups
00120         dia.newf_title(MSG_U(T_PROFILE_GROUPCONF,"Groups"),1,"",MSG_R(T_PROFILE_GROUPCONF));
00121         dia.newf_str (MSG_U(F_PROFILE_MEMBER,"Member key attribute"),member_key);
00122         dia.newf_str (MSG_U(F_PROFILE_GROUP,"Group prefix component"),group_prefix);
00123     
00124         int nof = 0;
00125 
00126         while (1){
00127             MENU_STATUS code = dia.edit (MSG_U(T_PROFILE_EDIT,"Profile")
00128                                          ,MSG_U(I_PROFILE_EDIT
00129                                                 ,"Profile setup")
00130                                          ,help_formclient           
00131                                          ,nof,
00132                                          MENUBUT_ACCEPT|MENUBUT_CANCEL|MENUBUT_ADD|MENUBUT_DEL);
00133             if (code == MENU_CANCEL || code == MENU_ESCAPE){
00134                 break;
00135             }else if (code == MENU_DEL && profiles.del()) {
00136                     break;
00137             }else if (code == MENU_ADD && profiles.add(&c_profile)) {
00138                     break;
00139             }else if (code == MENU_ACCEPT){
00140                 // Save profile 
00141                 ldap_protocol.setfrom(protocol);
00142                 
00143                 c_profile.replace ("profile","bind",bind_name);
00144                 c_profile.replace ("profile","form",form_name);
00145                 c_profile.replace ("profile","protocol",ldap_protocol.get());
00146                 c_profile.replace ("profile","prefix",dn_prefix);
00147                 c_profile.replace ("profile","primarykey",primary_key);
00148                 c_profile.replace ("profile","userconf_comng",userconf_comng);
00149                 c_profile.replace ("profile","userconf_pwsync",userconf_pwsync);
00150                 c_profile.replace ("profile","crypt_hash",crypt_hash);
00151                 c_profile.replace ("profile","memberkey",member_key);
00152                 c_profile.replace ("profile","groupprefix",group_prefix);
00153                 c_profile.replace ("profile","useraccess",user_access);
00154                 c_profile.replace ("profile","comment",comment);
00155                 c_profile.replace ("profile","max_uid",max_uid);
00156                 c_profile.replace ("profile","min_uid",min_uid);
00157 
00158                 c_profile.save();
00159                 break;
00160             }
00161         }   
00162     }
00163 }

void profile_select ( )
 

Definition at line 165 of file profile.cc.

Referenced by MODULE_ldapconf::dohtml(), MODULE_ldapconf::domenu(), MODULE_ldapconf::execmain(), and ldap_mainmenu_client().

00166 {
00167     while (profiles.dia_select() != -1){
00168         ldap_usermenu(profiles.profile.id.get());
00169     }
00170 }

void bindprofile_edit ( )
 

Definition at line 175 of file profile.cc.

Referenced by ldap_mainmenu_profile().

00176 {
00177     while (bindings.dia_admin() != -1){
00178         CONFDB conf = *bindings.profile.data;
00179         /* Defaults */
00180 
00181         SSTRING binddn = conf.getval ("ldap","binddn");
00182         SSTRING bindpw = conf.getval ("ldap","bindpw");
00183         SSTRING host = conf.getval ("ldap","host");
00184         SSTRING base = conf.getval ("ldap","base");
00185 
00186         DIALOG dia;
00187         dia.newf_info("Profilename",bindings.profile.id.get());
00188         dia.newf_str(MSG_U(F_BINDPROFILE_BASE,"Base"),base);
00189         dia.newf_str(MSG_U(F_BINDPROFILE_HOST,"Host"),host);
00190         dia.newf_str(MSG_U(F_BINDPROFILE_DN,"Bind DN"),binddn);
00191         dia.newf_str(MSG_U(F_BINDPROFILE_PW,"Password"),bindpw);
00192     
00193         int nof = 0;        
00194         while (1){      
00195             MENU_STATUS code = dia.edit (MSG_U(T_BINDPROFILE_CONFIG,"LDAP Bind profile")
00196                                          ,MSG_U(I_BINDPROFILE_CONFIG,"Configure LDAP binding profile")
00197                                          ,help_ldap
00198                                          ,nof
00199                                          ,MENUBUT_ADD|MENUBUT_ACCEPT|MENUBUT_CANCEL|MENUBUT_DEL);
00200             if (code == MENU_QUIT || code == MENU_CANCEL || code == MENU_ESCAPE){                   
00201                 break;          
00202             }else if (code == MENU_DEL && bindings.del()){
00203                 break;
00204             }else if (code == MENU_ADD && bindings.add(&conf)){
00205                 break;
00206             }else if (code == MENU_ACCEPT){
00207                 conf.replace("ldap","base",base.get());
00208                 conf.replace("ldap","host",host.get());
00209                 conf.replace("ldap","binddn",binddn.get());
00210                 conf.replace("ldap","bindpw",bindpw.get());
00211                 conf.save();            
00212                 break;
00213             }
00214         }
00215     }
00216 }

void formprofile_edit ( )
 

Definition at line 232 of file profile.cc.

Referenced by ldap_mainmenu_profile().

00233 {
00234     while (forms.dia_admin() != -1){
00235         FIELD_DEFS defs(forms.profile.data);
00236         defs.read();
00237         defs.edit();
00238         defs.write();
00239     }
00240 }


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