diff options
author | Simo Sorce <idra@samba.org> | 2010-07-18 20:04:42 -0400 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2010-07-18 20:04:42 -0400 |
commit | 7e4de49bfceed18c81abf93703a61d0a22617a24 (patch) | |
tree | 37b74b75d0edcfe28ce4d9898c0889a74b262492 /source3/smbd | |
parent | 378e4d5b8d30733f0f28cc2bceb28d9b9b594707 (diff) | |
parent | 27aece72004a84a6e0b2e00987d8a362e307d1d8 (diff) | |
download | samba-7e4de49bfceed18c81abf93703a61d0a22617a24.tar.gz samba-7e4de49bfceed18c81abf93703a61d0a22617a24.tar.bz2 samba-7e4de49bfceed18c81abf93703a61d0a22617a24.zip |
Merge branch 'master' of ssh://git.samba.org/data/git/samba
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/aio.c | 29 | ||||
-rw-r--r-- | source3/smbd/sesssetup.c | 9 | ||||
-rw-r--r-- | source3/smbd/smb2_sesssetup.c | 35 |
3 files changed, 56 insertions, 17 deletions
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c index a5a0e44738..dbce120dc6 100644 --- a/source3/smbd/aio.c +++ b/source3/smbd/aio.c @@ -67,11 +67,17 @@ static void smbd_aio_signal_handler(struct tevent_context *ev_ctx, } -static void initialize_async_io_handler(void) +static bool initialize_async_io_handler(void) { + static bool tried_signal_setup = false; + if (aio_signal_event) { - return; + return true; + } + if (tried_signal_setup) { + return false; } + tried_signal_setup = true; aio_signal_event = tevent_add_signal(smbd_event_context(), smbd_event_context(), @@ -79,7 +85,8 @@ static void initialize_async_io_handler(void) smbd_aio_signal_handler, NULL); if (!aio_signal_event) { - exit_server("Failed to setup RT_SIGNAL_AIO handler"); + DEBUG(10, ("Failed to setup RT_SIGNAL_AIO handler\n")); + return false; } /* tevent supports 100 signal with SA_SIGINFO */ @@ -145,7 +152,9 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn, int ret; /* Ensure aio is initialized. */ - initialize_async_io_handler(); + if (!initialize_async_io_handler()) { + return NT_STATUS_RETRY; + } if (fsp->base_fsp != NULL) { /* No AIO on streams yet */ @@ -250,7 +259,9 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn, int ret; /* Ensure aio is initialized. */ - initialize_async_io_handler(); + if (!initialize_async_io_handler()) { + return NT_STATUS_RETRY; + } if (fsp->base_fsp != NULL) { /* No AIO on streams yet */ @@ -382,7 +393,9 @@ NTSTATUS schedule_smb2_aio_read(connection_struct *conn, int ret; /* Ensure aio is initialized. */ - initialize_async_io_handler(); + if (!initialize_async_io_handler()) { + return NT_STATUS_RETRY; + } if (fsp->base_fsp != NULL) { /* No AIO on streams yet */ @@ -478,7 +491,9 @@ NTSTATUS schedule_aio_smb2_write(connection_struct *conn, int ret; /* Ensure aio is initialized. */ - initialize_async_io_handler(); + if (!initialize_async_io_handler()) { + return NT_STATUS_RETRY; + } if (fsp->base_fsp != NULL) { /* No AIO on streams yet */ diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c index 80a5239de3..52fcd282a6 100644 --- a/source3/smbd/sesssetup.c +++ b/source3/smbd/sesssetup.c @@ -41,10 +41,13 @@ struct pending_auth_data { on a logon error possibly map the error to success if "map to guest" is set approriately */ -static NTSTATUS do_map_to_guest(NTSTATUS status, - struct auth_serversupplied_info **server_info, - const char *user, const char *domain) +NTSTATUS do_map_to_guest(NTSTATUS status, + struct auth_serversupplied_info **server_info, + const char *user, const char *domain) { + user = user ? user : ""; + domain = domain ? domain : ""; + if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) { if ((lp_map_to_guest() == MAP_TO_GUEST_ON_BAD_USER) || (lp_map_to_guest() == MAP_TO_GUEST_ON_BAD_PASSWORD)) { diff --git a/source3/smbd/smb2_sesssetup.c b/source3/smbd/smb2_sesssetup.c index 6586a45439..493e74802d 100644 --- a/source3/smbd/smb2_sesssetup.c +++ b/source3/smbd/smb2_sesssetup.c @@ -143,6 +143,26 @@ static int smbd_smb2_session_destructor(struct smbd_smb2_session *session) return 0; } +static NTSTATUS setup_ntlmssp_server_info(struct smbd_smb2_session *session, + NTSTATUS status) +{ + if (NT_STATUS_IS_OK(status)) { + status = auth_ntlmssp_server_info(session, + session->auth_ntlmssp_state, + &session->server_info); + } else { + /* Note that this server_info won't have a session + * key. But for map to guest, that's exactly the right + * thing - we can't reasonably guess the key the + * client wants, as the password was wrong */ + status = do_map_to_guest(status, + &session->server_info, + auth_ntlmssp_get_username(session->auth_ntlmssp_state), + auth_ntlmssp_get_domain(session->auth_ntlmssp_state)); + } + return status; +} + #ifdef HAVE_KRB5 static NTSTATUS smbd_smb2_session_setup_krb5(struct smbd_smb2_session *session, struct smbd_smb2_request *smb2req, @@ -615,13 +635,6 @@ static NTSTATUS smbd_smb2_common_ntlmssp_auth_return(struct smbd_smb2_session *s uint64_t *out_session_id) { fstring tmp; - NTSTATUS status = auth_ntlmssp_server_info(session, session->auth_ntlmssp_state, - &session->server_info); - if (!NT_STATUS_IS_OK(status)) { - auth_ntlmssp_end(&session->auth_ntlmssp_state); - TALLOC_FREE(session); - return status; - } if ((in_security_mode & SMB2_NEGOTIATE_SIGNING_REQUIRED) || lp_server_signing() == Required) { @@ -775,6 +788,11 @@ static NTSTATUS smbd_smb2_spnego_auth(struct smbd_smb2_session *session, &auth_out); if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { + status = setup_ntlmssp_server_info(session, status); + } + + if (!NT_STATUS_IS_OK(status) && + !NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { auth_ntlmssp_end(&session->auth_ntlmssp_state); data_blob_free(&auth); TALLOC_FREE(session); @@ -850,6 +868,9 @@ static NTSTATUS smbd_smb2_raw_ntlmssp_auth(struct smbd_smb2_session *session, *out_session_id = session->vuid; return status; } + + status = setup_ntlmssp_server_info(session, status); + if (!NT_STATUS_IS_OK(status)) { auth_ntlmssp_end(&session->auth_ntlmssp_state); TALLOC_FREE(session); |