login-validator: New parameter -just-login
This commit is contained in:
parent
a2a056f3ff
commit
d5a67e2bbb
@ -15,7 +15,10 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
var loginSalt string
|
||||
var (
|
||||
loginSalt string
|
||||
justLogin bool
|
||||
)
|
||||
|
||||
type loginChecker struct {
|
||||
students []Student
|
||||
@ -81,6 +84,12 @@ func (l loginChecker) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if justLogin {
|
||||
log.Println("Successful login of", lu.Username, "at", r.RemoteAddr)
|
||||
http.Error(w, "You're now successfully logged.", http.StatusOK)
|
||||
return
|
||||
}
|
||||
|
||||
// Find corresponding MAC
|
||||
var ip net.IP
|
||||
spl := strings.SplitN(r.RemoteAddr, ":", 2)
|
||||
|
@ -18,6 +18,8 @@ var tftpDir string
|
||||
func main() {
|
||||
var studentsFile string
|
||||
|
||||
flag.BoolVar(&justLogin, "just-login", justLogin, "Don't perform MAC assignation and remote registration")
|
||||
|
||||
var bind = flag.String("bind", ":8081", "Bind port/socket")
|
||||
flag.StringVar(&studentsFile, "students", "./students.csv", "Path to a CSV file containing students list")
|
||||
flag.StringVar(&ARPTable, "arp", ARPTable, "Path to ARP table")
|
||||
|
Reference in New Issue
Block a user