diff options
author | Luke Leighton <lkcl@samba.org> | 1999-06-24 18:58:08 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-06-24 18:58:08 +0000 |
commit | cae3620b2e8abbe35f0369a82d5461cb596475a3 (patch) | |
tree | 1f0e36b2a99fd2bb9cce280a0b35f4d3c17f9802 /source3/rpc_client | |
parent | 07afc549e2cde45e1c5b536cc03903fe8765902f (diff) | |
download | samba-cae3620b2e8abbe35f0369a82d5461cb596475a3.tar.gz samba-cae3620b2e8abbe35f0369a82d5461cb596475a3.tar.bz2 samba-cae3620b2e8abbe35f0369a82d5461cb596475a3.zip |
safe string error reporting functions (found a potential buffer overflow
of a pstrcpy into an fstring).
(This used to be commit ac0060443de800fec9042b69b299ff2e9128a31c)
Diffstat (limited to 'source3/rpc_client')
-rw-r--r-- | source3/rpc_client/cli_netlogon.c | 32 | ||||
-rw-r--r-- | source3/rpc_client/cli_svcctl.c | 5 |
2 files changed, 28 insertions, 9 deletions
diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c index e9a8582d10..d385011bac 100644 --- a/source3/rpc_client/cli_netlogon.c +++ b/source3/rpc_client/cli_netlogon.c @@ -571,8 +571,10 @@ to ourselves.\n", remote_machine)); } if (!cli_connect(&cli, remote_machine, &cli.dest_ip)) { + fstring errstr; + cli_safe_errstr(&cli, errstr, sizeof(errstr)); DEBUG(0,("modify_trust_password: unable to connect to SMB server on \ -machine %s. Error was : %s.\n", remote_machine, cli_errstr(&cli) )); +machine %s. Error was : %s.\n", remote_machine, errstr )); return False; } @@ -582,8 +584,10 @@ machine %s. Error was : %s.\n", remote_machine, cli_errstr(&cli) )); if (!cli_session_request(&cli, &calling, &called)) { + fstring errstr; + cli_safe_errstr(&cli, errstr, sizeof(errstr)); DEBUG(0,("modify_trust_password: machine %s rejected the session setup. \ -Error was : %s.\n", remote_machine, cli_errstr(&cli) )); +Error was : %s.\n", remote_machine, errstr )); cli_shutdown(&cli); return False; } @@ -591,8 +595,10 @@ Error was : %s.\n", remote_machine, cli_errstr(&cli) )); cli.protocol = PROTOCOL_NT1; if (!cli_negprot(&cli)) { + fstring errstr; + cli_safe_errstr(&cli, errstr, sizeof(errstr)); DEBUG(0,("modify_trust_password: machine %s rejected the negotiate protocol. \ -Error was : %s.\n", remote_machine, cli_errstr(&cli) )); +Error was : %s.\n", remote_machine, errstr )); cli_shutdown(&cli); return False; } @@ -608,8 +614,10 @@ Error was : %s.\n", remote_machine, cli_errstr(&cli) )); */ if (!cli_session_setup(&cli, "", "", 0, "", 0, "")) { + fstring errstr; + cli_safe_errstr(&cli, errstr, sizeof(errstr)); DEBUG(0,("modify_trust_password: machine %s rejected the session setup. \ -Error was : %s.\n", remote_machine, cli_errstr(&cli) )); +Error was : %s.\n", remote_machine, errstr )); cli_shutdown(&cli); return False; } @@ -622,8 +630,10 @@ Error was : %s.\n", remote_machine, cli_errstr(&cli) )); } if (!cli_send_tconX(&cli, "IPC$", "IPC", "", 1)) { + fstring errstr; + cli_safe_errstr(&cli, errstr, sizeof(errstr)); DEBUG(0,("modify_trust_password: machine %s rejected the tconX on the IPC$ share. \ -Error was : %s.\n", remote_machine, cli_errstr(&cli) )); +Error was : %s.\n", remote_machine, errstr )); cli_shutdown(&cli); return False; } @@ -634,8 +644,10 @@ Error was : %s.\n", remote_machine, cli_errstr(&cli) )); */ if(cli_nt_session_open(&cli, PIPE_NETLOGON, &nt_pipe_fnum) == False) { + fstring errstr; + cli_safe_errstr(&cli, errstr, sizeof(errstr)); DEBUG(0,("modify_trust_password: unable to open the domain client session to \ -machine %s. Error was : %s.\n", remote_machine, cli_errstr(&cli))); +machine %s. Error was : %s.\n", remote_machine, errstr )); cli_nt_session_close(&cli, nt_pipe_fnum); cli_ulogoff(&cli); cli_shutdown(&cli); @@ -644,8 +656,10 @@ machine %s. Error was : %s.\n", remote_machine, cli_errstr(&cli))); if(cli_nt_setup_creds(&cli, nt_pipe_fnum, cli.mach_acct, orig_trust_passwd_hash, sec_chan) == False) { + fstring errstr; + cli_safe_errstr(&cli, errstr, sizeof(errstr)); DEBUG(0,("modify_trust_password: unable to setup the PDC credentials to machine \ -%s. Error was : %s.\n", remote_machine, cli_errstr(&cli))); +%s. Error was : %s.\n", remote_machine, errstr )); cli_nt_session_close(&cli, nt_pipe_fnum); cli_ulogoff(&cli); cli_shutdown(&cli); @@ -653,9 +667,11 @@ machine %s. Error was : %s.\n", remote_machine, cli_errstr(&cli))); } if( cli_nt_srv_pwset( &cli, nt_pipe_fnum, new_trust_passwd_hash, sec_chan ) == False) { + fstring errstr; + cli_safe_errstr(&cli, errstr, sizeof(errstr)); DEBUG(0,("modify_trust_password: unable to change password for machine %s in domain \ %s to Domain controller %s. Error was %s.\n", global_myname, domain, remote_machine, - cli_errstr(&cli))); + errstr )); cli_nt_session_close(&cli, nt_pipe_fnum); cli_ulogoff(&cli); cli_shutdown(&cli); diff --git a/source3/rpc_client/cli_svcctl.c b/source3/rpc_client/cli_svcctl.c index ebf8c15dc4..5e8a3952a5 100644 --- a/source3/rpc_client/cli_svcctl.c +++ b/source3/rpc_client/cli_svcctl.c @@ -199,8 +199,11 @@ BOOL svc_enum_svcs(struct cli_state *cli, uint16 fnum, if (p && r_o.dos_status != 0) { + fstring errmsg; + smb_safe_err_msg(ERRDOS, r_o.dos_status, + errmsg, sizeof(errmsg)); /* report error code */ - DEBUG(0,("SVC_ENUM_SVCS_STATUS: %s\n", smb_err_msg(ERRDOS, r_o.dos_status))); + DEBUG(0,("SVC_ENUM_SVCS_STATUS: %s\n", errmsg)); p = r_o.dos_status == ERRmoredata; } |