summaryrefslogtreecommitdiff
path: root/debian/patches/debian-changes
blob: f790ed02f141cf40358495b7a309e8acf5f8e507 (plain)
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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
Combined patches from git.
--- /dev/null
+++ ncbi-tools6-6.1.20170106/.gitignore
@@ -0,0 +1,6 @@
+bin
+build
+include
+lib
+shlib
+*-stamp
--- ncbi-tools6-6.1.20170106.orig/access/ent2api.c
+++ ncbi-tools6-6.1.20170106/access/ent2api.c
@@ -1273,7 +1273,7 @@ NLM_EXTERN CONN EntrezOpenConnection (
     *arg = '\0';
 
   return QUERY_OpenServiceQueryEx
-    (StringHasNoText (e2_service) ? "Entrez2" : e2_service, NULL, 30, arg);
+    (StringHasNoText (e2_service) ? "Entrez2s" : e2_service, NULL, 30, arg);
 }
 
 #ifdef OS_MAC
--- ncbi-tools6-6.1.20170106.orig/api/sqnutil3.c
+++ ncbi-tools6-6.1.20170106/api/sqnutil3.c
@@ -33198,7 +33198,7 @@ ClickableItemPtr LIBCALL ClickableGlobal
        cip->clickable_item_type = item_type;
        cip->description 
           = (CharPtr) MemNew ( sizeof (Char) * (StringLen (fmt) + 15));
-       sprintf (cip->description, fmt);
+       strcpy (cip->description, fmt);
        return cip;
   }
   return NULL;
