summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-05-27 17:41:39 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-05-28 10:04:48 +0200
commitfe2a6076402ec26091eb0c543447e0ae09f39f75 (patch)
tree39c5694473d71b9297ac94f73c35c8893bba8e1c
parenta64262697afb85f8db5872238c51b9499114ee58 (diff)
downloadsamba-fe2a6076402ec26091eb0c543447e0ae09f39f75.tar.gz
samba-fe2a6076402ec26091eb0c543447e0ae09f39f75.tar.bz2
samba-fe2a6076402ec26091eb0c543447e0ae09f39f75.zip
s4:utils/ntlm_auth.c - fix "asprintf" calls
-rw-r--r--source4/utils/ntlm_auth.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/source4/utils/ntlm_auth.c b/source4/utils/ntlm_auth.c
index 17e724eb6a..9c6d3d321b 100644
--- a/source4/utils/ntlm_auth.c
+++ b/source4/utils/ntlm_auth.c
@@ -225,10 +225,11 @@ static NTSTATUS local_pw_check_specified(struct loadparm_context *lp_ctx,
if (NT_STATUS_IS_OK(nt_status)) {
if (unix_name) {
- asprintf(unix_name,
- "%s%c%s", domain,
- *lp_winbind_separator(lp_ctx),
- username);
+ if (asprintf(unix_name, "%s%c%s", domain,
+ *lp_winbind_separator(lp_ctx),
+ username) < 0) {
+ nt_status = NT_STATUS_NO_MEMORY;
+ }
}
} else {
DEBUG(3, ("Login for user [%s]\\[%s]@[%s] failed due to [%s]\n",
@@ -759,7 +760,7 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod
} else if (plaintext_password) {
/* handle this request as plaintext */
if (!full_username) {
- if (asprintf(&full_username, "%s%c%s", domain, *lp_winbind_separator(lp_ctx), username) == -1) {
+ if (asprintf(&full_username, "%s%c%s", domain, *lp_winbind_separator(lp_ctx), username) < 0) {
mux_printf(mux_id, "Error: Out of memory in asprintf!\n.\n");
return;
}
@@ -1169,7 +1170,11 @@ int main(int argc, const char **argv)
{
char *user;
- asprintf(&user, "%s%c%s", opt_domain, *lp_winbind_separator(cmdline_lp_ctx), opt_username);
+ if (asprintf(&user, "%s%c%s", opt_domain,
+ *lp_winbind_separator(cmdline_lp_ctx),
+ opt_username) < 0) {
+ return 1;
+ }
if (!check_plaintext_auth(user, opt_password, true)) {
return 1;
}