yast2-ldap

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

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
64 int ldap_error_code;
65 bool ldap_initialized;
66
67 string userpw_hash;
68
69 LDAPConnection *ldap;
70 LDAPConstraints *cons;
71 LDAPSchema *schema;
72
73 YCPMap users,
74 users_by_name,
75 users_by_uidnumber,
76 usernames,
77 userdns,
78 uids,
79 homes,
80 user_items,
81 groups,
82 groups_by_name,
83 groups_by_gidnumber,
84 groupnames,
85 gids,
86 group_items;
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 */