File: patch-alpha-64bits.diff

package info (click to toggle)
queso 0.980922b-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 212 kB
  • ctags: 107
  • sloc: ansic: 964; sh: 152; makefile: 69
file content (328 lines) | stat: -rw-r--r-- 9,225 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
Only in queso-0.980922-alpha/: build
diff -u queso-0.980922/config.status queso-0.980922-alpha/config.status
--- queso-0.980922/config.status	Sun Dec 13 20:48:39 1998
+++ queso-0.980922-alpha/config.status	Sun Dec 13 20:51:59 1998
@@ -2,7 +2,7 @@
 # Generated automatically by configure.
 # Run this file to recreate the current configuration.
 # This directory was configured as follows,
-# on host ezili:
+# on host emperor:
 #
 # ./configure  --prefix=
 #
Common subdirectories: queso-0.980922/debian and queso-0.980922-alpha/debian
diff -u queso-0.980922/queso.c queso-0.980922-alpha/queso.c
--- queso-0.980922/queso.c	Tue Sep 22 22:35:43 1998
+++ queso-0.980922-alpha/queso.c	Sun Dec 13 20:28:45 1998
@@ -58,19 +58,19 @@
 static char CFGFILE[255] = DFLT_CONFIG_FILE;
 
 /*------------- Prototiping -----------------*/
-void debugtcp (unsigned long, tcprec);
+void debugtcp (u_int32_t, tcprec);
 void usage (const char *);
 int checkos (struct sockaddr_in, short);
 
 /*------------- Print TCP HDR ---------------*/
 void
