From b70f23c2b581c5d455362ab37f4846de9a910055 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 8 Aug 2012 17:01:00 -0700 Subject: Correctly check for errors in strlower_m() returns. --- source3/auth/auth_builtin.c | 4 +++- source3/auth/auth_util.c | 4 +++- source3/auth/pampass.c | 4 ++-- source3/auth/pass_check.c | 8 ++++++-- source3/auth/user_util.c | 4 +++- 5 files changed, 17 insertions(+), 7 deletions(-) (limited to 'source3/auth') diff --git a/source3/auth/auth_builtin.c b/source3/auth/auth_builtin.c index d61a0ec7bf..dce58bf8bf 100644 --- a/source3/auth/auth_builtin.c +++ b/source3/auth/auth_builtin.c @@ -103,7 +103,9 @@ static NTSTATUS check_name_to_ntstatus_security(const struct auth_context *auth_ return nt_status_string_to_code(user); } - strlower_m(user); + if (!strlower_m(user)) { + return NT_STATUS_INVALID_PARAMETER; + } error_num = strtoul(user, NULL, 16); DEBUG(5,("check_name_to_ntstatus_security: Error for user %s was %lx\n", user, error_num)); diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c index 28d934add3..a08d0945a5 100644 --- a/source3/auth/auth_util.c +++ b/source3/auth/auth_util.c @@ -1252,7 +1252,9 @@ static NTSTATUS check_account(TALLOC_CTX *mem_ctx, const char *domain, if (!lower_username) { return NT_STATUS_NO_MEMORY; } - strlower_m( lower_username ); + if (!strlower_m( lower_username )) { + return NT_STATUS_INVALID_PARAMETER; + } orig_dom_user = talloc_asprintf(mem_ctx, "%s%c%s", diff --git a/source3/auth/pampass.c b/source3/auth/pampass.c index 87fa8ca9fa..427c22a8ab 100644 --- a/source3/auth/pampass.c +++ b/source3/auth/pampass.c @@ -249,7 +249,7 @@ static struct chat_struct *make_pw_chat(const char *p) special_char_sub(prompt); fstrcpy(t->prompt, prompt); - strlower_m(t->prompt); + (void)strlower_m(t->prompt); trim_char(t->prompt, ' ', ' '); if (!next_token_talloc(frame, &p, &reply, NULL)) { @@ -262,7 +262,7 @@ static struct chat_struct *make_pw_chat(const char *p) special_char_sub(reply); fstrcpy(t->reply, reply); - strlower_m(t->reply); + (void)strlower_m(t->reply); trim_char(t->reply, ' ', ' '); } diff --git a/source3/auth/pass_check.c b/source3/auth/pass_check.c index ca99261678..f2d1fc241b 100644 --- a/source3/auth/pass_check.c +++ b/source3/auth/pass_check.c @@ -867,7 +867,9 @@ NTSTATUS pass_check(const struct passwd *pass, /* try all lowercase if it's currently all uppercase */ if (strhasupper(pass2)) { - strlower_m(pass2); + if (!strlower_m(pass2)) { + return NT_STATUS_INVALID_PARAMETER; + } nt_status = password_check(pass2, (const void *)rhost); if (NT_STATUS_IS_OK(nt_status)) { return (nt_status); @@ -880,7 +882,9 @@ NTSTATUS pass_check(const struct passwd *pass, } /* last chance - all combinations of up to level chars upper! */ - strlower_m(pass2); + if (!strlower_m(pass2)) { + return NT_STATUS_INVALID_PARAMETER; + } nt_status = string_combinations(pass2, password_check, level, (const void *)rhost); diff --git a/source3/auth/user_util.c b/source3/auth/user_util.c index 8938aeb003..4842192051 100644 --- a/source3/auth/user_util.c +++ b/source3/auth/user_util.c @@ -164,7 +164,9 @@ bool user_in_netgroup(TALLOC_CTX *ctx, const char *user, const char *ngname) if (!lowercase_user) { return false; } - strlower_m(lowercase_user); + if (!strlower_m(lowercase_user)) { + return false; + } if (strcmp(user,lowercase_user) == 0) { /* user name was already lower case! */ -- cgit