From ea2fa33f6564389240c4b414e27065a4a01dcfbc Mon Sep 17 00:00:00 2001 From: Herb Lewis Date: Thu, 12 Nov 1998 23:49:32 +0000 Subject: Removed code that used printf/fprintf in password changin libraries. Now passes strings instead. (This used to be commit 48af29bcc9e8094de6ba057a52dbae3c80ea7a05) --- source3/libsmb/passchange.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'source3/libsmb/passchange.c') diff --git a/source3/libsmb/passchange.c b/source3/libsmb/passchange.c index 7d89cbd3d7..4cca1927fa 100644 --- a/source3/libsmb/passchange.c +++ b/source3/libsmb/passchange.c @@ -29,14 +29,15 @@ extern pstring scope; change a password on a remote machine using IPC calls *************************************************************/ BOOL remote_password_change(const char *remote_machine, const char *user_name, - const char *old_passwd, const char *new_passwd) + const char *old_passwd, const char *new_passwd, + char *err_str, size_t err_str_len) { struct nmb_name calling, called; struct cli_state cli; struct in_addr ip; if(!resolve_name( remote_machine, &ip, 0x20)) { - fprintf(stderr, "unable to find an IP address for machine %s.\n", + slprintf(err_str, err_str_len-1, "unable to find an IP address for machine %s.\n", remote_machine ); return False; } @@ -44,7 +45,7 @@ BOOL remote_password_change(const char *remote_machine, const char *user_name, ZERO_STRUCT(cli); if (!cli_initialise(&cli) || !cli_connect(&cli, remote_machine, &ip)) { - fprintf(stderr, "unable to connect to SMB server on machine %s. Error was : %s.\n", + slprintf(err_str, err_str_len-1, "unable to connect to SMB server on machine %s. Error was : %s.\n", remote_machine, cli_errstr(&cli) ); return False; } @@ -53,7 +54,7 @@ BOOL remote_password_change(const char *remote_machine, const char *user_name, make_nmb_name(&called , remote_machine, 0x20, scope); if (!cli_session_request(&cli, &calling, &called)) { - fprintf(stderr, "machine %s rejected the session setup. Error was : %s.\n", + slprintf(err_str, err_str_len-1, "machine %s rejected the session setup. Error was : %s.\n", remote_machine, cli_errstr(&cli) ); cli_shutdown(&cli); return False; @@ -62,7 +63,7 @@ BOOL remote_password_change(const char *remote_machine, const char *user_name, cli.protocol = PROTOCOL_NT1; if (!cli_negprot(&cli)) { - fprintf(stderr, "machine %s rejected the negotiate protocol. Error was : %s.\n", + slprintf(err_str, err_str_len-1, "machine %s rejected the negotiate protocol. Error was : %s.\n", remote_machine, cli_errstr(&cli) ); cli_shutdown(&cli); return False; @@ -75,21 +76,21 @@ BOOL remote_password_change(const char *remote_machine, const char *user_name, */ if (!cli_session_setup(&cli, "", "", 0, "", 0, "")) { - fprintf(stderr, "machine %s rejected the session setup. Error was : %s.\n", + slprintf(err_str, err_str_len-1, "machine %s rejected the session setup. Error was : %s.\n", remote_machine, cli_errstr(&cli) ); cli_shutdown(&cli); return False; } if (!cli_send_tconX(&cli, "IPC$", "IPC", "", 1)) { - fprintf(stderr, "machine %s rejected the tconX on the IPC$ share. Error was : %s.\n", + slprintf(err_str, err_str_len-1, "machine %s rejected the tconX on the IPC$ share. Error was : %s.\n", remote_machine, cli_errstr(&cli) ); cli_shutdown(&cli); return False; } if(!cli_oem_change_password(&cli, user_name, new_passwd, old_passwd)) { - fprintf(stderr, "machine %s rejected the password change: Error was : %s.\n", + slprintf(err_str, err_str_len-1, "machine %s rejected the password change: Error was : %s.\n", remote_machine, cli_errstr(&cli) ); cli_shutdown(&cli); return False; -- cgit