func ntlmClientSession(c *config.Configuration, creds auth.Creds) (ntlm.ClientSession, error) { if c.NtlmSession != nil { return c.NtlmSession, nil } splits := strings.Split(creds["username"], "\\") if len(splits) != 2 { errorMessage := fmt.Sprintf("Your user name must be of the form DOMAIN\\user. It is currently %s", creds["username"]) return nil, errors.New(errorMessage) } session, err := ntlm.CreateClientSession(ntlm.Version2, ntlm.ConnectionOrientedMode) if err != nil { return nil, err } session.SetUserInfo(splits[1], creds["password"], strings.ToUpper(splits[0])) c.NtlmSession = session return session, nil }