Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

LdapAgent.h

Go to the documentation of this file.
00001 /* LdapAgent.h
00002  *
00003  * Ldap agent implementation
00004  *
00005  * Authors: Jiri Suchomel <jsuchome@suse.cz>
00006  *
00007  * $Id: LdapAgent.h 17803 2004-06-11 13:40:03Z jsuchome $
00008  */
00009 
00010 #ifndef _LdapAgent_h
00011 #define _LdapAgent_h
00012 
00013 #include <Y2.h>
00014 #include <scr/SCRAgent.h>
00015 
00016 #include <LDAPConnection.h>
00017 #include <LDAPException.h>
00018 #include <LDAPReferralException.h>
00019 #include <LDAPAttributeList.h>
00020 #include <LDAPAttribute.h>
00021 
00022 #include <LDAPSchema.h>
00023 
00024 #define DEFAULT_PORT 389
00025 #define ANSWER  42
00026 #define MAX_LENGTH_ID 5
00027 
00031 class LdapAgent : public SCRAgent
00032 {
00033 private:
00037     int port;
00038     string hostname;
00039     string bind_dn;
00040     string bind_pw;
00041     string ldap_error;
00042     string server_error;
00043 
00044     int ldap_error_code;
00045     bool ldap_initialized;
00046 
00047     string userpw_hash;
00048 
00049     LDAPConnection *ldap;
00050     LDAPConstraints *cons;
00051     LDAPSchema *schema;
00052 
00053     YCPMap  users,
00054             users_by_name,
00055             usernames,
00056             userdns,
00057             uids,
00058             homes,
00059             user_items,
00060             groups,
00061             groups_by_name,
00062             groupnames,
00063             gids,
00064             group_items;
00065 
00066     string getValue ( const YCPMap map, const string key);
00067 
00072     int getIntValue ( const YCPMap map, const string key, int deflt);
00073     bool getBoolValue (const YCPMap map, const string key);
00074     YCPList getListValue (const YCPMap map, const string key);
00075 
00079     StringList ycplist2stringlist (YCPList l);
00080     
00084     YCPList stringlist2ycplist (StringList sl);
00085     YCPList LdapAgent::stringlist2ycplist_low (StringList sl);
00086 
00087     YCPMap getGroupEntry (LDAPEntry *entry, string member_attribute);
00088     YCPMap getUserEntry (LDAPEntry *entry);
00089 
00095     YCPMap getSearchedEntry (LDAPEntry *entry, bool sinlge_value);
00096 
00102     YCPMap getObjectAttributes (string dn);
00103 
00107     YCPBoolean deleteSubTree (string dn);
00108 
00112     YCPBoolean moveWithSubtree (string dn, string new_dn, string parent_dn);
00113     
00118     YCPBoolean copyOneEntry (string dn, string new_dn);
00119  
00120     void debug_exception (LDAPException e, string action);
00121 
00125     void generate_attr_list (LDAPAttributeList* attrs, YCPMap map);
00126 
00131     void generate_mod_list (LDAPModList* modlist, YCPMap map, YCPValue attrs);
00132 
00133 public:
00137     LdapAgent();
00138 
00142     virtual ~LdapAgent();
00143 
00149     virtual YCPValue Read ( const YCPPath &path,
00150                             const YCPValue& arg = YCPNull(),
00151                             const YCPValue& opt = YCPNull());
00152 
00156     virtual YCPBoolean Write(const YCPPath &path,
00157                            const YCPValue& arg,
00158                            const YCPValue& arg2 = YCPNull());
00159 
00163     virtual YCPValue Execute(const YCPPath &path,
00164                              const YCPValue& arg = YCPNull(),
00165                              const YCPValue& arg2 = YCPNull());
00166 
00170     virtual YCPList Dir(const YCPPath& path);
00171 
00175     virtual YCPValue otherCommand(const YCPTerm& term);
00176 };
00177 
00178 #endif /* _LdapAgent_h */

Generated on Wed Sep 14 11:07:07 2005 for yast2-ldap by  doxygen 1.4.4