summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/ldap.h
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2015-02-12 16:55:38 +0000
committerCorinna Vinschen <corinna@vinschen.de>2015-02-12 16:55:38 +0000
commitb49934db7f440e099f628d7ccc3376902bb8800d (patch)
treeb6fe97f73e4bdfdac1b01b60a86b1806ba847286 /winsup/cygwin/ldap.h
parent54ade28dfa707bdd9bd0b37c7865d57be82a4263 (diff)
downloadcygnal-b49934db7f440e099f628d7ccc3376902bb8800d.tar.gz
cygnal-b49934db7f440e099f628d7ccc3376902bb8800d.tar.bz2
cygnal-b49934db7f440e099f628d7ccc3376902bb8800d.zip
* cygheap.h (cygheap_pwdgrp::get_home): Add dnsdomain parameter to
declaration in ldap-related method. (cygheap_pwdgrp::get_shell): Ditto. (cygheap_pwdgrp::get_gecos): Ditto. * ldap.cc (cyg_ldap::open): Use NO_ERROR instead of 0. (cyg_ldap::close): Reset last_fetched_sid. (cyg_ldap::fetch_ad_account): Return immediately if sid is the same as last_fetched_sid. Open LDAP connection from here. Move initialization of rdse after open call. Set last_fetched_sid if LDAP call was successful. * ldap.h (class cyg_ldap): Add member last_fetched_sid. (cyg_ldap::cyg_ldap): Initialize last_fetched_sid. (cyg_ldap::is_open): New inline method. * uinfo.cc (cygheap_pwdgrp::init): Drop initialization of db_home, db_shell and db_gecos with "cygwin desc", thus only using the fallback by default. (fetch_windows_home): Add parameter dnsdomain. Call cyg_ldap::fetch_ad_account if required. (fetch_from_path): Add parameter dnsdomain. Call fetch_windows_home accordingly. (cygheap_pwdgrp::get_home): Accomodate call to fetch_windows_home. Add dnsdomain parameter in ldap-related method. Call cyg_ldap::fetch_ad_account if required. (cygheap_pwdgrp::get_shell): Ditto. (cygheap_pwdgrp::get_gecos): Ditto. (pwdgrp::fetch_account_from_windows): Drop cyg_ldap::open call prior to cyg_ldap::fetch_ad_account call. Set is_current_user to true if we're handling the current user account. Make sure to perform the LDAP calls only for users, and only if required.
Diffstat (limited to 'winsup/cygwin/ldap.h')
-rw-r--r--winsup/cygwin/ldap.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/winsup/cygwin/ldap.h b/winsup/cygwin/ldap.h
index d3c28fcbd..4a85ece20 100644
--- a/winsup/cygwin/ldap.h
+++ b/winsup/cygwin/ldap.h
@@ -1,6 +1,6 @@
/* ldap.h.
- Copyright 2014 Red Hat, Inc.
+ Copyright 2014, 2015 Red Hat, Inc.
This file is part of Cygwin.
@@ -32,6 +32,7 @@ class cyg_ldap {
bool isAD;
PLDAPSearch srch_id;
PLDAPMessage srch_msg, srch_entry;
+ cygsid last_fetched_sid;
inline int map_ldaperr_to_errno (ULONG lerr);
inline int wait (cygthread *thr);
@@ -45,7 +46,8 @@ class cyg_ldap {
public:
cyg_ldap () : lh (NULL), rootdse (NULL), msg (NULL), entry (NULL), val (NULL),
- isAD (false), srch_id (NULL), srch_msg (NULL), srch_entry (NULL)
+ isAD (false), srch_id (NULL), srch_msg (NULL),
+ srch_entry (NULL), last_fetched_sid (NO_SID)
{}
~cyg_ldap () { close (); }
@@ -54,6 +56,7 @@ public:
ULONG search_s (PWCHAR base, PWCHAR filter, PWCHAR *attrs);
ULONG next_page_s ();
+ bool is_open () const { return !!lh; }
operator PLDAP () const { return lh; }
int open (PCWSTR in_domain);
void close ();