mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 14:50:55 +03:00
parse IP proxy header also if listening on UNIX domain socket
Fixes #867 Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -331,8 +331,12 @@ func (s *webDavServer) validateUser(user *dataprovider.User, r *http.Request, lo
|
||||
|
||||
func (s *webDavServer) checkRemoteAddress(r *http.Request) string {
|
||||
ipAddr := util.GetIPFromRemoteAddress(r.RemoteAddr)
|
||||
ip := net.ParseIP(ipAddr)
|
||||
if ip != nil {
|
||||
var ip net.IP
|
||||
isUnixSocket := filepath.IsAbs(s.binding.Address)
|
||||
if !isUnixSocket {
|
||||
ip = net.ParseIP(ipAddr)
|
||||
}
|
||||
if isUnixSocket || ip != nil {
|
||||
for _, allow := range s.binding.allowHeadersFrom {
|
||||
if allow(ip) {
|
||||
parsedIP := util.GetRealIP(r, s.binding.ClientIPProxyHeader, s.binding.ClientIPHeaderDepth)
|
||||
|
||||
Reference in New Issue
Block a user