libads/ldap_utils.c

ソースコードを見る。

関数

static ADS_STATUS ads_do_search_retry_internal (ADS_STRUCT *ads, const char *bind_path, int scope, const char *expr, const char **attrs, void *args, LDAPMessage **res)
ADS_STATUS ads_do_search_retry (ADS_STRUCT *ads, const char *bind_path, int scope, const char *expr, const char **attrs, LDAPMessage **res)
ADS_STATUS ads_do_search_retry_args (ADS_STRUCT *ads, const char *bind_path, int scope, const char *expr, const char **attrs, void *args, LDAPMessage **res)
ADS_STATUS ads_search_retry (ADS_STRUCT *ads, LDAPMessage **res, const char *expr, const char **attrs)
ADS_STATUS ads_search_retry_dn (ADS_STRUCT *ads, LDAPMessage **res, const char *dn, const char **attrs)
ADS_STATUS ads_search_retry_extended_dn (ADS_STRUCT *ads, LDAPMessage **res, const char *dn, const char **attrs, enum ads_extended_dn_flags flags)
ADS_STATUS ads_search_retry_sid (ADS_STRUCT *ads, LDAPMessage **res, const DOM_SID *sid, const char **attrs)


関数

static ADS_STATUS ads_do_search_retry_internal ( ADS_STRUCT ads,
const char *  bind_path,
int  scope,
const char *  expr,
const char **  attrs,
void *  args,
LDAPMessage **  res 
) [static]

ldap_utils.c30 行で定義されています。

参照先 ads_connect()ads_count_replies()ads_destroy()ads_do_search()ads_do_search_all_args()ads_errstr()ads_msgfree()ADS_STRUCT::authADS_STRUCT::flagsADS_STRUCT::last_attemptADS_STRUCT::ldstatus.

参照元 ads_do_search_retry()ads_do_search_retry_args().

00034 {
00035         ADS_STATUS status = ADS_SUCCESS;
00036         int count = 3;
00037         char *bp;
00038 
00039         *res = NULL;
00040 
00041         if (!ads->ld &&
00042             time(NULL) - ads->last_attempt < ADS_RECONNECT_TIME) {
00043                 return ADS_ERROR(LDAP_SERVER_DOWN);
00044         }
00045 
00046         bp = SMB_STRDUP(bind_path);
00047 
00048         if (!bp) {
00049                 return ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
00050         }
00051 
00052         *res = NULL;
00053 
00054         /* when binding anonymously, we cannot use the paged search LDAP
00055          * control - Guenther */
00056 
00057         if (ads->auth.flags & ADS_AUTH_ANON_BIND) {
00058                 status = ads_do_search(ads, bp, scope, expr, attrs, res);
00059         } else {
00060                 status = ads_do_search_all_args(ads, bp, scope, expr, attrs, args, res);
00061         }
00062         if (ADS_ERR_OK(status)) {
00063                DEBUG(5,("Search for %s in <%s> gave %d replies\n",
00064                         expr, bp, ads_count_replies(ads, *res)));
00065                 SAFE_FREE(bp);
00066                 return status;
00067         }
00068 
00069         while (--count) {
00070 
00071                 if (*res) 
00072                         ads_msgfree(ads, *res);
00073                 *res = NULL;
00074                 
00075                 DEBUG(3,("Reopening ads connection to realm '%s' after error %s\n", 
00076                          ads->config.realm, ads_errstr(status)));
00077                          
00078                 if (ads->ld) {
00079                         ldap_unbind(ads->ld); 
00080                 }
00081                 
00082                 ads->ld = NULL;
00083                 status = ads_connect(ads);
00084                 
00085                 if (!ADS_ERR_OK(status)) {
00086                         DEBUG(1,("ads_search_retry: failed to reconnect (%s)\n",
00087                                  ads_errstr(status)));
00088                         ads_destroy(&ads);
00089                         SAFE_FREE(bp);
00090                         return status;
00091                 }
00092 
00093                 *res = NULL;
00094 
00095                 /* when binding anonymously, we cannot use the paged search LDAP
00096                  * control - Guenther */
00097 
00098                 if (ads->auth.flags & ADS_AUTH_ANON_BIND) {
00099                         status = ads_do_search(ads, bp, scope, expr, attrs, res);
00100                 } else {
00101                         status = ads_do_search_all_args(ads, bp, scope, expr, attrs, args, res);
00102                 }
00103 
00104                 if (ADS_ERR_OK(status)) {
00105                         DEBUG(5,("Search for filter: %s, base: %s gave %d replies\n",
00106                                  expr, bp, ads_count_replies(ads, *res)));
00107                         SAFE_FREE(bp);
00108                         return status;
00109                 }
00110         }
00111         SAFE_FREE(bp);
00112 
00113         if (!ADS_ERR_OK(status)) {
00114                 DEBUG(1,("ads reopen failed after error %s\n", 
00115                          ads_errstr(status)));
00116         }
00117         return status;
00118 }

