mirror of
https://github.com/cbeuw/Cloak.git
synced 2024-11-19 09:25:41 +00:00
Fix admin mode
This commit is contained in:
parent
0e08683828
commit
1099b558f1
@ -90,11 +90,13 @@ func makeRemoteConn(sta *client.State) (net.Conn, error) {
|
|||||||
|
|
||||||
func makeSession(sta *client.State) *mux.Session {
|
func makeSession(sta *client.State) *mux.Session {
|
||||||
log.Println("Attemtping to start a new session")
|
log.Println("Attemtping to start a new session")
|
||||||
|
if !sta.IsAdmin {
|
||||||
// sessionID is usergenerated. There shouldn't be a security concern because the scope of
|
// sessionID is usergenerated. There shouldn't be a security concern because the scope of
|
||||||
// sessionID is limited to its UID.
|
// sessionID is limited to its UID.
|
||||||
quad := make([]byte, 4)
|
quad := make([]byte, 4)
|
||||||
rand.Read(quad)
|
rand.Read(quad)
|
||||||
sta.SessionID = binary.BigEndian.Uint32(quad)
|
sta.SessionID = binary.BigEndian.Uint32(quad)
|
||||||
|
}
|
||||||
|
|
||||||
sta.UpdateIntervalKeys()
|
sta.UpdateIntervalKeys()
|
||||||
|
|
||||||
@ -208,6 +210,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if adminUID != nil {
|
if adminUID != nil {
|
||||||
|
sta.IsAdmin = true
|
||||||
sta.SessionID = 0
|
sta.SessionID = 0
|
||||||
sta.UID = adminUID
|
sta.UID = adminUID
|
||||||
sta.NumConn = 1
|
sta.NumConn = 1
|
||||||
|
@ -46,6 +46,7 @@ type State struct {
|
|||||||
SessionID uint32
|
SessionID uint32
|
||||||
UID []byte
|
UID []byte
|
||||||
staticPub crypto.PublicKey
|
staticPub crypto.PublicKey
|
||||||
|
IsAdmin bool
|
||||||
|
|
||||||
intervalDataM sync.Mutex
|
intervalDataM sync.Mutex
|
||||||
intervalData *tthIntervalKeys
|
intervalData *tthIntervalKeys
|
||||||
|
Loading…
Reference in New Issue
Block a user