diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libsmb/passchange.c | 22 | ||||
-rw-r--r-- | source3/rpc_client/ndr.c | 2 | ||||
-rw-r--r-- | source3/utils/smbpasswd.c | 42 |
3 files changed, 33 insertions, 33 deletions
diff --git a/source3/libsmb/passchange.c b/source3/libsmb/passchange.c index c8a4406949..4c76234e0c 100644 --- a/source3/libsmb/passchange.c +++ b/source3/libsmb/passchange.c @@ -42,7 +42,7 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam "%s.\n", remote_machine); return NT_STATUS_UNSUCCESSFUL; } - + cli = cli_initialise(); if (!cli) { return NT_STATUS_NO_MEMORY; @@ -56,10 +56,10 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam cli_shutdown(cli); return result; } - + make_nmb_name(&calling, global_myname() , 0x0); make_nmb_name(&called , remote_machine, 0x20); - + if (!cli_session_request(cli, &calling, &called)) { asprintf(err_str, "machine %s rejected the session setup. " "Error was : %s.\n", @@ -68,7 +68,7 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam cli_shutdown(cli); return result; } - + cli->protocol = PROTOCOL_NT1; if (!cli_negprot(cli)) { @@ -79,7 +79,7 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam cli_shutdown(cli); return result; } - + /* Given things like SMB signing, restrict anonymous and the like, try an authenticated connection first */ result = cli_session_setup(cli, user_name, @@ -188,7 +188,7 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam } else if (!(NT_STATUS_EQUAL(result, NT_STATUS_ACCESS_DENIED) || 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: " "Error was : %s.\n", remote_machine, get_friendly_nt_error_msg(result)); @@ -198,12 +198,12 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam /* OK, that failed, so try again... */ TALLOC_FREE(pipe_hnd); - + /* Try anonymous NTLMSSP... */ cli_init_creds(cli, "", "", NULL); - + result = NT_STATUS_UNSUCCESSFUL; - + /* OK, this is ugly, but... try an anonymous pipe. */ result = cli_rpc_pipe_open_noauth(cli, &ndr_table_samr.syntax_id, &pipe_hnd); @@ -227,10 +227,10 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam cli_shutdown(cli); return result; } - + /* We have failed to change the user's password, and we think the server just might not support SAMR password changes, so fall back */ - + if (lp_client_lanman_auth()) { /* Use the old RAP method. */ if (cli_oem_change_password(cli, user_name, new_passwd, old_passwd)) { diff --git a/source3/rpc_client/ndr.c b/source3/rpc_client/ndr.c index c494cce848..72a33137a6 100644 --- a/source3/rpc_client/ndr.c +++ b/source3/rpc_client/ndr.c @@ -60,7 +60,7 @@ NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli, talloc_free(push); prs_init_empty( &r_ps, mem_ctx, UNMARSHALL ); - + status = rpc_api_pipe_req(cli, opnum, &q_ps, &r_ps); prs_mem_free( &q_ps ); diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c index 493a249bea..600fe52f0d 100644 --- a/source3/utils/smbpasswd.c +++ b/source3/utils/smbpasswd.c @@ -210,7 +210,7 @@ static char *prompt_for_new_password(bool stdin_get) fstring new_pw; ZERO_ARRAY(new_pw); - + p = get_pass("New SMB password:", stdin_get); fstrcpy(new_pw, p); @@ -254,7 +254,7 @@ static NTSTATUS password_change(const char *remote_mach, char *username, SAFE_FREE(err_str); return ret; } - + ret = local_password_change(username, local_flags, new_pw, &err_str, &msg_str); @@ -278,7 +278,7 @@ static bool store_ldap_admin_pw (char* pw) if (!secrets_init()) return False; - + return secrets_store_ldap_pw(lp_ldap_admin_dn(), pw); } @@ -316,7 +316,7 @@ static int process_root(int local_flags) DEBUG(0, ("Failed to open passdb!\n")); exit(1); } - + /* Ensure we have a SAM sid. */ get_global_sam_sid(); @@ -330,7 +330,7 @@ static int process_root(int local_flags) (remote_machine != NULL))) { usage(); } - + /* Only load interfaces if we are doing network operations. */ if (remote_machine) { @@ -386,19 +386,19 @@ static int process_root(int local_flags) exit(1); } } - + /* prepare uppercased and '$' terminated username */ slprintf(buf, sizeof(buf) - 1, "%s$", user_name); fstrcpy(user_name, buf); - + } else { - + if (remote_machine != NULL) { old_passwd = get_pass("Old SMB password:",stdin_passwd_get); } - + if (!(local_flags & LOCAL_SET_PASSWORD)) { - + /* * If we are trying to enable a user, first we need to find out * if they are using a modern version of the smbpasswd file that @@ -407,10 +407,10 @@ static int process_root(int local_flags) * password. If not (ie. they have a no stored password in the * smbpasswd file) then we need to prompt for a new password. */ - + if(local_flags & LOCAL_ENABLE_USER) { struct samu *sampass = NULL; - + sampass = samu_new( NULL ); if (!sampass) { fprintf(stderr, "talloc fail for struct samu.\n"); @@ -428,10 +428,10 @@ static int process_root(int local_flags) TALLOC_FREE(sampass); } } - + if((local_flags & LOCAL_SET_PASSWORD) && (new_passwd == NULL)) { new_passwd = prompt_for_new_password(stdin_passwd_get); - + if(!new_passwd) { fprintf(stderr, "Unable to get new password.\n"); exit(1); @@ -451,7 +451,7 @@ static int process_root(int local_flags) printf("Password changed for user %s on %s.\n", user_name, remote_machine ); } else if(!(local_flags & (LOCAL_ADD_USER|LOCAL_DISABLE_USER|LOCAL_ENABLE_USER|LOCAL_DELETE_USER|LOCAL_SET_NO_PASSWORD|LOCAL_SET_PASSWORD))) { struct samu *sampass = NULL; - + sampass = samu_new( NULL ); if (!sampass) { fprintf(stderr, "talloc fail for struct samu.\n"); @@ -507,7 +507,7 @@ static int process_nonroot(int local_flags) exit(1); } } - + /* * A non-root user is always setting a password * via a remote machine (even if that machine is @@ -523,13 +523,13 @@ static int process_nonroot(int local_flags) if (remote_machine != NULL) { old_pw = get_pass("Old SMB password:",stdin_passwd_get); } - + if (!new_passwd) { new_pw = prompt_for_new_password(stdin_passwd_get); } else new_pw = smb_xstrdup(new_passwd); - + if (!new_pw) { fprintf(stderr, "Unable to get new password.\n"); exit(1); @@ -561,7 +561,7 @@ int main(int argc, char **argv) TALLOC_CTX *frame = talloc_stackframe(); int local_flags = 0; int ret; - + AllowDebugChange = False; #if defined(HAVE_SET_AUTH_PARAMETERS) @@ -577,12 +577,12 @@ int main(int argc, char **argv) local_flags = process_options(argc, argv, local_flags); setup_logging("smbpasswd", True); - + /* * Set the machine NETBIOS name if not already * set from the config file. */ - + if (!init_names()) return 1; |