ADS_STATUS ads_do_search_retry ( ADS_STRUCT ads,
const char *  bind_path,
int  scope,
const char *  expr,
const char **  attrs,
LDAPMessage **  res 
)

ldap_utils.c120 行で定義されています。

参照先 ads_do_search_retry_internal().

参照元 ads_domain_sid()ads_get_attrname_by_oid()ads_get_attrnames_by_oids()ads_leave_realm()ads_search_retry()ads_search_retry_dn()ads_search_retry_sid()ads_USN().

00123 {
00124         return ads_do_search_retry_internal(ads, bind_path, scope, expr, attrs, NULL, res);
00125 }

ADS_STATUS ads_do_search_retry_args ( ADS_STRUCT ads,
const char *  bind_path,
int  scope,
const char *  expr,
const char **  attrs,
void *  args,
LDAPMessage **  res 
)

ldap_utils.c127 行で定義されています。

参照先 ads_do_search_retry_internal().

参照元 ads_search_retry_extended_dn().

00131 {
00132         return ads_do_search_retry_internal(ads, bind_path, scope, expr, attrs, args, res);
00133 }

ADS_STATUS ads_search_retry ( ADS_STRUCT ads,
LDAPMessage **  res,
const char *  expr,
const char **  attrs 
)

ldap_utils.c136 行で定義されています。

参照先 ads_do_search_retry()ADS_STRUCT::bind_pathADS_STRUCT::config.

参照元 enum_dom_groups()idmap_ad_sids_to_unixids()lookup_groupmem()lookup_usergroups_member()query_user()query_user_list().

00138 {
00139         return ads_do_search_retry(ads, ads->config.bind_path, LDAP_SCOPE_SUBTREE,
00140                                    expr, attrs, res);
00141 }

ADS_STATUS ads_search_retry_dn ( ADS_STRUCT ads,
LDAPMessage **  res,
const char *  dn,
const char **  attrs 
)

ldap_utils.c143 行で定義されています。

参照先 ads_do_search_retry().

参照元 dn_lookup().

00146 {
00147         return ads_do_search_retry(ads, dn, LDAP_SCOPE_BASE,
00148                                    "(objectclass=*)", attrs, res);
00149 }

ADS_STATUS ads_search_retry_extended_dn ( ADS_STRUCT ads,
LDAPMessage **  res,
const char *  dn,
const char **  attrs,
enum ads_extended_dn_flags  flags 
)

ldap_utils.c151 行で定義されています。

参照先 ads_do_search_retry_args()ads_control::controlads_control::criticalads_control::val.

参照元 lookup_usergroups_memberof().

00155 {
00156         ads_control args;
00157 
00158         args.control = ADS_EXTENDED_DN_OID;
00159         args.val = flags;
00160         args.critical = True;
00161 
00162         return ads_do_search_retry_args(ads, dn, LDAP_SCOPE_BASE,
00163                                         "(objectclass=*)", attrs, &args, res);
00164 }

ADS_STATUS ads_search_retry_sid ( ADS_STRUCT ads,
LDAPMessage **  res,
const DOM_SID sid,
const char **  attrs 
)

ldap_utils.c166 行で定義されています。

参照先 ads_do_search_retry()asprintf()sid_binstring_hex()status.

参照元 lookup_usergroups()net_ads_sid().

00169 {
00170         char *dn, *sid_string;
00171         ADS_STATUS status;
00172         
00173         sid_string = sid_binstring_hex(sid);
00174         if (sid_string == NULL) {
00175                 return ADS_ERROR(LDAP_NO_MEMORY);
00176         }
00177 
00178         if (!asprintf(&dn, "<SID=%s>", sid_string)) {
00179                 SAFE_FREE(sid_string);
00180                 return ADS_ERROR(LDAP_NO_MEMORY);
00181         }
00182 
00183         status = ads_do_search_retry(ads, dn, LDAP_SCOPE_BASE,
00184                                    "(objectclass=*)", attrs, res);
00185         SAFE_FREE(dn);
00186         SAFE_FREE(sid_string);
00187         return status;
00188 }


Sambaに対してSat Aug 29 21:23:42 2009に生成されました。  doxygen 1.4.7