yast2-ldap
LdapAgent.h
Go to the documentation of this file.
1 /* ------------------------------------------------------------------------------
2  * Copyright (c) 2006-2012 Novell, Inc. All Rights Reserved.
3  *
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of version 2 of the GNU General Public License as published by the
7  * Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along with
14  * this program; if not, contact Novell, Inc.
15  *
16  * To contact Novell about this file by physical or electronic mail, you may find
17  * current contact information at www.novell.com.
18  * ------------------------------------------------------------------------------
19  */
20 
21 /* LdapAgent.h
22  *
23  * Ldap agent implementation
24  *
25  * Authors: Jiri Suchomel <jsuchome@suse.cz>
26  *
27  * $Id$
28  */
29 
30 #ifndef _LdapAgent_h
31 #define _LdapAgent_h
32 
33 #include <Y2.h>
34 #include <scr/SCRAgent.h>
35 
36 #include <LDAPConnection.h>
37 #include <LDAPException.h>
38 #include <LDAPAttributeList.h>
39 #include <LDAPAttribute.h>
40 
41 #include <LDAPSchema.h>
42 
43 #define DEFAULT_PORT 389
44 #define ANSWER 42
45 #define MAX_LENGTH_ID 5
46 
50 class LdapAgent : public SCRAgent
51 {
52 private:
56  int port;
57  string hostname;
58  string bind_dn;
59  string bind_pw;
60  string ldap_error;
61  string server_error;
62  bool tls_error;
63 
66 
67  string userpw_hash;
68 
69  LDAPConnection *ldap;
70  LDAPConstraints *cons;
71  LDAPSchema *schema;
72 
76  usernames,
77  userdns,
78  uids,
79  homes,
80  user_items,
81  groups,
84  groupnames,
85  gids,
87 
92  string getValue ( const YCPMap map, const string key);
93 
100  int getIntValue ( const YCPMap map, const string key, int deflt);
101 
102  bool getBoolValue (const YCPMap map, const string key);
103 
104  YCPList getListValue (const YCPMap map, const string key);
105 
109  StringList ycplist2stringlist (YCPList l);
110 
114  YCPList stringlist2ycplist (StringList sl);
115 
119  YCPList stringlist2ycplist_low (StringList sl);
120 
126  YCPMap getGroupEntry (LDAPEntry *entry, string member_attribute);
127 
132  YCPMap getUserEntry (LDAPEntry *entry);
133 
139  YCPMap getSearchedEntry (LDAPEntry *entry, bool sinlge_value);
140 
146  YCPMap getObjectAttributes (string dn);
147 
151  YCPBoolean deleteSubTree (string dn);
152 
159  YCPBoolean moveWithSubtree (string dn, string new_dn, string parent_dn);
160 
167  YCPBoolean copyOneEntry (string dn, string new_dn);
168 
172  void debug_exception (LDAPException e, string action);
173 
177  void debug_referral (LDAPReferralException e, string action);
178 
182  void set_tls_options (YCPMap args, string tls);
183 
187  void generate_attr_list (LDAPAttributeList* attrs, YCPMap map);
188 
193  void generate_mod_list (LDAPModList* modlist, YCPMap map, YCPValue attrs);
194 
195 public:
199  LdapAgent();
200 
204  virtual ~LdapAgent();
205 
211  virtual YCPValue Read ( const YCPPath &path,
212  const YCPValue& arg = YCPNull(),
213  const YCPValue& opt = YCPNull());
214 
218  virtual YCPBoolean Write(const YCPPath &path,
219  const YCPValue& arg,
220  const YCPValue& arg2 = YCPNull());
221 
225  virtual YCPValue Execute(const YCPPath &path,
226  const YCPValue& arg = YCPNull(),
227  const YCPValue& arg2 = YCPNull());
228 
232  virtual YCPList Dir(const YCPPath& path);
233 
237  virtual YCPValue otherCommand(const YCPTerm& term);
238 };
239 
240 #endif /* _LdapAgent_h */
void debug_referral(LDAPReferralException e, string action)
Definition: LdapAgent.cc:513
YCPMap getSearchedEntry(LDAPEntry *entry, bool sinlge_value)
Definition: LdapAgent.cc:151
virtual ~LdapAgent()
Definition: LdapAgent.cc:77
YCPMap usernames
Definition: LdapAgent.h:73
LDAPConnection * ldap
Definition: LdapAgent.h:69
string bind_pw
Definition: LdapAgent.h:59
YCPMap uids
Definition: LdapAgent.h:73
StringList ycplist2stringlist(YCPList l)
Definition: LdapAgent.cc:319
YCPMap users_by_uidnumber
Definition: LdapAgent.h:73
YCPMap groups_by_gidnumber
Definition: LdapAgent.h:73
virtual YCPValue Execute(const YCPPath &path, const YCPValue &arg=YCPNull(), const YCPValue &arg2=YCPNull())
Definition: LdapAgent.cc:1263
YCPMap users_by_name
Definition: LdapAgent.h:73
YCPMap groupnames
Definition: LdapAgent.h:73
YCPList stringlist2ycplist_low(StringList sl)
Definition: LdapAgent.cc:348
YCPMap user_items
Definition: LdapAgent.h:73
int getIntValue(const YCPMap map, const string key, int deflt)
Definition: LdapAgent.cc:109
string userpw_hash
Definition: LdapAgent.h:67
YCPMap getGroupEntry(LDAPEntry *entry, string member_attribute)
Definition: LdapAgent.cc:227
bool getBoolValue(const YCPMap map, const string key)
Definition: LdapAgent.cc:126
YCPBoolean copyOneEntry(string dn, string new_dn)
Definition: LdapAgent.cc:955
LDAPSchema * schema
Definition: LdapAgent.h:71
YCPBoolean moveWithSubtree(string dn, string new_dn, string parent_dn)
Definition: LdapAgent.cc:1020
void generate_mod_list(LDAPModList *modlist, YCPMap map, YCPValue attrs)
Definition: LdapAgent.cc:422
void generate_attr_list(LDAPAttributeList *attrs, YCPMap map)
Definition: LdapAgent.cc:360
LDAPConstraints * cons
Definition: LdapAgent.h:70
void set_tls_options(YCPMap args, string tls)
Definition: LdapAgent.cc:527
virtual YCPList Dir(const YCPPath &path)
Definition: LdapAgent.cc:558
YCPMap group_items
Definition: LdapAgent.h:73
YCPMap getObjectAttributes(string dn)
Definition: LdapAgent.cc:195
string server_error
Definition: LdapAgent.h:61
YCPMap homes
Definition: LdapAgent.h:73
virtual YCPBoolean Write(const YCPPath &path, const YCPValue &arg, const YCPValue &arg2=YCPNull())
Definition: LdapAgent.cc:1095
bool tls_error
Definition: LdapAgent.h:62
bool ldap_initialized
Definition: LdapAgent.h:65
YCPMap groups_by_name
Definition: LdapAgent.h:73
YCPBoolean deleteSubTree(string dn)
Definition: LdapAgent.cc:907
virtual YCPValue Read(const YCPPath &path, const YCPValue &arg=YCPNull(), const YCPValue &opt=YCPNull())
Definition: LdapAgent.cc:567
YCPMap groups
Definition: LdapAgent.h:73
string getValue(const YCPMap map, const string key)
Definition: LdapAgent.cc:94
void debug_exception(LDAPException e, string action)
Definition: LdapAgent.cc:500
int ldap_error_code
Definition: LdapAgent.h:64
string bind_dn
Definition: LdapAgent.h:58
YCPMap gids
Definition: LdapAgent.h:73
YCPMap getUserEntry(LDAPEntry *entry)
Definition: LdapAgent.cc:267
int port
Definition: LdapAgent.h:56
string ldap_error
Definition: LdapAgent.h:60
YCPList stringlist2ycplist(StringList sl)
Definition: LdapAgent.cc:336
string hostname
Definition: LdapAgent.h:57
YCPList getListValue(const YCPMap map, const string key)
Definition: LdapAgent.cc:139
LdapAgent()
Definition: LdapAgent.cc:65
YCPMap userdns
Definition: LdapAgent.h:73
An interface class between YaST2 and Ldap Agent.
Definition: LdapAgent.h:50
virtual YCPValue otherCommand(const YCPTerm &term)
Definition: LdapAgent.cc:1833
YCPMap users
Definition: LdapAgent.h:73

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