Главная страница


ru.unix

 
 - RU.UNIX ----------------------------------------------------------------------
 From : Roman Bondarev                       2:5020/400     28 Aug 2000  14:53:48
 To : All
 Subject : Re: qmail question
 -------------------------------------------------------------------------------- 
 
 On 28 Aug 2000 09:27:04 +0400, netch@carrier.kiev.ua (Valentin
 Nechayev) wrote:
 
 >>>Делись.;)
 >RB> Hе-е, я передумал. :) Он у меня пока в тестовом состоянии - дам вам, а
 >RB> он недоработан окажется. Все шишки на меня навешаете :).
 >Згя, батенька, згя. Я точно не буду шишек вешать - потому что Вы хоть
 >постарались, в отличие от.
 
 Лады. Hо предупреждаю, что это пока тестовая версия и еще многое
 недоделано(или переделано, в смысле, лишнее).
 Я пофиксил ситуацию, когда враппер закрывает сокет или smtp выдает,
 что-то отличное от '220 ...'. Ситуацию, когда выдается '4xx ..' на
 'MAIL FROM' или 'RCPT TO' (5xx - это уже не то), пока не сделан, но
 это уже не сложно, когда выясню, стоит ли это делать.
 Также пробую выяснить смысл файлика 'queue/lock/tcpto' и
 оптимизировать исходный код в main().
 Как и во всех открытых кодах, ненужное - удалить, нужное - дописать.
 ================================================================================
 ==============
 - --- qmail-remote.orig.c  Mon Jun 15 18:53:16 1998
 +++ qmail-remote.new.c Mon Aug 28 14:37:53 2000
 @@ -140,14 +140,15 @@
       if (!stralloc_append(&smtptext,ch)) temp_nomem();
  }
  
 -unsigned long smtpcode()
 +unsigned long smtpcode(cod)
 +char cod;
  {
    unsigned char ch;
    unsigned long code;
  
    if (!stralloc_copys(&smtptext,"")) temp_nomem();
  
 -  get(&ch); code = ch - '0';
 +  if(cod) ch=cod; else get(&ch); code = ch - '0';
    get(&ch); code = code * 10 + (ch - '0');
    get(&ch); code = code * 10 + (ch - '0');
    for (;;) {
 @@ -216,25 +217,26 @@
  
  stralloc recip = {0};
  
 -void smtp()
 +void smtp(cod)
 +unsigned char cod;
  {
    unsigned long code;
    int flagbother;
    int i;
   
 -  if (smtpcode() != 220) quit("ZConnected to "," but greeting
 failed");
 +  if (smtpcode(cod) != 220) quit("ZConnected to "," but greeting
 failed");
   
    substdio_puts(&smtpto,"HELO ");
    substdio_put(&smtpto,helohost.s,helohost.len);
    substdio_puts(&smtpto,"\r\n");
    substdio_flush(&smtpto);
 -  if (smtpcode() != 250) quit("ZConnected to "," but my name was
 rejected");
 +  if (smtpcode(0) != 250) quit("ZConnected to "," but my name was
 rejected");
   
    substdio_puts(&smtpto,"MAIL FROM:<");
    substdio_put(&smtpto,sender.s,sender.len);
    substdio_puts(&smtpto,">\r\n");
    substdio_flush(&smtpto);
 -  code = smtpcode();
 +  code = smtpcode(0);
    if (code >= 500) quit("DConnected to "," but sender was rejected");
    if (code >= 400) quit("ZConnected to "," but sender was rejected");
   
 @@ -244,7 +246,7 @@
      substdio_put(&smtpto,reciplist.sa[i].s,reciplist.sa[i].len);
      substdio_puts(&smtpto,">\r\n");
      substdio_flush(&smtpto);
 -    code = smtpcode();
 +    code = smtpcode(0);
      if (code >= 500) {
        out("h"); outhost(); out(" does not like recipient.\n");
        outsmtptext(); zero();
 @@ -261,12 +263,12 @@
    if (!flagbother) quit("DGiving up on ","");
   
    substdio_putsflush(&smtpto,"DATA\r\n");
 -  code = smtpcode();
 +  code = smtpcode(0);
    if (code >= 500) quit("D"," failed on DATA command");
    if (code >= 400) quit("Z"," failed on DATA command");
   
    blast();
 -  code = smtpcode();
 +  code = smtpcode(0);
    flagcritical = 0;
    if (code >= 500) quit("D"," failed after I sent the message");
    if (code >= 400) quit("Z"," failed after I sent the message");
 @@ -332,12 +334,14 @@
  {
    static ipalloc ip = {0};
    int i;
 +  int j;
    unsigned long random;
    char **recips;
    unsigned long prefme;
    int flagallaliases;
    int flagalias;
    char *relayhost;
 +  unsigned char cod;
   
    sig_pipeignore();
    if (argc < 4) perm_usage();
 @@ -392,32 +396,36 @@
   
    if (ip.len <= 0) perm_nomx();
   
 -  prefme = 100000;
 +  prefme = ip.ix[ip.len-1].pref+1;
    for (i = 0;i < ip.len;++i)
      if (ipme_is(&ip.ix[i].ip))
 -      if (ip.ix[i].pref < prefme)
 +      if (ip.ix[i].pref < prefme){
          prefme = ip.ix[i].pref;
 +  break;
 +  }
   
 +/*
    if (relayhost) prefme = 300000;
    if (flagallaliases) prefme = 500000;
   
    for (i = 0;i < ip.len;++i)
      if (ip.ix[i].pref < prefme)
        break;
 +*/
   
    if (i >= ip.len)
      perm_ambigmx();
   
 -  for (i = 0;i < ip.len;++i) if (ip.ix[i].pref < prefme) {
 -    if (tcpto(&ip.ix[i].ip)) continue;
 +  for (j = 0;j < i;++j){
 +    if (tcpto(&ip.ix[j].ip)) continue;
   
      smtpfd = socket(AF_INET,SOCK_STREAM,0);
      if (smtpfd == -1) temp_oserr();
   
 -    if (timeoutconn(smtpfd,&ip.ix[i].ip,(unsigned int)
 port,timeoutconnect) == 0) {
 -      tcpto_err(&ip.ix[i].ip,0);
 -      partner = ip.ix[i].ip;
 -      smtp(); /* does not return */
 +    if (timeoutconn(smtpfd,&ip.ix[j].ip,(unsigned int)
 port,timeoutconnect) == 0) {
 +      tcpto_err(&ip.ix[j].ip,0);
 +      partner = ip.ix[j].ip;
 +      if(timeoutread(timeout,smtpfd,&cod,1) > 0) smtp(cod);
      }
      tcpto_err(&ip.ix[i].ip,errno == error_timeout);
      close(smtpfd);
 ================================================================================
 ==
 -- 
 Best regards,
  Roman Bondarev                 mailto:pomah@kemsu.ru
 --- ifmail v.2.15dev5
  * Origin: ICK NetLab (2:5020/400)
 
 

Вернуться к списку тем, сортированных по: возрастание даты  уменьшение даты  тема  автор 

 Тема:    Автор:    Дата:  
 Re: qmail question   Roman Bondarev   23 Aug 2000 06:36:24 
 Re: qmail question   Roman Bondarev   23 Aug 2000 10:13:03 
 Re: qmail question   sales@gpz.fi   23 Aug 2000 12:55:52 
 Re: qmail question   Roman Bondarev   23 Aug 2000 16:18:38 
 Re: qmail question   Roman Bondarev   23 Aug 2000 16:33:31 
 Re: qmail question   Roman Bondarev   23 Aug 2000 16:29:20 
 Re: qmail question   Valentin Nechayev   23 Aug 2000 17:34:28 
 Re: qmail question   Roman Bondarev   24 Aug 2000 05:42:26 
 Re: qmail question   Roman Bondarev   24 Aug 2000 08:55:22 
 Re: qmail question   Roman Bondarev   24 Aug 2000 09:10:12 
 Re: qmail question   Roman Bondarev   25 Aug 2000 10:13:18 
 Re: qmail question   Roman Bondarev   25 Aug 2000 10:25:42 
 Re: qmail question   Valentin Nechayev   27 Aug 2000 20:55:58 
 Re: qmail question   Roman Bondarev   28 Aug 2000 07:15:52 
 Re: qmail question   Valentin Nechayev   28 Aug 2000 09:27:04 
 Re: qmail question   Roman Bondarev   28 Aug 2000 14:53:48 
 Re: qmail question   Roman Bondarev   30 Aug 2000 07:50:02 
 Re: qmail question   Valentin Nechayev   25 Aug 2000 16:00:39 
 Re: qmail question   Roman Bondarev   26 Aug 2000 12:12:16 
 Re: qmail question   Roman Bondarev   28 Aug 2000 06:49:28 
 Re: qmail question   Valentin Nechayev   28 Aug 2000 09:25:02 
Архивное /ru.unix/208050772ab0.html, оценка 2 из 5, голосов 10
Яндекс.Метрика
Valid HTML 4.01 Transitional