diff options
author | Jeremy Allison <jra@samba.org> | 2010-11-09 12:07:25 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2010-11-10 01:14:17 +0000 |
commit | 9997ee813b8ceeb7016355bbc07651db7f6b2d5a (patch) | |
tree | a82115ab85000f85e26aca4edd94d4f237c0619c /source3/rpc_server | |
parent | 692a7477dd3b1a40df58de09a02754dbaecb07d6 (diff) | |
download | samba-9997ee813b8ceeb7016355bbc07651db7f6b2d5a.tar.gz samba-9997ee813b8ceeb7016355bbc07651db7f6b2d5a.tar.bz2 samba-9997ee813b8ceeb7016355bbc07651db7f6b2d5a.zip |
Remove fstring from map_username. Create a more sane interface than the called-parameter-is-modified.
Jeremy.
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/srv_samr_nt.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c index a04584e7c1..116d529025 100644 --- a/source3/rpc_server/srv_samr_nt.c +++ b/source3/rpc_server/srv_samr_nt.c @@ -1933,12 +1933,14 @@ NTSTATUS _samr_ChangePasswordUser2(struct pipes_struct *p, struct samr_ChangePasswordUser2 *r) { NTSTATUS status; - fstring user_name; + char *user_name = NULL; fstring wks; DEBUG(5,("_samr_ChangePasswordUser2: %d\n", __LINE__)); - fstrcpy(user_name, r->in.account->string); + if (!r->in.account->string) { + return NT_STATUS_INVALID_PARAMETER; + } fstrcpy(wks, r->in.server->string); DEBUG(5,("_samr_ChangePasswordUser2: user: %s wks: %s\n", user_name, wks)); @@ -1948,7 +1950,10 @@ NTSTATUS _samr_ChangePasswordUser2(struct pipes_struct *p, * function. */ - (void)map_username(user_name); + (void)map_username(talloc_tos(), r->in.account->string, &user_name); + if (!user_name) { + return NT_STATUS_NO_MEMORY; + } /* * UNIX username case mangling not required, pass_oem_change @@ -1980,12 +1985,14 @@ NTSTATUS _samr_OemChangePasswordUser2(struct pipes_struct *p, struct samr_OemChangePasswordUser2 *r) { NTSTATUS status; - fstring user_name; + char *user_name = NULL; const char *wks = NULL; DEBUG(5,("_samr_OemChangePasswordUser2: %d\n", __LINE__)); - fstrcpy(user_name, r->in.account->string); + if (!r->in.account->string) { + return NT_STATUS_INVALID_PARAMETER; + } if (r->in.server && r->in.server->string) { wks = r->in.server->string; } @@ -1997,7 +2004,10 @@ NTSTATUS _samr_OemChangePasswordUser2(struct pipes_struct *p, * function. */ - (void)map_username(user_name); + (void)map_username(talloc_tos(), r->in.account->string, &user_name); + if (!user_name) { + return NT_STATUS_NO_MEMORY; + } /* * UNIX username case mangling not required, pass_oem_change @@ -2033,7 +2043,7 @@ NTSTATUS _samr_ChangePasswordUser3(struct pipes_struct *p, struct samr_ChangePasswordUser3 *r) { NTSTATUS status; - fstring user_name; + char *user_name = NULL; const char *wks = NULL; enum samPwdChangeReason reject_reason; struct samr_DomInfo1 *dominfo = NULL; @@ -2042,7 +2052,9 @@ NTSTATUS _samr_ChangePasswordUser3(struct pipes_struct *p, DEBUG(5,("_samr_ChangePasswordUser3: %d\n", __LINE__)); - fstrcpy(user_name, r->in.account->string); + if (!r->in.account->string) { + return NT_STATUS_INVALID_PARAMETER; + } if (r->in.server && r->in.server->string) { wks = r->in.server->string; } @@ -2054,7 +2066,10 @@ NTSTATUS _samr_ChangePasswordUser3(struct pipes_struct *p, * function. */ - (void)map_username(user_name); + (void)map_username(talloc_tos(), r->in.account->string, &user_name); + if (!user_name) { + return NT_STATUS_NO_MEMORY; + } /* * UNIX username case mangling not required, pass_oem_change |