summaryrefslogtreecommitdiffstats
path: root/source3/libsmb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-12-31 16:30:11 -0800
committerJeremy Allison <jra@samba.org>2008-12-31 16:30:11 -0800
commitbb23f5725f538d14b2ccec0463cfb1136be3ebd0 (patch)
tree392ffa5f6e85aa85ee05c7fbdd0dbeaee8aee5cc /source3/libsmb
parentd99aeed50f1221561d8d935777216d372a2a4a71 (diff)
downloadsamba-bb23f5725f538d14b2ccec0463cfb1136be3ebd0.tar.gz
samba-bb23f5725f538d14b2ccec0463cfb1136be3ebd0.tar.xz
samba-bb23f5725f538d14b2ccec0463cfb1136be3ebd0.zip
Fix more asprintf and "ignoring return code" warnings from gcc 4.3.
Jeremy.
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/passchange.c78
1 files changed, 52 insertions, 26 deletions
diff --git a/source3/libsmb/passchange.c b/source3/libsmb/passchange.c
index 2746a4681e..76b06088d6 100644
--- a/source3/libsmb/passchange.c
+++ b/source3/libsmb/passchange.c
@@ -38,8 +38,10 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
*err_str = NULL;
if(!resolve_name( remote_machine, &ss, 0x20)) {
- asprintf(err_str, "Unable to find an IP address for machine "
- "%s.\n", remote_machine);
+ if (asprintf(err_str, "Unable to find an IP address for machine "
+ "%s.\n", remote_machine) == -1) {
+ *err_str = NULL;
+ }
return NT_STATUS_UNSUCCESSFUL;
}
@@ -50,9 +52,11 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
result = cli_connect(cli, remote_machine, &ss);
if (!NT_STATUS_IS_OK(result)) {
- asprintf(err_str, "Unable to connect to SMB server on "
+ if (asprintf(err_str, "Unable to connect to SMB server on "
"machine %s. Error was : %s.\n",
- remote_machine, nt_errstr(result));
+ remote_machine, nt_errstr(result))==-1) {
+ *err_str = NULL;
+ }
cli_shutdown(cli);
return result;
}
@@ -61,9 +65,11 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
make_nmb_name(&called , remote_machine, 0x20);
if (!cli_session_request(cli, &calling, &called)) {
- asprintf(err_str, "machine %s rejected the session setup. "
+ if (asprintf(err_str, "machine %s rejected the session setup. "
"Error was : %s.\n",
- remote_machine, cli_errstr(cli) );
+ remote_machine, cli_errstr(cli)) == -1) {
+ *err_str = NULL;
+ }
result = cli_nt_error(cli);
cli_shutdown(cli);
return result;
@@ -74,9 +80,11 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
result = cli_negprot(cli);
if (!NT_STATUS_IS_OK(result)) {
- asprintf(err_str, "machine %s rejected the negotiate "
+ if (asprintf(err_str, "machine %s rejected the negotiate "
"protocol. Error was : %s.\n",
- remote_machine, nt_errstr(result));
+ remote_machine, nt_errstr(result)) == -1) {
+ *err_str = NULL;
+ }
result = cli_nt_error(cli);
cli_shutdown(cli);
return result;
@@ -97,8 +105,10 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
if (!NT_STATUS_EQUAL(result, NT_STATUS_PASSWORD_MUST_CHANGE) &&
!NT_STATUS_EQUAL(result, NT_STATUS_PASSWORD_EXPIRED)) {
- asprintf(err_str, "Could not connect to machine %s: "
- "%s\n", remote_machine, cli_errstr(cli));
+ if (asprintf(err_str, "Could not connect to machine %s: "
+ "%s\n", remote_machine, cli_errstr(cli)) == -1) {
+ *err_str = NULL;
+ }
cli_shutdown(cli);
return result;
}
@@ -114,9 +124,11 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
result = cli_session_setup(cli, "", "", 0, "", 0, "");
if (!NT_STATUS_IS_OK(result)) {
- asprintf(err_str, "machine %s rejected the session "
+ if (asprintf(err_str, "machine %s rejected the session "
"setup. Error was : %s.\n",
- remote_machine, cli_errstr(cli) );
+ remote_machine, cli_errstr(cli)) == -1) {
+ *err_str = NULL;
+ }
cli_shutdown(cli);
return result;
}
@@ -127,9 +139,11 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
}
if (!cli_send_tconX(cli, "IPC$", "IPC", "", 1)) {
- asprintf(err_str, "machine %s rejected the tconX on the IPC$ "
+ if (asprintf(err_str, "machine %s rejected the tconX on the IPC$ "
"share. Error was : %s.\n",
- remote_machine, cli_errstr(cli) );
+ remote_machine, cli_errstr(cli)) == -1) {
+ *err_str = NULL;
+ }
result = cli_nt_error(cli);
cli_shutdown(cli);
return result;
@@ -162,18 +176,22 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
if (lp_client_lanman_auth()) {
/* Use the old RAP method. */
if (!cli_oem_change_password(cli, user_name, new_passwd, old_passwd)) {
- asprintf(err_str, "machine %s rejected the "
+ if (asprintf(err_str, "machine %s rejected the "
"password change: Error was : %s.\n",
- remote_machine, cli_errstr(cli) );
+ remote_machine, cli_errstr(cli)) == -1) {
+ *err_str = NULL;
+ }
result = cli_nt_error(cli);
cli_shutdown(cli);
return result;
}
} else {
- asprintf(err_str, "SAMR connection to machine %s "
+ if (asprintf(err_str, "SAMR connection to machine %s "
"failed. Error was %s, but LANMAN password "
"changed are disabled\n",
- nt_errstr(result), remote_machine);
+ nt_errstr(result), remote_machine) == -1) {
+ *err_str = NULL;
+ }
result = cli_nt_error(cli);
cli_shutdown(cli);
return result;
@@ -191,9 +209,11 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
|| NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))) {
/* it failed, but for reasons such as wrong password, too short etc ... */
- asprintf(err_str, "machine %s rejected the password change: "
+ if (asprintf(err_str, "machine %s rejected the password change: "
"Error was : %s.\n",
- remote_machine, get_friendly_nt_error_msg(result));
+ remote_machine, get_friendly_nt_error_msg(result)) == -1) {
+ *err_str = NULL;
+ }
cli_shutdown(cli);
return result;
}
@@ -222,10 +242,12 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
|| NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))) {
/* it failed, but again it was due to things like new password too short */
- asprintf(err_str, "machine %s rejected the "
+ if (asprintf(err_str, "machine %s rejected the "
"(anonymous) password change: Error was : "
"%s.\n", remote_machine,
- get_friendly_nt_error_msg(result));
+ get_friendly_nt_error_msg(result)) == -1) {
+ *err_str = NULL;
+ }
cli_shutdown(cli);
return result;
}
@@ -241,17 +263,21 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
cli_shutdown(cli);
return NT_STATUS_OK;
}
- asprintf(err_str, "machine %s rejected the password "
+ if (asprintf(err_str, "machine %s rejected the password "
"change: Error was : %s.\n",
- remote_machine, cli_errstr(cli) );
+ remote_machine, cli_errstr(cli)) == -1) {
+ *err_str = NULL;
+ }
result = cli_nt_error(cli);
cli_shutdown(cli);
return result;
} else {
- asprintf(err_str, "SAMR connection to machine %s "
+ if (asprintf(err_str, "SAMR connection to machine %s "
"failed. Error was %s, but LANMAN password "
"changed are disabled\n",
- nt_errstr(result), remote_machine);
+ nt_errstr(result), remote_machine) == -1) {
+ *err_str = NULL;
+ }
cli_shutdown(cli);
return NT_STATUS_UNSUCCESSFUL;
}