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/winbindd/wb_fill_pwent.c | 5 ++++- source3/winbindd/winbindd_cache.c | 2 +- source3/winbindd/winbindd_pam.c | 4 +++- source3/winbindd/winbindd_util.c | 7 +++++-- 4 files changed, 13 insertions(+), 5 deletions(-) (limited to 'source3/winbindd') diff --git a/source3/winbindd/wb_fill_pwent.c b/source3/winbindd/wb_fill_pwent.c index a716245ce8..62b1b4a189 100644 --- a/source3/winbindd/wb_fill_pwent.c +++ b/source3/winbindd/wb_fill_pwent.c @@ -111,7 +111,10 @@ static void wb_fill_pwent_sid2gid_done(struct tevent_req *subreq) /* Username */ fstrcpy(user_name, state->info->acct_name); - strlower_m(user_name); + if (!strlower_m(user_name)) { + tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); + return; + } status = normalize_name_map(state, domain, user_name, &mapped_name); /* Basic removal of whitespace */ diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index cfa843424a..2c9dd4a9b3 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -1868,7 +1868,7 @@ static NTSTATUS name_to_sid(struct winbindd_domain *domain, if (!strupper_m(discard_const_p(char, domain_name))) { return NT_STATUS_INVALID_PARAMETER; } - strlower_m(discard_const_p(char, name)); + (void)strlower_m(discard_const_p(char, name)); wcache_save_sid_to_name(domain, status, sid, domain_name, name, *type); } } diff --git a/source3/winbindd/winbindd_pam.c b/source3/winbindd/winbindd_pam.c index 48bb79bdcd..d8febe6a5c 100644 --- a/source3/winbindd/winbindd_pam.c +++ b/source3/winbindd/winbindd_pam.c @@ -217,7 +217,9 @@ static NTSTATUS append_afs_token(TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } - strlower_m(afsname); + if (!strlower_m(afsname)) { + return NT_STATUS_INVALID_PARAMETER; + } DEBUG(10, ("Generating token for user %s\n", afsname)); diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c index 656735633b..c36ae0bb0a 100644 --- a/source3/winbindd/winbindd_util.c +++ b/source3/winbindd/winbindd_util.c @@ -931,7 +931,7 @@ void fill_domain_username(fstring name, const char *domain, const char *user, bo fstring tmp_user; fstrcpy(tmp_user, user); - strlower_m(tmp_user); + (void)strlower_m(tmp_user); if (can_assume && assume_domain(domain)) { strlcpy(name, tmp_user, sizeof(fstring)); @@ -954,7 +954,10 @@ char *fill_domain_username_talloc(TALLOC_CTX *mem_ctx, char *tmp_user, *name; tmp_user = talloc_strdup(mem_ctx, user); - strlower_m(tmp_user); + if (!strlower_m(tmp_user)) { + TALLOC_FREE(tmp_user); + return NULL; + } if (can_assume && assume_domain(domain)) { name = tmp_user; -- cgit