1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

s4:smb_server: Use cli_credentials_init_server() for negprot

Signed-off-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Sep  7 13:22:26 UTC 2020 on sn-devel-184
This commit is contained in:
Andreas Schneider 2020-09-07 09:19:43 +02:00 committed by Stefan Metzmacher
parent 6c94ebf77f
commit 0b742ec6a0
2 changed files with 27 additions and 26 deletions

View File

@ -374,22 +374,22 @@ static void reply_nt1(struct smbsrv_request *req, uint16_t choice)
DATA_BLOB blob = data_blob_null; DATA_BLOB blob = data_blob_null;
const char *oid; const char *oid;
NTSTATUS nt_status; NTSTATUS nt_status;
server_credentials server_credentials =
= cli_credentials_init(req); cli_credentials_init_server(req, req->smb_conn->lp_ctx);
if (!server_credentials) { if (server_credentials == NULL) {
smbsrv_terminate_connection(req->smb_conn, "Failed to init server credentials\n"); DBG_DEBUG("Failed to obtain server credentials, "
return; "perhaps a standalone server?\n");
}
cli_credentials_set_conf(server_credentials, req->smb_conn->lp_ctx);
nt_status = cli_credentials_set_machine_account(server_credentials, req->smb_conn->lp_ctx);
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(10, ("Failed to obtain server credentials, perhaps a standalone server?: %s\n", nt_errstr(nt_status)));
/* /*
* We keep the server_credentials as anonymous * Create anon server credentials for for the
* this is required for the spoolss.notify test * spoolss.notify test.
*/ */
server_credentials = cli_credentials_init_anon(req);
if (server_credentials == NULL) {
smbsrv_terminate_connection(req->smb_conn,
"Failed to init server credentials\n");
return;
}
} }
nt_status = samba_server_gensec_start(req, nt_status = samba_server_gensec_start(req,

View File

@ -39,20 +39,21 @@ static NTSTATUS smb2srv_negprot_secblob(struct smb2srv_request *req, DATA_BLOB *
NTSTATUS nt_status; NTSTATUS nt_status;
struct cli_credentials *server_credentials; struct cli_credentials *server_credentials;
server_credentials = cli_credentials_init(req); server_credentials =
if (!server_credentials) { cli_credentials_init_server(req, req->smb_conn->lp_ctx);
smbsrv_terminate_connection(req->smb_conn, "Failed to init server credentials\n"); if (server_credentials == NULL) {
return NT_STATUS_NO_MEMORY; DBG_DEBUG("Failed to obtain server credentials, "
} "perhaps a standalone server?\n");
cli_credentials_set_conf(server_credentials, req->smb_conn->lp_ctx);
nt_status = cli_credentials_set_machine_account(server_credentials, req->smb_conn->lp_ctx);
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(10, ("Failed to obtain server credentials, perhaps a standalone server?: %s\n", nt_errstr(nt_status)));
/* /*
* We keep the server_credentials as anonymous * Create anon server credentials for for the
* this is required for the spoolss.notify test * spoolss.notify test.
*/ */
server_credentials = cli_credentials_init_anon(req);
if (server_credentials == NULL) {
smbsrv_terminate_connection(req->smb_conn,
"Failed to init server credentials\n");
return NT_STATUS_NO_MEMORY;
}
} }
req->smb_conn->negotiate.server_credentials = talloc_steal(req->smb_conn, server_credentials); req->smb_conn->negotiate.server_credentials = talloc_steal(req->smb_conn, server_credentials);