2014-04-22 2 views
0

postfix tcp_table 조회 인터페이스에 대해 자세히 배우고 이해하고 있으며 회신 형식이 정확히 무엇인지 이해하는 데 어려움을 겪고 있습니다.postfix tcp_table 조회 형식

요청/반환 형식이

XXX SPACE *text* NEWLINE 

이다 명확한 문서가 있지만 텍스트이거나 할 수있는 것을 나에게 정말 불분명하다. 누군가 좀 더 자세히 설명해 줄 수 있습니까?

답변

1

다음 python 스크립트 (간단한 tcp 서버)는받은 데이터에 대해 REJECT User is blacklisted을 반환합니다.

import SocketServer 

class MyTCPHandler(SocketServer.BaseRequestHandler): 
    def handle(self): 
    self.data = self.request.recv(1024).strip() 
    print "{} wrote:".format(self.client_address[0]) 
    print self.data 
    # reply data 
    data = '200 REJECT%20User%20is%20blacklisted\n' 
    self.request.send(data) 

if __name__ == "__main__": 
    HOST, PORT = "localhost", 9999 
    server = SocketServer.TCPServer((HOST, PORT), MyTCPHandler) 
    server.serve_forever() 

서버를 시작한 후, 당신은 그래서 text 어떤 사람이 읽을 수 description.It를 반환 문자열이 당신이 당신의 access 표에 sepcify 같은 text입니다

[[email protected] ~]$ postmap -q [email protected] tcp:localhost:9999 
REJECT User is blacklisted 

으로이를 조회 할 수 있습니다. 예 : [email protected] REJECT You are blacklisted