Ticket #1544: 0015-Log-the-ip-of-failed-auth-tries-in-error.log.patch

File 0015-Log-the-ip-of-failed-auth-tries-in-error.log.patch, 1.5 kB (added by stbuehler, 5 months ago)
  • a/src/http_auth.c

    old new  
    2929#include "log.h" 
    3030#include "http_auth.h" 
    3131#include "http_auth_digest.h" 
     32#include "inet_ntop_cache.h" 
    3233#include "stream.h" 
    3334 
    3435#ifdef USE_OPENSSL 
     
    862863 
    863864        /* password doesn't match */ 
    864865        if (http_auth_basic_password_compare(srv, p, req, username, realm->value, password, pw)) { 
    865                 log_error_write(srv, __FILE__, __LINE__, "sbb", "password doesn't match for", con->uri.path, username); 
     866                log_error_write(srv, __FILE__, __LINE__, "sbbss", "password doesn't match for ", con->uri.path, username, ", IP:", inet_ntop_cache_get_ip(srv, &(con->dst_addr))); 
    866867 
    867868                buffer_free(username); 
    868869                buffer_free(password); 
     
    11301131                } 
    11311132 
    11321133                log_error_write(srv, __FILE__, __LINE__, "sss", 
    1133                                 "digest: auth failed for", username, "wrong password"); 
     1134                                "digest: auth failed for ", username, ": wrong password, IP:", inet_ntop_cache_get_ip(srv, &(con->dst_addr))); 
    11341135 
    11351136                buffer_free(b); 
    11361137                return 0;