static NTSTATUS make_new_session_info_guest(struct auth_session_info **session_info, struct auth_serversupplied_info **server_info) { static const char zeros[16] = {0}; const char *guest_account = lp_guestaccount(); const char *domain = lp_netbios_name(); struct netr_SamInfo3 info3; TALLOC_CTX *tmp_ctx; NTSTATUS status; tmp_ctx = talloc_stackframe(); if (tmp_ctx == NULL) { return NT_STATUS_NO_MEMORY; } ZERO_STRUCT(info3); status = get_guest_info3(tmp_ctx, &info3); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("get_guest_info3 failed with %s\n", nt_errstr(status))); goto done; } status = make_server_info_info3(tmp_ctx, guest_account, domain, server_info, &info3); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("make_server_info_info3 failed with %s\n", nt_errstr(status))); goto done; } (*server_info)->guest = true; /* This should not be done here (we should produce a server * info, and later construct a session info from it), but for * now this does not change the previous behavior */ status = create_local_token(tmp_ctx, *server_info, NULL, (*server_info)->info3->base.account_name.string, session_info); if (!NT_STATUS_IS_OK(status)) { DEBUG(0, ("create_local_token failed: %s\n", nt_errstr(status))); goto done; } talloc_steal(NULL, *session_info); talloc_steal(NULL, *server_info); /* annoying, but the Guest really does have a session key, and it is all zeros! */ (*session_info)->session_key = data_blob(zeros, sizeof(zeros)); status = NT_STATUS_OK; done: TALLOC_FREE(tmp_ctx); return status; }
static NTSTATUS make_new_server_info_guest(struct auth_serversupplied_info **server_info) { static const char zeros[16] = {0}; const char *guest_account = lp_guestaccount(); const char *domain = global_myname(); struct netr_SamInfo3 info3; TALLOC_CTX *tmp_ctx; NTSTATUS status; fstring tmp; tmp_ctx = talloc_stackframe(); if (tmp_ctx == NULL) { return NT_STATUS_NO_MEMORY; } ZERO_STRUCT(info3); status = get_guest_info3(tmp_ctx, &info3); if (!NT_STATUS_IS_OK(status)) { goto done; } status = make_server_info_info3(tmp_ctx, guest_account, domain, server_info, &info3); if (!NT_STATUS_IS_OK(status)) { goto done; } (*server_info)->guest = True; status = create_local_token(*server_info); if (!NT_STATUS_IS_OK(status)) { DEBUG(10, ("create_local_token failed: %s\n", nt_errstr(status))); goto done; } /* annoying, but the Guest really does have a session key, and it is all zeros! */ (*server_info)->user_session_key = data_blob(zeros, sizeof(zeros)); (*server_info)->lm_session_key = data_blob(zeros, sizeof(zeros)); alpha_strcpy(tmp, (*server_info)->info3->base.account_name.string, ". _-$", sizeof(tmp)); (*server_info)->sanitized_username = talloc_strdup(*server_info, tmp); status = NT_STATUS_OK; done: TALLOC_FREE(tmp_ctx); return status; }