s3: Replace IS_DOMAIN_OFFLINE by a function
authorVolker Lendecke <vl@samba.org>
Thu, 24 Dec 2009 11:52:24 +0000 (12:52 +0100)
committerVolker Lendecke <vl@samba.org>
Sat, 26 Dec 2009 11:26:07 +0000 (12:26 +0100)
source3/winbindd/wb_sid2gid.c
source3/winbindd/wb_sid2uid.c
source3/winbindd/winbindd.h
source3/winbindd/winbindd_cache.c
source3/winbindd/winbindd_proto.h
source3/winbindd/winbindd_util.c

index a578746ea2f7cd0ffb92ca3a731962dc306b15bc..e15d563cd73f829060d1a0e24bdc67732bfd81e9 100644 (file)
@@ -54,7 +54,7 @@ struct tevent_req *wb_sid2gid_send(TALLOC_CTX *mem_ctx,
                DEBUG(10, ("idmap_cache_find_sid2gid found %d%s\n",
                           (int)state->gid, expired ? " (expired)": ""));
 
-               if (!expired || IS_DOMAIN_OFFLINE(find_our_domain())) {
+               if (!expired || is_domain_offline(find_our_domain())) {
                        if (state->gid == -1) {
                                tevent_req_nterror(req, NT_STATUS_NONE_MAPPED);
                        } else {
index abfe257bfaef75cbd4e93a412ada84a96fe76a2c..9c22b8d10bd399a688bdfdb1f88f0c697d33c7e9 100644 (file)
@@ -53,7 +53,7 @@ struct tevent_req *wb_sid2uid_send(TALLOC_CTX *mem_ctx,
                DEBUG(10, ("idmap_cache_find_sid2uid found %d%s\n",
                           (int)state->uid, expired ? " (expired)": ""));
 
-               if (!expired || IS_DOMAIN_OFFLINE(find_our_domain())) {
+               if (!expired || is_domain_offline(find_our_domain())) {
                        if (state->uid == -1) {
                                tevent_req_nterror(req, NT_STATUS_NONE_MAPPED);
                        } else {
index 99fa10250ae12f9236b52d7748ea2a52473e2cf6..a589ecc0ccb2947b8332c561c1048100d845476d 100644 (file)
@@ -387,9 +387,4 @@ struct WINBINDD_CCACHE_ENTRY {
 #define WINBINDD_PAM_AUTH_KRB5_RENEW_TIME 2592000 /* one month */
 #define DOM_SEQUENCE_NONE ((uint32)-1)
 
-#define IS_DOMAIN_OFFLINE(x) ( lp_winbind_offline_logon() && \
-                              ( get_global_winbindd_state_offline() \
-                                || !(x)->online ) )
-#define IS_DOMAIN_ONLINE(x) (!IS_DOMAIN_OFFLINE(x))
-
 #endif /* _WINBINDD_H */
index 6e70a18c3529d62b7dad66b9c6f6883235689d1c..ac855886ce562b528a2b015722260215026ea589 100644 (file)
@@ -514,7 +514,7 @@ static void refresh_sequence_number(struct winbindd_domain *domain, bool force)
        time_t t = time(NULL);
        unsigned cache_time = lp_winbind_cache_time();
 
-       if ( IS_DOMAIN_OFFLINE(domain) ) {
+       if (is_domain_offline(domain)) {
                return;
        }
 
@@ -4394,7 +4394,7 @@ bool wcache_fetch_ndr(TALLOC_CTX *mem_ctx, struct winbindd_domain *domain,
                goto fail;
        }
 
-       if (IS_DOMAIN_ONLINE(domain)) {
+       if (is_domain_offline(domain)) {
                uint32_t entry_seqnum, dom_seqnum, last_check;
 
                if (!wcache_fetch_seqnum(domain->name, &dom_seqnum,
index 012e3b6332eac2ba9785aaee84a2996d9e403cb1..263e3269177e9ab438b5d21fad923b7ee8966789 100644 (file)
@@ -474,6 +474,7 @@ void winbindd_unset_locator_kdc_env(const struct winbindd_domain *domain);
 void winbindd_set_locator_kdc_envs(const struct winbindd_domain *domain);
 void winbindd_unset_locator_kdc_env(const struct winbindd_domain *domain);
 void set_auth_errors(struct winbindd_response *resp, NTSTATUS result);
+bool is_domain_offline(const struct winbindd_domain *domain);
 
 /* The following definitions come from winbindd/winbindd_wins.c  */
 
index 8c21ed66108c5a29b3df774fc3fe3a991af630c1..17603820d4f725999161a0fe52395ffc686f165b 100644 (file)
@@ -1461,3 +1461,14 @@ void set_auth_errors(struct winbindd_response *resp, NTSTATUS result)
                        get_friendly_nt_error_msg(result));
        resp->data.auth.pam_error = nt_status_to_pam(result);
 }
+
+bool is_domain_offline(const struct winbindd_domain *domain)
+{
+       if (!lp_winbind_offline_logon()) {
+               return false;
+       }
+       if (get_global_winbindd_state_offline()) {
+               return true;
+       }
+       return !domain->online;
+}