-debugtcp (unsigned long myseq, tcprec tcp)
+debugtcp (u_int32_t myseq, tcprec tcp)
 {
   fprintf (stderr, "%d->%d S:%1d A:%s%lX W:%04X U:%X F: ",
 	   ntohs (tcp.sport), ntohs (tcp.dport),
 	   (tcp.seqnum?1:0),
 	   tcp.acknum?"+":" ",
-	   (tcp.acknum?(unsigned long) ntohl (tcp.acknum)-myseq:0),
+	   (tcp.acknum?(u_int32_t) ntohl (tcp.acknum)-myseq:0),
 	   ntohs (tcp.window), ntohs (tcp.urgentptr));
 
   if (tcp.flags & URG)
@@ -142,12 +142,12 @@
 
 typedef struct
 {
-  unsigned short set;
-  unsigned long seq;
-  unsigned long ack;
-  unsigned short urg;
-  unsigned short win;
-  unsigned short flag;
+  u_int16_t set;
+  u_int32_t seq;
+  u_int32_t ack;
+  u_int16_t urg;
+  u_int16_t win;
+  u_int16_t flag;
 }
 OSRES;
 
@@ -158,12 +158,12 @@
 {
   spoofrec spoof;
   tcprec tcp;
-  unsigned short start, s;
+  u_int16_t start, s;
   int n;
   long timeout;
   FILE *f;
   char line[1024];
-  unsigned long myseq;
+  u_int32_t myseq;
 #ifdef PCAP
   char fromtxt[16], desttxt[16];
   char bpftxt[4096];
@@ -284,8 +284,8 @@
   if ((f = fopen (CFGFILE, "r")))
     {
       char osname[256];		/* should be smaller than line[], 256 should suffice */
-      unsigned short flag1 = 0, found = 0, linez = 0;
-      unsigned short pn = 0, ps = 0, pa = 0, pw = 0, pf = 0, pu = 0;
+      u_int16_t flag1 = 0, found = 0, linez = 0;
+      u_int16_t pn = 0, ps = 0, pa = 0, pw = 0, pf = 0, pu = 0;
       char *p;
 
       while (fgets (line, sizeof (osname) - 1, f))
@@ -516,13 +516,13 @@
 main (int argc, char *argv[])
 {
   struct sockaddr_in dest, from;
-  unsigned short port;
+  u_int16_t port;
   char *s, *p;
   int c;
   int accuracy;
   int limit = 0;
   int bits = 32;		/* single host */
-  unsigned long firsthost, lasthost, netmask, host;
+  u_int32_t firsthost, lasthost, netmask, host;
   
   /*
    * Unbuffer stdout and stderr
@@ -652,7 +652,13 @@
       }
     
     host = ntohl (dest.sin_addr.s_addr);
-    netmask = ~(0xFFFFFFFFL >> bits);
+    netmask = 0xFFFFFFFFL;
+    if(bits >= 1){
+       netmask >>= 1;
+       bits--;
+    }
+    netmask >>= bits;
+    netmask = ~netmask;
     /*-- WARNING: 32bit arquitectures have problems when bits==32 --*/
     firsthost = (host & netmask) + 1;
     lasthost = (host | ~(netmask)) - 1;
diff -u queso-0.980922/tcpip.c queso-0.980922-alpha/tcpip.c
--- queso-0.980922/tcpip.c	Tue Sep 22 22:35:43 1998
+++ queso-0.980922-alpha/tcpip.c	Sun Dec 13 21:03:06 1998
@@ -40,7 +40,7 @@
 typedef struct
   {
     struct in_addr addr;
-    unsigned long naddr;	/* netmask */
+    u_int32_t naddr;	/* netmask */
     interfacerec *iface;
   }
 routerec;
@@ -61,11 +61,11 @@
 #endif
 
 int sendsock, readsock;
-unsigned short ipident;
+u_int16_t ipident;
 
 /* This function will determine the checksum for a specific packet. Used by */
 /*  nearly EVERYTHING on the internet */
-unsigned short
+u_int16_t
 inet_checksum (void *addr, int len)
 {
   register int nleft = len;
@@ -106,16 +106,16 @@
   struct in_addr dest_address;
   unsigned char place_holder;
   unsigned char protocol;
-  unsigned short length;
+  u_int16_t length;
 } psuedohdr;
 
-unsigned short tcp_checksum(char *packet,
+u_int16_t tcp_checksum(char *packet,
                            int length,
                            struct in_addr source_address,
                            struct in_addr dest_address)
 {
   char *psuedo_packet;
-  unsigned short cksum;
+  u_int16_t cksum;
   
   psuedohdr.protocol = IPPROTO_TCP;
   psuedohdr.length = htons(length);
@@ -133,7 +133,7 @@
   memcpy((psuedo_packet + sizeof(psuedohdr)),
          packet,length);
   
-  cksum = inet_checksum((unsigned short *)psuedo_packet,(length + sizeof(psuedohdr)));
+  cksum = inet_checksum((u_int16_t *)psuedo_packet,(length + sizeof(psuedohdr)));
   free(psuedo_packet);
   return cksum;
 }
@@ -153,7 +153,7 @@
   memset (sa, 0, sizeof (struct sockaddr));
   sa->sin_family = AF_INET;
   sa->sin_addr.s_addr = inet_addr (host);
-  if ((long) inet_addr (host) == -1)
+  if ((int32_t) inet_addr (host) == -1)
     {
       ent = gethostbyname (host);
       if (ent != NULL)
@@ -173,7 +173,7 @@
 
 /* Sends a TCP packet */
 void
-sendtcp (spoofrec * spoof, unsigned short flags, short rep)
+sendtcp (spoofrec * spoof, u_int16_t flags, short rep)
 {
   struct tcphdr tcp;
   struct ip ip;
@@ -319,7 +319,7 @@
 /*-- Linux: Search out IP in Routing tables --*/
 /*-- Other: Return hostname ip ---------------*/
 struct in_addr
-getlocalip (unsigned long dest)
+getlocalip (u_int32_t dest)
 {
   static struct in_addr ina;
 #ifdef LINUX  /*---------------------------------------------- LINUX --*/
@@ -327,7 +327,7 @@
 
   for (i = 0; i < numroutes; i++)
     {
-      if ((dest & routes[i].naddr) == (unsigned long) routes[i].addr.s_addr)
+      if ((dest & routes[i].naddr) == (u_int32_t) routes[i].addr.s_addr)
         {
           return (routes[i].iface->addr);
         }
@@ -434,7 +434,7 @@
       else
         strcpy (iface, ptr);
       ptr = strtok (NULL, "\t ");       /* hack avoiding fscanf */
-      routes[i].addr.s_addr=(unsigned long)strtol(ptr,NULL,16);
+      routes[i].addr.s_addr=(u_int32_t)strtol(ptr,NULL,16);
       for (i1 = 0; i1 < 6; i1++)
         {
           ptr = strtok (NULL, "\t ");   /* ignore Gateway Flags RefCnt Use Metric */
@@ -443,7 +443,7 @@
         fputs ("Error parsing /proc/net/route\n", stderr);
         continue;
       }
-      routes[i].naddr=(unsigned long)strtol(ptr,NULL,16);   /* Netmask */
+      routes[i].naddr=(u_int32_t)strtol(ptr,NULL,16);   /* Netmask */
 
       found = 0;
       for (i1 = 0; i1 < numinterfaces; i1++)
diff -u queso-0.980922/tcpip.h queso-0.980922-alpha/tcpip.h
--- queso-0.980922/tcpip.h	Tue Sep 22 22:35:43 1998
+++ queso-0.980922-alpha/tcpip.h	Sun Dec 13 20:27:57 1998
@@ -4,12 +4,12 @@
   {
     unsigned char vh;
     unsigned char stype;
-    unsigned short length;
-    unsigned short ident;
-    unsigned short frag;
+    u_int16_t length;
+    u_int16_t ident;
+    u_int16_t frag;
     unsigned char ttl;
     unsigned char protocol;
-    unsigned short cksum;
+    u_int16_t cksum;
     struct in_addr sip;
     struct in_addr dip;
   }
@@ -17,15 +17,15 @@
 
 typedef struct
   {
-    unsigned short sport;
-    unsigned short dport;
-    unsigned long seqnum;
-    unsigned long acknum;
+    u_int16_t sport;
+    u_int16_t dport;
+    u_int32_t seqnum;
+    u_int32_t acknum;
     unsigned char txoff;
     unsigned char flags;
-    unsigned short window;
-    unsigned short cksum;
-    unsigned short urgentptr;
+    u_int16_t window;
+    u_int16_t cksum;
+    u_int16_t urgentptr;
   }
 tcprec;
 
@@ -35,7 +35,7 @@
     struct in_addr dip;
     unsigned char zero;
     unsigned char proto;
-    unsigned short tcplen;
+    u_int16_t tcplen;
   }
 tcpsrec;
 
@@ -43,12 +43,12 @@
   {
     unsigned char type;
     unsigned char code;
-    unsigned short cksum;
-    unsigned long zero;
+    u_int16_t cksum;
+    u_int32_t zero;
     iprec ip;
-    unsigned short sport;
-    unsigned short dport;
-    unsigned long seq;
+    u_int16_t sport;
+    u_int16_t dport;
+    u_int32_t seq;
   }
 icmprec;
 
@@ -67,23 +67,23 @@
   {
     struct sockaddr_in from;
     struct sockaddr_in dest;
-    unsigned short sport;
-    unsigned short dport;
-    unsigned long seq;
-    unsigned long ack;
+    u_int16_t sport;
+    u_int16_t dport;
+    u_int32_t seq;
+    u_int32_t ack;
   }
 spoofrec;
 
 /* -------------- Prototiping --------------- */
 void init_tcpip(void);
 int init_pcap(char*);
-unsigned short in_cksum (unsigned short *, int);  
+u_int16_t in_cksum (u_int16_t *, int);  
 void sendip (spoofrec *, char *, short, short *, short *, short);
-unsigned short tcpcksum (spoofrec *, char *, short);
+u_int16_t tcpcksum (spoofrec *, char *, short);
 short resolve_host (char *, struct sockaddr_in *);
 short gettcp (spoofrec *, tcprec *);
-void sendtcp (spoofrec *, unsigned short, short); 
-void sendicmp (spoofrec *, struct sockaddr_in *, unsigned short);
-struct in_addr getlocalip (unsigned long dest);
+void sendtcp (spoofrec *, u_int16_t, short); 
+void sendicmp (spoofrec *, struct sockaddr_in *, u_int16_t);
+struct in_addr getlocalip (u_int32_t dest);
 char *tcpip_id(void);