NTSTATUS smb2cli_session_create_channel(TALLOC_CTX *mem_ctx,
					struct smbXcli_session *session1,
					struct smbXcli_conn *conn,
					struct smbXcli_session **_session2)
{
	struct smbXcli_session *session2;

	if (session1->smb2->signing_key.length == 0) {
		return NT_STATUS_INVALID_PARAMETER_MIX;
	}

	if (conn == NULL) {
		return NT_STATUS_INVALID_PARAMETER_MIX;
	}

	session2 = talloc_zero(mem_ctx, struct smbXcli_session);
	if (session2 == NULL) {
		return NT_STATUS_NO_MEMORY;
	}
	session2->smb2 = talloc_reference(session2, session1->smb2);
	if (session2->smb2 == NULL) {
		talloc_free(session2);
		return NT_STATUS_NO_MEMORY;
	}

	talloc_set_destructor(session2, smbXcli_session_destructor);
	DLIST_ADD_END(conn->sessions, session2);
	session2->conn = conn;

	memcpy(session2->smb2_channel.preauth_sha512,
	       conn->smb2.preauth_sha512,
	       sizeof(session2->smb2_channel.preauth_sha512));

	*_session2 = session2;
	return NT_STATUS_OK;
}
NTSTATUS smb2cli_session_create_channel(TALLOC_CTX *mem_ctx,
					struct smbXcli_session *session1,
					struct smbXcli_conn *conn,
					struct smbXcli_session **_session2)
{
	struct smbXcli_session *session2;

	if (session1->smb2->signing_key.length == 0) {
		return NT_STATUS_INVALID_PARAMETER_MIX;
	}

	if (conn == NULL) {
		return NT_STATUS_INVALID_PARAMETER_MIX;
	}

	session2 = talloc_zero(mem_ctx, struct smbXcli_session);
	if (session2 == NULL) {
		return NT_STATUS_NO_MEMORY;
	}
	session2->smb2 = talloc_reference(session2, session1->smb2);
	if (session2->smb2 == NULL) {
		talloc_free(session2);
		return NT_STATUS_NO_MEMORY;
	}

	talloc_set_destructor(session2, smbXcli_session_destructor);
	DLIST_ADD_END(conn->sessions, session2);
	session2->conn = conn;

	memcpy(session2->smb2_channel.preauth_sha512,
	       conn->smb2.preauth_sha512,
	       sizeof(session2->smb2_channel.preauth_sha512));

	*_session2 = session2;
	return NT_STATUS_OK;
}