pkg/login-validator: fix compilation errors
This commit is contained in:
parent
11f9820006
commit
c69bd5c202
@ -157,13 +157,16 @@ func (l loginChecker) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
// Find corresponding MAC
|
// Find corresponding MAC
|
||||||
var fname string
|
var fname string
|
||||||
spl := strings.SplitN(remoteAddr, ":", 2)
|
spl := strings.SplitN(r.RemoteAddr, ":", 2)
|
||||||
if ip := net.ParseIP(spl[0]); ip == nil {
|
if ip := net.ParseIP(spl[0]); ip == nil {
|
||||||
return errors.New("Unable to parse given IPv4: " + spl[0])
|
http.Error(w, "Unable to parse given IPv4: " + spl[0], http.StatusInternalServerError)
|
||||||
|
return
|
||||||
} else if arptable, err := ARPAnalyze(); err != nil {
|
} else if arptable, err := ARPAnalyze(); err != nil {
|
||||||
return err
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
} else if arpent := ARPContainsIP(arptable, ip); arpent == nil {
|
} else if arpent := ARPContainsIP(arptable, ip); arpent == nil {
|
||||||
return errors.New("Unable to find MAC in ARP table")
|
http.Error(w, "Unable to find MAC in ARP table", http.StatusInternalServerError)
|
||||||
|
return
|
||||||
} else {
|
} else {
|
||||||
fname = fmt.Sprintf("%02x-%02x-%02x-%02x-%02x-%02x-%02x", arpent.HWType, arpent.HWAddress[0], arpent.HWAddress[1], arpent.HWAddress[2], arpent.HWAddress[3], arpent.HWAddress[4], arpent.HWAddress[5])
|
fname = fmt.Sprintf("%02x-%02x-%02x-%02x-%02x-%02x-%02x", arpent.HWType, arpent.HWAddress[0], arpent.HWAddress[1], arpent.HWAddress[2], arpent.HWAddress[3], arpent.HWAddress[4], arpent.HWAddress[5])
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user