diff options
author | Stefan Metzmacher <metze@samba.org> | 2010-03-29 16:31:13 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2010-03-29 18:11:19 +0200 |
commit | 6bd5a2a3739938f95fce23ab2da652c9b5a48111 (patch) | |
tree | 7e4bc51156791be9f405a803f21d80996d250585 /source3 | |
parent | 94a4bcd2f0c0464e192556679c6636639cb307ea (diff) | |
download | samba-6bd5a2a3739938f95fce23ab2da652c9b5a48111.tar.gz samba-6bd5a2a3739938f95fce23ab2da652c9b5a48111.tar.bz2 samba-6bd5a2a3739938f95fce23ab2da652c9b5a48111.zip |
s3:winbindd_reconnect: don't only reconnect on NT_STATUS_UNSUCCESSFUL
metze
Diffstat (limited to 'source3')
-rw-r--r-- | source3/winbindd/winbindd_reconnect.c | 73 |
1 files changed, 59 insertions, 14 deletions
diff --git a/source3/winbindd/winbindd_reconnect.c b/source3/winbindd/winbindd_reconnect.c index bf6e577f29..28fbcb954d 100644 --- a/source3/winbindd/winbindd_reconnect.c +++ b/source3/winbindd/winbindd_reconnect.c @@ -27,6 +27,51 @@ extern struct winbindd_methods msrpc_methods; +static bool reconnect_need_retry(NTSTATUS status) +{ + if (NT_STATUS_IS_OK(status)) { + return false; + } + + if (!NT_STATUS_IS_ERR(status)) { + return false; + } + + if (NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED)) { + return false; + } + + if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) { + return false; + } + + if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_GROUP)) { + return false; + } + + if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_ALIAS)) { + return false; + } + + if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_MEMBER)) { + return false; + } + + if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_DOMAIN)) { + return false; + } + + if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_PRIVILEGE)) { + return false; + } + + if (NT_STATUS_EQUAL(status, NT_STATUS_NO_MEMORY)) { + return false; + } + + return true; +} + /* List all users */ static NTSTATUS query_user_list(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx, @@ -38,7 +83,7 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain, result = msrpc_methods.query_user_list(domain, mem_ctx, num_entries, info); - if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL)) + if (reconnect_need_retry(result)) result = msrpc_methods.query_user_list(domain, mem_ctx, num_entries, info); return result; @@ -55,7 +100,7 @@ static NTSTATUS enum_dom_groups(struct winbindd_domain *domain, result = msrpc_methods.enum_dom_groups(domain, mem_ctx, num_entries, info); - if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL)) + if (reconnect_need_retry(result)) result = msrpc_methods.enum_dom_groups(domain, mem_ctx, num_entries, info); return result; @@ -73,7 +118,7 @@ static NTSTATUS enum_local_groups(struct winbindd_domain *domain, result = msrpc_methods.enum_local_groups(domain, mem_ctx, num_entries, info); - if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL)) + if (reconnect_need_retry(result)) result = msrpc_methods.enum_local_groups(domain, mem_ctx, num_entries, info); @@ -94,7 +139,7 @@ static NTSTATUS name_to_sid(struct winbindd_domain *domain, result = msrpc_methods.name_to_sid(domain, mem_ctx, domain_name, name, flags, sid, type); - if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL)) + if (reconnect_need_retry(result)) result = msrpc_methods.name_to_sid(domain, mem_ctx, domain_name, name, flags, sid, type); @@ -117,7 +162,7 @@ static NTSTATUS sid_to_name(struct winbindd_domain *domain, result = msrpc_methods.sid_to_name(domain, mem_ctx, sid, domain_name, name, type); - if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL)) + if (reconnect_need_retry(result)) result = msrpc_methods.sid_to_name(domain, mem_ctx, sid, domain_name, name, type); @@ -138,7 +183,7 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain, result = msrpc_methods.rids_to_names(domain, mem_ctx, sid, rids, num_rids, domain_name, names, types); - if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL)) { + if (reconnect_need_retry(result)) { result = msrpc_methods.rids_to_names(domain, mem_ctx, sid, rids, num_rids, domain_name, names, @@ -159,7 +204,7 @@ static NTSTATUS query_user(struct winbindd_domain *domain, result = msrpc_methods.query_user(domain, mem_ctx, user_sid, user_info); - if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL)) + if (reconnect_need_retry(result)) result = msrpc_methods.query_user(domain, mem_ctx, user_sid, user_info); @@ -178,7 +223,7 @@ static NTSTATUS lookup_usergroups(struct winbindd_domain *domain, user_sid, num_groups, user_gids); - if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL)) + if (reconnect_need_retry(result)) result = msrpc_methods.lookup_usergroups(domain, mem_ctx, user_sid, num_groups, user_gids); @@ -198,7 +243,7 @@ static NTSTATUS lookup_useraliases(struct winbindd_domain *domain, num_aliases, alias_rids); - if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL)) + if (reconnect_need_retry(result)) result = msrpc_methods.lookup_useraliases(domain, mem_ctx, num_sids, sids, num_aliases, @@ -223,7 +268,7 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain, sid_mem, names, name_types); - if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL)) + if (reconnect_need_retry(result)) result = msrpc_methods.lookup_groupmem(domain, mem_ctx, group_sid, type, num_names, @@ -240,7 +285,7 @@ static NTSTATUS sequence_number(struct winbindd_domain *domain, uint32 *seq) result = msrpc_methods.sequence_number(domain, seq); - if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL)) + if (reconnect_need_retry(result)) result = msrpc_methods.sequence_number(domain, seq); return result; @@ -255,7 +300,7 @@ static NTSTATUS lockout_policy(struct winbindd_domain *domain, result = msrpc_methods.lockout_policy(domain, mem_ctx, policy); - if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL)) + if (reconnect_need_retry(result)) result = msrpc_methods.lockout_policy(domain, mem_ctx, policy); return result; @@ -270,7 +315,7 @@ static NTSTATUS password_policy(struct winbindd_domain *domain, result = msrpc_methods.password_policy(domain, mem_ctx, policy); - if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL)) + if (reconnect_need_retry(result)) result = msrpc_methods.password_policy(domain, mem_ctx, policy); return result; @@ -285,7 +330,7 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain, result = msrpc_methods.trusted_domains(domain, mem_ctx, trusts); - if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL)) + if (reconnect_need_retry(result)) result = msrpc_methods.trusted_domains(domain, mem_ctx, trusts); |