yast2-ldap

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 63174 2011-01-13 10:50:42Z 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 <LDAPAttributeList.h>
00019 #include <LDAPAttribute.h>
00020 
00021 #include <LDAPSchema.h>
00022 
00023 #define DEFAULT_PORT 389
00024 #define ANSWER  42
00025 #define MAX_LENGTH_ID 5
00026 
00030 class LdapAgent : public SCRAgent
00031 {
00032 private:
00036     int port;
00037     string hostname;
00038     string bind_dn;
00039     string bind_pw;
00040     string ldap_error;
00041     string server_error;
00042     bool tls_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             users_by_uidnumber,
00056             usernames,
00057             userdns,
00058             uids,
00059             homes,
00060             user_items,
00061             groups,
00062             groups_by_name,
00063             groups_by_gidnumber,
00064             groupnames,
00065             gids,
00066             group_items;
00067 
00072     string getValue ( const YCPMap map, const string key);
00073 
00080     int getIntValue ( const YCPMap map, const string key, int deflt);
00081     
00082     bool getBoolValue (const YCPMap map, const string key);
00083 
00084     YCPList getListValue (const YCPMap map, const string key);
00085 
00089     StringList ycplist2stringlist (YCPList l);
00090     
00094     YCPList stringlist2ycplist (StringList sl);
00095 
00099     YCPList stringlist2ycplist_low (StringList sl);
00100 
00106     YCPMap getGroupEntry (LDAPEntry *entry, string member_attribute);
00107 
00112     YCPMap getUserEntry (LDAPEntry *entry);
00113 
00119     YCPMap getSearchedEntry (LDAPEntry *entry, bool sinlge_value);
00120 
00126     YCPMap getObjectAttributes (string dn);
00127 
00131     YCPBoolean deleteSubTree (string dn);
00132 
00139     YCPBoolean moveWithSubtree (string dn, string new_dn, string parent_dn);
00140     
00147     YCPBoolean copyOneEntry (string dn, string new_dn);
00148  
00152     void debug_exception (LDAPException e, string action);
00153     
00157     void debug_referral (LDAPReferralException e, string action);
00158 
00162     void set_tls_options (YCPMap args, string tls);
00163 
00167     void generate_attr_list (LDAPAttributeList* attrs, YCPMap map);
00168 
00173     void generate_mod_list (LDAPModList* modlist, YCPMap map, YCPValue attrs);
00174 
00175 public:
00179     LdapAgent();
00180 
00184     virtual ~LdapAgent();
00185 
00191     virtual YCPValue Read ( const YCPPath &path,
00192                             const YCPValue& arg = YCPNull(),
00193                             const YCPValue& opt = YCPNull());
00194 
00198     virtual YCPBoolean Write(const YCPPath &path,
00199                            const YCPValue& arg,
00200                            const YCPValue& arg2 = YCPNull());
00201 
00205     virtual YCPValue Execute(const YCPPath &path,
00206                              const YCPValue& arg = YCPNull(),
00207                              const YCPValue& arg2 = YCPNull());
00208 
00212     virtual YCPList Dir(const YCPPath& path);
00213 
00217     virtual YCPValue otherCommand(const YCPTerm& term);
00218 };
00219 
00220 #endif /* _LdapAgent_h */

Generated on a sunny day for yast2-ldap by doxygen 1.7.3