~ubuntu-branches/ubuntu/karmic/edbrowse/karmic

« back to all changes in this revision

Viewing changes to fetchmail.c

  • Committer: Bazaar Package Importer
  • Author(s): Kapil Hari Paranjape
  • Date: 2007-05-09 07:33:04 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070509073304-ywptg9g6iiitsg17
Tags: 3.2.1-1
* New upstream version (3.2.1). Closes: #421451.
  - can fetch and execute a local javascript file
    if required by local html file.
  - provide COPYING and CHANGES files.
* debian/rules:
  - add CHANGES to dh_installchangelogs line.
  - add dh_installman entry to install the man page.
* debian/copyright: updated to include the COPYING file.
* debian/edbrowse.1: added a basic man page.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 */
8
8
 
9
9
#include "eb.h"
10
 
#include "tcp.h"
11
10
 
12
11
#define MHLINE 120              /* length of a mail header line */
13
12
#define BAD64 1
41
40
static struct MHINFO *lastMailInfo;
42
41
static char *lastMailText;
43
42
#define MAXIPBLACK 3000
44
 
static long ipblacklist[MAXIPBLACK];
45
 
static unsigned long ipblackmask[MAXIPBLACK];
 
43
static IP32bit ipblacklist[MAXIPBLACK];
 
44
static IP32bit ipblackmask[MAXIPBLACK];
46
45
static bool ipblackcomp[MAXIPBLACK];
47
46
static int nipblack;
48
47
 
66
65
        while(isspaceByte(*s))
67
66
            ++s;
68
67
        if(isdigitByte(*s)) {
69
 
            long ip;
70
 
            unsigned long ipmask;
 
68
            IP32bit ip;
 
69
            IP32bit ipmask;
71
70
            char dotstop = 0;
72
71
            char *q = strpbrk(s, "/!");
73
72
            if(q)
86
85
                            dotstop = '!';
87
86
                    }
88
87
                    if(bits > 0 && bits < 32) {
89
 
                        static const unsigned long masklist[] = {
 
88
                        static const IP32bit masklist[] = {
90
89
                            0xffffffff, 0xfeffffff, 0xfcffffff, 0xf8ffffff,
91
90
                            0xf0ffffff, 0xe0ffffff, 0xc0ffffff, 0x80ffffff,
92
91
                            0x00ffffff, 0x00feffff, 0x00fcffff, 0x00f8ffff,
118
117
}                               /* loadBlacklist */
119
118
 
120
119
bool
121
 
onBlacklist1(long tip)
 
120
onBlacklist1(IP32bit tip)
122
121
{
123
 
    long blip;                  /* black ip */
124
 
    unsigned long mask;
 
122
    IP32bit blip;               /* black ip */
 
123
    IP32bit mask;
125
124
    int j;
126
125
    for(j = 0; j < nipblack; ++j) {
127
126
        bool comp = ipblackcomp[j];
140
139
static bool
141
140
onBlacklist(void)
142
141
{
143
 
    long *ipp = cw->iplist;
144
 
    long tip;                   /* test ip */
 
142
    IP32bit *ipp = cw->iplist;
 
143
    IP32bit tip;                /* test ip */
145
144
    if(!ipp)
146
145
        return false;
147
 
    while((tip = *ipp++) != -1)
 
146
    while((tip = *ipp++) != NULL_IP)
148
147
        if(onBlacklist1(tip))
149
148
            return true;
150
149
    return false;
356
355
            lastMailText = 0;
357
356
            if(sessionList[1].lw)
358
357
                cxQuit(1, 2);
 
358
            cs = 0;
359
359
            linesReset();
360
 
            cs = 0;
361
 
            cw = 0;
362
360
            cxSwitch(1, false);
363
361
/* Now grab the entire message */
364
362
            sprintf(serverLine, "retr %d%s", m, eol);
508
506
                                    puts(ipbFile ? "none" :
509
507
                                       "no blacklist file specified, feature disabled");
510
508
                            } else {
511
 
                                for(k = 0; (j = cw->iplist[k]) != -1; ++k) {
512
 
                                    puts(tcp_ip_dots(j));
 
509
                                IP32bit addr;
 
510
                                for(k = 0; (addr = cw->iplist[k]) != NULL_IP;
 
511
                                   ++k) {
 
512
                                    puts(tcp_ip_dots(addr));
513
513
                                    if(nipblack == MAXIPBLACK)
514
514
                                        continue;
515
 
                                    ipblacklist[nipblack] = j;
 
515
                                    ipblacklist[nipblack] = addr;
516
516
                                    ipblackmask[nipblack] = 0xffffffff;
517
517
                                    ipblackcomp[nipblack] = false;
518
518
                                    ++nipblack;
1102
1102
        *vr = 0;
1103
1103
        strcpy(w->reply, vl + 1);
1104
1104
    }
 
1105
/* get rid of (name) comment */
 
1106
    vl = strchr(w->reply, '(');
 
1107
    vr = strchr(w->reply, ')');
 
1108
    if(vl && vr && vl < vr) {
 
1109
        while(vl > w->reply && vl[-1] == ' ')
 
1110
            --vl;
 
1111
        *vl = 0;
 
1112
    }
1105
1113
/* no @ means it's not an email address */
1106
1114
    if(!strchr(w->reply, '@'))
1107
1115
        w->reply[0] = 0;