/[monit]/monit/http/engine.c
ViewVC logotype

Diff of /monit/http/engine.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.47 by martinp, Fri Sep 19 09:55:56 2003 UTC revision 1.48 by hauk, Fri Sep 19 22:07:47 2003 UTC
# Line 125  static pthread_mutex_t hostlist_mutex= P Line 125  static pthread_mutex_t hostlist_mutex= P
125    
126  static void check_Impl();  static void check_Impl();
127  static void initialize_service();  static void initialize_service();
128  static int  authenticate(Socket_T);  static int  authenticate(const char*);
129  static int  is_host_allow(const char *);  static int  is_host_allow(const char *);
130  static void destroy_host_allow(HostsAllow);  static void destroy_host_allow(HostsAllow);
131  static Socket_T socket_producer(int, int, void*);  static Socket_T socket_producer(int, int, void*);
# Line 189  void start_httpd(int port, int backlog, Line 189  void start_httpd(int port, int backlog,
189          continue;          continue;
190        }        }
191    
       if(! authenticate(S)) {  
         socket_free(&S);  
         continue;  
       }  
   
192        http_processor(S);        http_processor(S);
193                
194      }      }
# Line 201  void start_httpd(int port, int backlog, Line 196  void start_httpd(int port, int backlog,
196      if(S) {      if(S) {
197        socket_free(&S);        socket_free(&S);
198      }      }
199        
200      delete_ssl_server_socket(mySSLServerConnection);        delete_ssl_server_socket(mySSLServerConnection);  
201      close(myServerSocket);      close_socket(myServerSocket);
202    
203    }    }
204    
# Line 354  static void check_Impl() { Line 350  static void check_Impl() {
350   * FALSE. If allow Basic Authentication is defined in the Run.Auth   * FALSE. If allow Basic Authentication is defined in the Run.Auth
351   * object, authentication is delegated to the processor module.   * object, authentication is delegated to the processor module.
352   */   */
353  static int authenticate(Socket_T S) {  static int authenticate(const char *host) {
354    
355    if(is_host_allow(socket_get_remote_host(S))) {    if(is_host_allow(host)) {
356            
357      return TRUE;      return TRUE;
358            
# Line 367  static int authenticate(Socket_T S) { Line 363  static int authenticate(Socket_T S) {
363      return TRUE;      return TRUE;
364    
365    }    }
366    
367      log("%s: Denied connection from non-authorized client [%s]\n", prog, host);
368        
369    return FALSE;    return FALSE;
370    
# Line 446  static Socket_T socket_producer(int serv Line 444  static Socket_T socket_producer(int serv
444      goto error;      goto error;
445    }    }
446        
447        if(! authenticate(inet_ntoa(in.sin_addr))) {
448        goto error;
449      }
450    
451    
452    return socket_create_a(client, inet_ntoa(in.sin_addr), port, sslserver);    return socket_create_a(client, inet_ntoa(in.sin_addr), port, sslserver);
453    
454    error:    error:
455    close_socket(client);    close_socket(client);
     
456    return NULL;    return NULL;
457    
458  }  }

Legend:
Removed from v.1.47  
changed lines
  Added in v.1.48

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26