--- ncbi-tools6-6.1.20170106.orig/connect/ncbi_gnutls.c
+++ ncbi-tools6-6.1.20170106/connect/ncbi_gnutls.c
@@ -585,6 +585,7 @@ static EIO_Status s_GnuTlsInit(FSSLPull
 
     assert(!s_GnuTlsCredAnon);
 
+#if 0
     version = gnutls_check_version(0);
     if (strcasecmp(GNUTLS_VERSION, version) != 0) {
         CORE_LOGF(eLOG_Critical,
@@ -592,6 +593,7 @@ static EIO_Status s_GnuTlsInit(FSSLPull
                    GNUTLS_VERSION, version));
         assert(0);
     }
+#endif
 
     val = ConnNetInfo_GetValue(0, "GNUTLS_LOGLEVEL", buf, sizeof(buf), 0);
     CORE_LOCK_READ;
--- ncbi-tools6-6.1.20170106.orig/connect/ncbi_http_connector.c
+++ ncbi-tools6-6.1.20170106/connect/ncbi_http_connector.c
@@ -240,8 +240,14 @@ static int/*bool*/ x_UnsafeRedirectOK(SH
     if (uuu->unsafe_redir == eDefault) {
         if (!(uuu->flags & fHTTP_UnsafeRedirects)) {
             char val[32];
+            const char* dflt = NULL;
+            if (uuu->net_info->scheme == eURL_Https
+		&&  (strspn(uuu->net_info->host, "0123456789.")
+		     == strlen(uuu->net_info->host))) {
+                dflt = "TRUE";
+            }
             ConnNetInfo_GetValue(0, "HTTP_UNSAFE_REDIRECTS",
-                                 val, sizeof(val), 0);
+                                 val, sizeof(val), dflt);
             uuu->unsafe_redir = ConnNetInfo_Boolean(val) ? eOn : eOff;
         } else
             uuu->unsafe_redir = eOn;
--- ncbi-tools6-6.1.20170106.orig/connect/ncbi_util.c
+++ ncbi-tools6-6.1.20170106/connect/ncbi_util.c
@@ -49,7 +49,9 @@
 #  ifndef NCBI_OS_SOLARIS
 #    include <limits.h>
 #  endif /*!NCBI_OS_SOLARIS*/
-#  ifdef NCBI_OS_LINUX
+#  ifdef __MACH__
+#    include <mach/vm_param.h>
+#  elif defined(NCBI_OS_LINUX)
 #    include <sys/user.h>
 #  endif /*NCBI_OS_LINUX*/
 #  include <pwd.h>
--- ncbi-tools6-6.1.20170106.orig/connect/urlquery.c
+++ ncbi-tools6-6.1.20170106/connect/urlquery.c
@@ -128,7 +128,10 @@ NLM_EXTERN CONN QUERY_OpenUrlQuery (
   }
   if ( host_port ) {
     net_info->port = host_port;
+  } else {
+    net_info->scheme = eURL_Https;
   }
+
   StringNCpy_0 (net_info->path, host_path, sizeof (net_info->path));
   if (StringDoesHaveText (arguments)) {
     StringNCpy_0 (net_info->args, arguments, sizeof (net_info->args));
--- ncbi-tools6-6.1.20170106.orig/corelib/ncbimain.c
+++ ncbi-tools6-6.1.20170106/corelib/ncbimain.c
@@ -67,6 +67,7 @@
 #pragma segment NlmSegA
 #endif
 
+extern Nlm_Int2 Nlm_Main(void) __attribute__((weak));
 
 /*****************************************************************************
 *
@@ -95,7 +96,12 @@ main(int argc, char *argv[])
   /* Initialize connection library's logger, registry and lock */
   CONNECT_Init(0);
 
-  retval = Nlm_Main();
+  if (Nlm_Main) {
+    retval = Nlm_Main();
+  } else {
+    ErrPost(0, 0, "Neither main nor Nlm_Main defined by program.");
+    retval = -1;
+  }
 
   NlmThreadJoinAll();
 
--- ncbi-tools6-6.1.20170106.orig/corelib/ncbitime.c
+++ ncbi-tools6-6.1.20170106/corelib/ncbitime.c
@@ -77,6 +77,7 @@
 #include <ncbi.h>
 #include <ncbithr.h>
 #include <ncbiwin.h>
+#include <stdlib.h>
 
 #ifdef OS_UNIX
 #include <sys/times.h>
@@ -108,8 +109,18 @@ NLM_EXTERN time_t LIBCALL  Nlm_GetSecs (
 *****************************************************************************/
 NLM_EXTERN Nlm_Boolean LIBCALL  Nlm_GetDayTime (Nlm_DayTimePtr dtp)
 {
+  /* This function honors the SOURCE_DATE_EPOCH specificatin
+     (https://reproducible-builds.org/specs/source-date-epoch/) */
+  const char *sde = getenv("SOURCE_DATE_EPOCH");
 #if (defined(SOLARIS_THREADS_AVAIL)  ||  defined(POSIX_THREADS_AVAIL)  ||  defined(WIN32)) && !defined(OS_UNIX_DARWIN)
-  time_t t = time( NULL );
+  time_t t;
+  if (sde) {
+    t = strtoul(sde, NULL, 0);
+    if (t == 0)
+      return FALSE;
+  } else {
+    t = time( NULL );
+  }
 #ifdef WIN32
   static TNlmMutex localtime_lock;
   if (NlmMutexLockEx( &localtime_lock ) != 0)
@@ -125,7 +136,13 @@ NLM_EXTERN Nlm_Boolean LIBCALL  Nlm_GetD
   time_t ltime;
   struct tm *dt;
   Nlm_MemFill ((Nlm_VoidPtr) dtp, 0, sizeof(Nlm_DayTime));
-	time(&ltime);
+  if (sde) {
+    ltime = strtoul(sde, NULL, 0);
+    if (ltime == 0)
+      return FALSE;
+  } else {
+    time(&ltime);
+  }
   if ((dt = localtime (&ltime)) != NULL)
  	{
         Nlm_MemCopy ((Nlm_VoidPtr) dtp, (Nlm_VoidPtr) dt, sizeof (struct tm));
--- ncbi-tools6-6.1.20170106.orig/demo/asndisc.c
+++ ncbi-tools6-6.1.20170106/demo/asndisc.c
@@ -65,6 +65,7 @@
 #include <objmacro.h>
 #include <macroapi.h>
 
+#include <connect/ncbi_gnutls.h>
 
 #define ASNDISC_APP_VER "2.3"
 
@@ -1264,6 +1265,8 @@ Int2 Main (void)
   UseLocalAsnloadDataAndErrMsg ();
   ErrPathReset ();
 
+  SOCK_SetupSSL(NcbiSetupGnuTls);
+
   if (! AllObjLoad ()) {
     Message (MSG_FATAL, "AllObjLoad failed");
     return 1;
--- ncbi-tools6-6.1.20170106.orig/demo/entrez2.c
+++ ncbi-tools6-6.1.20170106/demo/entrez2.c
@@ -61,6 +61,8 @@
 
 #include <entrez2.h>
 
+#include <connect/ncbi_gnutls.h>
+
 #define ENTREZ_APP_VERSION "12.1"
 
 #define MAX_QUERY_FORMS 256
@@ -884,6 +886,8 @@ Int2 Main (void)
   UseLocalAsnloadDataAndErrMsg ();
   ErrPathReset ();
 
+  SOCK_SetupSSL(NcbiSetupGnuTls);
+
   /*--------------------------------*/
   /* Initialize the global settings */
   /*--------------------------------*/
@@ -1026,7 +1030,7 @@ Int2 Main (void)
   /*--------------------------------------*/
 
   if (useNormalServ) {
-    EntrezSetService ("Entrez2");
+    EntrezSetService ("Entrez2s");
   } else if (useTestServ) {
     EntrezSetService ("Entrez2Test");
   } else if (useURL) {
--- ncbi-tools6-6.1.20170106.orig/demo/findspl.c
+++ ncbi-tools6-6.1.20170106/demo/findspl.c
@@ -62,6 +62,8 @@
 #include <accentr.h>
 #include <sequtil.h>
 
+#include <connect/ncbi_gnutls.h>
+
 #define NUMARGS 3
 Args myargs[NUMARGS] = {
         {"Gi number of protein","0","1","99999999",FALSE,'g',ARG_INT,0.0,0,NULL},
@@ -98,6 +100,8 @@ Int2 Main(void)
 	FILE *ofp;
 	FILE *ifp = NULL;
 
+	SOCK_SetupSSL(NcbiSetupGnuTls);
+
 	if ( !GetArgs("findspl", NUMARGS, myargs) ) return 1;
 
 	gi = myargs[0].intvalue;
--- ncbi-tools6-6.1.20170106.orig/demo/gbseqget.c
+++ ncbi-tools6-6.1.20170106/demo/gbseqget.c
@@ -54,6 +54,8 @@
 #include <pmfapi.h>
 #include <asn2gnbp.h>
 
+#include <connect/ncbi_gnutls.h>
+
 static CharPtr ReadALine (
   CharPtr str,
   size_t size,
@@ -417,6 +419,8 @@ Int2 Main (void)
   UseLocalAsnloadDataAndErrMsg ();
   ErrPathReset ();
 
+  SOCK_SetupSSL(NcbiSetupGnuTls);
+
   if (! AllObjLoad ()) {
     Message (MSG_FATAL, "AllObjLoad failed");
     return 1;
--- ncbi-tools6-6.1.20170106.orig/demo/insdseqget.c
+++ ncbi-tools6-6.1.20170106/demo/insdseqget.c
@@ -55,6 +55,8 @@
 #include <pmfapi.h>
 #include <asn2gnbp.h>
 
+#include <connect/ncbi_gnutls.h>
+
 #define INSDSEQGET_APP_VER "1.1"
 
 CharPtr INSDSEQGET_APPLICATION = INSDSEQGET_APP_VER;
@@ -423,6 +425,8 @@ Int2 Main (void)
   UseLocalAsnloadDataAndErrMsg ();
   ErrPathReset ();
 
+  SOCK_SetupSSL(NcbiSetupGnuTls);
+
   if (! AllObjLoad ()) {
     Message (MSG_FATAL, "AllObjLoad failed");
     return 1;
--- ncbi-tools6-6.1.20170106.orig/demo/nps2gps.c
+++ ncbi-tools6-6.1.20170106/demo/nps2gps.c
@@ -50,6 +50,8 @@
 #include <toasn3.h>
 #include <pmfapi.h>
 
+#include <connect/ncbi_gnutls.h>
+
 #define NPS2GPSAPP_VER "3.6"
 
 CharPtr NPS2GPSAPPLICATION = NPS2GPSAPP_VER;
@@ -2439,6 +2441,8 @@ Int2 Main (void)
   UseLocalAsnloadDataAndErrMsg ();
   ErrPathReset ();
 
+  SOCK_SetupSSL(NcbiSetupGnuTls);
+
   if (! AllObjLoad ()) {
     Message (MSG_FATAL, "AllObjLoad failed");
     return 1;
--- ncbi-tools6-6.1.20170106.orig/demo/taxblast_main.c
+++ ncbi-tools6-6.1.20170106/demo/taxblast_main.c
@@ -41,6 +41,8 @@ static char const rcsid[] = "$Id: taxbla
 #include <objgen.h>
 #include <taxblast.h>
 
+#include <connect/ncbi_gnutls.h>
+
 
 #define NUMARG (sizeof(myargs)/sizeof(myargs[0]))
 
@@ -63,6 +65,8 @@ Int2 Main (void)
     FILE *outfile;
     Char ofile[128];
     
+    SOCK_SetupSSL(NcbiSetupGnuTls);
+
     if (!GetArgs("txblast", NUMARG, myargs)) {
         return 1;
     }
--- ncbi-tools6-6.1.20170106.orig/demo/tbl2asn.c
+++ ncbi-tools6-6.1.20170106/demo/tbl2asn.c
@@ -8911,10 +8911,12 @@ Int2 Main (void)
     return 1;
   }
 
+  /*
   if (MoreThanYearOld ()) {
     too_old = TRUE;
     Message (MSG_POST, "This copy of tbl2asn is more than a year old.  Please download the current version.");
   }
+  */
 
   /* process command line arguments */
 
@@ -9668,6 +9670,9 @@ Int2 Main (void)
   }
 
   if (tbl.other_failure) {
+    if (MoreThanYearOld ()) {
+      Message (MSG_POST, "This copy of tbl2asn is more than a year old.  Please try again with the current version.");
+    }
     return 1;
   }
 
--- ncbi-tools6-6.1.20170106.orig/desktop/bspview.c
+++ ncbi-tools6-6.1.20170106/desktop/bspview.c
@@ -2549,13 +2549,13 @@ NLM_EXTERN void Nlm_LaunchWebPage (Char
     }
 #endif
 #ifdef WIN_MOTIF
-  argv [0] = "netscape";
+  argv [0] = "sensible-browser";
   argv [1] = url;
   argv [2] = NULL;
   child = fork();
   if(child == 0) {
-     if (execvp ("netscape", argv) == -1) {
-        Message (MSG_POST, "Unable to launch netscape");
+     if (execvp ("sensible-browser", argv) == -1) {
+        Message (MSG_POST, "Unable to launch browser");
         exit(-1);
     }
   }
--- ncbi-tools6-6.1.20170106.orig/doc/dispatcher.html
+++ ncbi-tools6-6.1.20170106/doc/dispatcher.html
@@ -9,15 +9,15 @@
 -->
   <META NAME="keywords" CONTENT="dispatcher toolkit">
   <META NAME="description" CONTENT="NCBI dispatcher">
-  <link rel="stylesheet" href="http://www.ncbi.nlm.nih.gov/corehtml/ncbi2.css">
+  <link rel="stylesheet" href="ncbi2.css">
 </head>
 
 
-<body bgcolor="#FFFFFF" background="http://www.ncbi.nlm.nih.gov/corehtml/bkgd.gif" text="#000000" link="#CC6600" vlink="#CC6600">
+<body bgcolor="#FFFFFF" background="bkgd.gif" text="#000000" link="#CC6600" vlink="#CC6600">
 <!--  the header   --> 
 <table border="0" width="600" cellspacing="0" cellpadding="0">
   <tr> 
-    <td width="140"><a href="http://www.ncbi.nlm.nih.gov"> <img src="http://www.ncbi.nlm.nih.gov/corehtml/left.GIF" width="130" height="45" border="0"></a></td>
+    <td width="140"><a href="http://www.ncbi.nlm.nih.gov"> <img src="left.gif" width="130" height="45" border="0"></a></td>
     <td width="360" class="head1" valign="BOTTOM"> <span class="H1">Network Configuration</span></td>
     <td width="100" valign="BOTTOM"></td>
   </tr>
@@ -37,7 +37,7 @@
 <table border="0" width="600" cellspacing="0" cellpadding="0">
   <tr valign="TOP"> <!--  left column   --> 
     <td width="125"> 
-   <img src="http://www.ncbi.nlm.nih.gov/corehtml/spacer10.GIF" width="125" height="1" border="0">
+   <img src="spacer10.gif" width="125" height="1" border="0">
    <p>
    <a href="#Switch" class="GUTTER">The Switch</a>
    <p>
@@ -52,7 +52,7 @@
    <a href="#Addendum" class="GUTTER">Additional Info</a>
    </td>
     <!-- extra column to force things over the gif border --> 
-    <td width="15"><img src="http://www.ncbi.nlm.nih.gov/corehtml/spacer10.GIF" width="15" height="1" border="0"> </td>
+    <td width="15"><img src="spacer10.gif" width="15" height="1" border="0"> </td>
     <!-- right content column  --> 
     <td width="460"> 
       <p>&nbsp;</p>
--- ncbi-tools6-6.1.20170106.orig/doc/firewall.html
+++ ncbi-tools6-6.1.20170106/doc/firewall.html
@@ -9,15 +9,15 @@
  <META NAME="keywords" CONTENT="insert your keywords for the search engine">
  <META NAME="description" CONTENT="insert the description to be displayed by the search engine.  Also searched by the search engine.">
 -->
-  <link rel="stylesheet" href="http://www.ncbi.nlm.nih.gov/corehtml/ncbi2.css">
+  <link rel="stylesheet" href="ncbi2.css">
 </head>
 
 
-<body bgcolor="#FFFFFF" background="http://www.ncbi.nlm.nih.gov/corehtml/bkgd.gif" text="#000000" link="#CC6600" vlink="#CC6600">
+<body bgcolor="#FFFFFF" background="bkgd.gif" text="#000000" link="#CC6600" vlink="#CC6600">
 <!--  the header   --> 
 <table border="0" width="600" cellspacing="0" cellpadding="0">
   <tr> 
-    <td width="140"><a href="http://www.ncbi.nlm.nih.gov"> <img src="http://www.ncbi.nlm.nih.gov/corehtml/left.GIF" width="130" height="45" border="0"></a></td>
+    <td width="140"><a href="http://www.ncbi.nlm.nih.gov"> <img src="left.gif" width="130" height="45" border="0"></a></td>
     <td width="360" class="head1" valign="BOTTOM"> <span class="H1">Network Configuration</span></td>
     <td width="100" valign="BOTTOM"></td>
   </tr>
@@ -37,12 +37,12 @@
 <table border="0" width="600" cellspacing="0" cellpadding="0">
   <tr valign="TOP"> <!--  left column   --> 
     <td width="125"> 
-<img src="http://www.ncbi.nlm.nih.gov/corehtml/spacer10.GIF" width="125" height="1" border="0">
+<img src="spacer10.gif" width="125" height="1" border="0">
 
 
    </td>
     <!-- extra column to force things over the gif border --> 
-    <td width="15"><img src="http://www.ncbi.nlm.nih.gov/corehtml/spacer10.GIF" width="15" height="1" border="0"> </td>
+    <td width="15"><img src="spacer10.gif" width="15" height="1" border="0"> </td>
     <!-- right content column  --> 
     <td width="460"> 
       <p>&nbsp;</p>
@@ -133,7 +133,7 @@ in case the public access will eventuall
 
 <p>
 To see what ports are currently on, and their status, as reported within
-NCBI, please refer to the following <a href="fwd_check.cgi">Firewall Daemon Presence
+NCBI, please refer to the following <a href="http://www.ncbi.nlm.nih.gov/IEB/ToolBox/NETWORK/fwd_check.cgi">Firewall Daemon Presence
 Check</a> page.  Ports marked <b>INTERNAL</b> are solely for NCBI own use, and may be
 inaccessible from your site. That, however, does not affect availability of any
 services that NCBI provides through other (open) firewall ports.
@@ -143,7 +143,7 @@ TROUBLESHOOTING:  You can test whether t
 your host just by running simple <tt>telnet</tt> command (available on most
 current systems).  To know which ports, at the moment, you should be trying
 from the list above (see the "Ports to open"), first check their status by visiting
-<a href="fwd_check.cgi">Firewall Daemon Presence Check</a> link, then select any
+<a href="http://www.ncbi.nlm.nih.gov/IEB/ToolBox/NETWORK/fwd_check.cgi">Firewall Daemon Presence Check</a> link, then select any
 up-and-running port and do the following (the example assumes port 5861 has
 been shown in operational state):
 <pre>
@@ -175,7 +175,7 @@ functions of NCBI dispatching facilities
 
 <p>
 There is also an auxiliary automated UNIX shell script
-<a href="fwd_check.sh">fwd_check.sh</a> to check all of
+<a href="../libncbi6/examples/fwd_check.sh">fwd_check.sh</a> to check all of
 the preset ports, and it is kept in-sync with currently
 configured open ports (so remember to refresh your download
 prior to actual use).
--- ncbi-tools6-6.1.20170106.orig/doc/fwd_check.sh
+++ ncbi-tools6-6.1.20170106/doc/fwd_check.sh
@@ -8,7 +8,7 @@
 delay_sec="$1"
 delay_sec=${delay_sec:="10"}
 netcat="`which nc 2>/dev/null`"
-temp="/tmp/`basename $0`.$$.tmp"
+temp=`mktemp`
 helper="./fwd_failure_helper.exe"
 test -z "$netcat"  &&  netcat="`whereis nc | sed 's/^[^:]*://;s/ //g'`"
 test -z "$HTTP_NCBI_EXTERNAL"  &&  HTTP_CAF_EXTERNAL="$HTTP_NCBI_EXTERNAL"
--- ncbi-tools6-6.1.20170106.orig/doc/man/cleanasn.1
+++ ncbi-tools6-6.1.20170106/doc/man/cleanasn.1
@@ -1,4 +1,4 @@
-.TH CLEANASN 1 2016-09-01 NCBI "NCBI Tools User's Manual"
+.TH CLEANASN 1 2017-01-09 NCBI "NCBI Tools User's Manual"
 .SH NAME
 cleanasn \- clean up irregularities in NCBI ASN.1 objects
 .SH SYNOPSIS
@@ -75,6 +75,10 @@ Exclude nuc\-prot sets
 Only segmented sequences
 .IP w
 Exclude segmented sequences
+.IP x
+Only segmented proteins
+.IP y
+Exclude segmented proteins
 .PD
 .RE
 .TP
@@ -86,6 +90,8 @@ Sequence operations, per the flags in st
 Compress
 .IP d
 Decompress
+.IP l
+Recalculated segmented sequence length
 .IP v
 Virtual gaps inside segmented sequence
 .IP s
--- /dev/null
+++ ncbi-tools6-6.1.20170106/doc/man/taxblast.1
@@ -0,0 +1,31 @@
+.TH TAXBLAST 1 2016-12-05 NCBI "NCBI Tools User's Manual"
+.SH NAME
+taxblast \- annotate BLAST output with taxonomic details
+.SH SYNOPSIS
+.B taxblast
+[\|\fB\-\fP\|]
+[\|\fB\-d\fP\ \fIstr\fP\|]
+\fB\-i\fP\ \fIfilename\fP
+[\|\fB\-o\fP\ \fIfilename\fP\|]
+[\|\fB\-p\fP\|]
+.SH DESCRIPTION
+\fBtaxblast\fP annotates BLAST output with taxonomic details.
+.SH OPTIONS
+A summary of options is included below.
+.TP
+\fB\-\fP
+Print usage message
+.TP
+\fB\-d\fP\ \fIstr\fP
+Database used to get SeqAnnot ASN.1 (\fBnr\fP by default)
+.TP
+\fB\-i\fP\ \fIfilename\fP
+Input ASN.1 File (SeqAnnot)
+.TP
+\fB\-o\fP\ \fIfilename\fP
+Output file name (stdout by default)
+.TP
+\fB\-p\fP
+Sequence is DNA
+.SH AUTHOR
+The National Center for Biotechnology Information.
--- ncbi-tools6-6.1.20170106.orig/make/makeall.unx
+++ ncbi-tools6-6.1.20170106/make/makeall.unx
@@ -1,4 +1,4 @@
-#	makefile for asntool and ncbi core routines,
+#	-*- makefile -*- for asntool and ncbi core routines,
 #
 #	$Id: makeall.unx,v 6.321 2016/12/31 22:35:10 ucko Exp $
 #
@@ -234,7 +234,7 @@ SRC20 = drawseq.c dotmatrx.c fea2seg.c f
 	dlgutil1.c dlgutil2.c e2trmlst.c e2docsum.c asn2graphic.c \
 	medview.c bspview.c gbfview.c gphview.c gphdraw.c gxydraw.c gtrdraw.c \
 	seqpanel.c ingengraph.c ingenext.c ingenwin.c macrodlg.c \
-	biosrc.c cdrgn.c import.c pubdesc.c seqsub.c mapgene.c prtgene.c salogif.c
+	biosrc.c cdrgn.c import.c pubdesc.c seqsub.c mapgene.c prtgene.c
 
 SRC45 = ddvclick.c ddvgraph.c ddvopen.c ddvpanel.c
 
@@ -392,7 +392,7 @@ OBJ20 = drawseq.o dotmatrx.o fea2seg.o f
 	dlgutil1.o dlgutil2.o e2trmlst.o e2docsum.o asn2graphic.o \
 	medview.o bspview.o gbfview.o gphview.o gphdraw.o gxydraw.o gtrdraw.o \
 	seqpanel.o ingengraph.o ingenext.o ingenwin.o macrodlg.o \
-	biosrc.o cdrgn.o import.o pubdesc.o seqsub.o mapgene.o prtgene.o salogif.o
+	biosrc.o cdrgn.o import.o pubdesc.o seqsub.o mapgene.o prtgene.o
 
 OBJ45 = ddvclick.o ddvgraph.o ddvopen.o ddvpanel.o
 
@@ -491,14 +491,14 @@ ln-if-absent:	../make/ln-if-absent
 nocopy : sources $(THR_OBJ) $(LIB1) $(LIBTLS) $(LIB2) $(LIB3) $(DLIB4) $(DLIB400) \
 	$(LIB5) $(DLIB20) $(DLIB45) $(LIB22) $(LIB23) $(LIBCOMPADJ) \
 	$(DLIB28) $(DLIB30) $(DLIB3000) \
-	$(DLIB34) $(DLIB37) $(DLIB38) $(LIB50) $(LIB60) $(LIB61) $(NCBI_SHLIBS)
+	$(DLIB34) $(DLIB37) $(DLIB38) $(LIB60) $(LIB61) $(NCBI_SHLIBS)
 
 sources : $(SRCALL)
 
 ## To clean out the directory without removing make
 ##
 clean :
-	-rm -f *.[acho]
+	-rm -f *.[acho] *.glo
 
 .NO_PARALLEL:	copy $(ULIB4) $(ULIB30)
 
@@ -656,10 +656,12 @@ shlib.sol :
 	cd ../shlib; make -f $(MAKESHLIB) `ls *.a | sed "s/\.a/.so/"` NCBI_OTHERLIBS=$(OTHERLIBS)
 	rm -f ../shlib/*.a
 
-#
-# Linux shared libs are built the same in the same manner as for SGI
-#
-shlib.lnx : shlib.sgi
+shlib.lnx :
+	-mkdir ../shlib
+	-rm -f ../shlib/*.a
+	ln $(NCBI_LIBDIR)/*.a ../shlib
+	cd ../shlib; make -f $(MAKESHLIB) `ls *.a | sed "s/\.a/.so.$(NCBI_VERSION_MAJOR)/"` SH1="$(CC) -o" SH2="-shared *.o"
+	rm -f ../shlib/*.a
 
 shlib.sgi :
 	-mkdir ../shlib
@@ -792,7 +794,7 @@ copy :
 	cp -fp ../algo/blast/core/*.h ../include/algo/blast/core
 	- mkdir -p ../include/algo/blast/composition_adjustment
 	$(SRCCOPY) ../algo/blast/composition_adjustment/*.c .
-	$(SRCCOPY) ../algo/blast/composition_adjustment/*.h ../include
+#	$(SRCCOPY) ../algo/blast/composition_adjustment/*.h ../include
 	cp -fp ../algo/blast/composition_adjustment/*.h \
 		../include/algo/blast/composition_adjustment
 	- mkdir -p ../include/algo/blast/api
--- ncbi-tools6-6.1.20170106.orig/make/makedemo.unx
+++ ncbi-tools6-6.1.20170106/make/makedemo.unx
@@ -1,4 +1,4 @@
-#	makefile for demo programs
+#	-*- makefile -*- for demo programs
 #
 #	$Id: makedemo.unx,v 6.96 2016/08/31 19:05:26 ucko Exp $
 #
@@ -228,7 +228,8 @@ cdscan : cdscan.c
 # findspl
 
 findspl : findspl.c
-	$(CC) -o findspl $(LDFLAGS) findspl.c $(ENTREZLIBS) $(LIB2) $(LIB1) $(OTHERLIBS)
+	$(CC) -o findspl $(LDFLAGS) findspl.c $(ENTREZLIBS) $(LIB2) $(LIB1) \
+	    $(LIBTLS) $(OTHERLIBS)
 
 # errhdr
 
--- ncbi-tools6-6.1.20170106.orig/make/makenet.unx
+++ ncbi-tools6-6.1.20170106/make/makenet.unx
@@ -1,4 +1,4 @@
-#   makefile for network demo programs and network entrez
+#   -*- makefile -*- for network demo programs and network entrez
 #
 #	$Id: makenet.unx,v 6.261 2016/08/25 15:37:04 ucko Exp $
 #   test, ignore
@@ -330,6 +330,8 @@ OBJ46 = id2.o id2sgen.o
 
 # objects & sources needed for versions of network demo programs
 
+OBJCN3D =       cn3dmain.o
+
 OBJDDV = ddvmain.o
 
 OBJUDV = udvmain.o
@@ -445,10 +447,12 @@ shlib.sol :
 	cd ../shlib; make -f $(MAKESHLIB) `ls *.a | sed "s/\.a/.so/"` NCBI_OTHERLIBS=$(OTHERLIBS)
 	rm -f ../shlib/*.a
 
-#
-# Linux shared libs are built the same in the same manner as for SGI
-#
-shlib.lnx : shlib.sgi
+shlib.lnx :
+	-mkdir ../shlib
+	-rm -f ../shlib/*.a
+	ln $(NCBI_LIBDIR)/*.a ../shlib
+	cd ../shlib; make -f $(MAKESHLIB) `ls *.a | sed "s/\.a/.so.$(NCBI_VERSION_MAJOR)/"` SH1="$(CC) -o" SH2="-shared *.o"
+	rm -f ../shlib/*.a
 
 shlib.sgi :
 	-mkdir ../shlib
@@ -518,7 +522,7 @@ copy :
 	$(SRCCOPY) ../network/vibnet/*.h ../include
 	$(SRCCOPY) ../cdromlib/*.h ../include
 	-$(SRCCOPY) ../network/wwwblast/Src/*.c .
-	-$(SRCCOPY) ../network/wwwblast/Src/*.h ../include
+#	-$(SRCCOPY) ../network/wwwblast/Src/*.h ../include
 	$(SRCCOPY) ../cdromlib/accentr.c .
 	$(SRCCOPY) ../cdromlib/accutils.c .
 	-$(SRCCOPY) ../sequin/*.* .
@@ -952,6 +956,11 @@ accvdb.o : accvdb.c
 ##
 
 
+Cn3D : $(OBJCN3D) $(BENTREZLIBS) netentcf $(BLIB36)
+	$(CC) -o Cn3D $(LDFLAGS) $(OBJCN3D) $(LIB31) $(LIB3000) $(LIB20) \
+		$(LIB45) $(LIB22) $(LIB8) $(LIB7) \
+		$(LIB400) $(LIB2) $(LIB1) $(VIBLIBS) $(OGLLIBS)
+
 ddv    : $(OBJDDV)
 	$(CC) -o ddv $(LDFLAGS) $(OBJDDV) $(LIB41) $(LIB31) $(LIB20) $(LIB61) $(LIB60) $(LIB22) $(LIB45) \
 	$(LIB8) $(LIB7) $(NETCLILIB) $(LIB3) $(LIB4) $(LIB23) \
@@ -1097,8 +1106,8 @@ asnval_dbx_psf.o :	asnval.c
 # asndisc program (asndisc)
 asndisc :	asndisc.c
 	$(CC) -g -o asndisc $(LDFLAGS) asndisc.c $(THREAD_OBJ) $(LIB41) \
-		$(NETCLILIB) $(LIB23) $(LIBCOMPADJ) $(LIB2) $(LIB1) \
-		$(OTHERLIBS) $(THREAD_OTHERLIBS)
+		$(NETCLILIB) $(LIB23) $(LIBCOMPADJ) $(LIB2) $(LIBTLS) $(LIB1) \
+		$(GNUTLS_LIBS) $(OTHERLIBS) $(THREAD_OTHERLIBS)
 
 # asndisc_psf, uses PUBSEQBioseqFetchEnable instead of PubSeqFetchEnable
 # should be used only internally within NCBI.
@@ -1150,17 +1159,19 @@ diffshift :	diffshift.c
 # gbseqget program (gbseqget)
 gbseqget :	gbseqget.c
 	$(CC) -g -o gbseqget $(LDFLAGS) gbseqget.c $(LIB41) $(NETCLILIB) \
-		$(LIB23) $(LIBCOMPADJ) $(LIB2) $(LIB1) $(OTHERLIBS)
+		$(LIB23) $(LIBCOMPADJ) $(LIB2) $(LIBTLS) $(LIB1) \
+		$(GNUTLS_LIBS) $(OTHERLIBS)
 
 # insdseqget program (insdseqget)
 insdseqget :	insdseqget.c
 	$(CC) -g -o insdseqget $(LDFLAGS) insdseqget.c $(LIB41) $(NETCLILIB) \
-		$(LIB23) $(LIBCOMPADJ) $(LIB2) $(LIB1) $(OTHERLIBS)
+		$(LIB23) $(LIBCOMPADJ) $(LIB2) $(LIBTLS) $(LIB1) \
+		$(GNUTLS_LIBS) $(OTHERLIBS)
 
 # nps2gps program (nps2gps)
 nps2gps :	nps2gps.c
 	$(CC) -g -o nps2gps $(LDFLAGS) nps2gps.c $(LIB23) $(LIBCOMPADJ) \
-		$(LIB2) $(LIB1) $(OTHERLIBS)
+		$(LIB2) $(LIBTLS) $(LIB1) $(GNUTLS_LIBS) $(OTHERLIBS)
 
 # trna2sap program (trna2sap)
 trna2sap :	trna2sap.c
@@ -1181,7 +1192,8 @@ testent2 :	testent2.c
 entrez2 :	entrez2.c
 	$(CC) -g -o entrez2 $(LDFLAGS) entrez2.c $(LIB41) $(LIB6) $(LIB20) \
 		$(LIB61) $(LIB60) $(LIB22) $(LIB23) $(LIBCOMPADJ) \
-		$(LIB2) $(LIB4) $(LIB1) $(VIBLIBS) $(OTHERLIBS)
+		$(LIB2) $(LIB4) $(LIBTLS) $(LIB1) \
+		$(GNUTLS_LIBS) $(VIBLIBS) $(OTHERLIBS)
 	$(VIB_POST_LINK) entrez2
 
 # demo program (spidey)
@@ -1285,7 +1297,7 @@ bl2seq : bl2seq.c
 taxblast: taxblast_main.c $(BLIB41) $(BLIB40)
 	$(CC) -g -o taxblast $(LDFLAGS) taxblast_main.c \
 		$(LIB61) $(LIB60) $(LIB36) $(LIB41) $(LIB40) $(LIB23) $(LIBCOMPADJ) \
-		$(NETCLILIB) $(LIB2) $(LIB1) $(OTHERLIBS)
+		$(NETCLILIB) $(LIB2) $(LIBTLS) $(LIB1) $(GNUTLS_LIBS) $(OTHERLIBS)
 
 # test client for the suggest network service
 suggcli: suggcli.c $(BNETCLILIB) $(BLIB24)
--- ncbi-tools6-6.1.20170106.orig/make/makeshlb.unx
+++ ncbi-tools6-6.1.20170106/make/makeshlb.unx
@@ -1,4 +1,4 @@
-#
+# -*- makefile -*-
 #
 #	$Id: makeshlb.unx,v 6.1 1999/03/18 17:31:11 beloslyu Exp $
 #
@@ -12,7 +12,115 @@ SH1 = ld -G -o
 SH2 = `lorder *.o | tsort` $(NCBI_OTHERLIBS)
 
 %.so: %.a
-	rm -f *.o __*
+	rm -f *.o *.glo __*
 	ar x $<
+	case $< in \
+	    *OGL.a) for f in *.glo; do mv $$f `basename $$f .glo`.o; done ;; \
+	esac
 	$(SH1) $@ $(SH2)
 	rm -f *.o __*
+
+so=so.$(NCBI_VERSION_MAJOR).$(NCBI_VERSION_MINOR)
+
+%.$(so): %.a
+	$(CC) -shared -Wl,-soname=$*.so.$(NCBI_VERSION_MAJOR) -o $@ \
+	    -Wl,--whole-archive $< -Wl,--no-whole-archive $(LDFLAGS) \
+	    $($*_deps) $($*_sysdeps)
+
+%.so.$(NCBI_VERSION_MAJOR): %.$(so)
+	ln -s $< $@
+	ln -s $< $*.so
+
+# Make libncbiCacc and libncbiacc pointers to libncbiNacc, since it's
+# the most useful variant in the usual (net-only) case.  Do the same
+# for libnetentr, and link the static version into libncbiNacc.so, due
+# to a circular dependency.
+libnetentr.$(so) libncbiCacc.$(so) libncbiacc.$(so):
+	ln -s libncbiNacc.$(so) $@
+
+# Standardize on the OpenGL-enabled versions of Vibrant, since there's
+# no longer any real penalty in doing so.
+libvibrant.$(so):
+	ln -s libvibrantOGL.$(so) $@
+libncbicn3d.$(so):
+	ln -s libncbicn3dOGL.$(so) $@
+
+libblast_deps       = libblastcompadj.$(so) libncbi.$(so)
+libblast_sysdeps    = -lm
+libblastapi_deps    = libblast.$(so) libncbitool.$(so) libncbiobj.$(so) \
+                      libncbi.$(so)
+libblastapi_sysdeps = -lm
+libblastcompadj_sysdeps = -lm
+libconnssl_deps     = libncbi.$(so)
+libconnssl_sysdeps  = -lgnutls
+libncbi_sysdeps     = -lm
+# libncbiCacc_deps    = libncbicdr.$(so) libnetentr.a libnetcli.$(so)
+libncbiNacc_deps    = libncbicdr.$(so) libnetentr.a libnetcli.$(so) \
+                      libncbiobj.$(so) libncbi.$(so)
+libncbiNacc_sysdeps = -lm
+# libncbiacc_deps     = libncbicdr.$(so)
+libncbicdr_deps     = libncbiobj.$(so) libncbi.$(so)
+libncbiid1_deps     = libncbiobj.$(so) libnetcli.$(so) libncbi.$(so)
+libncbimla_deps     = libncbiobj.$(so) libnetcli.$(so) libncbi.$(so)
+libncbimmdb_deps    = libncbiid1.$(so) libncbitool.$(so) libncbiobj.$(so) \
+                      libncbi.$(so)
+libncbimmdb_sysdeps = -lm
+libncbiobj_deps     = libncbi.$(so)
+libncbiobj_sysdeps  = -lm
+libncbitool_deps    = libblastcompadj.$(so) libncbiobj.$(so) libncbi.$(so)
+libncbitool_sysdeps = -lm
+libncbitxc2_deps    = libncbitool.$(so) libnetcli.$(so) libncbiobj.$(so) \
+                      libncbi.$(so)
+libncbitxc2_sysdeps = -lm
+libnetblast_deps    = libncbitool.$(so) libnetcli.$(so) libncbiobj.$(so) \
+                      libncbi.$(so)
+libnetcli_deps      = libncbi.$(so)
+# libnetentr_deps     = libncbiacc.$(so) libnetcli.$(so)
+libvibgif_deps      = libncbi.$(so)
+libvibgif_sysdeps   = -lm
+
+libddvlib_deps        = libncbidesk.$(so) libvibrantOGL.$(so) \
+                        libncbitool.$(so) libncbiobj.$(so) libncbi.$(so)
+libncbicn3d_deps      = libncbiNacc.$(so) libddvlib.$(so) libncbidesk.$(so) \
+                        libncbimmdb.$(so) libncbitool.$(so) libncbiobj.$(so) \
+                        libncbi.$(so)
+libncbicn3dOGL_deps   = $(libncbicn3d_deps) libvibrantOGL.$(so)
+libncbicn3dOGL_sysdeps = -lm
+libncbidesk_deps      = libblastapi.$(so) libncbimmdb.$(so) libncbitool.$(so) \
+                        libvibrantOGL.$(so) libncbiobj.$(so) libncbi.$(so)
+libncbidesk_sysdeps   = -lm
+libvibnet_deps        = libncbiNacc.$(so) libncbidesk.$(so) libncbimmdb.$(so) \
+                        libvibrantOGL.$(so) libncbitool.$(so) \
+                        libncbicdr.$(so) libncbiobj.$(so) libncbi.$(so)
+# libvibrant_deps     = libncbi.$(so)
+# libvibrant_sysdeps  = $(VIBLIBS)
+# for ddvcolor stuff
+libvibrantOGL_deps    = libncbiobj.$(so) libncbi.$(so)
+libvibrantOGL_sysdeps = $(OGLLIBS) $(VIBLIBS) -lm
+
+# XXX - is there a way to express these programmatically?
+libblast.$(so):    $(libblast_deps)
+libblastapi.$(so): $(libblastapi_deps)
+libconnssl.$(so):  $(libconnssl_deps)
+# libncbiCacc.$(so): $(libncbiCacc_deps)
+libncbiNacc.$(so): $(libncbiNacc_deps)
+# libncbiacc.$(so):  $(libncbiacc_deps)
+libncbicdr.$(so):  $(libncbicdr_deps)
+libncbiid1.$(so):  $(libncbiid1_deps)
+libncbimla.$(so):  $(libncbimla_deps)
+libncbimmdb.$(so): $(libncbimmdb_deps)
+libncbiobj.$(so):  $(libncbiobj_deps)
+libncbitool.$(so): $(libncbitool_deps)
+libncbitxc2.$(so): $(libncbitxc2_deps)
+libnetblast.$(so): $(libnetblast_deps)
+libnetcli.$(so):   $(libnetcli_deps)
+# libnetentr.$(so): $(libnetentr_deps)
+
+libddvlib.$(so):      $(libddvlib_deps)
+# libncbicn3d.$(so):  $(libncbicn3d_deps)
+libncbicn3dOGL.$(so): $(libncbicn3dOGL_deps)
+libncbidesk.$(so):    $(libncbidesk_deps)
+libvibgif.$(so):      $(libvibgif_deps)
+libvibnet.$(so):      $(libvibnet_deps)
+# libvibrant.$(so):   $(libvibrant_deps)
+libvibrantOGL.$(so):  $(libvibrantOGL_deps)
--- ncbi-tools6-6.1.20170106.orig/tools/readdb.c
+++ ncbi-tools6-6.1.20170106/tools/readdb.c
@@ -10167,7 +10167,10 @@ static    Int2    FDBFinish (FormatDBPtr
             return 1;
     
     MemSet(dateTime, 0, DATETIME_LENGTH);
-    Nlm_DayTimeStr(dateTime, TRUE, TRUE);
+    /* SOURCE_DATE_EPOCH specification: "If the value is malformed, the
+       build process SHOULD exit with a non-zero error code." */
+    if (!Nlm_DayTimeStr(dateTime, TRUE, TRUE))
+      return 1;
 
     /* write db_title and date-time stamp eigth bytes aligned */
     tmp = title_len + StringLen(dateTime);
--- ncbi-tools6-6.1.20170106.orig/vibrant/netscape.c
+++ ncbi-tools6-6.1.20170106/vibrant/netscape.c
@@ -548,9 +548,8 @@ static Boolean NS_LoadNetscape(const cha
     }
 
     /* ---------- child process ------------ */
-    if (execlp("netscape", "netscape", url, NULL) < 0  &&
-        execl(NETSCAPE_PATH, NETSCAPE_PATH, url, NULL) < 0) {
-        Message(MSG_ERROR, "Failure to open URL in netscape window");
+    if (execlp("sensible-browser", "sensible-browser", url, NULL) < 0) {
+        Message(MSG_ERROR, "Failure to open URL in browser window");
         exit(1);
     }
 
--- ncbi-tools6-6.1.20170106.orig/vibrant/shim3d.c
+++ ncbi-tools6-6.1.20170106/vibrant/shim3d.c
@@ -321,6 +321,7 @@
 
 #ifdef _PNG
 #include <png.h> /* must go berore ncbi headers */
+#include <zlib.h>
 #ifndef png_jmpbuf
 #define png_jmpbuf(x) ((x)->jmpbuf)
 #endif
@@ -339,7 +340,8 @@ NLM_EXTERN void LIBCALL Nlm_HeapSort PRO
 #include <ddvcolor.h>
 
 #if defined(_OPENGL) && defined(_PNG)
-TOGL_Data *Cn3D_GetCurrentOGLData(void); /* in cn3dxprt.c */
+/* In cn3dxprt.c; declared weak here to avoid dependency loops. */
+extern TOGL_Data *Cn3D_GetCurrentOGLData(void) __attribute__((weak));
 #endif
 
 
@@ -2939,7 +2941,15 @@ void Nlm_SaveImagePNG(Nlm_Char *fname)
     png_structp png_ptr = NULL;
     png_infop info_ptr = NULL;
     Nlm_Boolean doInterlacing = TRUE;
-    TOGL_Data *OGL_Data = (TOGL_Data *)(Cn3D_GetCurrentOGLData());
+    TOGL_Data *OGL_Data;
+    
+    if (!Cn3D_GetCurrentOGLData) {
+      Message(MSG_ERROR, "PNG output unavailable; "
+	      "please relink application with -lncbicn3d.");
+      return;
+    }
+    
+    OGL_Data = (TOGL_Data *)(Cn3D_GetCurrentOGLData());
 
 #if defined(WIN_MOTIF)
     GLint glSize;
@@ -3720,4 +3730,3 @@ void Nlm_AddHalfWorm3D(Nlm_Picture3D pic
     if (fblock)
         MemFree(fblock);
 }
-
--- ncbi-tools6-6.1.20170106.orig/vibrant/vibmain.c
+++ ncbi-tools6-6.1.20170106/vibrant/vibmain.c
@@ -44,6 +44,21 @@
 
 
 
+extern Nlm_Int2 Nlm_Main(void) __attribute__((weak));
+
+static Nlm_Int2 s_CallNlmMain(void)
+{
+  if (Nlm_Main) {
+    return Nlm_Main();
+  } else {
+    ErrPost(0, 0, "Neither main nor Nlm_Main defined by program.");
+    return -1;
+  }
+}
+
+#define Nlm_Main s_CallNlmMain
+
+
 #ifdef WIN_MAC
 #ifdef OS_UNIX_DARWIN
 int main (int argc, char *argv[]) 
--- ncbi-tools6-6.1.20170106.orig/vibrant/vibwndws.c
+++ ncbi-tools6-6.1.20170106/vibrant/vibwndws.c
@@ -6818,7 +6818,7 @@ extern void Nlm_VibMainPrelude (int argc
   Nlm_InitPrompt ();
   Nlm_InitSlate ();
   Nlm_InitTexts ();
-  if (! Nlm_SetupWindows ()) return;
+  if (! Nlm_SetupWindows ()) exit(1);
   Nlm_RegisterWindows ();
   Nlm_RegisterTexts ();
   Nlm_RegisterSlates ();