%PDF- %PDF-
| Direktori : /proc/self/root/lib/python3.6/site-packages/pyzor/__pycache__/ |
| Current File : //proc/self/root/lib/python3.6/site-packages/pyzor/__pycache__/server.cpython-36.pyc |
3
�2�^�= �
@ s" d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl
ZyddlZW n e
k
r| ddlZY nX ddlZddlZddlZddlZejjj� dd� ZG dd� dej�ZG dd� de�ZG d d
� d
eje�ZG dd� de�ZG d
d� deje�ZG dd� dej �Z!dS )a� Networked spam-signature detection server.
The server receives the request in the form of a RFC5321 message, and
responds with another RFC5321 message. Neither of these messages has a
body - all of the data is encapsulated in the headers.
The response headers will always include a "Code" header, which is a
HTTP-style response code, and a "Diag" header, which is a human-readable
message explaining the response code (typically this will be "OK").
Both the request and response headers always include a "PV" header, which
indicates the protocol version that is being used (in a major.minor format).
Both the requestion and response headers also always include a "Thread",
which uniquely identifies the request (this is a requirement of using UDP).
Responses to requests may arrive in any order, but the "Thread" header of
a response will always match the "Thread" header of the appropriate request.
Authenticated requests must also have "User", "Time" (timestamp), and "Sig"
(signature) headers.
� Nc G sH xBy| |� S t k
r> } z|jd tjkr.� W Y dd}~X qX qW dS )z*restart a system call interrupted by EINTRr N)�OSError�args�errnoZEINTR)�funcr �e� r �/usr/lib/python3.6/server.py�_eintr_retry/ s r c @ sB e Zd ZdZdZdZddd�Zdd� Zd d
� Zdd� Z d
d� Z
dS )�Serverz_The pyzord server. Handles incoming UDP connections in a single
thread and single process.i � Nc C s d|d krt jt_nt jt_tjd�| _tjd�| _|| _ t
| j dd�| _|| _|| _
i | _i | _| j� || _| jjd|� tjj| |tdd� y| j jt jt jd� W n6 tt jfk
r� } z| jjd |� W Y d d }~X nX | j� | j� tjtj| j � tjtj!| j"� d S )
N�:r Zpyzordzpyzord-usageZhandles_one_stepFzListening on %s)Zbind_and_activatez%Unable to set IPV6_V6ONLY to false %s)#�socketZAF_INET6r
Zaddress_familyZAF_INET�loggingZ getLogger�log� usage_log�database�getattr�one_step� passwd_fn� access_fn�accounts�acl�load_config� forwarder�debug�SocketServer� UDPServer�__init__�RequestHandlerZ
setsockoptZIPPROTO_IPV6ZIPV6_V6ONLY�AttributeError�errorZserver_bindZserver_activate�signal�SIGUSR1�reload_handler�SIGTERM�shutdown_handler)�self�addressr r r r r r r r r ? s0
zServer.__init__c C s( t jj| j�| _t jj| j| j�| _dS )z>Reads the configuration files and loads the accounts and ACLs.N)�pyzor�configZload_passwd_filer r Zload_access_filer r )r&