summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/helsinki.at/rhimport/core.go4
-rw-r--r--src/helsinki.at/rhimportd/ctrlTelnet.go2
-rw-r--r--src/helsinki.at/rhimportd/ctrlWebSimple.go9
-rw-r--r--src/helsinki.at/rhimportd/ctrlWebSocket.go3
4 files changed, 10 insertions, 8 deletions
diff --git a/src/helsinki.at/rhimport/core.go b/src/helsinki.at/rhimport/core.go
index 9927be9..986327b 100644
--- a/src/helsinki.at/rhimport/core.go
+++ b/src/helsinki.at/rhimport/core.go
@@ -86,11 +86,11 @@ type Context struct {
Cancel <-chan bool
}
-func NewContext(conf *Config, rddb *RdDbChan, user string) *Context {
+func NewContext(conf *Config, rddb *RdDbChan) *Context {
ctx := new(Context)
ctx.conf = conf
ctx.rddb = rddb
- ctx.UserName = user
+ ctx.UserName = ""
ctx.Password = ""
ctx.Trusted = false
ctx.ShowId = 0
diff --git a/src/helsinki.at/rhimportd/ctrlTelnet.go b/src/helsinki.at/rhimportd/ctrlTelnet.go
index 3b703dd..da117f3 100644
--- a/src/helsinki.at/rhimportd/ctrlTelnet.go
+++ b/src/helsinki.at/rhimportd/ctrlTelnet.go
@@ -153,7 +153,7 @@ func telnetSet(c *telgo.Client, args []string, conf *rhimport.Config, rddb *rhim
var ctx *rhimport.Context
if c.UserData == nil {
- c.UserData = rhimport.NewContext(conf, rddb, "")
+ c.UserData = rhimport.NewContext(conf, rddb)
ctx = c.UserData.(*rhimport.Context)
ctx.Trusted = false
} else {
diff --git a/src/helsinki.at/rhimportd/ctrlWebSimple.go b/src/helsinki.at/rhimportd/ctrlWebSimple.go
index 9a408ed..61daf0a 100644
--- a/src/helsinki.at/rhimportd/ctrlWebSimple.go
+++ b/src/helsinki.at/rhimportd/ctrlWebSimple.go
@@ -99,12 +99,13 @@ func webSimpleParseRequest(conf *rhimport.Config, rddb *rhimport.RdDbChan, trust
return
}
- username := reqdata.UserName
+ ctx = rhimport.NewContext(conf, rddb)
if trusted {
- username = r.Header.Get("X-Forwarded-User")
+ ctx.UserName = r.Header.Get("X-Forwarded-User")
+ } else {
+ ctx.UserName = reqdata.UserName
+ ctx.Password = reqdata.Password
}
- ctx = rhimport.NewContext(conf, rddb, username)
- ctx.Password = reqdata.Password
ctx.Trusted = trusted
ctx.ShowId = reqdata.ShowId
ctx.ClearShowCarts = reqdata.ClearShowCarts
diff --git a/src/helsinki.at/rhimportd/ctrlWebSocket.go b/src/helsinki.at/rhimportd/ctrlWebSocket.go
index 2345db7..5e970a1 100644
--- a/src/helsinki.at/rhimportd/ctrlWebSocket.go
+++ b/src/helsinki.at/rhimportd/ctrlWebSocket.go
@@ -193,7 +193,8 @@ func webSocketDone(res rhimport.Result, userdata interface{}) bool {
}
func (self *webSocketSession) startNewSession(reqdata *webSocketRequestData, conf *rhimport.Config, sessions *rhimport.SessionStoreChan) (int, string) {
- ctx := rhimport.NewContext(conf, nil, reqdata.UserName)
+ ctx := rhimport.NewContext(conf, nil)
+ ctx.UserName = reqdata.UserName
ctx.Password = reqdata.Password
ctx.Trusted = false
ctx.ShowId = reqdata.ShowId