struct loadparm_context *lp_ctx = NULL;
struct cli_credentials *creds = NULL;
const char *principal = NULL;
+ char *tmp = NULL;
+ char *p = NULL;
bool ok;
creds = cli_credentials_init(mem_ctx);
}
}
+ tmp = talloc_strdup(creds, username);
+ if (tmp == NULL) {
+ goto fail;
+ }
+ username = tmp;
+
+ /* allow for workgroups as part of the username */
+ if ((p = strchr_m(tmp, '\\')) ||
+ (p = strchr_m(tmp, '/')) ||
+ (p = strchr_m(tmp, *lp_winbind_separator()))) {
+ *p = 0;
+ username = p + 1;
+ domain = tmp;
+ }
+
principal = username;
username = cli_session_setup_get_account(creds, principal);
if (username == NULL) {
{
struct tevent_req *req, *subreq;
struct cli_session_setup_state *state;
- char *p;
- char *user2;
const char *dest_realm = NULL;
struct cli_credentials *creds = NULL;
uint16_t sec_mode = smb1cli_conn_server_security_mode(cli->conn);
tevent_req_set_cleanup_fn(req, cli_session_setup_cleanup);
- if (user) {
- user2 = talloc_strdup(state, user);
- } else {
- user2 = talloc_strdup(state, "");
- }
- if (user2 == NULL) {
- tevent_req_oom(req);
- return tevent_req_post(req, ev);
- }
-
- if (!workgroup) {
- workgroup = "";
- }
-
- /* allow for workgroups as part of the username */
- if ((p=strchr_m(user2,'\\')) || (p=strchr_m(user2,'/')) ||
- (p=strchr_m(user2,*lp_winbind_separator()))) {
- *p = 0;
- user = p+1;
- if (!strupper_m(user2)) {
- tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
- return tevent_req_post(req, ev);
- }
- workgroup = user2;
- }
-
/*
* dest_realm is only valid in the winbindd use case,
* where we also have the account in that realm.