return NT_STATUS_OK;
}
+NTSTATUS cli_state_update_after_negprot(struct cli_state *cli)
+{
+ static const struct {
+ enum protocol_types proto;
+ const char *name;
+ } protos[] = {
+ {PROTOCOL_SMB3_11, "SMB3_11"},
+ {PROTOCOL_SMB3_10, "SMB3_10"},
+ {PROTOCOL_SMB3_02, "SMB3_02"},
+ {PROTOCOL_SMB3_00, "SMB3_00"},
+ {PROTOCOL_SMB2_24, "SMB2_24"},
+ {PROTOCOL_SMB2_22, "SMB2_22"},
+ {PROTOCOL_SMB2_10, "SMB2_10"},
+ {PROTOCOL_SMB2_02, "SMB2_02"},
+ {PROTOCOL_NT1, "NT1"},
+ {PROTOCOL_LANMAN2, "LANMAN2"},
+ {PROTOCOL_LANMAN1, "LANMAN1"},
+ {PROTOCOL_CORE, "CORE"},
+ {PROTOCOL_COREPLUS, "COREPLUS"},
+ {PROTOCOL_NONE, "NONE"},
+ {PROTOCOL_DEFAULT, "DEFAULT"},
+ };
+ enum protocol_types protocol;
+ const char *proto_name = NULL;
+ size_t i;
+
+ protocol = smbXcli_conn_protocol(cli->conn);
+
+ if (protocol >= PROTOCOL_SMB2_02) {
+ /* Ensure we ask for some initial credits. */
+ smb2cli_conn_set_max_credits(cli->conn, DEFAULT_SMB2_MAX_CREDITS);
+ }
+
+ for (i=0; i < ARRAY_SIZE(protos); i++) {
+ if (protos[i].proto == protocol) {
+ proto_name = protos[i].name;
+ break;
+ }
+ }
+
+ cli->server_os = talloc_asprintf(cli, "%s Server", proto_name);
+ if (cli->server_os == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ cli->server_type = talloc_asprintf(cli, "%s",
+ smbXcli_conn_remote_name(cli->conn));
+ if (cli->server_type == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ return NT_STATUS_OK;
+}
+
static NTSTATUS cli_state_update_after_sesssetup(struct cli_state *cli,
const char *native_os,
const char *native_lm,
return;
}
- if (smbXcli_conn_protocol(state->cli->conn) >= PROTOCOL_SMB2_02) {
- /* Ensure we ask for some initial credits. */
- smb2cli_conn_set_max_credits(state->cli->conn,
- DEFAULT_SMB2_MAX_CREDITS);
+ status = cli_state_update_after_negprot(state->cli);
+ if (tevent_req_nterror(req, status)) {
+ return;
}
tevent_req_done(req);