The branch, v3-6-test has been updated via 2a2d118 s3: Remove a reference to "winbindd_cli_state" from append_auth_data via 9d02adc s3: Remove a reference to "winbindd_cli_state" from append_info3_as_txt via 940d4ab s3: Remove a reference to "winbindd_cli_state" from append_afs_token via 19bfd98 s3: Remove a reference to "winbindd_cli_state" from append_info3_as_ndr via 8f5591d s3: Remove a reference to "winbindd_cli_state" from append_unix_username via 4f20daf s3: Remove a reference to "winbindd_cli_state" from append_auth_data via 8a5939f "bool ? true : false" is a bit pointless via e105708 s3: Move parse_sidlist to the only calling file via f70d36f s3: Remove some unused code from 37f8565 s3-spoolss: fix spoolss GetPrinterData behaviour
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test - Log ----------------------------------------------------------------- commit 2a2d118f729ac4c8f014d3529afbfb0d4956fadd Author: Volker Lendecke <v...@samba.org> Date: Tue Nov 16 17:58:10 2010 +0100 s3: Remove a reference to "winbindd_cli_state" from append_auth_data Autobuild-User: Volker Lendecke <vlen...@samba.org> Autobuild-Date: Wed Nov 17 12:02:34 UTC 2010 on sn-devel-104 commit 9d02adc7ae350ca72c2d442a545439247ef0b550 Author: Volker Lendecke <v...@samba.org> Date: Tue Nov 16 17:56:21 2010 +0100 s3: Remove a reference to "winbindd_cli_state" from append_info3_as_txt commit 940d4ab44b21c9320269d207c1aae34d5e0fbd08 Author: Volker Lendecke <v...@samba.org> Date: Tue Nov 16 17:52:31 2010 +0100 s3: Remove a reference to "winbindd_cli_state" from append_afs_token commit 19bfd988a3b8c61694772ac9f33587fdf70c10f8 Author: Volker Lendecke <v...@samba.org> Date: Tue Nov 16 17:50:16 2010 +0100 s3: Remove a reference to "winbindd_cli_state" from append_info3_as_ndr commit 8f5591d046b75fb04290d7e08027b9ad250c56c9 Author: Volker Lendecke <v...@samba.org> Date: Tue Nov 16 17:44:08 2010 +0100 s3: Remove a reference to "winbindd_cli_state" from append_unix_username commit 4f20daf7383c33c107fd3beda76e5aae2237d871 Author: Volker Lendecke <v...@samba.org> Date: Tue Nov 16 17:07:33 2010 +0100 s3: Remove a reference to "winbindd_cli_state" from append_auth_data commit 8a5939f2af62ea4f3dc53372312975c0769595eb Author: Volker Lendecke <v...@samba.org> Date: Tue Nov 16 16:22:32 2010 +0100 "bool ? true : false" is a bit pointless commit e105708068d7836dbee97aaf20ff0d3520291118 Author: Volker Lendecke <v...@samba.org> Date: Tue Nov 16 16:11:14 2010 +0100 s3: Move parse_sidlist to the only calling file commit f70d36fe2d0119db7d67aacc725796c793ed8174 Author: Volker Lendecke <v...@samba.org> Date: Tue Nov 16 16:09:04 2010 +0100 s3: Remove some unused code ----------------------------------------------------------------------- Summary of changes: source3/winbindd/winbindd_async.c | 60 -------------- source3/winbindd/winbindd_dual.c | 3 +- source3/winbindd/winbindd_getsidaliases.c | 42 ++++++++++ source3/winbindd/winbindd_pam.c | 125 +++++++++++++++-------------- source3/winbindd/winbindd_proto.h | 7 -- 5 files changed, 106 insertions(+), 131 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/winbindd/winbindd_async.c b/source3/winbindd/winbindd_async.c index 9e7be6b..958dce3 100644 --- a/source3/winbindd/winbindd_async.c +++ b/source3/winbindd/winbindd_async.c @@ -26,66 +26,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_WINBIND -bool print_sidlist(TALLOC_CTX *mem_ctx, const struct dom_sid *sids, - size_t num_sids, char **result, ssize_t *len) -{ - size_t i; - size_t buflen = 0; - - *len = 0; - *result = NULL; - for (i=0; i<num_sids; i++) { - fstring tmp; - sprintf_append(mem_ctx, result, len, &buflen, - "%s\n", sid_to_fstring(tmp, &sids[i])); - } - - if ((num_sids != 0) && (*result == NULL)) { - return False; - } - - return True; -} - -bool parse_sidlist(TALLOC_CTX *mem_ctx, const char *sidstr, - struct dom_sid **sids, size_t *num_sids) -{ - const char *p, *q; - - p = sidstr; - if (p == NULL) - return False; - - while (p[0] != '\0') { - fstring tmp; - size_t sidlen; - struct dom_sid sid; - q = strchr(p, '\n'); - if (q == NULL) { - DEBUG(0, ("Got invalid sidstr: %s\n", p)); - return False; - } - sidlen = PTR_DIFF(q, p); - if (sidlen >= sizeof(tmp)-1) { - return false; - } - memcpy(tmp, p, sidlen); - tmp[sidlen] = '\0'; - q += 1; - if (!string_to_sid(&sid, tmp)) { - DEBUG(0, ("Could not parse sid %s\n", p)); - return False; - } - if (!NT_STATUS_IS_OK(add_sid_to_array(mem_ctx, &sid, sids, - num_sids))) - { - return False; - } - p = q; - } - return True; -} - enum winbindd_result winbindd_dual_ping(struct winbindd_domain *domain, struct winbindd_cli_state *state) { diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c index 05f0706..fbf7def 100644 --- a/source3/winbindd/winbindd_dual.c +++ b/source3/winbindd/winbindd_dual.c @@ -234,8 +234,7 @@ struct tevent_req *wb_domain_request_send(TALLOC_CTX *mem_ctx, /* The primary domain has to find the DC name itself */ state->init_req->cmd = WINBINDD_INIT_CONNECTION; fstrcpy(state->init_req->domain_name, domain->name); - state->init_req->data.init_conn.is_primary = - domain->primary ? true : false; + state->init_req->data.init_conn.is_primary = domain->primary; fstrcpy(state->init_req->data.init_conn.dcname, ""); subreq = wb_child_request_send(state, ev, &domain->child, diff --git a/source3/winbindd/winbindd_getsidaliases.c b/source3/winbindd/winbindd_getsidaliases.c index 9bd321f..3c8ed99 100644 --- a/source3/winbindd/winbindd_getsidaliases.c +++ b/source3/winbindd/winbindd_getsidaliases.c @@ -26,6 +26,9 @@ struct winbindd_getsidaliases_state { uint32_t *aliases; }; +static bool parse_sidlist(TALLOC_CTX *mem_ctx, const char *sidstr, + struct dom_sid **sids, size_t *num_sids); + static void winbindd_getsidaliases_done(struct tevent_req *subreq); struct tevent_req *winbindd_getsidaliases_send(TALLOC_CTX *mem_ctx, @@ -151,3 +154,42 @@ NTSTATUS winbindd_getsidaliases_recv(struct tevent_req *req, response->data.num_entries = state->num_aliases; return NT_STATUS_OK; } + +static bool parse_sidlist(TALLOC_CTX *mem_ctx, const char *sidstr, + struct dom_sid **sids, size_t *num_sids) +{ + const char *p, *q; + + p = sidstr; + if (p == NULL) + return False; + + while (p[0] != '\0') { + fstring tmp; + size_t sidlen; + struct dom_sid sid; + q = strchr(p, '\n'); + if (q == NULL) { + DEBUG(0, ("Got invalid sidstr: %s\n", p)); + return False; + } + sidlen = PTR_DIFF(q, p); + if (sidlen >= sizeof(tmp)-1) { + return false; + } + memcpy(tmp, p, sidlen); + tmp[sidlen] = '\0'; + q += 1; + if (!string_to_sid(&sid, tmp)) { + DEBUG(0, ("Could not parse sid %s\n", p)); + return False; + } + if (!NT_STATUS_IS_OK(add_sid_to_array(mem_ctx, &sid, sids, + num_sids))) + { + return False; + } + p = q; + } + return True; +} diff --git a/source3/winbindd/winbindd_pam.c b/source3/winbindd/winbindd_pam.c index e84af3d..56d77fd 100644 --- a/source3/winbindd/winbindd_pam.c +++ b/source3/winbindd/winbindd_pam.c @@ -41,57 +41,57 @@ #define LOGON_KRB5_FAIL_CLOCK_SKEW 0x02000000 static NTSTATUS append_info3_as_txt(TALLOC_CTX *mem_ctx, - struct winbindd_cli_state *state, + struct winbindd_response *resp, struct netr_SamInfo3 *info3) { char *ex; uint32_t i; - state->response->data.auth.info3.logon_time = + resp->data.auth.info3.logon_time = nt_time_to_unix(info3->base.last_logon); - state->response->data.auth.info3.logoff_time = + resp->data.auth.info3.logoff_time = nt_time_to_unix(info3->base.last_logoff); - state->response->data.auth.info3.kickoff_time = + resp->data.auth.info3.kickoff_time = nt_time_to_unix(info3->base.acct_expiry); - state->response->data.auth.info3.pass_last_set_time = + resp->data.auth.info3.pass_last_set_time = nt_time_to_unix(info3->base.last_password_change); - state->response->data.auth.info3.pass_can_change_time = + resp->data.auth.info3.pass_can_change_time = nt_time_to_unix(info3->base.allow_password_change); - state->response->data.auth.info3.pass_must_change_time = + resp->data.auth.info3.pass_must_change_time = nt_time_to_unix(info3->base.force_password_change); - state->response->data.auth.info3.logon_count = info3->base.logon_count; - state->response->data.auth.info3.bad_pw_count = info3->base.bad_password_count; + resp->data.auth.info3.logon_count = info3->base.logon_count; + resp->data.auth.info3.bad_pw_count = info3->base.bad_password_count; - state->response->data.auth.info3.user_rid = info3->base.rid; - state->response->data.auth.info3.group_rid = info3->base.primary_gid; - sid_to_fstring(state->response->data.auth.info3.dom_sid, info3->base.domain_sid); + resp->data.auth.info3.user_rid = info3->base.rid; + resp->data.auth.info3.group_rid = info3->base.primary_gid; + sid_to_fstring(resp->data.auth.info3.dom_sid, info3->base.domain_sid); - state->response->data.auth.info3.num_groups = info3->base.groups.count; - state->response->data.auth.info3.user_flgs = info3->base.user_flags; + resp->data.auth.info3.num_groups = info3->base.groups.count; + resp->data.auth.info3.user_flgs = info3->base.user_flags; - state->response->data.auth.info3.acct_flags = info3->base.acct_flags; - state->response->data.auth.info3.num_other_sids = info3->sidcount; + resp->data.auth.info3.acct_flags = info3->base.acct_flags; + resp->data.auth.info3.num_other_sids = info3->sidcount; - fstrcpy(state->response->data.auth.info3.user_name, + fstrcpy(resp->data.auth.info3.user_name, info3->base.account_name.string); - fstrcpy(state->response->data.auth.info3.full_name, + fstrcpy(resp->data.auth.info3.full_name, info3->base.full_name.string); - fstrcpy(state->response->data.auth.info3.logon_script, + fstrcpy(resp->data.auth.info3.logon_script, info3->base.logon_script.string); - fstrcpy(state->response->data.auth.info3.profile_path, + fstrcpy(resp->data.auth.info3.profile_path, info3->base.profile_path.string); - fstrcpy(state->response->data.auth.info3.home_dir, + fstrcpy(resp->data.auth.info3.home_dir, info3->base.home_directory.string); - fstrcpy(state->response->data.auth.info3.dir_drive, + fstrcpy(resp->data.auth.info3.dir_drive, info3->base.home_drive.string); - fstrcpy(state->response->data.auth.info3.logon_srv, + fstrcpy(resp->data.auth.info3.logon_srv, info3->base.logon_server.string); - fstrcpy(state->response->data.auth.info3.logon_dom, + fstrcpy(resp->data.auth.info3.logon_dom, info3->base.domain.string); - ex = talloc_strdup(state->mem_ctx, ""); + ex = talloc_strdup(mem_ctx, ""); NT_STATUS_HAVE_NO_MEMORY(ex); for (i=0; i < info3->base.groups.count; i++) { @@ -115,14 +115,14 @@ static NTSTATUS append_info3_as_txt(TALLOC_CTX *mem_ctx, talloc_free(sid); } - state->response->extra_data.data = ex; - state->response->length += talloc_get_size(ex); + resp->extra_data.data = ex; + resp->length += talloc_get_size(ex); return NT_STATUS_OK; } static NTSTATUS append_info3_as_ndr(TALLOC_CTX *mem_ctx, - struct winbindd_cli_state *state, + struct winbindd_response *resp, struct netr_SamInfo3 *info3) { DATA_BLOB blob; @@ -135,14 +135,14 @@ static NTSTATUS append_info3_as_ndr(TALLOC_CTX *mem_ctx, return ndr_map_error2ntstatus(ndr_err); } - state->response->extra_data.data = blob.data; - state->response->length += blob.length; + resp->extra_data.data = blob.data; + resp->length += blob.length; return NT_STATUS_OK; } static NTSTATUS append_unix_username(TALLOC_CTX *mem_ctx, - struct winbindd_cli_state *state, + struct winbindd_response *resp, const struct netr_SamInfo3 *info3, const char *name_domain, const char *name_user) @@ -166,17 +166,17 @@ static NTSTATUS append_unix_username(TALLOC_CTX *mem_ctx, nt_username = name_user; } - fill_domain_username(state->response->data.auth.unix_username, + fill_domain_username(resp->data.auth.unix_username, nt_domain, nt_username, true); - DEBUG(5,("Setting unix username to [%s]\n", - state->response->data.auth.unix_username)); + DEBUG(5, ("Setting unix username to [%s]\n", + resp->data.auth.unix_username)); return NT_STATUS_OK; } static NTSTATUS append_afs_token(TALLOC_CTX *mem_ctx, - struct winbindd_cli_state *state, + struct winbindd_response *resp, const struct netr_SamInfo3 *info3, const char *name_domain, const char *name_user) @@ -230,13 +230,11 @@ static NTSTATUS append_afs_token(TALLOC_CTX *mem_ctx, if (token == NULL) { return NT_STATUS_OK; } - state->response->extra_data.data = talloc_strdup(state->mem_ctx, - token); - if (state->response->extra_data.data == NULL) { + resp->extra_data.data = talloc_strdup(mem_ctx, token); + if (resp->extra_data.data == NULL) { return NT_STATUS_NO_MEMORY; } - state->response->length += - strlen((const char *)state->response->extra_data.data)+1; + resp->length += strlen((const char *)resp->extra_data.data)+1; return NT_STATUS_OK; } @@ -743,31 +741,32 @@ bool check_request_flags(uint32_t flags) /**************************************************************** ****************************************************************/ -static NTSTATUS append_auth_data(struct winbindd_cli_state *state, +static NTSTATUS append_auth_data(TALLOC_CTX *mem_ctx, + struct winbindd_response *resp, + uint32_t request_flags, struct netr_SamInfo3 *info3, const char *name_domain, const char *name_user) { NTSTATUS result; - uint32_t flags = state->request->flags; - if (flags & WBFLAG_PAM_USER_SESSION_KEY) { - memcpy(state->response->data.auth.user_session_key, + if (request_flags & WBFLAG_PAM_USER_SESSION_KEY) { + memcpy(resp->data.auth.user_session_key, info3->base.key.key, - sizeof(state->response->data.auth.user_session_key) + sizeof(resp->data.auth.user_session_key) /* 16 */); } - if (flags & WBFLAG_PAM_LMKEY) { - memcpy(state->response->data.auth.first_8_lm_hash, + if (request_flags & WBFLAG_PAM_LMKEY) { + memcpy(resp->data.auth.first_8_lm_hash, info3->base.LMSessKey.key, - sizeof(state->response->data.auth.first_8_lm_hash) + sizeof(resp->data.auth.first_8_lm_hash) /* 8 */); } - if (flags & WBFLAG_PAM_UNIX_NAME) { - result = append_unix_username(state->mem_ctx, state, info3, - name_domain, name_user); + if (request_flags & WBFLAG_PAM_UNIX_NAME) { + result = append_unix_username(mem_ctx, resp, + info3, name_domain, name_user); if (!NT_STATUS_IS_OK(result)) { DEBUG(10,("Failed to append Unix Username: %s\n", nt_errstr(result))); @@ -777,8 +776,8 @@ static NTSTATUS append_auth_data(struct winbindd_cli_state *state, /* currently, anything from here on potentially overwrites extra_data. */ - if (flags & WBFLAG_PAM_INFO3_NDR) { - result = append_info3_as_ndr(state->mem_ctx, state, info3); + if (request_flags & WBFLAG_PAM_INFO3_NDR) { + result = append_info3_as_ndr(mem_ctx, resp, info3); if (!NT_STATUS_IS_OK(result)) { DEBUG(10,("Failed to append INFO3 (NDR): %s\n", nt_errstr(result))); @@ -786,8 +785,8 @@ static NTSTATUS append_auth_data(struct winbindd_cli_state *state, } } - if (flags & WBFLAG_PAM_INFO3_TEXT) { - result = append_info3_as_txt(state->mem_ctx, state, info3); + if (request_flags & WBFLAG_PAM_INFO3_TEXT) { + result = append_info3_as_txt(mem_ctx, resp, info3); if (!NT_STATUS_IS_OK(result)) { DEBUG(10,("Failed to append INFO3 (TXT): %s\n", nt_errstr(result))); @@ -795,9 +794,9 @@ static NTSTATUS append_auth_data(struct winbindd_cli_state *state, } } - if (flags & WBFLAG_PAM_AFS_TOKEN) { - result = append_afs_token(state->mem_ctx, state, info3, - name_domain, name_user); + if (request_flags & WBFLAG_PAM_AFS_TOKEN) { + result = append_afs_token(mem_ctx, resp, + info3, name_domain, name_user); if (!NT_STATUS_IS_OK(result)) { DEBUG(10,("Failed to append AFS token: %s\n", nt_errstr(result))); @@ -1630,8 +1629,9 @@ process_result: goto done; } - result = append_auth_data(state, info3, name_domain, - name_user); + result = append_auth_data(state->mem_ctx, state->response, + state->request->flags, info3, + name_domain, name_user); if (!NT_STATUS_IS_OK(result)) { goto done; } @@ -1862,8 +1862,9 @@ process_result: goto done; } - result = append_auth_data(state, info3, name_domain, - name_user); + result = append_auth_data(state->mem_ctx, state->response, + state->request->flags, info3, + name_domain, name_user); if (!NT_STATUS_IS_OK(result)) { goto done; } diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h index 9912575..66945c4 100644 --- a/source3/winbindd/winbindd_proto.h +++ b/source3/winbindd/winbindd_proto.h @@ -72,13 +72,6 @@ NTSTATUS winbindd_lookup_names(TALLOC_CTX *mem_ctx, struct dom_sid **sids, enum lsa_SidType **types); -/* The following definitions come from winbindd/winbindd_async.c */ - -bool print_sidlist(TALLOC_CTX *mem_ctx, const struct dom_sid *sids, - size_t num_sids, char **result, ssize_t *len); -bool parse_sidlist(TALLOC_CTX *mem_ctx, const char *sidstr, - struct dom_sid **sids, size_t *num_sids); - /* The following definitions come from winbindd/winbindd_cache.c */ struct cache_entry *centry_start(struct winbindd_domain *domain, NTSTATUS status); -- Samba Shared Repository