add hostname to init packet

This commit is contained in:
sawka
2022-07-07 13:25:42 -07:00
parent 2652a3509b
commit eb880e024e
3 changed files with 3 additions and 1 deletions
+1
View File
@@ -387,6 +387,7 @@ type InitPacketType struct {
HomeDir string `json:"homedir,omitempty"`
Env []string `json:"env,omitempty"`
User string `json:"user,omitempty"`
HostName string `json:"hostname,omitempty"`
NotFound bool `json:"notfound,omitempty"`
UName string `json:"uname,omitempty"`
RemoteId string `json:"remoteid,omitempty"`
+1 -1
View File
@@ -41,7 +41,7 @@ func (m *MServer) ProcessCommandPacket(pk packet.CommandPacketType) {
cproc := m.ClientMap[ck]
m.Lock.Unlock()
if cproc == nil {
m.Sender.SendCmdError(ck, fmt.Errorf("no client proc for ck '%s'", ck))
m.Sender.SendCmdError(ck, fmt.Errorf("no client proc for ck '%s', pk=%s", ck, packet.AsString(pk)))
return
}
cproc.Input.SendPacket(pk)
+1
View File
@@ -1060,6 +1060,7 @@ func MakeInitPacket() *packet.InitPacketType {
if user, _ := user.Current(); user != nil {
initPacket.User = user.Username
}
initPacket.HostName, _ = os.Hostname()
return initPacket
}