MCPcopy Create free account
hub / github.com/3proxy/3proxy / readcommand

Function readcommand

src/smtpp.c:45–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45int readcommand (struct clientparam* param) {
46 unsigned char * buf;
47 int res, i, bufsize = 320;
48 int ret = 1;
49
50 if(!(buf = myalloc(bufsize))) return 0;
51 i = sockgetlinebuf(param, CLIENT, buf, bufsize-1, '\n', conf.timeouts[STRING_L]);
52 if(i < 4) return 0;
53#ifndef WITHMAIN
54 if(!strncasecmp((char *)buf, "MAIL", 4) || !strncasecmp((char *)buf, "RCPT", 4) || !strncasecmp((char *)buf, "STARTTLS", 8) || !strncasecmp((char *)buf, "TURN", 4)){
55 res = handlehdrfilterscli(param, &buf, &bufsize, 0, &i);
56 if(res != PASS) {
57 myfree(buf);
58 if(res == HANDLED) return 2;
59 return -1;
60 }
61 }
62#endif
63 socksend(param->remsock, buf, i, conf.timeouts[STRING_S]);
64 myfree(buf);
65 if(!strncasecmp((char *)buf, "STARTTLS", 8) || !strncasecmp((char *)buf, "TURN", 4)){
66 ret = 22;
67 }
68 return ret;
69}
70
71int readdata (struct clientparam* param) {
72 unsigned char * buf;

Callers 1

smtppchildFunction · 0.85

Calls 5

myallocFunction · 0.85
sockgetlinebufFunction · 0.85
handlehdrfilterscliFunction · 0.85
myfreeFunction · 0.85
socksendFunction · 0.85

Tested by

no test coverage detected