diff options
author | Andreas Schneider <asn@samba.org> | 2011-06-15 18:03:30 +0200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-07-04 18:28:10 +1000 |
commit | 5f228fff2a9c4ee240978aefa4c8f900bcd40fd1 (patch) | |
tree | c705572895964aeda4e80f52f1484ee2b1df2a49 /source3/rpc_server/samr | |
parent | f0361924fb9ed71affde66bc476490b9368b4079 (diff) | |
download | samba-5f228fff2a9c4ee240978aefa4c8f900bcd40fd1.tar.gz samba-5f228fff2a9c4ee240978aefa4c8f900bcd40fd1.tar.bz2 samba-5f228fff2a9c4ee240978aefa4c8f900bcd40fd1.zip |
s3-samr: Replace client_id in samr server.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source3/rpc_server/samr')
-rw-r--r-- | source3/rpc_server/samr/srv_samr_nt.c | 79 |
1 files changed, 72 insertions, 7 deletions
diff --git a/source3/rpc_server/samr/srv_samr_nt.c b/source3/rpc_server/samr/srv_samr_nt.c index a253f307ac..475a204d55 100644 --- a/source3/rpc_server/samr/srv_samr_nt.c +++ b/source3/rpc_server/samr/srv_samr_nt.c @@ -44,6 +44,7 @@ #include "passdb.h" #include "auth.h" #include "rpc_server/srv_access_check.h" +#include "../lib/tsocket/tsocket.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV @@ -1825,7 +1826,9 @@ NTSTATUS _samr_ChangePasswordUser2(struct pipes_struct *p, { NTSTATUS status; char *user_name = NULL; + char *rhost; fstring wks; + int rc; DEBUG(5,("_samr_ChangePasswordUser2: %d\n", __LINE__)); @@ -1846,13 +1849,27 @@ NTSTATUS _samr_ChangePasswordUser2(struct pipes_struct *p, return NT_STATUS_NO_MEMORY; } + rc = get_remote_hostname(p->remote_address, + &rhost, + talloc_tos()); + if (rc < 0) { + return NT_STATUS_NO_MEMORY; + } + if (strequal(rhost,"UNKNOWN")) { + rhost = tsocket_address_inet_addr_string(p->remote_address, + talloc_tos()); + if (rhost == NULL) { + return NT_STATUS_NO_MEMORY; + } + } + /* * UNIX username case mangling not required, pass_oem_change * is case insensitive. */ status = pass_oem_change(user_name, - p->client_id->name, + rhost, r->in.lm_password->data, r->in.lm_verifier->hash, r->in.nt_password->data, @@ -1878,6 +1895,8 @@ NTSTATUS _samr_OemChangePasswordUser2(struct pipes_struct *p, NTSTATUS status; char *user_name = NULL; const char *wks = NULL; + char *rhost; + int rc; DEBUG(5,("_samr_OemChangePasswordUser2: %d\n", __LINE__)); @@ -1909,8 +1928,22 @@ NTSTATUS _samr_OemChangePasswordUser2(struct pipes_struct *p, return NT_STATUS_INVALID_PARAMETER; } + rc = get_remote_hostname(p->remote_address, + &rhost, + talloc_tos()); + if (rc < 0) { + return NT_STATUS_NO_MEMORY; + } + if (strequal(rhost,"UNKNOWN")) { + rhost = tsocket_address_inet_addr_string(p->remote_address, + talloc_tos()); + if (rhost == NULL) { + return NT_STATUS_NO_MEMORY; + } + } + status = pass_oem_change(user_name, - p->client_id->name, + rhost, r->in.password->data, r->in.hash->hash, 0, @@ -1940,6 +1973,8 @@ NTSTATUS _samr_ChangePasswordUser3(struct pipes_struct *p, struct samr_DomInfo1 *dominfo = NULL; struct userPwdChangeFailureInformation *reject = NULL; uint32_t tmp; + char *rhost; + int rc; DEBUG(5,("_samr_ChangePasswordUser3: %d\n", __LINE__)); @@ -1962,13 +1997,27 @@ NTSTATUS _samr_ChangePasswordUser3(struct pipes_struct *p, return NT_STATUS_NO_MEMORY; } + rc = get_remote_hostname(p->remote_address, + &rhost, + talloc_tos()); + if (rc < 0) { + return NT_STATUS_NO_MEMORY; + } + if (strequal(rhost,"UNKNOWN")) { + rhost = tsocket_address_inet_addr_string(p->remote_address, + talloc_tos()); + if (rhost == NULL) { + return NT_STATUS_NO_MEMORY; + } + } + /* * UNIX username case mangling not required, pass_oem_change * is case insensitive. */ status = pass_oem_change(user_name, - p->client_id->name, + rhost, r->in.lm_password->data, r->in.lm_verifier->hash, r->in.nt_password->data, @@ -5004,6 +5053,8 @@ NTSTATUS _samr_SetUserInfo(struct pipes_struct *p, uint32_t acc_required = 0; uint32_t fields = 0; bool ret; + char *rhost; + int rc; DEBUG(5,("_samr_SetUserInfo: %d\n", __LINE__)); @@ -5086,6 +5137,20 @@ NTSTATUS _samr_SetUserInfo(struct pipes_struct *p, return NT_STATUS_NO_SUCH_USER; } + rc = get_remote_hostname(p->remote_address, + &rhost, + talloc_tos()); + if (rc < 0) { + return NT_STATUS_NO_MEMORY; + } + if (strequal(rhost,"UNKNOWN")) { + rhost = tsocket_address_inet_addr_string(p->remote_address, + talloc_tos()); + if (rhost == NULL) { + return NT_STATUS_NO_MEMORY; + } + } + /* ================ BEGIN Privilege BLOCK ================ */ become_root(); @@ -5185,7 +5250,7 @@ NTSTATUS _samr_SetUserInfo(struct pipes_struct *p, status = set_user_info_23(p->mem_ctx, &info->info23, - p->client_id->name, + rhost, pwd); break; @@ -5200,7 +5265,7 @@ NTSTATUS _samr_SetUserInfo(struct pipes_struct *p, dump_data(100, info->info24.password.data, 516); status = set_user_info_24(p->mem_ctx, - p->client_id->name, + rhost, &info->info24, pwd); break; @@ -5215,7 +5280,7 @@ NTSTATUS _samr_SetUserInfo(struct pipes_struct *p, dump_data(100, info->info25.password.data, 532); status = set_user_info_25(p->mem_ctx, - p->client_id->name, + rhost, &info->info25, pwd); break; @@ -5230,7 +5295,7 @@ NTSTATUS _samr_SetUserInfo(struct pipes_struct *p, dump_data(100, info->info26.password.data, 516); status = set_user_info_26(p->mem_ctx, - p->client_id->name, + rhost, &info->info26, pwd); break; |