~ubuntu-branches/ubuntu/hardy/openswan/hardy-updates

« back to all changes in this revision

Viewing changes to programs/lwdnsq/lwdnsq.c

  • Committer: Bazaar Package Importer
  • Author(s): Rene Mayrhofer
  • Date: 2005-01-27 16:10:11 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050127161011-idgybmyz3vwhpfiq
Tags: 2.3.0-2
Urgency HIGH due to security issue and problems with build-deps in sarge.
* Fix the security issue. Please see
  http://www.idefense.com/application/poi/display?id=190&
      type=vulnerabilities&flashstatus=false
  for more details. Thanks to Martin Schulze for informing me about
  this issue.
  Closes: #292458: Openswan XAUTH/PAM Buffer Overflow Vulnerability
* Added a Build-Dependency to lynx.
  Closes: #291143: openswan: FTBFS: Missing build dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
 * for more details.
14
14
 */
15
15
 
16
 
char tncfg_c_version[] = "RCSID $Id: lwdnsq.c,v 1.16 2003/12/02 04:34:09 mcr Exp $";
 
16
char tncfg_c_version[] = "RCSID $Id: lwdnsq.c,v 1.19 2004/12/02 06:16:19 mcr Exp $";
17
17
 
18
18
 
19
19
#include <stdio.h>
26
26
#include <setjmp.h>
27
27
#include <ctype.h>
28
28
#include <signal.h>
 
29
#include <time.h>
29
30
 
30
31
#include <isc/lang.h>
31
32
#include <isc/magic.h>
42
43
 
43
44
#include "lwdnsq.h"
44
45
 
 
46
FILE *cmdlog = NULL;
 
47
 
 
48
extern int EF_DISABLE_BANNER;
 
49
extern int EF_ALIGNMENT;
 
50
extern int EF_PROTECT_BELOW;
 
51
extern int EF_PROTECT_FREE;
 
52
extern int EF_ALLOW_MALLOC_0;
 
53
extern int EF_FREE_WIPES;
 
54
 
 
55
 
45
56
static void
46
57
usage(char *name)
47
58
{       
48
 
        fprintf(stdout,"%s --attach --virtual <virtual-device> --physical <physical-device>\n",
49
 
                name);
 
59
        fprintf(stdout,"%s\n", name);
50
60
        exit(1);
51
61
}
52
62
 
55
65
        {"prompt", 0, 0, 'i'},
56
66
        {"serial", 0, 0, 's'},
57
67
        {"debug",  0, 0, 'g'},
 
68
        {"log",    1, 0, 'l'},
58
69
        {"regress",0, 0, 'X'},
59
70
        {"ignoreeof",0, 0, 'Z'},
60
71
        {0, 0, 0, 0}
127
138
                {NULL,        NULL}};
128
139
        const struct cmd_entry *ce = cmds;
129
140
 
 
141
        if(cmdlog != NULL) {
 
142
                fprintf(cmdlog, "%lu|%s\n", time(NULL), cmdline);
 
143
                fflush(cmdlog);
 
144
        }
 
145
 
130
146
        argc=0;
131
147
        
132
148
        /* skip initial spaces */
222
238
        int c;
223
239
        static int ignoreeof=0;  /* static to avoid longjmp clobber */
224
240
        int ineof;
 
241
        char *logfilename=NULL;
225
242
 
226
243
        memset(&gs, 0, sizeof(dnskey_glob));
227
244
 
230
247
        sleep(60);
231
248
#endif
232
249
 
 
250
#ifdef EFENCE
 
251
        EF_DISABLE_BANNER=1;
 
252
        /* EF_ALIGNMENT=4; */
 
253
        EF_PROTECT_BELOW=1;
 
254
        EF_PROTECT_FREE=1;
 
255
        /* EF_ALLOW_MALLOC_0; */
 
256
        EF_FREE_WIPES=1;
 
257
#endif
 
258
 
 
259
        { 
 
260
                        FILE *newerr;
 
261
                        newerr = fopen("/var/tmp/lwdnsq.log", "a+");
 
262
                        if(newerr) {
 
263
                                close(2);
 
264
                                dup2(fileno(newerr), 2);
 
265
                                fclose(newerr);
 
266
                        }
 
267
                        fprintf(stderr, "stderr capture started\n");
 
268
                        setbuf(stderr, NULL);
 
269
        }
 
270
 
 
271
 
233
272
        program_name = argv[0];
234
273
        gs.concurrent = 1;
235
274
 
248
287
                exit(5);
249
288
        }
250
289
 
251
 
        while((c = getopt_long_only(argc, argv, "dgsiXZ", longopts, 0)) != EOF) {
 
290
        while((c = getopt_long_only(argc, argv, "dgl:siXZ", longopts, 0)) != EOF) {
252
291
                switch(c) {
253
292
                case 'd':
254
293
                        gs.debug+=2;
 
294
                        logfilename="/var/tmp/lwdns.req.log";
255
295
                        break;
256
296
 
257
297
                case 'g':
258
298
                        gs.debug++;
259
299
                        break;
 
300
 
260
301
                case 's':
261
302
                        gs.concurrent=0;
262
303
                        break;
267
308
                        gs.regress++;
268
309
                        break;
269
310
 
 
311
                case 'l':
 
312
                        logfilename=optarg;
 
313
                        break;
 
314
 
270
315
                case 'Z':
271
316
                        ignoreeof=1;
272
317
                        break;
285
330
                gs.prompt=1;
286
331
        }
287
332
 
 
333
        if(logfilename != NULL) {
 
334
          cmdlog = fopen(logfilename, "w");
 
335
          if(cmdlog == NULL) {
 
336
            fprintf(stderr, "Can not open %s: %s\n", logfilename, strerror(errno));
 
337
          }
 
338
        }
 
339
 
288
340
        /* do various bits of setup */
289
341
        if(setjmp(getMeOut)!=0) {
290
342
                signal(SIGINT,  SIG_DFL);
492
544
        
493
545
/*
494
546
 * $Log: lwdnsq.c,v $
 
547
 * Revision 1.19  2004/12/02 06:16:19  mcr
 
548
 *      fixed long standing bug with async resolver when there was
 
549
 *      more than one outstanding request.
 
550
 *
 
551
 * Revision 1.18  2004/11/25 18:16:47  mcr
 
552
 *      make sure to actually open the log file.
 
553
 *
 
554
 * Revision 1.17  2004/11/24 01:36:10  mcr
 
555
 *      if debugging is on, then log all requests that are sent,
 
556
 *      so that we can later replay, looking for bugs.
 
557
 *
495
558
 * Revision 1.16  2003/12/02 04:34:09  mcr
496
559
 *      if lwresd does not start early enough, then the request is
497
560
 *      lost and never retransmitted. This version can now deal with