Changeset 745 for trunk/server/source4/heimdal/lib/asn1
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 38 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source4/heimdal/lib/asn1/asn1-common.h
r414 r745 3 3 #include <stddef.h> 4 4 #include <time.h> 5 #include <krb5-types.h> 5 6 6 7 #ifndef __asn1_common_definitions__ … … 20 21 typedef char *heim_general_string; 21 22 typedef char *heim_utf8_string; 22 typedef char *heim_printable_string;23 typedef char *heim_ia5_string;23 typedef struct heim_octet_string heim_printable_string; 24 typedef struct heim_octet_string heim_ia5_string; 24 25 25 26 typedef struct heim_bmp_string { … … 64 65 } while (0) 65 66 67 #ifdef _WIN32 68 #ifndef ASN1_LIB 69 #define ASN1EXP __declspec(dllimport) 70 #else 71 #define ASN1EXP 66 72 #endif 73 #define ASN1CALL __stdcall 74 #else 75 #define ASN1EXP 76 #define ASN1CALL 77 #endif 78 79 #endif -
trunk/server/source4/heimdal/lib/asn1/asn1_err.et
r414 r745 25 25 error_code INDEF_OVERRUN, "ASN.1 BER indefinte encoding overrun" 26 26 error_code INDEF_UNDERRUN, "ASN.1 BER indefinte encoding underun" 27 error_code GOT_BER, "ASN.1 got BER encoded when expected DER" 28 error_code INDEF_EXTRA_DATA, "ASN.1 EoC tag contained data" 27 29 end -
trunk/server/source4/heimdal/lib/asn1/asn1_gen.c
r414 r745 47 47 { 48 48 char buf[2048]; 49 char *fnout ;49 char *fnout = NULL; 50 50 const char *bname; 51 51 unsigned long line = 0; … … 63 63 bname = fn; 64 64 65 asprintf(&fnout, "%s.out", bname); 66 if (fnout == NULL) 65 if (asprintf(&fnout, "%s.out", bname) < 0 || fnout == NULL) 67 66 errx(1, "malloc"); 68 67 -
trunk/server/source4/heimdal/lib/asn1/asn1parse.c
r414 r745 1 /* A Bison parser, made by GNU Bison 2.3. */ 1 2 /* A Bison parser, made by GNU Bison 2.4.1. */ 2 3 3 4 /* Skeleton implementation for Bison's Yacc-like parsers in C 4 5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 20065 6 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 6 7 Free Software Foundation, Inc. 7 8 This program is free software ;you can redistribute it and/or modify8 9 This program is free software: you can redistribute it and/or modify 9 10 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation ; either version 2, or (at your option)11 any later version.12 11 the Free Software Foundation, either version 3 of the License, or 12 (at your option) any later version. 13 13 14 This program is distributed in the hope that it will be useful, 14 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 17 GNU General Public License for more details. 17 18 18 19 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 Boston, MA 02110-1301, USA. */ 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 22 21 23 22 /* As a special exception, you may create a larger work that contains … … 30 29 Bison output files to be licensed under the GNU General Public 31 30 License without this special exception. 32 31 33 32 This special exception was added by the Free Software Foundation in 34 33 version 2.2 of Bison. */ … … 48 47 49 48 /* Bison version. */ 50 #define YYBISON_VERSION "2. 3"49 #define YYBISON_VERSION "2.4.1" 51 50 52 51 /* Skeleton name. */ … … 56 55 #define YYPURE 0 57 56 57 /* Push parsers. */ 58 #define YYPUSH 0 59 60 /* Pull parsers. */ 61 #define YYPULL 1 62 58 63 /* Using locations. */ 59 64 #define YYLSP_NEEDED 0 60 65 66 67 68 /* Copy the first part of user declarations. */ 69 70 /* Line 189 of yacc.c */ 71 #line 38 "asn1parse.c" 72 73 74 #include <config.h> 75 76 #include <stdio.h> 77 #include <stdlib.h> 78 #include <string.h> 79 #include "symbol.h" 80 #include "lex.h" 81 #include "gen_locl.h" 82 #include "der.h" 83 84 RCSID("$Id$"); 85 86 static Type *new_type (Typetype t); 87 static struct constraint_spec *new_constraint_spec(enum ctype); 88 static Type *new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype); 89 void yyerror (const char *); 90 static struct objid *new_objid(const char *label, int value); 91 static void add_oid_to_tail(struct objid *, struct objid *); 92 static void fix_labels(Symbol *s); 93 94 struct string_list { 95 char *string; 96 struct string_list *next; 97 }; 98 99 /* Declarations for Bison */ 100 #define YYMALLOC malloc 101 #define YYFREE free 102 103 104 105 /* Line 189 of yacc.c */ 106 #line 107 "asn1parse.c" 107 108 /* Enabling traces. */ 109 #ifndef YYDEBUG 110 # define YYDEBUG 0 111 #endif 112 113 /* Enabling verbose error messages. */ 114 #ifdef YYERROR_VERBOSE 115 # undef YYERROR_VERBOSE 116 # define YYERROR_VERBOSE 1 117 #else 118 # define YYERROR_VERBOSE 0 119 #endif 120 121 /* Enabling the token table. */ 122 #ifndef YYTOKEN_TABLE 123 # define YYTOKEN_TABLE 0 124 #endif 61 125 62 126 … … 248 312 249 313 250 /* Copy the first part of user declarations. */251 #line 36 "heimdal/lib/asn1/asn1parse.y"252 253 254 #include <config.h>255 256 #include <stdio.h>257 #include <stdlib.h>258 #include <string.h>259 #include "symbol.h"260 #include "lex.h"261 #include "gen_locl.h"262 #include "der.h"263 264 RCSID("$Id$");265 266 static Type *new_type (Typetype t);267 static struct constraint_spec *new_constraint_spec(enum ctype);268 static Type *new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype);269 void yyerror (const char *);270 static struct objid *new_objid(const char *label, int value);271 static void add_oid_to_tail(struct objid *, struct objid *);272 static void fix_labels(Symbol *s);273 274 struct string_list {275 char *string;276 struct string_list *next;277 };278 279 280 281 /* Enabling traces. */282 #ifndef YYDEBUG283 # define YYDEBUG 0284 #endif285 286 /* Enabling verbose error messages. */287 #ifdef YYERROR_VERBOSE288 # undef YYERROR_VERBOSE289 # define YYERROR_VERBOSE 1290 #else291 # define YYERROR_VERBOSE 0292 #endif293 294 /* Enabling the token table. */295 #ifndef YYTOKEN_TABLE296 # define YYTOKEN_TABLE 0297 #endif298 299 314 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 300 315 typedef union YYSTYPE 301 #line 65 "heimdal/lib/asn1/asn1parse.y" 302 { 316 { 317 318 /* Line 214 of yacc.c */ 319 #line 71 "asn1parse.c" 320 303 321 int constant; 304 322 struct value *value; … … 313 331 struct memhead *members; 314 332 struct constraint_spec *constraint_spec; 315 } 316 /* Line 187 of yacc.c. */ 317 #line 318 "heimdal/lib/asn1/asn1parse.y" 318 YYSTYPE; 333 334 335 336 /* Line 214 of yacc.c */ 337 #line 338 "asn1parse.c" 338 } YYSTYPE; 339 # define YYSTYPE_IS_TRIVIAL 1 319 340 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 320 341 # define YYSTYPE_IS_DECLARED 1 321 # define YYSTYPE_IS_TRIVIAL 1 322 #endif 323 342 #endif 324 343 325 344 … … 327 346 328 347 329 /* Line 2 16 of yacc.c.*/330 #line 3 31 "heimdal/lib/asn1/asn1parse.y"348 /* Line 264 of yacc.c */ 349 #line 350 "asn1parse.c" 331 350 332 351 #ifdef short … … 403 422 || defined __cplusplus || defined _MSC_VER) 404 423 static int 405 YYID (int i)424 YYID (int yyi) 406 425 #else 407 426 static int 408 YYID ( i)409 int i;410 #endif 411 { 412 return i;427 YYID (yyi) 428 int yyi; 429 #endif 430 { 431 return yyi; 413 432 } 414 433 #endif … … 491 510 union yyalloc 492 511 { 493 yytype_int16 yyss ;494 YYSTYPE yyvs ;495 512 yytype_int16 yyss_alloc; 513 YYSTYPE yyvs_alloc; 514 }; 496 515 497 516 /* The size of the maximum gap between one aligned stack and the next. */ … … 527 546 stack. Advance YYPTR to a properly aligned location for the next 528 547 stack. */ 529 # define YYSTACK_RELOCATE(Stack )\548 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 530 549 do \ 531 550 { \ 532 551 YYSIZE_T yynewbytes; \ 533 YYCOPY (&yyptr->Stack , Stack, yysize);\534 Stack = &yyptr->Stack ;\552 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 553 Stack = &yyptr->Stack_alloc; \ 535 554 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 536 555 yyptr += yynewbytes / sizeof (*yyptr); \ … … 543 562 #define YYFINAL 6 544 563 /* YYLAST -- Last index in YYTABLE. */ 545 #define YYLAST 195564 #define YYLAST 203 546 565 547 566 /* YYNTOKENS -- Number of terminals. */ 548 567 #define YYNTOKENS 98 549 568 /* YYNNTS -- Number of nonterminals. */ 550 #define YYNNTS 6 8569 #define YYNNTS 69 551 570 /* YYNRULES -- Number of rules. */ 552 #define YYNRULES 1 36571 #define YYNRULES 140 553 572 /* YYNRULES -- Number of states. */ 554 #define YYNSTATES 2 14573 #define YYNSTATES 220 555 574 556 575 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ … … 607 626 { 608 627 0, 0, 3, 13, 16, 19, 22, 23, 26, 27, 609 30, 31, 35, 36, 38, 39, 41, 44, 49, 51, 610 54, 56, 58, 62, 64, 68, 70, 72, 74, 76, 611 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 612 98, 100, 102, 104, 110, 116, 122, 126, 128, 131, 613 136, 138, 142, 146, 151, 156, 158, 161, 167, 170, 614 174, 176, 177, 180, 185, 189, 194, 199, 203, 207, 615 212, 214, 216, 218, 220, 222, 225, 229, 231, 233, 616 235, 238, 242, 248, 253, 257, 262, 263, 265, 267, 617 269, 270, 272, 274, 279, 281, 283, 285, 287, 289, 618 291, 293, 295, 297, 301, 305, 308, 310, 313, 317, 619 319, 323, 328, 330, 331, 335, 336, 339, 344, 346, 620 348, 350, 352, 354, 356, 358, 360, 362, 364, 366, 621 368, 370, 372, 374, 376, 378, 380 628 31, 32, 36, 37, 39, 40, 42, 45, 50, 54, 629 57, 58, 60, 63, 65, 67, 71, 73, 77, 79, 630 81, 83, 85, 87, 89, 91, 93, 95, 97, 99, 631 101, 103, 105, 107, 109, 111, 113, 119, 125, 131, 632 135, 137, 140, 145, 147, 151, 155, 160, 165, 167, 633 170, 176, 179, 183, 185, 186, 189, 194, 198, 203, 634 208, 212, 216, 221, 223, 225, 227, 229, 231, 234, 635 238, 240, 242, 244, 247, 251, 257, 262, 266, 271, 636 272, 274, 276, 278, 279, 281, 283, 288, 290, 292, 637 294, 296, 298, 300, 302, 304, 306, 308, 312, 316, 638 319, 321, 324, 328, 330, 334, 339, 341, 342, 346, 639 347, 350, 355, 357, 359, 361, 363, 365, 367, 369, 640 371, 373, 375, 377, 379, 381, 383, 385, 387, 389, 641 391 622 642 }; 623 643 … … 625 645 static const yytype_int16 yyrhs[] = 626 646 { 627 99, 0, -1, 86, 15 1, 21, 100, 101, 84, 8,647 99, 0, -1, 86, 152, 21, 100, 101, 84, 8, 628 648 102, 24, -1, 27, 70, -1, 38, 70, -1, 7, 629 70, -1, -1, 29, 39, -1, -1, 103, 107, -1, 630 -1, 40, 104, 90, -1, -1, 105, -1, -1, 106, 631 -1, 105, 106, -1, 109, 32, 86, 151, -1, 108, 632 -1, 108, 107, -1, 110, -1, 143, -1, 86, 91, 633 109, -1, 86, -1, 86, 84, 111, -1, 112, -1, 634 130, -1, 133, -1, 120, -1, 113, -1, 144, -1, 635 129, -1, 118, -1, 115, -1, 123, -1, 121, -1, 636 122, -1, 125, -1, 126, -1, 127, -1, 128, -1, 637 139, -1, 11, -1, 92, 155, 83, 155, 93, -1, 638 92, 155, 83, 46, 93, -1, 92, 47, 83, 155, 639 93, -1, 92, 155, 93, -1, 43, -1, 43, 114, 640 -1, 43, 94, 116, 95, -1, 117, -1, 116, 91, 641 117, -1, 116, 91, 85, -1, 86, 92, 163, 93, 642 -1, 25, 94, 119, 95, -1, 116, -1, 9, 67, 643 -1, 9, 67, 94, 149, 95, -1, 51, 37, -1, 644 52, 67, 124, -1, 49, -1, -1, 66, 114, -1, 645 64, 94, 146, 95, -1, 64, 94, 95, -1, 64, 646 124, 53, 111, -1, 65, 94, 146, 95, -1, 65, 647 94, 95, -1, 65, 53, 111, -1, 14, 94, 146, 648 95, -1, 131, -1, 132, -1, 86, -1, 34, -1, 649 77, -1, 111, 134, -1, 92, 135, 93, -1, 136, 650 -1, 137, -1, 138, -1, 19, 111, -1, 23, 12, 651 155, -1, 19, 111, 23, 12, 155, -1, 18, 12, 652 94, 95, -1, 140, 142, 111, -1, 96, 141, 89, 653 97, -1, -1, 76, -1, 6, -1, 60, -1, -1, 654 27, -1, 38, -1, 86, 111, 84, 155, -1, 145, 655 -1, 33, -1, 78, -1, 61, -1, 81, -1, 36, 656 -1, 10, -1, 79, -1, 148, -1, 146, 91, 148, 657 -1, 146, 91, 85, -1, 86, 111, -1, 147, -1, 658 147, 54, -1, 147, 20, 155, -1, 150, -1, 149, 659 91, 150, -1, 86, 92, 89, 93, -1, 152, -1, 660 -1, 94, 153, 95, -1, -1, 154, 153, -1, 86, 661 92, 89, 93, -1, 86, -1, 89, -1, 156, -1, 662 157, -1, 161, -1, 160, -1, 162, -1, 165, -1, 663 164, -1, 158, -1, 159, -1, 86, -1, 88, -1, 664 71, -1, 31, -1, 163, -1, 89, -1, 49, -1, 665 152, -1 649 70, -1, -1, 29, 39, -1, -1, 107, 103, 108, 650 -1, -1, 40, 104, 90, -1, -1, 105, -1, -1, 651 106, -1, 105, 106, -1, 110, 32, 86, 152, -1, 652 28, 110, 90, -1, 28, 5, -1, -1, 109, -1, 653 109, 108, -1, 111, -1, 144, -1, 86, 91, 110, 654 -1, 86, -1, 86, 84, 112, -1, 113, -1, 131, 655 -1, 134, -1, 121, -1, 114, -1, 145, -1, 130, 656 -1, 119, -1, 116, -1, 124, -1, 122, -1, 123, 657 -1, 126, -1, 127, -1, 128, -1, 129, -1, 140, 658 -1, 11, -1, 92, 156, 83, 156, 93, -1, 92, 659 156, 83, 46, 93, -1, 92, 47, 83, 156, 93, 660 -1, 92, 156, 93, -1, 43, -1, 43, 115, -1, 661 43, 94, 117, 95, -1, 118, -1, 117, 91, 118, 662 -1, 117, 91, 85, -1, 86, 92, 164, 93, -1, 663 25, 94, 120, 95, -1, 117, -1, 9, 67, -1, 664 9, 67, 94, 150, 95, -1, 51, 37, -1, 52, 665 67, 125, -1, 49, -1, -1, 66, 115, -1, 64, 666 94, 147, 95, -1, 64, 94, 95, -1, 64, 125, 667 53, 112, -1, 65, 94, 147, 95, -1, 65, 94, 668 95, -1, 65, 53, 112, -1, 14, 94, 147, 95, 669 -1, 132, -1, 133, -1, 86, -1, 34, -1, 77, 670 -1, 112, 135, -1, 92, 136, 93, -1, 137, -1, 671 138, -1, 139, -1, 19, 112, -1, 23, 12, 156, 672 -1, 19, 112, 23, 12, 156, -1, 18, 12, 94, 673 95, -1, 141, 143, 112, -1, 96, 142, 89, 97, 674 -1, -1, 76, -1, 6, -1, 60, -1, -1, 27, 675 -1, 38, -1, 86, 112, 84, 156, -1, 146, -1, 676 33, -1, 73, -1, 78, -1, 61, -1, 81, -1, 677 36, -1, 10, -1, 79, -1, 149, -1, 147, 91, 678 149, -1, 147, 91, 85, -1, 86, 112, -1, 148, 679 -1, 148, 54, -1, 148, 20, 156, -1, 151, -1, 680 150, 91, 151, -1, 86, 92, 89, 93, -1, 153, 681 -1, -1, 94, 154, 95, -1, -1, 155, 154, -1, 682 86, 92, 89, 93, -1, 86, -1, 89, -1, 157, 683 -1, 158, -1, 162, -1, 161, -1, 163, -1, 166, 684 -1, 165, -1, 159, -1, 160, -1, 86, -1, 88, 685 -1, 71, -1, 31, -1, 164, -1, 89, -1, 49, 686 -1, 153, -1 666 687 }; 667 688 … … 669 690 static const yytype_uint16 yyrline[] = 670 691 { 671 0, 233, 233, 240, 241, 243, 245, 248, 250, 253, 672 254, 257, 258, 261, 262, 265, 266, 269, 280, 281, 673 284, 285, 288, 294, 302, 312, 313, 314, 317, 318, 674 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 675 329, 330, 333, 340, 350, 358, 366, 377, 382, 388, 676 396, 402, 407, 411, 424, 432, 435, 442, 450, 456, 677 465, 473, 474, 479, 485, 493, 502, 508, 516, 524, 678 531, 532, 535, 546, 551, 558, 574, 580, 583, 584, 679 587, 593, 601, 611, 617, 630, 639, 642, 646, 650, 680 657, 660, 664, 671, 682, 685, 690, 695, 700, 705, 681 710, 715, 723, 729, 734, 745, 756, 762, 768, 776, 682 782, 789, 802, 803, 806, 813, 816, 827, 831, 842, 683 848, 849, 852, 853, 854, 855, 856, 859, 862, 865, 684 876, 884, 890, 898, 906, 909, 914 692 0, 239, 239, 246, 247, 249, 251, 254, 256, 259, 693 260, 263, 264, 267, 268, 271, 272, 275, 287, 293, 694 294, 297, 298, 301, 302, 305, 311, 319, 329, 330, 695 331, 334, 335, 336, 337, 338, 339, 340, 341, 342, 696 343, 344, 345, 346, 347, 350, 357, 367, 375, 383, 697 394, 399, 405, 413, 419, 424, 428, 441, 449, 452, 698 459, 467, 473, 482, 490, 491, 496, 502, 510, 519, 699 525, 533, 541, 548, 549, 552, 563, 568, 575, 591, 700 597, 600, 601, 604, 610, 618, 628, 634, 647, 656, 701 659, 663, 667, 674, 677, 681, 688, 699, 702, 707, 702 712, 717, 722, 727, 732, 737, 745, 751, 756, 767, 703 778, 784, 790, 798, 804, 811, 824, 825, 828, 835, 704 838, 849, 853, 864, 870, 871, 874, 875, 876, 877, 705 878, 881, 884, 887, 898, 906, 912, 920, 928, 931, 706 936 685 707 }; 686 708 #endif … … 714 736 "$accept", "ModuleDefinition", "TagDefault", "ExtensionDefault", 715 737 "ModuleBody", "Imports", "SymbolsImported", "SymbolsFromModuleList", 716 "SymbolsFromModule", "AssignmentList", "Assignment", "referencenames", 717 "TypeAssignment", "Type", "BuiltinType", "BooleanType", "range", 718 "IntegerType", "NamedNumberList", "NamedNumber", "EnumeratedType", 719 "Enumerations", "BitStringType", "ObjectIdentifierType", 720 "OctetStringType", "NullType", "size", "SequenceType", "SequenceOfType", 721 "SetType", "SetOfType", "ChoiceType", "ReferencedType", "DefinedType", 722 "UsefulType", "ConstrainedType", "Constraint", "ConstraintSpec", 723 "GeneralConstraint", "ContentsConstraint", "UserDefinedConstraint", 724 "TaggedType", "Tag", "Class", "tagenv", "ValueAssignment", 725 "CharacterStringType", "RestrictedCharactedStringType", 726 "ComponentTypeList", "NamedType", "ComponentType", "NamedBitList", 727 "NamedBit", "objid_opt", "objid", "objid_list", "objid_element", "Value", 728 "BuiltinValue", "ReferencedValue", "DefinedValue", "Valuereference", 738 "SymbolsFromModule", "Exports", "AssignmentList", "Assignment", 739 "referencenames", "TypeAssignment", "Type", "BuiltinType", "BooleanType", 740 "range", "IntegerType", "NamedNumberList", "NamedNumber", 741 "EnumeratedType", "Enumerations", "BitStringType", 742 "ObjectIdentifierType", "OctetStringType", "NullType", "size", 743 "SequenceType", "SequenceOfType", "SetType", "SetOfType", "ChoiceType", 744 "ReferencedType", "DefinedType", "UsefulType", "ConstrainedType", 745 "Constraint", "ConstraintSpec", "GeneralConstraint", 746 "ContentsConstraint", "UserDefinedConstraint", "TaggedType", "Tag", 747 "Class", "tagenv", "ValueAssignment", "CharacterStringType", 748 "RestrictedCharactedStringType", "ComponentTypeList", "NamedType", 749 "ComponentType", "NamedBitList", "NamedBit", "objid_opt", "objid", 750 "objid_list", "objid_element", "Value", "BuiltinValue", 751 "ReferencedValue", "DefinedValue", "Valuereference", 729 752 "CharacterStringValue", "BooleanValue", "IntegerValue", "SignedNumber", 730 753 "NullValue", "ObjectIdentifierValue", 0 … … 755 778 0, 98, 99, 100, 100, 100, 100, 101, 101, 102, 756 779 102, 103, 103, 104, 104, 105, 105, 106, 107, 107, 757 108, 108, 109, 109, 110, 111, 111, 111, 112, 112, 758 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 759 112, 112, 113, 114, 114, 114, 114, 115, 115, 115, 760 116, 116, 116, 117, 118, 119, 120, 120, 121, 122, 761 123, 124, 124, 125, 125, 126, 127, 127, 128, 129, 762 130, 130, 131, 132, 132, 133, 134, 135, 136, 136, 763 137, 137, 137, 138, 139, 140, 141, 141, 141, 141, 764 142, 142, 142, 143, 144, 145, 145, 145, 145, 145, 765 145, 145, 146, 146, 146, 147, 148, 148, 148, 149, 766 149, 150, 151, 151, 152, 153, 153, 154, 154, 154, 767 155, 155, 156, 156, 156, 156, 156, 157, 158, 159, 768 160, 161, 161, 162, 163, 164, 165 780 107, 108, 108, 109, 109, 110, 110, 111, 112, 112, 781 112, 113, 113, 113, 113, 113, 113, 113, 113, 113, 782 113, 113, 113, 113, 113, 114, 115, 115, 115, 115, 783 116, 116, 116, 117, 117, 117, 118, 119, 120, 121, 784 121, 122, 123, 124, 125, 125, 126, 126, 127, 128, 785 128, 129, 130, 131, 131, 132, 133, 133, 134, 135, 786 136, 137, 137, 138, 138, 138, 139, 140, 141, 142, 787 142, 142, 142, 143, 143, 143, 144, 145, 146, 146, 788 146, 146, 146, 146, 146, 146, 147, 147, 147, 148, 789 149, 149, 149, 150, 150, 151, 152, 152, 153, 154, 790 154, 155, 155, 155, 156, 156, 157, 157, 157, 157, 791 157, 158, 159, 160, 161, 162, 162, 163, 164, 165, 792 166 769 793 }; 770 794 … … 772 796 static const yytype_uint8 yyr2[] = 773 797 { 774 0, 2, 9, 2, 2, 2, 0, 2, 0, 2,775 0, 3, 0, 1, 0, 1, 2, 4, 1, 2,776 1, 1, 3, 1, 3, 1, 1, 1, 1, 1,798 0, 2, 9, 2, 2, 2, 0, 2, 0, 3, 799 0, 3, 0, 1, 0, 1, 2, 4, 3, 2, 800 0, 1, 2, 1, 1, 3, 1, 3, 1, 1, 777 801 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 778 1, 1, 1, 5, 5, 5, 3, 1, 2, 4, 779 1, 3, 3, 4, 4, 1, 2, 5, 2, 3, 780 1, 0, 2, 4, 3, 4, 4, 3, 3, 4, 781 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 782 2, 3, 5, 4, 3, 4, 0, 1, 1, 1, 783 0, 1, 1, 4, 1, 1, 1, 1, 1, 1, 784 1, 1, 1, 3, 3, 2, 1, 2, 3, 1, 785 3, 4, 1, 0, 3, 0, 2, 4, 1, 1, 802 1, 1, 1, 1, 1, 1, 5, 5, 5, 3, 803 1, 2, 4, 1, 3, 3, 4, 4, 1, 2, 804 5, 2, 3, 1, 0, 2, 4, 3, 4, 4, 805 3, 3, 4, 1, 1, 1, 1, 1, 2, 3, 806 1, 1, 1, 2, 3, 5, 4, 3, 4, 0, 807 1, 1, 1, 0, 1, 1, 4, 1, 1, 1, 808 1, 1, 1, 1, 1, 1, 1, 3, 3, 2, 809 1, 2, 3, 1, 3, 4, 1, 0, 3, 0, 810 2, 4, 1, 1, 1, 1, 1, 1, 1, 1, 786 811 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 787 1 , 1, 1, 1, 1, 1, 1812 1 788 813 }; 789 814 … … 793 818 static const yytype_uint8 yydefact[] = 794 819 { 795 0, 11 3, 0, 115, 0, 112, 1, 118, 119, 0,796 11 5, 6, 0, 114, 116, 0, 0, 0, 8, 0,797 5, 3, 4, 0, 0, 1 17, 7, 0, 10, 14,798 0, 0, 23, 0, 13, 15, 0, 2, 0, 9,799 18, 20, 21, 0, 11, 16, 0, 0, 100, 42,800 0, 0, 95, 73, 99, 47, 60, 0, 0, 97,801 61, 0, 74, 96, 101, 98, 0, 72, 86, 0,802 25, 29, 33, 32, 28, 35, 36, 34, 37, 38,803 3 9, 40, 31, 26, 70, 71, 27, 41, 90, 30,804 94, 19, 22, 113, 56, 0, 0, 0, 0, 48,805 5 8, 61, 0, 0, 0, 0, 0, 24, 88, 89,806 87, 0, 0, 0, 75, 91, 92, 0, 17, 0,807 0, 0, 106, 102, 0, 55, 50, 0, 132, 0,808 135, 131, 129, 130, 134, 136, 0, 120, 121, 127,809 1 28, 123, 122, 124, 133, 126, 125, 0, 59, 62,810 64, 0, 0, 68, 67, 0, 0, 93, 0, 0,811 0, 0, 77, 78, 79, 84, 0, 0, 109, 105,812 0, 69, 0, 107, 0, 0, 54, 0, 0, 46,813 49, 63, 65, 66, 85, 0, 80, 0, 76, 0,814 0, 57, 104, 103, 108, 0, 52, 51, 0, 0,815 0, 0, 0, 81, 0, 110, 53, 45, 44, 43,816 83, 0, 111, 82820 0, 117, 0, 119, 0, 116, 1, 122, 123, 0, 821 119, 6, 0, 118, 120, 0, 0, 0, 8, 0, 822 5, 3, 4, 0, 0, 121, 7, 0, 20, 0, 823 0, 12, 19, 26, 0, 2, 14, 0, 0, 18, 824 0, 13, 15, 0, 0, 9, 21, 23, 24, 25, 825 11, 16, 0, 0, 104, 45, 0, 0, 98, 76, 826 103, 50, 63, 0, 0, 101, 64, 0, 99, 77, 827 100, 105, 102, 0, 75, 89, 0, 28, 32, 36, 828 35, 31, 38, 39, 37, 40, 41, 42, 43, 34, 829 29, 73, 74, 30, 44, 93, 33, 97, 22, 117, 830 59, 0, 0, 0, 0, 51, 61, 64, 0, 0, 831 0, 0, 0, 27, 91, 92, 90, 0, 0, 0, 832 78, 94, 95, 0, 17, 0, 0, 0, 110, 106, 833 0, 58, 53, 0, 136, 0, 139, 135, 133, 134, 834 138, 140, 0, 124, 125, 131, 132, 127, 126, 128, 835 137, 130, 129, 0, 62, 65, 67, 0, 0, 71, 836 70, 0, 0, 96, 0, 0, 0, 0, 80, 81, 837 82, 87, 0, 0, 113, 109, 0, 72, 0, 111, 838 0, 0, 57, 0, 0, 49, 52, 66, 68, 69, 839 88, 0, 83, 0, 79, 0, 0, 60, 108, 107, 840 112, 0, 55, 54, 0, 0, 0, 0, 0, 84, 841 0, 114, 56, 48, 47, 46, 86, 0, 115, 85 817 842 }; 818 843 … … 820 845 static const yytype_int16 yydefgoto[] = 821 846 { 822 -1, 2, 18, 24, 30, 3 1, 33, 34, 35, 39,823 4 0, 36, 41, 69, 70, 71, 99, 72, 125, 126,824 73, 127, 74, 75, 76, 77, 104, 78, 79, 80,825 8 1, 82, 83, 84, 85, 86, 114, 161, 162, 163,826 16 4, 87, 88, 111, 117, 42, 89, 90, 121, 122,827 12 3, 167, 168, 4, 135, 9, 10, 136, 137, 138,828 1 39, 140, 141, 142, 143, 144, 145, 146847 -1, 2, 18, 24, 30, 37, 40, 41, 42, 31, 848 45, 46, 43, 47, 76, 77, 78, 105, 79, 131, 849 132, 80, 133, 81, 82, 83, 84, 110, 85, 86, 850 87, 88, 89, 90, 91, 92, 93, 120, 167, 168, 851 169, 170, 94, 95, 117, 123, 48, 96, 97, 127, 852 128, 129, 173, 174, 4, 141, 9, 10, 142, 143, 853 144, 145, 146, 147, 148, 149, 150, 151, 152 829 854 }; 830 855 831 856 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 832 857 STATE-NUM. */ 833 #define YYPACT_NINF -11 3858 #define YYPACT_NINF -119 834 859 static const yytype_int16 yypact[] = 835 860 { 836 - 74, -67, 38, -69, 23, -113, -113, -44, -113, -41,837 -6 9, 4, -26, -113, -113, -3, 1, 10, 52, -10,838 -11 3, -113, -113, 45, 13, -113, -113, 77, -35, 15,839 64, 19, 17, 20, 15, -113, 85, -113, 25, -113,840 19, -113, -113, 15, -113, -113, 27, 47, -113, -113,841 26, 29, -113, -113, -113, -30, -113, 89, 61, -113,842 -57, -47, -113, -113, -113, -113, 82, -113, -4, -68,843 -11 3, -113, -113, -113, -113, -113, -113, -113, -113, -113,844 -11 3, -113, -113, -113, -113, -113, -113, -113, -17, -113,845 -11 3, -113, -113, -67, 35, 33, 46, 51, 46, -113,846 -113, 69, 44, -73, 88, 82, -72, 56, -113, -113,847 -113, 49, 93, 7, -113, -113, -113, 82, -113, 58,848 82, -76, -13, -113, 57, 59, -113, 60, -113, 68,849 -113, -113, -113, -113, -113, -113, -75, -113, -113, -113,850 -11 3, -113, -113, -113, -113, -113, -113, -63, -113, -113,851 -11 3, -62, 82, 56, -113, -46, 65, -113, 141, 82,852 142, 63, -113, -113, -113, 56, 66, -38, -113, 56,853 -16, -113, 93, -113, 76, -7, -113, 93, 81, -113,854 -113, -113, 56, -113, -113, 72, -19, 93, -113, 83,855 58, -113, -113, -113, -113, 78, -113, -113, 80, 84,856 87, 62, 162, -113, 90, -113, -113, -113, -113, -113,857 -113, 93, -113, -113861 -43, -56, 47, -65, 29, -119, -119, -31, -119, -25, 862 -65, 4, -1, -119, -119, 17, 20, 26, 50, 13, 863 -119, -119, -119, 63, 24, -119, -119, 104, 8, -2, 864 89, 74, -119, 33, 25, -119, 34, 39, 34, -119, 865 37, 34, -119, 98, 58, -119, 39, -119, -119, -119, 866 -119, -119, 52, 66, -119, -119, 51, 53, -119, -119, 867 -119, -79, -119, 109, 81, -119, -60, -48, -119, -119, 868 -119, -119, -119, 107, -119, 2, -74, -119, -119, -119, 869 -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, 870 -119, -119, -119, -119, -119, -18, -119, -119, -119, -56, 871 55, 65, 67, -12, 67, -119, -119, 86, 68, -70, 872 102, 107, -69, 69, -119, -119, -119, 73, 40, 10, 873 -119, -119, -119, 107, -119, 71, 107, -47, -13, -119, 874 72, 75, -119, 70, -119, 80, -119, -119, -119, -119, 875 -119, -119, -71, -119, -119, -119, -119, -119, -119, -119, 876 -119, -119, -119, -46, -119, -119, -119, -39, 107, 69, 877 -119, -38, 76, -119, 155, 107, 157, 77, -119, -119, 878 -119, 69, 82, -10, -119, 69, -22, -119, 40, -119, 879 87, 19, -119, 40, 9, -119, -119, -119, 69, -119, 880 -119, 83, -19, 40, -119, 90, 71, -119, -119, -119, 881 -119, 85, -119, -119, 88, 94, 96, 95, 163, -119, 882 99, -119, -119, -119, -119, -119, -119, 40, -119, -119 858 883 }; 859 884 … … 861 886 static const yytype_int16 yypgoto[] = 862 887 { 863 -11 3, -113, -113, -113, -113, -113, -113, -113, 150, 136,864 -113, 143, -113, -65, -113, -113, 86, -113, 91, 16,865 -113, -113, -113, -113, -113, -113, 92, -113, -113, -113,866 -11 3, -113, -113, -113, -113, -113, -113, -113, -113, -113,867 -11 3, -113, -113, -113, -113, -113, -113, -113, -60, -113,868 22, -113, -5, 97, 2, 184, -113, -112, -113, -113,869 -11 3, -113, -113, -113, -113, 21, -113, -113888 -119, -119, -119, -119, -119, -119, -119, -119, 141, -119, 889 137, -119, -15, -119, -72, -119, -119, 91, -119, 92, 890 14, -119, -119, -119, -119, -119, -119, 84, -119, -119, 891 -119, -119, -119, -119, -119, -119, -119, -119, -119, -119, 892 -119, -119, -119, -119, -119, -119, -119, -119, -119, -82, 893 -119, 18, -119, 5, 101, 1, 187, -119, -118, -119, 894 -119, -119, -119, -119, -119, -119, 22, -119, -119 870 895 }; 871 896 … … 874 899 number is the opposite. If zero, do what YYDEFACT says. 875 900 If YYTABLE_NINF, syntax error. */ 876 #define YYTABLE_NINF -1 3901 #define YYTABLE_NINF -11 877 902 static const yytype_int16 yytable[] = 878 903 { 879 157, 107, 108, 5, 202, 29, 105, 172, 178, 102, 880 115, 15, 1, 120, 120, 170, 112, 7, 179, 171, 881 8, 116, 150, 154, 113, 158, 159, 3, 175, 170, 882 160, 16, 180, 181, 47, 48, 49, 103, 6, 50, 883 153, 173, 17, 151, 11, 170, 155, 106, 12, 183, 884 51, -12, 165, 190, 13, 169, 109, 191, 52, 53, 885 194, 54, 97, 19, 98, 198, 200, 20, 55, 192, 886 120, 21, 110, 113, 56, 203, 57, 58, 196, 124, 887 22, 23, 128, 25, 26, 28, 59, 182, 37, 60, 888 61, 47, 48, 49, 186, 5, 50, 27, 129, 213, 889 130, 32, 62, 63, 64, 38, 65, 51, 43, 66, 890 44, 67, 128, 93, 94, 52, 53, 46, 54, 120, 891 95, 68, 131, 96, 128, 55, 100, 199, 101, 119, 892 130, 56, 124, 57, 58, 102, 97, 132, 156, 133, 893 134, 152, 130, 59, 166, 3, 60, 61, 113, 174, 894 175, 177, 131, 185, 187, 176, 188, 210, 189, 62, 895 63, 64, 184, 65, 131, 134, 201, 132, 67, 133, 896 134, 206, 204, 207, 211, 3, 91, 208, 68, 132, 897 209, 133, 134, 212, 45, 205, 92, 3, 149, 147, 898 118, 197, 193, 148, 14, 195 904 163, 113, 5, 32, 208, 111, 108, 178, 114, 121, 905 118, 15, 184, 103, 34, 104, 126, 126, 119, 134, 906 122, 7, 185, 49, 8, 156, 160, 157, 164, 165, 907 161, 16, -10, 166, 109, 135, 29, 136, 3, 159, 908 134, 179, 17, 1, 176, 181, 112, 6, 177, 186, 909 11, 171, 176, 176, 175, 205, 187, 189, 136, 137, 910 200, 12, 115, 198, 126, 204, 206, 53, 54, 55, 911 13, 134, 56, 119, 138, 209, 139, 140, 116, 23, 912 137, 196, 3, 57, 33, 197, 188, 20, 19, 136, 913 21, 58, 59, 192, 60, 138, 22, 139, 140, 219, 914 5, 61, 26, 3, 202, 130, 25, 62, 27, 63, 915 64, 137, 28, 35, 36, 39, 53, 54, 55, 65, 916 33, 56, 66, 67, 38, 44, 138, 50, 139, 140, 917 52, 68, 57, 100, 3, 69, 70, 71, 99, 72, 918 58, 59, 73, 60, 74, 101, 106, 102, 107, 125, 919 61, 126, 108, 130, 75, 158, 62, 172, 63, 64, 920 103, 119, 162, 183, 180, 182, 181, 191, 65, 193, 921 194, 66, 67, 190, 195, 217, 140, 207, 212, 210, 922 68, 213, 51, 98, 69, 70, 71, 214, 72, 215, 923 216, 154, 218, 74, 199, 203, 153, 14, 0, 155, 924 124, 211, 201, 75 899 925 }; 900 926 901 static const yytype_uint8 yycheck[] = 902 { 903 112, 66, 6, 1, 23, 40, 53, 20, 83, 66, 904 27, 7, 86, 86, 86, 91, 84, 86, 93, 95, 905 89, 38, 95, 95, 92, 18, 19, 94, 91, 91, 906 23, 27, 95, 95, 9, 10, 11, 94, 0, 14, 907 105, 54, 38, 103, 21, 91, 106, 94, 92, 95, 908 25, 86, 117, 91, 95, 120, 60, 95, 33, 34, 909 172, 36, 92, 89, 94, 177, 178, 70, 43, 85, 910 86, 70, 76, 92, 49, 187, 51, 52, 85, 86, 911 70, 29, 31, 93, 39, 8, 61, 152, 24, 64, 912 65, 9, 10, 11, 159, 93, 14, 84, 47, 211, 913 49, 86, 77, 78, 79, 86, 81, 25, 91, 84, 914 90, 86, 31, 86, 67, 33, 34, 32, 36, 86, 915 94, 96, 71, 94, 31, 43, 37, 46, 67, 94, 916 49, 49, 86, 51, 52, 66, 92, 86, 89, 88, 917 89, 53, 49, 61, 86, 94, 64, 65, 92, 92, 918 91, 83, 71, 12, 12, 95, 93, 95, 92, 77, 919 78, 79, 97, 81, 71, 89, 94, 86, 86, 88, 920 89, 93, 89, 93, 12, 94, 40, 93, 96, 86, 921 93, 88, 89, 93, 34, 190, 43, 94, 102, 98, 922 93, 175, 170, 101, 10, 174 927 static const yytype_int16 yycheck[] = 928 { 929 118, 73, 1, 5, 23, 53, 66, 20, 6, 27, 930 84, 7, 83, 92, 29, 94, 86, 86, 92, 31, 931 38, 86, 93, 38, 89, 95, 95, 109, 18, 19, 932 112, 27, 24, 23, 94, 47, 28, 49, 94, 111, 933 31, 54, 38, 86, 91, 91, 94, 0, 95, 95, 934 21, 123, 91, 91, 126, 46, 95, 95, 49, 71, 935 178, 92, 60, 85, 86, 183, 184, 9, 10, 11, 936 95, 31, 14, 92, 86, 193, 88, 89, 76, 29, 937 71, 91, 94, 25, 86, 95, 158, 70, 89, 49, 938 70, 33, 34, 165, 36, 86, 70, 88, 89, 217, 939 99, 43, 39, 94, 85, 86, 93, 49, 84, 51, 940 52, 71, 8, 24, 40, 90, 9, 10, 11, 61, 941 86, 14, 64, 65, 91, 86, 86, 90, 88, 89, 942 32, 73, 25, 67, 94, 77, 78, 79, 86, 81, 943 33, 34, 84, 36, 86, 94, 37, 94, 67, 94, 944 43, 86, 66, 86, 96, 53, 49, 86, 51, 52, 945 92, 92, 89, 83, 92, 95, 91, 12, 61, 12, 946 93, 64, 65, 97, 92, 12, 89, 94, 93, 89, 947 73, 93, 41, 46, 77, 78, 79, 93, 81, 93, 948 95, 107, 93, 86, 176, 181, 104, 10, -1, 108, 949 99, 196, 180, 96 923 950 }; 924 951 … … 927 954 static const yytype_uint8 yystos[] = 928 955 { 929 0, 86, 99, 94, 15 1, 152, 0, 86, 89, 153,930 15 4, 21, 92, 95, 153, 7, 27, 38, 100, 89,931 70, 70, 70, 29, 101, 93, 39, 84, 8, 40,932 102, 10 3, 86, 104, 105, 106, 109, 24, 86, 107,933 10 8, 110, 143, 91, 90, 106, 32, 9, 10, 11,934 14, 25, 33, 34, 36, 43, 49, 51, 52, 61,935 64, 65, 77, 78, 79, 81, 84, 86, 96, 111,936 112, 113, 115, 118, 120, 121, 122, 123, 125, 126,937 1 27, 128, 129, 130, 131, 132, 133, 139, 140, 144,938 1 45, 107, 109, 86, 67, 94, 94, 92, 94, 114,939 37, 67, 66, 94, 124, 53, 94, 111, 6, 60,940 76, 141, 84, 92, 134, 27, 38, 142, 151, 94,941 86, 146, 147, 148, 86, 116, 117, 119, 31, 47,942 49, 71, 86, 88, 89, 152, 155, 156, 157, 158,943 159, 160, 161, 162, 163, 164, 165, 116, 124, 114,944 95, 146, 53, 111, 95, 146, 89, 155, 18, 19,945 23, 135, 136, 137, 138, 111, 86, 149, 150, 111,946 91, 95, 20, 54, 92, 91, 95, 83, 83, 93,947 9 5, 95, 111, 95, 97, 12, 111, 12, 93, 92,948 9 1, 95, 85, 148, 155, 163, 85, 117, 155, 46,949 15 5, 94, 23, 155, 89, 150, 93, 93, 93, 93,950 95, 12, 93, 155956 0, 86, 99, 94, 152, 153, 0, 86, 89, 154, 957 155, 21, 92, 95, 154, 7, 27, 38, 100, 89, 958 70, 70, 70, 29, 101, 93, 39, 84, 8, 28, 959 102, 107, 5, 86, 110, 24, 40, 103, 91, 90, 960 104, 105, 106, 110, 86, 108, 109, 111, 144, 110, 961 90, 106, 32, 9, 10, 11, 14, 25, 33, 34, 962 36, 43, 49, 51, 52, 61, 64, 65, 73, 77, 963 78, 79, 81, 84, 86, 96, 112, 113, 114, 116, 964 119, 121, 122, 123, 124, 126, 127, 128, 129, 130, 965 131, 132, 133, 134, 140, 141, 145, 146, 108, 86, 966 67, 94, 94, 92, 94, 115, 37, 67, 66, 94, 967 125, 53, 94, 112, 6, 60, 76, 142, 84, 92, 968 135, 27, 38, 143, 152, 94, 86, 147, 148, 149, 969 86, 117, 118, 120, 31, 47, 49, 71, 86, 88, 970 89, 153, 156, 157, 158, 159, 160, 161, 162, 163, 971 164, 165, 166, 117, 125, 115, 95, 147, 53, 112, 972 95, 147, 89, 156, 18, 19, 23, 136, 137, 138, 973 139, 112, 86, 150, 151, 112, 91, 95, 20, 54, 974 92, 91, 95, 83, 83, 93, 95, 95, 112, 95, 975 97, 12, 112, 12, 93, 92, 91, 95, 85, 149, 976 156, 164, 85, 118, 156, 46, 156, 94, 23, 156, 977 89, 151, 93, 93, 93, 93, 95, 12, 93, 156 951 978 }; 952 979 … … 1133 1160 || defined __cplusplus || defined _MSC_VER) 1134 1161 static void 1135 yy_stack_print (yytype_int16 * bottom, yytype_int16 *top)1162 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 1136 1163 #else 1137 1164 static void 1138 yy_stack_print ( bottom,top)1139 yytype_int16 * bottom;1140 yytype_int16 * top;1165 yy_stack_print (yybottom, yytop) 1166 yytype_int16 *yybottom; 1167 yytype_int16 *yytop; 1141 1168 #endif 1142 1169 { 1143 1170 YYFPRINTF (stderr, "Stack now"); 1144 for (; bottom <= top; ++bottom) 1145 YYFPRINTF (stderr, " %d", *bottom); 1171 for (; yybottom <= yytop; yybottom++) 1172 { 1173 int yybot = *yybottom; 1174 YYFPRINTF (stderr, " %d", yybot); 1175 } 1146 1176 YYFPRINTF (stderr, "\n"); 1147 1177 } … … 1177 1207 for (yyi = 0; yyi < yynrhs; yyi++) 1178 1208 { 1179 fprintf(stderr, " $%d = ", yyi + 1);1209 YYFPRINTF (stderr, " $%d = ", yyi + 1); 1180 1210 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 1181 1211 &(yyvsp[(yyi + 1) - (yynrhs)]) 1182 1212 ); 1183 fprintf(stderr, "\n");1213 YYFPRINTF (stderr, "\n"); 1184 1214 } 1185 1215 } … … 1464 1494 } 1465 1495 1466 1467 1468 1496 /* Prevent warnings from -Wmissing-prototypes. */ 1469 1470 1497 #ifdef YYPARSE_PARAM 1471 1498 #if defined __STDC__ || defined __cplusplus … … 1483 1510 1484 1511 1485 1486 /* The look-ahead symbol. */ 1512 /* The lookahead symbol. */ 1487 1513 int yychar; 1488 1514 1489 /* The semantic value of the look -ahead symbol. */1515 /* The semantic value of the lookahead symbol. */ 1490 1516 YYSTYPE yylval; 1491 1517 … … 1495 1521 1496 1522 1497 /*---------- .1498 | yyparse . |1499 `---------- */1523 /*-------------------------. 1524 | yyparse or yypush_parse. | 1525 `-------------------------*/ 1500 1526 1501 1527 #ifdef YYPARSE_PARAM … … 1521 1547 #endif 1522 1548 { 1523 1524 int yystate; 1549 1550 1551 int yystate; 1552 /* Number of tokens to shift before error messages enabled. */ 1553 int yyerrstatus; 1554 1555 /* The stacks and their tools: 1556 `yyss': related to states. 1557 `yyvs': related to semantic values. 1558 1559 Refer to the stacks thru separate pointers, to allow yyoverflow 1560 to reallocate them elsewhere. */ 1561 1562 /* The state stack. */ 1563 yytype_int16 yyssa[YYINITDEPTH]; 1564 yytype_int16 *yyss; 1565 yytype_int16 *yyssp; 1566 1567 /* The semantic value stack. */ 1568 YYSTYPE yyvsa[YYINITDEPTH]; 1569 YYSTYPE *yyvs; 1570 YYSTYPE *yyvsp; 1571 1572 YYSIZE_T yystacksize; 1573 1525 1574 int yyn; 1526 1575 int yyresult; 1527 /* Number of tokens to shift before error messages enabled. */ 1528 int yyerrstatus; 1529 /* Look-ahead token as an internal (translated) token number. */ 1530 int yytoken = 0; 1576 /* Lookahead token as an internal (translated) token number. */ 1577 int yytoken; 1578 /* The variables used to return semantic value and location from the 1579 action routines. */ 1580 YYSTYPE yyval; 1581 1531 1582 #if YYERROR_VERBOSE 1532 1583 /* Buffer for error messages, and its allocated size. */ … … 1536 1587 #endif 1537 1588 1538 /* Three stacks and their tools:1539 `yyss': related to states,1540 `yyvs': related to semantic values,1541 `yyls': related to locations.1542 1543 Refer to the stacks thru separate pointers, to allow yyoverflow1544 to reallocate them elsewhere. */1545 1546 /* The state stack. */1547 yytype_int16 yyssa[YYINITDEPTH];1548 yytype_int16 *yyss = yyssa;1549 yytype_int16 *yyssp;1550 1551 /* The semantic value stack. */1552 YYSTYPE yyvsa[YYINITDEPTH];1553 YYSTYPE *yyvs = yyvsa;1554 YYSTYPE *yyvsp;1555 1556 1557 1558 1589 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1559 1560 YYSIZE_T yystacksize = YYINITDEPTH;1561 1562 /* The variables used to return semantic value and location from the1563 action routines. */1564 YYSTYPE yyval;1565 1566 1590 1567 1591 /* The number of symbols on the RHS of the reduced rule. … … 1569 1593 int yylen = 0; 1570 1594 1595 yytoken = 0; 1596 yyss = yyssa; 1597 yyvs = yyvsa; 1598 yystacksize = YYINITDEPTH; 1599 1571 1600 YYDPRINTF ((stderr, "Starting parse\n")); 1572 1601 … … 1574 1603 yyerrstatus = 0; 1575 1604 yynerrs = 0; 1576 yychar = YYEMPTY; 1605 yychar = YYEMPTY; /* Cause a token to be read. */ 1577 1606 1578 1607 /* Initialize stack pointers. … … 1580 1609 so that they stay on the same level as the state stack. 1581 1610 The wasted elements are never initialized. */ 1582 1583 1611 yyssp = yyss; 1584 1612 yyvsp = yyvs; … … 1610 1638 yytype_int16 *yyss1 = yyss; 1611 1639 1612 1613 1640 /* Each stack pointer address is followed by the size of the 1614 1641 data in use in that stack, in bytes. This used to be a … … 1618 1645 &yyss1, yysize * sizeof (*yyssp), 1619 1646 &yyvs1, yysize * sizeof (*yyvsp), 1620 1621 1647 &yystacksize); 1622 1648 … … 1641 1667 if (! yyptr) 1642 1668 goto yyexhaustedlab; 1643 YYSTACK_RELOCATE (yyss); 1644 YYSTACK_RELOCATE (yyvs); 1645 1669 YYSTACK_RELOCATE (yyss_alloc, yyss); 1670 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 1646 1671 # undef YYSTACK_RELOCATE 1647 1672 if (yyss1 != yyssa) … … 1654 1679 yyvsp = yyvs + yysize - 1; 1655 1680 1656 1657 1681 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1658 1682 (unsigned long int) yystacksize)); … … 1663 1687 1664 1688 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1689 1690 if (yystate == YYFINAL) 1691 YYACCEPT; 1665 1692 1666 1693 goto yybackup; … … 1672 1699 1673 1700 /* Do appropriate processing given the current state. Read a 1674 look -ahead token if we need one and don't already have one. */1675 1676 /* First try to decide what to do without reference to look -ahead token. */1701 lookahead token if we need one and don't already have one. */ 1702 1703 /* First try to decide what to do without reference to lookahead token. */ 1677 1704 yyn = yypact[yystate]; 1678 1705 if (yyn == YYPACT_NINF) 1679 1706 goto yydefault; 1680 1707 1681 /* Not known => get a look -ahead token if don't already have one. */1682 1683 /* YYCHAR is either YYEMPTY or YYEOF or a valid look -ahead symbol. */1708 /* Not known => get a lookahead token if don't already have one. */ 1709 1710 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 1684 1711 if (yychar == YYEMPTY) 1685 1712 { … … 1713 1740 } 1714 1741 1715 if (yyn == YYFINAL)1716 YYACCEPT;1717 1718 1742 /* Count tokens shifted since error; after three, turn off error 1719 1743 status. */ … … 1721 1745 yyerrstatus--; 1722 1746 1723 /* Shift the look -ahead token. */1747 /* Shift the lookahead token. */ 1724 1748 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1725 1749 1726 /* Discard the shifted token unless it is eof. */ 1727 if (yychar != YYEOF) 1728 yychar = YYEMPTY; 1750 /* Discard the shifted token. */ 1751 yychar = YYEMPTY; 1729 1752 1730 1753 yystate = yyn; … … 1766 1789 { 1767 1790 case 2: 1768 #line 235 "heimdal/lib/asn1/asn1parse.y" 1791 1792 /* Line 1455 of yacc.c */ 1793 #line 241 "asn1parse.c" 1769 1794 { 1770 1795 checkundefined(); … … 1773 1798 1774 1799 case 4: 1775 #line 242 "heimdal/lib/asn1/asn1parse.y" 1776 { error_message("implicit tagging is not supported"); } 1800 1801 /* Line 1455 of yacc.c */ 1802 #line 248 "asn1parse.c" 1803 { lex_error_message("implicit tagging is not supported"); } 1777 1804 break; 1778 1805 1779 1806 case 5: 1780 #line 244 "heimdal/lib/asn1/asn1parse.y" 1781 { error_message("automatic tagging is not supported"); } 1807 1808 /* Line 1455 of yacc.c */ 1809 #line 250 "asn1parse.c" 1810 { lex_error_message("automatic tagging is not supported"); } 1782 1811 break; 1783 1812 1784 1813 case 7: 1785 #line 249 "heimdal/lib/asn1/asn1parse.y" 1786 { error_message("no extensibility options supported"); } 1814 1815 /* Line 1455 of yacc.c */ 1816 #line 255 "asn1parse.c" 1817 { lex_error_message("no extensibility options supported"); } 1787 1818 break; 1788 1819 1789 1820 case 17: 1790 #line 270 "heimdal/lib/asn1/asn1parse.y" 1821 1822 /* Line 1455 of yacc.c */ 1823 #line 276 "asn1parse.c" 1791 1824 { 1792 1825 struct string_list *sl; … … 1794 1827 Symbol *s = addsym(sl->string); 1795 1828 s->stype = Stype; 1829 gen_template_import(s); 1796 1830 } 1797 1831 add_import((yyvsp[(3) - (4)].name)); … … 1799 1833 break; 1800 1834 1801 case 22: 1802 #line 289 "heimdal/lib/asn1/asn1parse.y" 1835 case 18: 1836 1837 /* Line 1455 of yacc.c */ 1838 #line 288 "asn1parse.c" 1839 { 1840 struct string_list *sl; 1841 for(sl = (yyvsp[(2) - (3)].sl); sl != NULL; sl = sl->next) 1842 add_export(sl->string); 1843 } 1844 break; 1845 1846 case 25: 1847 1848 /* Line 1455 of yacc.c */ 1849 #line 306 "asn1parse.c" 1803 1850 { 1804 1851 (yyval.sl) = emalloc(sizeof(*(yyval.sl))); … … 1808 1855 break; 1809 1856 1810 case 23: 1811 #line 295 "heimdal/lib/asn1/asn1parse.y" 1857 case 26: 1858 1859 /* Line 1455 of yacc.c */ 1860 #line 312 "asn1parse.c" 1812 1861 { 1813 1862 (yyval.sl) = emalloc(sizeof(*(yyval.sl))); … … 1817 1866 break; 1818 1867 1819 case 24: 1820 #line 303 "heimdal/lib/asn1/asn1parse.y" 1868 case 27: 1869 1870 /* Line 1455 of yacc.c */ 1871 #line 320 "asn1parse.c" 1821 1872 { 1822 1873 Symbol *s = addsym ((yyvsp[(1) - (3)].name)); … … 1828 1879 break; 1829 1880 1830 case 42: 1831 #line 334 "heimdal/lib/asn1/asn1parse.y" 1881 case 45: 1882 1883 /* Line 1455 of yacc.c */ 1884 #line 351 "asn1parse.c" 1832 1885 { 1833 1886 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Boolean, … … 1836 1889 break; 1837 1890 1838 case 43: 1839 #line 341 "heimdal/lib/asn1/asn1parse.y" 1891 case 46: 1892 1893 /* Line 1455 of yacc.c */ 1894 #line 358 "asn1parse.c" 1840 1895 { 1841 1896 if((yyvsp[(2) - (5)].value)->type != integervalue) 1842 error_message("Non-integer used in first part of range");1897 lex_error_message("Non-integer used in first part of range"); 1843 1898 if((yyvsp[(2) - (5)].value)->type != integervalue) 1844 error_message("Non-integer in second part of range");1899 lex_error_message("Non-integer in second part of range"); 1845 1900 (yyval.range) = ecalloc(1, sizeof(*(yyval.range))); 1846 1901 (yyval.range)->min = (yyvsp[(2) - (5)].value)->u.integervalue; … … 1849 1904 break; 1850 1905 1851 case 44: 1852 #line 351 "heimdal/lib/asn1/asn1parse.y" 1906 case 47: 1907 1908 /* Line 1455 of yacc.c */ 1909 #line 368 "asn1parse.c" 1853 1910 { 1854 1911 if((yyvsp[(2) - (5)].value)->type != integervalue) 1855 error_message("Non-integer in first part of range");1912 lex_error_message("Non-integer in first part of range"); 1856 1913 (yyval.range) = ecalloc(1, sizeof(*(yyval.range))); 1857 1914 (yyval.range)->min = (yyvsp[(2) - (5)].value)->u.integervalue; … … 1860 1917 break; 1861 1918 1862 case 45: 1863 #line 359 "heimdal/lib/asn1/asn1parse.y" 1919 case 48: 1920 1921 /* Line 1455 of yacc.c */ 1922 #line 376 "asn1parse.c" 1864 1923 { 1865 1924 if((yyvsp[(4) - (5)].value)->type != integervalue) 1866 error_message("Non-integer in second part of range");1925 lex_error_message("Non-integer in second part of range"); 1867 1926 (yyval.range) = ecalloc(1, sizeof(*(yyval.range))); 1868 1927 (yyval.range)->min = (yyvsp[(4) - (5)].value)->u.integervalue + 2; … … 1871 1930 break; 1872 1931 1873 case 46: 1874 #line 367 "heimdal/lib/asn1/asn1parse.y" 1932 case 49: 1933 1934 /* Line 1455 of yacc.c */ 1935 #line 384 "asn1parse.c" 1875 1936 { 1876 1937 if((yyvsp[(2) - (3)].value)->type != integervalue) 1877 error_message("Non-integer used in limit");1938 lex_error_message("Non-integer used in limit"); 1878 1939 (yyval.range) = ecalloc(1, sizeof(*(yyval.range))); 1879 1940 (yyval.range)->min = (yyvsp[(2) - (3)].value)->u.integervalue; … … 1882 1943 break; 1883 1944 1884 case 47: 1885 #line 378 "heimdal/lib/asn1/asn1parse.y" 1945 case 50: 1946 1947 /* Line 1455 of yacc.c */ 1948 #line 395 "asn1parse.c" 1886 1949 { 1887 1950 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Integer, … … 1890 1953 break; 1891 1954 1892 case 48: 1893 #line 383 "heimdal/lib/asn1/asn1parse.y" 1955 case 51: 1956 1957 /* Line 1455 of yacc.c */ 1958 #line 400 "asn1parse.c" 1894 1959 { 1895 1960 (yyval.type) = new_type(TInteger); … … 1899 1964 break; 1900 1965 1901 case 49: 1902 #line 389 "heimdal/lib/asn1/asn1parse.y" 1966 case 52: 1967 1968 /* Line 1455 of yacc.c */ 1969 #line 406 "asn1parse.c" 1903 1970 { 1904 1971 (yyval.type) = new_type(TInteger); … … 1908 1975 break; 1909 1976 1910 case 50: 1911 #line 397 "heimdal/lib/asn1/asn1parse.y" 1977 case 53: 1978 1979 /* Line 1455 of yacc.c */ 1980 #line 414 "asn1parse.c" 1912 1981 { 1913 1982 (yyval.members) = emalloc(sizeof(*(yyval.members))); … … 1917 1986 break; 1918 1987 1919 case 51: 1920 #line 403 "heimdal/lib/asn1/asn1parse.y" 1988 case 54: 1989 1990 /* Line 1455 of yacc.c */ 1991 #line 420 "asn1parse.c" 1921 1992 { 1922 1993 ASN1_TAILQ_INSERT_TAIL((yyvsp[(1) - (3)].members), (yyvsp[(3) - (3)].member), members); … … 1925 1996 break; 1926 1997 1927 case 52: 1928 #line 408 "heimdal/lib/asn1/asn1parse.y" 1998 case 55: 1999 2000 /* Line 1455 of yacc.c */ 2001 #line 425 "asn1parse.c" 1929 2002 { (yyval.members) = (yyvsp[(1) - (3)].members); } 1930 2003 break; 1931 2004 1932 case 53: 1933 #line 412 "heimdal/lib/asn1/asn1parse.y" 2005 case 56: 2006 2007 /* Line 1455 of yacc.c */ 2008 #line 429 "asn1parse.c" 1934 2009 { 1935 2010 (yyval.member) = emalloc(sizeof(*(yyval.member))); … … 1944 2019 break; 1945 2020 1946 case 54: 1947 #line 425 "heimdal/lib/asn1/asn1parse.y" 2021 case 57: 2022 2023 /* Line 1455 of yacc.c */ 2024 #line 442 "asn1parse.c" 1948 2025 { 1949 2026 (yyval.type) = new_type(TInteger); … … 1953 2030 break; 1954 2031 1955 case 56: 1956 #line 436 "heimdal/lib/asn1/asn1parse.y" 2032 case 59: 2033 2034 /* Line 1455 of yacc.c */ 2035 #line 453 "asn1parse.c" 1957 2036 { 1958 2037 (yyval.type) = new_type(TBitString); … … 1963 2042 break; 1964 2043 1965 case 57: 1966 #line 443 "heimdal/lib/asn1/asn1parse.y" 2044 case 60: 2045 2046 /* Line 1455 of yacc.c */ 2047 #line 460 "asn1parse.c" 1967 2048 { 1968 2049 (yyval.type) = new_type(TBitString); … … 1972 2053 break; 1973 2054 1974 case 58: 1975 #line 451 "heimdal/lib/asn1/asn1parse.y" 2055 case 61: 2056 2057 /* Line 1455 of yacc.c */ 2058 #line 468 "asn1parse.c" 1976 2059 { 1977 2060 (yyval.type) = new_tag(ASN1_C_UNIV, UT_OID, … … 1980 2063 break; 1981 2064 1982 case 59: 1983 #line 457 "heimdal/lib/asn1/asn1parse.y" 2065 case 62: 2066 2067 /* Line 1455 of yacc.c */ 2068 #line 474 "asn1parse.c" 1984 2069 { 1985 2070 Type *t = new_type(TOctetString); … … 1990 2075 break; 1991 2076 1992 case 60: 1993 #line 466 "heimdal/lib/asn1/asn1parse.y" 2077 case 63: 2078 2079 /* Line 1455 of yacc.c */ 2080 #line 483 "asn1parse.c" 1994 2081 { 1995 2082 (yyval.type) = new_tag(ASN1_C_UNIV, UT_Null, … … 1998 2085 break; 1999 2086 2000 case 61: 2001 #line 473 "heimdal/lib/asn1/asn1parse.y" 2087 case 64: 2088 2089 /* Line 1455 of yacc.c */ 2090 #line 490 "asn1parse.c" 2002 2091 { (yyval.range) = NULL; } 2003 2092 break; 2004 2093 2005 case 62: 2006 #line 475 "heimdal/lib/asn1/asn1parse.y" 2094 case 65: 2095 2096 /* Line 1455 of yacc.c */ 2097 #line 492 "asn1parse.c" 2007 2098 { (yyval.range) = (yyvsp[(2) - (2)].range); } 2008 2099 break; 2009 2100 2010 case 63: 2011 #line 480 "heimdal/lib/asn1/asn1parse.y" 2101 case 66: 2102 2103 /* Line 1455 of yacc.c */ 2104 #line 497 "asn1parse.c" 2012 2105 { 2013 2106 (yyval.type) = new_type(TSequence); … … 2017 2110 break; 2018 2111 2019 case 64: 2020 #line 486 "heimdal/lib/asn1/asn1parse.y" 2112 case 67: 2113 2114 /* Line 1455 of yacc.c */ 2115 #line 503 "asn1parse.c" 2021 2116 { 2022 2117 (yyval.type) = new_type(TSequence); … … 2026 2121 break; 2027 2122 2028 case 65: 2029 #line 494 "heimdal/lib/asn1/asn1parse.y" 2123 case 68: 2124 2125 /* Line 1455 of yacc.c */ 2126 #line 511 "asn1parse.c" 2030 2127 { 2031 2128 (yyval.type) = new_type(TSequenceOf); … … 2036 2133 break; 2037 2134 2038 case 66: 2039 #line 503 "heimdal/lib/asn1/asn1parse.y" 2135 case 69: 2136 2137 /* Line 1455 of yacc.c */ 2138 #line 520 "asn1parse.c" 2040 2139 { 2041 2140 (yyval.type) = new_type(TSet); … … 2045 2144 break; 2046 2145 2047 case 67: 2048 #line 509 "heimdal/lib/asn1/asn1parse.y" 2146 case 70: 2147 2148 /* Line 1455 of yacc.c */ 2149 #line 526 "asn1parse.c" 2049 2150 { 2050 2151 (yyval.type) = new_type(TSet); … … 2054 2155 break; 2055 2156 2056 case 68: 2057 #line 517 "heimdal/lib/asn1/asn1parse.y" 2157 case 71: 2158 2159 /* Line 1455 of yacc.c */ 2160 #line 534 "asn1parse.c" 2058 2161 { 2059 2162 (yyval.type) = new_type(TSetOf); … … 2063 2166 break; 2064 2167 2065 case 69: 2066 #line 525 "heimdal/lib/asn1/asn1parse.y" 2168 case 72: 2169 2170 /* Line 1455 of yacc.c */ 2171 #line 542 "asn1parse.c" 2067 2172 { 2068 2173 (yyval.type) = new_type(TChoice); … … 2071 2176 break; 2072 2177 2073 case 72: 2074 #line 536 "heimdal/lib/asn1/asn1parse.y" 2178 case 75: 2179 2180 /* Line 1455 of yacc.c */ 2181 #line 553 "asn1parse.c" 2075 2182 { 2076 2183 Symbol *s = addsym((yyvsp[(1) - (1)].name)); 2077 2184 (yyval.type) = new_type(TType); 2078 2185 if(s->stype != Stype && s->stype != SUndefined) 2079 error_message ("%s is not a type\n", (yyvsp[(1) - (1)].name));2186 lex_error_message ("%s is not a type\n", (yyvsp[(1) - (1)].name)); 2080 2187 else 2081 2188 (yyval.type)->symbol = s; … … 2083 2190 break; 2084 2191 2085 case 73: 2086 #line 547 "heimdal/lib/asn1/asn1parse.y" 2192 case 76: 2193 2194 /* Line 1455 of yacc.c */ 2195 #line 564 "asn1parse.c" 2087 2196 { 2088 2197 (yyval.type) = new_tag(ASN1_C_UNIV, UT_GeneralizedTime, … … 2091 2200 break; 2092 2201 2093 case 74: 2094 #line 552 "heimdal/lib/asn1/asn1parse.y" 2202 case 77: 2203 2204 /* Line 1455 of yacc.c */ 2205 #line 569 "asn1parse.c" 2095 2206 { 2096 2207 (yyval.type) = new_tag(ASN1_C_UNIV, UT_UTCTime, … … 2099 2210 break; 2100 2211 2101 case 75: 2102 #line 559 "heimdal/lib/asn1/asn1parse.y" 2212 case 78: 2213 2214 /* Line 1455 of yacc.c */ 2215 #line 576 "asn1parse.c" 2103 2216 { 2104 2217 /* if (Constraint.type == contentConstrant) { … … 2115 2228 break; 2116 2229 2117 case 76: 2118 #line 575 "heimdal/lib/asn1/asn1parse.y" 2230 case 79: 2231 2232 /* Line 1455 of yacc.c */ 2233 #line 592 "asn1parse.c" 2119 2234 { 2120 2235 (yyval.constraint_spec) = (yyvsp[(2) - (3)].constraint_spec); … … 2122 2237 break; 2123 2238 2124 case 80: 2125 #line 588 "heimdal/lib/asn1/asn1parse.y" 2239 case 83: 2240 2241 /* Line 1455 of yacc.c */ 2242 #line 605 "asn1parse.c" 2126 2243 { 2127 2244 (yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS); … … 2131 2248 break; 2132 2249 2133 case 81: 2134 #line 594 "heimdal/lib/asn1/asn1parse.y" 2250 case 84: 2251 2252 /* Line 1455 of yacc.c */ 2253 #line 611 "asn1parse.c" 2135 2254 { 2136 2255 if ((yyvsp[(3) - (3)].value)->type != objectidentifiervalue) 2137 error_message("Non-OID used in ENCODED BY constraint");2256 lex_error_message("Non-OID used in ENCODED BY constraint"); 2138 2257 (yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS); 2139 2258 (yyval.constraint_spec)->u.content.type = NULL; … … 2142 2261 break; 2143 2262 2144 case 82: 2145 #line 602 "heimdal/lib/asn1/asn1parse.y" 2263 case 85: 2264 2265 /* Line 1455 of yacc.c */ 2266 #line 619 "asn1parse.c" 2146 2267 { 2147 2268 if ((yyvsp[(5) - (5)].value)->type != objectidentifiervalue) 2148 error_message("Non-OID used in ENCODED BY constraint");2269 lex_error_message("Non-OID used in ENCODED BY constraint"); 2149 2270 (yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS); 2150 2271 (yyval.constraint_spec)->u.content.type = (yyvsp[(2) - (5)].type); … … 2153 2274 break; 2154 2275 2155 case 83: 2156 #line 612 "heimdal/lib/asn1/asn1parse.y" 2276 case 86: 2277 2278 /* Line 1455 of yacc.c */ 2279 #line 629 "asn1parse.c" 2157 2280 { 2158 2281 (yyval.constraint_spec) = new_constraint_spec(CT_USER); … … 2160 2283 break; 2161 2284 2162 case 84: 2163 #line 618 "heimdal/lib/asn1/asn1parse.y" 2285 case 87: 2286 2287 /* Line 1455 of yacc.c */ 2288 #line 635 "asn1parse.c" 2164 2289 { 2165 2290 (yyval.type) = new_type(TTag); … … 2174 2299 break; 2175 2300 2176 case 85: 2177 #line 631 "heimdal/lib/asn1/asn1parse.y" 2301 case 88: 2302 2303 /* Line 1455 of yacc.c */ 2304 #line 648 "asn1parse.c" 2178 2305 { 2179 2306 (yyval.tag).tagclass = (yyvsp[(2) - (4)].constant); … … 2183 2310 break; 2184 2311 2185 case 86: 2186 #line 639 "heimdal/lib/asn1/asn1parse.y" 2312 case 89: 2313 2314 /* Line 1455 of yacc.c */ 2315 #line 656 "asn1parse.c" 2187 2316 { 2188 2317 (yyval.constant) = ASN1_C_CONTEXT; … … 2190 2319 break; 2191 2320 2192 case 87: 2193 #line 643 "heimdal/lib/asn1/asn1parse.y" 2321 case 90: 2322 2323 /* Line 1455 of yacc.c */ 2324 #line 660 "asn1parse.c" 2194 2325 { 2195 2326 (yyval.constant) = ASN1_C_UNIV; … … 2197 2328 break; 2198 2329 2199 case 88: 2200 #line 647 "heimdal/lib/asn1/asn1parse.y" 2330 case 91: 2331 2332 /* Line 1455 of yacc.c */ 2333 #line 664 "asn1parse.c" 2201 2334 { 2202 2335 (yyval.constant) = ASN1_C_APPL; … … 2204 2337 break; 2205 2338 2206 case 89: 2207 #line 651 "heimdal/lib/asn1/asn1parse.y" 2339 case 92: 2340 2341 /* Line 1455 of yacc.c */ 2342 #line 668 "asn1parse.c" 2208 2343 { 2209 2344 (yyval.constant) = ASN1_C_PRIVATE; … … 2211 2346 break; 2212 2347 2213 case 90: 2214 #line 657 "heimdal/lib/asn1/asn1parse.y" 2348 case 93: 2349 2350 /* Line 1455 of yacc.c */ 2351 #line 674 "asn1parse.c" 2215 2352 { 2216 2353 (yyval.constant) = TE_EXPLICIT; … … 2218 2355 break; 2219 2356 2220 case 91: 2221 #line 661 "heimdal/lib/asn1/asn1parse.y" 2357 case 94: 2358 2359 /* Line 1455 of yacc.c */ 2360 #line 678 "asn1parse.c" 2222 2361 { 2223 2362 (yyval.constant) = TE_EXPLICIT; … … 2225 2364 break; 2226 2365 2227 case 92: 2228 #line 665 "heimdal/lib/asn1/asn1parse.y" 2366 case 95: 2367 2368 /* Line 1455 of yacc.c */ 2369 #line 682 "asn1parse.c" 2229 2370 { 2230 2371 (yyval.constant) = TE_IMPLICIT; … … 2232 2373 break; 2233 2374 2234 case 93: 2235 #line 672 "heimdal/lib/asn1/asn1parse.y" 2375 case 96: 2376 2377 /* Line 1455 of yacc.c */ 2378 #line 689 "asn1parse.c" 2236 2379 { 2237 2380 Symbol *s; … … 2244 2387 break; 2245 2388 2246 case 95: 2247 #line 686 "heimdal/lib/asn1/asn1parse.y" 2389 case 98: 2390 2391 /* Line 1455 of yacc.c */ 2392 #line 703 "asn1parse.c" 2248 2393 { 2249 2394 (yyval.type) = new_tag(ASN1_C_UNIV, UT_GeneralString, … … 2252 2397 break; 2253 2398 2254 case 96: 2255 #line 691 "heimdal/lib/asn1/asn1parse.y" 2399 case 99: 2400 2401 /* Line 1455 of yacc.c */ 2402 #line 708 "asn1parse.c" 2403 { 2404 (yyval.type) = new_tag(ASN1_C_UNIV, UT_TeletexString, 2405 TE_EXPLICIT, new_type(TTeletexString)); 2406 } 2407 break; 2408 2409 case 100: 2410 2411 /* Line 1455 of yacc.c */ 2412 #line 713 "asn1parse.c" 2256 2413 { 2257 2414 (yyval.type) = new_tag(ASN1_C_UNIV, UT_UTF8String, … … 2260 2417 break; 2261 2418 2262 case 97: 2263 #line 696 "heimdal/lib/asn1/asn1parse.y" 2419 case 101: 2420 2421 /* Line 1455 of yacc.c */ 2422 #line 718 "asn1parse.c" 2264 2423 { 2265 2424 (yyval.type) = new_tag(ASN1_C_UNIV, UT_PrintableString, … … 2268 2427 break; 2269 2428 2270 case 98: 2271 #line 701 "heimdal/lib/asn1/asn1parse.y" 2429 case 102: 2430 2431 /* Line 1455 of yacc.c */ 2432 #line 723 "asn1parse.c" 2272 2433 { 2273 2434 (yyval.type) = new_tag(ASN1_C_UNIV, UT_VisibleString, … … 2276 2437 break; 2277 2438 2278 case 99: 2279 #line 706 "heimdal/lib/asn1/asn1parse.y" 2439 case 103: 2440 2441 /* Line 1455 of yacc.c */ 2442 #line 728 "asn1parse.c" 2280 2443 { 2281 2444 (yyval.type) = new_tag(ASN1_C_UNIV, UT_IA5String, … … 2284 2447 break; 2285 2448 2286 case 100: 2287 #line 711 "heimdal/lib/asn1/asn1parse.y" 2449 case 104: 2450 2451 /* Line 1455 of yacc.c */ 2452 #line 733 "asn1parse.c" 2288 2453 { 2289 2454 (yyval.type) = new_tag(ASN1_C_UNIV, UT_BMPString, … … 2292 2457 break; 2293 2458 2294 case 101: 2295 #line 716 "heimdal/lib/asn1/asn1parse.y" 2459 case 105: 2460 2461 /* Line 1455 of yacc.c */ 2462 #line 738 "asn1parse.c" 2296 2463 { 2297 2464 (yyval.type) = new_tag(ASN1_C_UNIV, UT_UniversalString, … … 2300 2467 break; 2301 2468 2302 case 102: 2303 #line 724 "heimdal/lib/asn1/asn1parse.y" 2469 case 106: 2470 2471 /* Line 1455 of yacc.c */ 2472 #line 746 "asn1parse.c" 2304 2473 { 2305 2474 (yyval.members) = emalloc(sizeof(*(yyval.members))); … … 2309 2478 break; 2310 2479 2311 case 103: 2312 #line 730 "heimdal/lib/asn1/asn1parse.y" 2480 case 107: 2481 2482 /* Line 1455 of yacc.c */ 2483 #line 752 "asn1parse.c" 2313 2484 { 2314 2485 ASN1_TAILQ_INSERT_TAIL((yyvsp[(1) - (3)].members), (yyvsp[(3) - (3)].member), members); … … 2317 2488 break; 2318 2489 2319 case 104: 2320 #line 735 "heimdal/lib/asn1/asn1parse.y" 2490 case 108: 2491 2492 /* Line 1455 of yacc.c */ 2493 #line 757 "asn1parse.c" 2321 2494 { 2322 2495 struct member *m = ecalloc(1, sizeof(*m)); … … 2329 2502 break; 2330 2503 2331 case 105: 2332 #line 746 "heimdal/lib/asn1/asn1parse.y" 2504 case 109: 2505 2506 /* Line 1455 of yacc.c */ 2507 #line 768 "asn1parse.c" 2333 2508 { 2334 2509 (yyval.member) = emalloc(sizeof(*(yyval.member))); … … 2341 2516 break; 2342 2517 2343 case 106: 2344 #line 757 "heimdal/lib/asn1/asn1parse.y" 2518 case 110: 2519 2520 /* Line 1455 of yacc.c */ 2521 #line 779 "asn1parse.c" 2345 2522 { 2346 2523 (yyval.member) = (yyvsp[(1) - (1)].member); … … 2350 2527 break; 2351 2528 2352 case 107: 2353 #line 763 "heimdal/lib/asn1/asn1parse.y" 2529 case 111: 2530 2531 /* Line 1455 of yacc.c */ 2532 #line 785 "asn1parse.c" 2354 2533 { 2355 2534 (yyval.member) = (yyvsp[(1) - (2)].member); … … 2359 2538 break; 2360 2539 2361 case 108: 2362 #line 769 "heimdal/lib/asn1/asn1parse.y" 2540 case 112: 2541 2542 /* Line 1455 of yacc.c */ 2543 #line 791 "asn1parse.c" 2363 2544 { 2364 2545 (yyval.member) = (yyvsp[(1) - (3)].member); … … 2368 2549 break; 2369 2550 2370 case 109: 2371 #line 777 "heimdal/lib/asn1/asn1parse.y" 2551 case 113: 2552 2553 /* Line 1455 of yacc.c */ 2554 #line 799 "asn1parse.c" 2372 2555 { 2373 2556 (yyval.members) = emalloc(sizeof(*(yyval.members))); … … 2377 2560 break; 2378 2561 2379 case 110: 2380 #line 783 "heimdal/lib/asn1/asn1parse.y" 2562 case 114: 2563 2564 /* Line 1455 of yacc.c */ 2565 #line 805 "asn1parse.c" 2381 2566 { 2382 2567 ASN1_TAILQ_INSERT_TAIL((yyvsp[(1) - (3)].members), (yyvsp[(3) - (3)].member), members); … … 2385 2570 break; 2386 2571 2387 case 111: 2388 #line 790 "heimdal/lib/asn1/asn1parse.y" 2572 case 115: 2573 2574 /* Line 1455 of yacc.c */ 2575 #line 812 "asn1parse.c" 2389 2576 { 2390 2577 (yyval.member) = emalloc(sizeof(*(yyval.member))); … … 2399 2586 break; 2400 2587 2401 case 113: 2402 #line 803 "heimdal/lib/asn1/asn1parse.y" 2588 case 117: 2589 2590 /* Line 1455 of yacc.c */ 2591 #line 825 "asn1parse.c" 2403 2592 { (yyval.objid) = NULL; } 2404 2593 break; 2405 2594 2406 case 114: 2407 #line 807 "heimdal/lib/asn1/asn1parse.y" 2595 case 118: 2596 2597 /* Line 1455 of yacc.c */ 2598 #line 829 "asn1parse.c" 2408 2599 { 2409 2600 (yyval.objid) = (yyvsp[(2) - (3)].objid); … … 2411 2602 break; 2412 2603 2413 case 115: 2414 #line 813 "heimdal/lib/asn1/asn1parse.y" 2604 case 119: 2605 2606 /* Line 1455 of yacc.c */ 2607 #line 835 "asn1parse.c" 2415 2608 { 2416 2609 (yyval.objid) = NULL; … … 2418 2611 break; 2419 2612 2420 case 116: 2421 #line 817 "heimdal/lib/asn1/asn1parse.y" 2613 case 120: 2614 2615 /* Line 1455 of yacc.c */ 2616 #line 839 "asn1parse.c" 2422 2617 { 2423 2618 if ((yyvsp[(2) - (2)].objid)) { … … 2430 2625 break; 2431 2626 2432 case 117: 2433 #line 828 "heimdal/lib/asn1/asn1parse.y" 2627 case 121: 2628 2629 /* Line 1455 of yacc.c */ 2630 #line 850 "asn1parse.c" 2434 2631 { 2435 2632 (yyval.objid) = new_objid((yyvsp[(1) - (4)].name), (yyvsp[(3) - (4)].constant)); … … 2437 2634 break; 2438 2635 2439 case 118: 2440 #line 832 "heimdal/lib/asn1/asn1parse.y" 2636 case 122: 2637 2638 /* Line 1455 of yacc.c */ 2639 #line 854 "asn1parse.c" 2441 2640 { 2442 2641 Symbol *s = addsym((yyvsp[(1) - (1)].name)); 2443 2642 if(s->stype != SValue || 2444 2643 s->value->type != objectidentifiervalue) { 2445 error_message("%s is not an object identifier\n",2644 lex_error_message("%s is not an object identifier\n", 2446 2645 s->name); 2447 2646 exit(1); … … 2451 2650 break; 2452 2651 2453 case 119: 2454 #line 843 "heimdal/lib/asn1/asn1parse.y" 2652 case 123: 2653 2654 /* Line 1455 of yacc.c */ 2655 #line 865 "asn1parse.c" 2455 2656 { 2456 2657 (yyval.objid) = new_objid(NULL, (yyvsp[(1) - (1)].constant)); … … 2458 2659 break; 2459 2660 2460 case 129: 2461 #line 866 "heimdal/lib/asn1/asn1parse.y" 2661 case 133: 2662 2663 /* Line 1455 of yacc.c */ 2664 #line 888 "asn1parse.c" 2462 2665 { 2463 2666 Symbol *s = addsym((yyvsp[(1) - (1)].name)); 2464 2667 if(s->stype != SValue) 2465 error_message ("%s is not a value\n",2668 lex_error_message ("%s is not a value\n", 2466 2669 s->name); 2467 2670 else … … 2470 2673 break; 2471 2674 2472 case 130: 2473 #line 877 "heimdal/lib/asn1/asn1parse.y" 2675 case 134: 2676 2677 /* Line 1455 of yacc.c */ 2678 #line 899 "asn1parse.c" 2474 2679 { 2475 2680 (yyval.value) = emalloc(sizeof(*(yyval.value))); … … 2479 2684 break; 2480 2685 2481 case 131: 2482 #line 885 "heimdal/lib/asn1/asn1parse.y" 2686 case 135: 2687 2688 /* Line 1455 of yacc.c */ 2689 #line 907 "asn1parse.c" 2483 2690 { 2484 2691 (yyval.value) = emalloc(sizeof(*(yyval.value))); … … 2488 2695 break; 2489 2696 2490 case 132: 2491 #line 891 "heimdal/lib/asn1/asn1parse.y" 2697 case 136: 2698 2699 /* Line 1455 of yacc.c */ 2700 #line 913 "asn1parse.c" 2492 2701 { 2493 2702 (yyval.value) = emalloc(sizeof(*(yyval.value))); … … 2497 2706 break; 2498 2707 2499 case 133: 2500 #line 899 "heimdal/lib/asn1/asn1parse.y" 2708 case 137: 2709 2710 /* Line 1455 of yacc.c */ 2711 #line 921 "asn1parse.c" 2501 2712 { 2502 2713 (yyval.value) = emalloc(sizeof(*(yyval.value))); … … 2506 2717 break; 2507 2718 2508 case 135: 2509 #line 910 "heimdal/lib/asn1/asn1parse.y" 2510 { 2511 } 2512 break; 2513 2514 case 136: 2515 #line 915 "heimdal/lib/asn1/asn1parse.y" 2719 case 139: 2720 2721 /* Line 1455 of yacc.c */ 2722 #line 932 "asn1parse.c" 2723 { 2724 } 2725 break; 2726 2727 case 140: 2728 2729 /* Line 1455 of yacc.c */ 2730 #line 937 "asn1parse.c" 2516 2731 { 2517 2732 (yyval.value) = emalloc(sizeof(*(yyval.value))); … … 2522 2737 2523 2738 2524 /* Line 1267 of yacc.c. */ 2525 #line 2523 "heimdal/lib/asn1/asn1parse.y" 2739 2740 /* Line 1455 of yacc.c */ 2741 #line 2740 "asn1parse.c" 2526 2742 default: break; 2527 2743 } … … 2533 2749 2534 2750 *++yyvsp = yyval; 2535 2536 2751 2537 2752 /* Now `shift' the result of the reduction. Determine what state … … 2599 2814 if (yyerrstatus == 3) 2600 2815 { 2601 /* If just tried and failed to reuse look -ahead token after an2816 /* If just tried and failed to reuse lookahead token after an 2602 2817 error, discard it. */ 2603 2818 … … 2616 2831 } 2617 2832 2618 /* Else will try to reuse look -ahead token after shifting the error2833 /* Else will try to reuse lookahead token after shifting the error 2619 2834 token. */ 2620 2835 goto yyerrlab1; … … 2673 2888 } 2674 2889 2675 if (yyn == YYFINAL)2676 YYACCEPT;2677 2678 2890 *++yyvsp = yylval; 2679 2891 … … 2700 2912 goto yyreturn; 2701 2913 2702 #if ndef yyoverflow2914 #if !defined(yyoverflow) || YYERROR_VERBOSE 2703 2915 /*-------------------------------------------------. 2704 2916 | yyexhaustedlab -- memory exhaustion comes here. | … … 2711 2923 2712 2924 yyreturn: 2713 if (yychar != YYE OF && yychar != YYEMPTY)2925 if (yychar != YYEMPTY) 2714 2926 yydestruct ("Cleanup: discarding lookahead", 2715 2927 yytoken, &yylval); … … 2737 2949 2738 2950 2739 #line 922 "heimdal/lib/asn1/asn1parse.y" 2951 2952 /* Line 1675 of yacc.c */ 2953 #line 944 "asn1parse.c" 2740 2954 2741 2955 … … 2743 2957 yyerror (const char *s) 2744 2958 { 2745 error_message ("%s\n", s);2959 lex_error_message ("%s\n", s); 2746 2960 } 2747 2961 … … 2808 3022 return; 2809 3023 ASN1_TAILQ_FOREACH(m, members, members) { 2810 asprintf(&m->label, "%s_%s", prefix, m->gen_name); 3024 if (asprintf(&m->label, "%s_%s", prefix, m->gen_name) < 0) 3025 errx(1, "malloc"); 2811 3026 if (m->label == NULL) 2812 3027 errx(1, "malloc"); … … 2825 3040 fix_labels(Symbol *s) 2826 3041 { 2827 char *p; 2828 asprintf(&p, "choice_%s", s->gen_name); 2829 if (p == NULL) 3042 char *p = NULL; 3043 if (asprintf(&p, "choice_%s", s->gen_name) < 0 || p == NULL) 2830 3044 errx(1, "malloc"); 2831 3045 fix_labels2(s->type, p); -
trunk/server/source4/heimdal/lib/asn1/asn1parse.h
r414 r745 1 /* A Bison parser, made by GNU Bison 2.3. */ 1 2 /* A Bison parser, made by GNU Bison 2.4.1. */ 2 3 3 4 /* Skeleton interface for Bison's Yacc-like parsers in C 4 5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 20065 6 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 6 7 Free Software Foundation, Inc. 7 8 This program is free software ;you can redistribute it and/or modify8 9 This program is free software: you can redistribute it and/or modify 9 10 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation ; either version 2, or (at your option)11 any later version.12 11 the Free Software Foundation, either version 3 of the License, or 12 (at your option) any later version. 13 13 14 This program is distributed in the hope that it will be useful, 14 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 17 GNU General Public License for more details. 17 18 18 19 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 Boston, MA 02110-1301, USA. */ 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 22 21 23 22 /* As a special exception, you may create a larger work that contains … … 30 29 Bison output files to be licensed under the GNU General Public 31 30 License without this special exception. 32 31 33 32 This special exception was added by the Free Software Foundation in 34 33 version 2.2 of Bison. */ 34 35 35 36 36 /* Tokens. */ … … 223 223 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 224 224 typedef union YYSTYPE 225 #line 65 "heimdal/lib/asn1/asn1parse.y"226 225 { 226 227 /* Line 1676 of yacc.c */ 228 #line 71 "asn1parse.c" 229 227 230 int constant; 228 231 struct value *value; … … 237 240 struct memhead *members; 238 241 struct constraint_spec *constraint_spec; 239 } 240 /* Line 1489 of yacc.c. */ 241 #line 242 "heimdal/lib/asn1/asn1parse.y" 242 YYSTYPE; 242 243 244 245 /* Line 1676 of yacc.c */ 246 #line 247 "asn1parse.c" 247 } YYSTYPE; 248 # define YYSTYPE_IS_TRIVIAL 1 243 249 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 244 250 # define YYSTYPE_IS_DECLARED 1 245 # define YYSTYPE_IS_TRIVIAL 1246 251 #endif 247 252 248 253 extern YYSTYPE yylval; 249 254 255 -
trunk/server/source4/heimdal/lib/asn1/asn1parse.y
r414 r745 3 3 * (Royal Institute of Technology, Stockholm, Sweden). 4 4 * All rights reserved. 5 * 6 * Portions Copyright (c) 2009 Apple Inc. All rights reserved. 5 7 * 6 8 * Redistribution and use in source and binary forms, with or without … … 60 62 struct string_list *next; 61 63 }; 64 65 /* Declarations for Bison */ 66 #define YYMALLOC malloc 67 #define YYFREE free 62 68 63 69 %} … … 240 246 TagDefault : kw_EXPLICIT kw_TAGS 241 247 | kw_IMPLICIT kw_TAGS 242 { error_message("implicit tagging is not supported"); }248 { lex_error_message("implicit tagging is not supported"); } 243 249 | kw_AUTOMATIC kw_TAGS 244 { error_message("automatic tagging is not supported"); }250 { lex_error_message("automatic tagging is not supported"); } 245 251 | /* empty */ 246 252 ; 247 253 248 254 ExtensionDefault: kw_EXTENSIBILITY kw_IMPLIED 249 { error_message("no extensibility options supported"); }255 { lex_error_message("no extensibility options supported"); } 250 256 | /* empty */ 251 257 ; 252 258 253 ModuleBody : /* Exports */Imports AssignmentList259 ModuleBody : Exports Imports AssignmentList 254 260 | /* empty */ 255 261 ; … … 273 279 Symbol *s = addsym(sl->string); 274 280 s->stype = Stype; 281 gen_template_import(s); 275 282 } 276 283 add_import($3); 277 284 } 285 ; 286 287 Exports : kw_EXPORTS referencenames ';' 288 { 289 struct string_list *sl; 290 for(sl = $2; sl != NULL; sl = sl->next) 291 add_export(sl->string); 292 } 293 | kw_EXPORTS kw_ALL 294 | /* empty */ 278 295 ; 279 296 … … 341 358 { 342 359 if($2->type != integervalue) 343 error_message("Non-integer used in first part of range");360 lex_error_message("Non-integer used in first part of range"); 344 361 if($2->type != integervalue) 345 error_message("Non-integer in second part of range");362 lex_error_message("Non-integer in second part of range"); 346 363 $$ = ecalloc(1, sizeof(*$$)); 347 364 $$->min = $2->u.integervalue; … … 351 368 { 352 369 if($2->type != integervalue) 353 error_message("Non-integer in first part of range");370 lex_error_message("Non-integer in first part of range"); 354 371 $$ = ecalloc(1, sizeof(*$$)); 355 372 $$->min = $2->u.integervalue; … … 359 376 { 360 377 if($4->type != integervalue) 361 error_message("Non-integer in second part of range");378 lex_error_message("Non-integer in second part of range"); 362 379 $$ = ecalloc(1, sizeof(*$$)); 363 380 $$->min = $4->u.integervalue + 2; … … 367 384 { 368 385 if($2->type != integervalue) 369 error_message("Non-integer used in limit");386 lex_error_message("Non-integer used in limit"); 370 387 $$ = ecalloc(1, sizeof(*$$)); 371 388 $$->min = $2->u.integervalue; … … 538 555 $$ = new_type(TType); 539 556 if(s->stype != Stype && s->stype != SUndefined) 540 error_message ("%s is not a type\n", $1);557 lex_error_message ("%s is not a type\n", $1); 541 558 else 542 559 $$->symbol = s; … … 594 611 { 595 612 if ($3->type != objectidentifiervalue) 596 error_message("Non-OID used in ENCODED BY constraint");613 lex_error_message("Non-OID used in ENCODED BY constraint"); 597 614 $$ = new_constraint_spec(CT_CONTENTS); 598 615 $$->u.content.type = NULL; … … 602 619 { 603 620 if ($5->type != objectidentifiervalue) 604 error_message("Non-OID used in ENCODED BY constraint");621 lex_error_message("Non-OID used in ENCODED BY constraint"); 605 622 $$ = new_constraint_spec(CT_CONTENTS); 606 623 $$->u.content.type = $2; … … 688 705 TE_EXPLICIT, new_type(TGeneralString)); 689 706 } 707 | kw_TeletexString 708 { 709 $$ = new_tag(ASN1_C_UNIV, UT_TeletexString, 710 TE_EXPLICIT, new_type(TTeletexString)); 711 } 690 712 | kw_UTF8String 691 713 { … … 834 856 if(s->stype != SValue || 835 857 s->value->type != objectidentifiervalue) { 836 error_message("%s is not an object identifier\n",858 lex_error_message("%s is not an object identifier\n", 837 859 s->name); 838 860 exit(1); … … 867 889 Symbol *s = addsym($1); 868 890 if(s->stype != SValue) 869 error_message ("%s is not a value\n",891 lex_error_message ("%s is not a value\n", 870 892 s->name); 871 893 else … … 925 947 yyerror (const char *s) 926 948 { 927 error_message ("%s\n", s);949 lex_error_message ("%s\n", s); 928 950 } 929 951 … … 990 1012 return; 991 1013 ASN1_TAILQ_FOREACH(m, members, members) { 992 asprintf(&m->label, "%s_%s", prefix, m->gen_name); 1014 if (asprintf(&m->label, "%s_%s", prefix, m->gen_name) < 0) 1015 errx(1, "malloc"); 993 1016 if (m->label == NULL) 994 1017 errx(1, "malloc"); … … 1007 1030 fix_labels(Symbol *s) 1008 1031 { 1009 char *p; 1010 asprintf(&p, "choice_%s", s->gen_name); 1011 if (p == NULL) 1032 char *p = NULL; 1033 if (asprintf(&p, "choice_%s", s->gen_name) < 0 || p == NULL) 1012 1034 errx(1, "malloc"); 1013 1035 fix_labels2(s->type, p); -
trunk/server/source4/heimdal/lib/asn1/cms.asn1
r414 r745 5 5 6 6 IMPORTS CertificateSerialNumber, AlgorithmIdentifier, Name, 7 Attribute, Certificate, Name,SubjectKeyIdentifier FROM rfc24597 Attribute, Certificate, SubjectKeyIdentifier FROM rfc2459 8 8 heim_any, heim_any_set FROM heim; 9 9 -
trunk/server/source4/heimdal/lib/asn1/cms.opt
r414 r745 1 1 --decode-dce-ber 2 --sequence=DigestAlgorithmIdentifiers -
trunk/server/source4/heimdal/lib/asn1/der.h
r414 r745 95 95 } heim_ber_time_t; 96 96 97 struct asn1_template; 98 97 99 #include <der-protos.h> 98 100 -
trunk/server/source4/heimdal/lib/asn1/der_cmp.c
r414 r745 54 54 55 55 int 56 der_printable_string_cmp(const heim_printable_string *p, 57 const heim_printable_string *q) 58 { 59 return der_heim_octet_string_cmp(p, q); 60 } 61 62 int 63 der_ia5_string_cmp(const heim_ia5_string *p, 64 const heim_ia5_string *q) 65 { 66 return der_heim_octet_string_cmp(p, q); 67 } 68 69 int 56 70 der_heim_bit_string_cmp(const heim_bit_string *p, 57 71 const heim_bit_string *q) -
trunk/server/source4/heimdal/lib/asn1/der_copy.c
r414 r745 3 3 * (Royal Institute of Technology, Stockholm, Sweden). 4 4 * All rights reserved. 5 * 6 * Portions Copyright (c) 2009 Apple Inc. All rights reserved. 5 7 * 6 8 * Redistribution and use in source and binary forms, with or without … … 47 49 48 50 int 51 der_copy_integer (const int *from, int *to) 52 { 53 *to = *from; 54 return 0; 55 } 56 57 int 58 der_copy_unsigned (const unsigned *from, unsigned *to) 59 { 60 *to = *from; 61 return 0; 62 } 63 64 int 65 der_copy_generalized_time (const time_t *from, time_t *to) 66 { 67 *to = *from; 68 return 0; 69 } 70 71 int 72 der_copy_utctime (const time_t *from, time_t *to) 73 { 74 *to = *from; 75 return 0; 76 } 77 78 int 49 79 der_copy_utf8string (const heim_utf8_string *from, heim_utf8_string *to) 50 80 { … … 56 86 heim_printable_string *to) 57 87 { 58 return der_copy_general_string(from, to); 88 to->length = from->length; 89 to->data = malloc(to->length + 1); 90 if(to->data == NULL) 91 return ENOMEM; 92 memcpy(to->data, from->data, to->length); 93 ((char *)to->data)[to->length] = '\0'; 94 return 0; 59 95 } 60 96 61 97 int 62 der_copy_ia5_string (const heim_ printable_string *from,63 heim_ printable_string *to)98 der_copy_ia5_string (const heim_ia5_string *from, 99 heim_ia5_string *to) 64 100 { 65 return der_copy_ general_string(from, to);101 return der_copy_printable_string(from, to); 66 102 } 67 103 -
trunk/server/source4/heimdal/lib/asn1/der_free.c
r414 r745 3 3 * (Royal Institute of Technology, Stockholm, Sweden). 4 4 * All rights reserved. 5 * 6 * Portions Copyright (c) 2009 Apple Inc. All rights reserved. 5 7 * 6 8 * Redistribution and use in source and binary forms, with or without … … 44 46 45 47 void 48 der_free_integer (int *i) 49 { 50 *i = 0; 51 } 52 53 void 54 der_free_unsigned (unsigned *u) 55 { 56 *u = 0; 57 } 58 59 void 60 der_free_generalized_time(time_t *t) 61 { 62 *t = 0; 63 } 64 65 void 66 der_free_utctime(time_t *t) 67 { 68 *t = 0; 69 } 70 71 72 void 46 73 der_free_utf8string (heim_utf8_string *str) 47 74 { … … 53 80 der_free_printable_string (heim_printable_string *str) 54 81 { 55 free(*str); 56 *str = NULL; 82 der_free_octet_string(str); 57 83 } 58 84 … … 60 86 der_free_ia5_string (heim_ia5_string *str) 61 87 { 62 free(*str); 63 *str = NULL; 88 der_free_octet_string(str); 64 89 } 65 90 -
trunk/server/source4/heimdal/lib/asn1/der_get.c
r414 r745 168 168 169 169 int 170 der_get_printable_string (const unsigned char *p, size_t len, 171 heim_printable_string *str, size_t *size) 172 { 173 return der_get_general_string(p, len, str, size); 174 } 175 176 int 177 der_get_ia5_string (const unsigned char *p, size_t len, 178 heim_ia5_string *str, size_t *size) 179 { 180 return der_get_general_string(p, len, str, size); 170 der_get_printable_string(const unsigned char *p, size_t len, 171 heim_printable_string *str, size_t *size) 172 { 173 str->length = len; 174 str->data = malloc(len + 1); 175 if (str->data == NULL) 176 return ENOMEM; 177 memcpy(str->data, p, len); 178 ((char *)str->data)[len] = '\0'; 179 if(size) *size = len; 180 return 0; 181 } 182 183 int 184 der_get_ia5_string(const unsigned char *p, size_t len, 185 heim_ia5_string *str, size_t *size) 186 { 187 return der_get_printable_string(p, len, str, size); 181 188 } 182 189 -
trunk/server/source4/heimdal/lib/asn1/der_length.c
r414 r745 3 3 * (Royal Institute of Technology, Stockholm, Sweden). 4 4 * All rights reserved. 5 * 6 * Portions Copyright (c) 2009 Apple Inc. All rights reserved. 5 7 * 6 8 * Redistribution and use in source and binary forms, with or without … … 114 116 115 117 size_t 118 der_length_tag(unsigned int tag) 119 { 120 size_t len = 0; 121 122 if(tag <= 30) 123 return 1; 124 while(tag) { 125 tag /= 128; 126 len++; 127 } 128 return len + 1; 129 } 130 131 size_t 116 132 der_length_integer (const int *data) 117 133 { … … 146 162 der_length_printable_string (const heim_printable_string *data) 147 163 { 148 return strlen(*data);164 return data->length; 149 165 } 150 166 … … 152 168 der_length_ia5_string (const heim_ia5_string *data) 153 169 { 154 return strlen(*data);170 return data->length; 155 171 } 156 172 -
trunk/server/source4/heimdal/lib/asn1/der_locl.h
r414 r745 53 53 #include <asn1_err.h> 54 54 #include <der.h> 55 #include <der-private.h> 56 #include "asn1-template.h" 55 57 56 58 time_t _der_timegm (struct tm *); 59 struct tm * _der_gmtime(time_t t, struct tm *); 57 60 size_t _heim_len_unsigned (unsigned); 58 61 size_t _heim_len_int (int); -
trunk/server/source4/heimdal/lib/asn1/der_put.c
r414 r745 182 182 const heim_printable_string *str, size_t *size) 183 183 { 184 return der_put_ general_string(p, len, str, size);184 return der_put_octet_string(p, len, str, size); 185 185 } 186 186 … … 189 189 const heim_ia5_string *str, size_t *size) 190 190 { 191 return der_put_ general_string(p, len, str, size);191 return der_put_octet_string(p, len, str, size); 192 192 } 193 193 … … 427 427 _heim_time2generalizedtime (time_t t, heim_octet_string *s, int gtimep) 428 428 { 429 struct tm *tm;429 struct tm tm; 430 430 const size_t len = gtimep ? 15 : 13; 431 431 … … 434 434 return ENOMEM; 435 435 s->length = len; 436 tm = gmtime (&t);436 _der_gmtime(t, &tm); 437 437 if (gtimep) 438 438 snprintf (s->data, len + 1, "%04d%02d%02d%02d%02d%02dZ", 439 tm ->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,440 tm ->tm_hour, tm->tm_min, tm->tm_sec);439 tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, 440 tm.tm_hour, tm.tm_min, tm.tm_sec); 441 441 else 442 442 snprintf (s->data, len + 1, "%02d%02d%02d%02d%02d%02dZ", 443 tm ->tm_year % 100, tm->tm_mon + 1, tm->tm_mday,444 tm ->tm_hour, tm->tm_min, tm->tm_sec);443 tm.tm_year % 100, tm.tm_mon + 1, tm.tm_mday, 444 tm.tm_hour, tm.tm_min, tm.tm_sec); 445 445 446 446 return 0; -
trunk/server/source4/heimdal/lib/asn1/digest.asn1
r414 r745 101 101 } 102 102 103 NTLMRequest2 ::= SEQUENCE { 104 loginUserName [0] UTF8String, 105 loginDomainName [1] UTF8String, 106 flags [2] INTEGER (0..4294967295), 107 lmchallenge [3] OCTET STRING SIZE (8), 108 ntChallengeResponce [4] OCTET STRING, 109 lmChallengeResponce [5] OCTET STRING 110 } 111 112 NTLMReply ::= SEQUENCE { 113 success [0] BOOLEAN, 114 flags [1] INTEGER (0..4294967295), 115 sessionkey [2] OCTET STRING OPTIONAL 116 } 117 103 118 DigestReqInner ::= CHOICE { 104 119 init [0] DigestInit, -
trunk/server/source4/heimdal/lib/asn1/extra.c
r414 r745 3 3 * (Royal Institute of Technology, Stockholm, Sweden). 4 4 * All rights reserved. 5 * 6 * Portions Copyright (c) 2009 Apple Inc. All rights reserved. 5 7 * 6 8 * Redistribution and use in source and binary forms, with or without … … 41 43 const heim_any *data, size_t *size) 42 44 { 43 if (data->length > len) 44 return ASN1_OVERFLOW; 45 p -= data->length; 46 len -= data->length; 47 memcpy (p+1, data->data, data->length); 48 *size = data->length; 49 return 0; 45 return der_put_octet_string (p, len, data, size); 50 46 } 51 47 … … 92 88 free_heim_any(heim_any *data) 93 89 { 94 free(data->data); 95 data->data = NULL; 90 der_free_octet_string(data); 96 91 } 97 92 … … 105 100 copy_heim_any(const heim_any *from, heim_any *to) 106 101 { 107 to->data = malloc(from->length); 108 if (to->data == NULL && from->length != 0) 109 return ENOMEM; 110 memcpy(to->data, from->data, from->length); 111 to->length = from->length; 112 return 0; 102 return der_copy_octet_string(from, to); 113 103 } 114 104 … … 117 107 const heim_any_set *data, size_t *size) 118 108 { 119 return encode_heim_any(p, len, data, size);109 return der_put_octet_string (p, len, data, size); 120 110 } 121 122 111 123 112 int … … 125 114 heim_any_set *data, size_t *size) 126 115 { 127 memset(data, 0, sizeof(*data)); 128 data->data = malloc(len); 129 if (data->data == NULL && len != 0) 130 return ENOMEM; 131 data->length = len; 132 memcpy(data->data, p, len); 133 if (size) *size = len; 134 return 0; 116 return der_get_octet_string(p, len, data, size); 135 117 } 136 118 … … 138 120 free_heim_any_set(heim_any_set *data) 139 121 { 140 free_heim_any(data);122 der_free_octet_string(data); 141 123 } 142 124 … … 144 126 length_heim_any_set(const heim_any *data) 145 127 { 146 return length_heim_any(data);128 return data->length; 147 129 } 148 130 … … 150 132 copy_heim_any_set(const heim_any_set *from, heim_any_set *to) 151 133 { 152 return copy_heim_any(from, to);134 return der_copy_octet_string(from, to); 153 135 } 154 136 … … 156 138 heim_any_cmp(const heim_any_set *p, const heim_any_set *q) 157 139 { 158 if (p->length != q->length) 159 return p->length - q->length; 160 return memcmp(p->data, q->data, p->length); 140 return der_heim_octet_string_cmp(p, q); 161 141 } -
trunk/server/source4/heimdal/lib/asn1/gen.c
r414 r745 3 3 * (Royal Institute of Technology, Stockholm, Sweden). 4 4 * All rights reserved. 5 * 6 * Portions Copyright (c) 2009 Apple Inc. All rights reserved. 5 7 * 6 8 * Redistribution and use in source and binary forms, with or without … … 36 38 RCSID("$Id$"); 37 39 38 FILE * headerfile, *codefile, *logfile;40 FILE *privheaderfile, *headerfile, *codefile, *logfile, *templatefile; 39 41 40 42 #define STEM "asn1" 41 43 42 44 static const char *orig_filename; 43 static char * header;45 static char *privheader, *header, *template; 44 46 static const char *headerbase = STEM; 45 47 … … 67 69 } 68 70 71 /* 72 * List of all exported symbols 73 */ 74 75 struct sexport { 76 const char *name; 77 int defined; 78 struct sexport *next; 79 }; 80 81 static struct sexport *exports = NULL; 82 83 void 84 add_export (const char *name) 85 { 86 struct sexport *tmp = emalloc (sizeof(*tmp)); 87 88 tmp->name = name; 89 tmp->next = exports; 90 exports = tmp; 91 } 92 93 int 94 is_export(const char *name) 95 { 96 struct sexport *tmp; 97 98 if (exports == NULL) /* no export list, all exported */ 99 return 1; 100 101 for (tmp = exports; tmp != NULL; tmp = tmp->next) { 102 if (strcmp(tmp->name, name) == 0) { 103 tmp->defined = 1; 104 return 1; 105 } 106 } 107 return 0; 108 } 109 69 110 const char * 70 111 get_filename (void) … … 76 117 init_generate (const char *filename, const char *base) 77 118 { 78 char *fn ;119 char *fn = NULL; 79 120 80 121 orig_filename = filename; … … 86 127 87 128 /* public header file */ 88 asprintf(&header, "%s.h", headerbase); 89 if (header == NULL) 129 if (asprintf(&header, "%s.h", headerbase) < 0 || header == NULL) 90 130 errx(1, "malloc"); 91 asprintf(&fn, "%s.hx", headerbase); 92 if (fn == NULL) 131 if (asprintf(&fn, "%s.hx", headerbase) < 0 || fn == NULL) 93 132 errx(1, "malloc"); 94 133 headerfile = fopen (fn, "w"); … … 96 135 err (1, "open %s", fn); 97 136 free(fn); 98 137 fn = NULL; 138 139 /* private header file */ 140 if (asprintf(&privheader, "%s-priv.h", headerbase) < 0 || privheader == NULL) 141 errx(1, "malloc"); 142 if (asprintf(&fn, "%s-priv.hx", headerbase) < 0 || fn == NULL) 143 errx(1, "malloc"); 144 privheaderfile = fopen (fn, "w"); 145 if (privheaderfile == NULL) 146 err (1, "open %s", fn); 147 free(fn); 148 fn = NULL; 149 150 /* template file */ 151 if (asprintf(&template, "%s-template.c", headerbase) < 0 || template == NULL) 152 errx(1, "malloc"); 99 153 fprintf (headerfile, 100 154 "/* Generated from %s */\n" … … 128 182 ); 129 183 fprintf (headerfile, 130 "typedef char *heim_printable_string;\n\n"184 "typedef struct heim_octet_string heim_printable_string;\n\n" 131 185 ); 132 186 fprintf (headerfile, 133 "typedef char *heim_ia5_string;\n\n"187 "typedef struct heim_octet_string heim_ia5_string;\n\n" 134 188 ); 135 189 fprintf (headerfile, … … 175 229 " } while (0)\n\n", 176 230 headerfile); 231 fputs("#ifdef _WIN32\n" 232 "#ifndef ASN1_LIB\n" 233 "#define ASN1EXP __declspec(dllimport)\n" 234 "#else\n" 235 "#define ASN1EXP\n" 236 "#endif\n" 237 "#define ASN1CALL __stdcall\n" 238 "#else\n" 239 "#define ASN1EXP\n" 240 "#define ASN1CALL\n" 241 "#endif\n", 242 headerfile); 177 243 fprintf (headerfile, "struct units;\n\n"); 178 244 fprintf (headerfile, "#endif\n\n"); 179 asprintf(&fn, "%s_files", base); 180 if (fn == NULL) 245 if (asprintf(&fn, "%s_files", base) < 0 || fn == NULL) 181 246 errx(1, "malloc"); 182 247 logfile = fopen(fn, "w"); 183 248 if (logfile == NULL) 184 249 err (1, "open %s", fn); 185 } 186 187 void 188 close_generate (void) 189 { 190 fprintf (headerfile, "#endif /* __%s_h__ */\n", headerbase); 191 192 fclose (headerfile); 193 fprintf (logfile, "\n"); 194 fclose (logfile); 195 } 196 197 void 198 gen_assign_defval(const char *var, struct value *val) 199 { 200 switch(val->type) { 201 case stringvalue: 202 fprintf(codefile, "if((%s = strdup(\"%s\")) == NULL)\nreturn ENOMEM;\n", var, val->u.stringvalue); 203 break; 204 case integervalue: 205 fprintf(codefile, "%s = %d;\n", var, val->u.integervalue); 206 break; 207 case booleanvalue: 208 if(val->u.booleanvalue) 209 fprintf(codefile, "%s = TRUE;\n", var); 210 else 211 fprintf(codefile, "%s = FALSE;\n", var); 212 break; 213 default: 214 abort(); 215 } 216 } 217 218 void 219 gen_compare_defval(const char *var, struct value *val) 220 { 221 switch(val->type) { 222 case stringvalue: 223 fprintf(codefile, "if(strcmp(%s, \"%s\") != 0)\n", var, val->u.stringvalue); 224 break; 225 case integervalue: 226 fprintf(codefile, "if(%s != %d)\n", var, val->u.integervalue); 227 break; 228 case booleanvalue: 229 if(val->u.booleanvalue) 230 fprintf(codefile, "if(!%s)\n", var); 231 else 232 fprintf(codefile, "if(%s)\n", var); 233 break; 234 default: 235 abort(); 236 } 237 } 238 239 void 240 generate_header_of_codefile(const char *name) 241 { 242 char *filename; 243 244 if (codefile != NULL) 245 abort(); 246 247 asprintf (&filename, "%s_%s.x", STEM, name); 248 if (filename == NULL) 249 errx(1, "malloc"); 250 codefile = fopen (filename, "w"); 251 if (codefile == NULL) 252 err (1, "fopen %s", filename); 253 fprintf(logfile, "%s ", filename); 254 free(filename); 255 fprintf (codefile, 250 251 /* if one code file, write into the one codefile */ 252 if (one_code_file) 253 return; 254 255 templatefile = fopen (template, "w"); 256 if (templatefile == NULL) 257 err (1, "open %s", template); 258 259 fprintf (templatefile, 256 260 "/* Generated from %s */\n" 257 261 "/* Do not edit */\n\n" … … 263 267 "#include <limits.h>\n" 264 268 "#include <krb5-types.h>\n", 269 filename); 270 271 fprintf (templatefile, 272 "#include <%s>\n" 273 "#include <%s>\n" 274 "#include <der.h>\n" 275 "#include <der-private.h>\n" 276 "#include <asn1-template.h>\n", 277 header, privheader); 278 279 280 } 281 282 void 283 close_generate (void) 284 { 285 fprintf (headerfile, "#endif /* __%s_h__ */\n", headerbase); 286 287 if (headerfile) 288 fclose (headerfile); 289 if (privheaderfile) 290 fclose (privheaderfile); 291 if (templatefile) 292 fclose (templatefile); 293 if (logfile) 294 fprintf (logfile, "\n"); 295 fclose (logfile); 296 } 297 298 void 299 gen_assign_defval(const char *var, struct value *val) 300 { 301 switch(val->type) { 302 case stringvalue: 303 fprintf(codefile, "if((%s = strdup(\"%s\")) == NULL)\nreturn ENOMEM;\n", var, val->u.stringvalue); 304 break; 305 case integervalue: 306 fprintf(codefile, "%s = %d;\n", var, val->u.integervalue); 307 break; 308 case booleanvalue: 309 if(val->u.booleanvalue) 310 fprintf(codefile, "%s = TRUE;\n", var); 311 else 312 fprintf(codefile, "%s = FALSE;\n", var); 313 break; 314 default: 315 abort(); 316 } 317 } 318 319 void 320 gen_compare_defval(const char *var, struct value *val) 321 { 322 switch(val->type) { 323 case stringvalue: 324 fprintf(codefile, "if(strcmp(%s, \"%s\") != 0)\n", var, val->u.stringvalue); 325 break; 326 case integervalue: 327 fprintf(codefile, "if(%s != %d)\n", var, val->u.integervalue); 328 break; 329 case booleanvalue: 330 if(val->u.booleanvalue) 331 fprintf(codefile, "if(!%s)\n", var); 332 else 333 fprintf(codefile, "if(%s)\n", var); 334 break; 335 default: 336 abort(); 337 } 338 } 339 340 void 341 generate_header_of_codefile(const char *name) 342 { 343 char *filename = NULL; 344 345 if (codefile != NULL) 346 abort(); 347 348 if (asprintf (&filename, "%s_%s.x", STEM, name) < 0 || filename == NULL) 349 errx(1, "malloc"); 350 codefile = fopen (filename, "w"); 351 if (codefile == NULL) 352 err (1, "fopen %s", filename); 353 fprintf(logfile, "%s ", filename); 354 free(filename); 355 filename = NULL; 356 fprintf (codefile, 357 "/* Generated from %s */\n" 358 "/* Do not edit */\n\n" 359 "#define ASN1_LIB\n\n" 360 "#include <stdio.h>\n" 361 "#include <stdlib.h>\n" 362 "#include <time.h>\n" 363 "#include <string.h>\n" 364 "#include <errno.h>\n" 365 "#include <limits.h>\n" 366 "#include <krb5-types.h>\n", 265 367 orig_filename); 266 368 267 369 fprintf (codefile, 268 "#include <%s.h>\n", 269 headerbase); 370 "#include <%s>\n" 371 "#include <%s>\n", 372 header, privheader); 270 373 fprintf (codefile, 271 374 "#include <asn1_err.h>\n" 272 375 "#include <der.h>\n" 376 "#include <der-private.h>\n" 377 "#include <asn1-template.h>\n" 273 378 "#include <parse_units.h>\n\n"); 274 379 … … 303 408 struct objid *o, **list; 304 409 unsigned int i, len; 410 char *gen_upper; 305 411 306 412 if (!one_code_file) … … 328 434 } 329 435 330 fprintf (headerfile, "} */\n");331 fprintf (headerfile, "const heim_oid *oid_%s(void);\n",332 s->gen_name);333 fprintf (headerfile,334 "extern const heim_oid asn1_oid_%s;\n\n",335 s->gen_name);336 337 338 436 fprintf (codefile, "static unsigned oid_%s_variable_num[%d] = {", 339 437 s->gen_name, len); … … 347 445 s->gen_name, len, s->gen_name); 348 446 349 fprintf (codefile, "const heim_oid *oid_%s(void)\n"350 "{\n"351 "return &asn1_oid_%s;\n"352 "}\n\n",353 s->gen_name, s->gen_name);354 355 447 free(list); 448 449 /* header file */ 450 451 gen_upper = strdup(s->gen_name); 452 len = strlen(gen_upper); 453 for (i = 0; i < len; i++) 454 gen_upper[i] = toupper((int)s->gen_name[i]); 455 456 fprintf (headerfile, "} */\n"); 457 fprintf (headerfile, 458 "extern ASN1EXP const heim_oid asn1_oid_%s;\n" 459 "#define ASN1_OID_%s (&asn1_oid_%s)\n\n", 460 s->gen_name, 461 gen_upper, 462 s->gen_name); 463 464 free(gen_upper); 356 465 357 466 if (!one_code_file) … … 362 471 default: 363 472 abort(); 473 } 474 } 475 476 int 477 is_primitive_type(int type) 478 { 479 switch(type) { 480 case TInteger: 481 case TBoolean: 482 case TOctetString: 483 case TBitString: 484 case TEnumerated: 485 case TGeneralizedTime: 486 case TGeneralString: 487 case TTeletexString: 488 case TOID: 489 case TUTCTime: 490 case TUTF8String: 491 case TPrintableString: 492 case TIA5String: 493 case TBMPString: 494 case TUniversalString: 495 case TVisibleString: 496 case TNull: 497 return 1; 498 default: 499 return 0; 364 500 } 365 501 } … … 495 631 fprintf (headerfile, "GeneralString"); 496 632 break; 633 case TTeletexString: 634 fprintf (headerfile, "TeletexString"); 635 break; 497 636 case TTag: { 498 637 const char *classnames[] = { "UNIVERSAL ", "APPLICATION ", … … 548 687 549 688 static void 550 define_type (int level, const char *name, Type *t, int typedefp, int preservep) 551 { 689 getnewbasename(char **newbasename, int typedefp, const char *basename, const char *name) 690 { 691 if (typedefp) 692 *newbasename = strdup(name); 693 else { 694 if (name[0] == '*') 695 name++; 696 if (asprintf(newbasename, "%s_%s", basename, name) < 0) 697 errx(1, "malloc"); 698 } 699 if (*newbasename == NULL) 700 err(1, "malloc"); 701 } 702 703 static void 704 define_type (int level, const char *name, const char *basename, Type *t, int typedefp, int preservep) 705 { 706 char *newbasename = NULL; 707 552 708 switch (t->type) { 553 709 case TType: … … 600 756 fprintf (headerfile, "heim_bit_string %s;\n", name); 601 757 else { 602 fprintf (headerfile, "struct %s {\n", typedefp ? name : ""); 758 int pos = 0; 759 getnewbasename(&newbasename, typedefp, basename, name); 760 761 fprintf (headerfile, "struct %s {\n", newbasename); 603 762 ASN1_TAILQ_FOREACH(m, t->members, members) { 604 char *n ;763 char *n = NULL; 605 764 606 asprintf (&n, "%s:1", m->gen_name); 607 if (n == NULL) 765 /* pad unused */ 766 while (pos < m->val) { 767 if (asprintf (&n, "_unused%d:1", pos) < 0 || n == NULL) 768 errx(1, "malloc"); 769 define_type (level + 1, n, newbasename, &i, FALSE, FALSE); 770 free(n); 771 pos++; 772 } 773 774 n = NULL; 775 if (asprintf (&n, "%s:1", m->gen_name) < 0 || n == NULL) 608 776 errx(1, "malloc"); 609 define_type (level + 1, n, &i, FALSE, FALSE);777 define_type (level + 1, n, newbasename, &i, FALSE, FALSE); 610 778 free (n); 779 n = NULL; 780 pos++; 611 781 } 782 /* pad to 32 elements */ 783 while (pos < 32) { 784 char *n = NULL; 785 if (asprintf (&n, "_unused%d:1", pos) < 0 || n == NULL) 786 errx(1, "malloc"); 787 define_type (level + 1, n, newbasename, &i, FALSE, FALSE); 788 free(n); 789 pos++; 790 } 791 612 792 space(level); 613 793 fprintf (headerfile, "} %s;\n\n", name); … … 636 816 Member *m; 637 817 638 space(level); 639 fprintf (headerfile, "struct %s {\n", typedefp ? name : ""); 818 getnewbasename(&newbasename, typedefp, basename, name); 819 820 space(level); 821 fprintf (headerfile, "struct %s {\n", newbasename); 640 822 if (t->type == TSequence && preservep) { 641 823 space(level + 1); … … 646 828 ; 647 829 } else if (m->optional) { 648 char *n; 649 650 asprintf (&n, "*%s", m->gen_name); 651 if (n == NULL) 830 char *n = NULL; 831 832 if (asprintf (&n, "*%s", m->gen_name) < 0 || n == NULL) 652 833 errx(1, "malloc"); 653 define_type (level + 1, n, m->type, FALSE, FALSE);834 define_type (level + 1, n, newbasename, m->type, FALSE, FALSE); 654 835 free (n); 655 836 } else 656 define_type (level + 1, m->gen_name, m->type, FALSE, FALSE);837 define_type (level + 1, m->gen_name, newbasename, m->type, FALSE, FALSE); 657 838 } 658 839 space(level); … … 665 846 struct range range = { 0, INT_MAX }; 666 847 848 getnewbasename(&newbasename, typedefp, basename, name); 849 667 850 i.type = TInteger; 668 851 i.range = ⦥ … … 671 854 672 855 space(level); 673 fprintf (headerfile, "struct %s {\n", typedefp ? name : "");674 define_type (level + 1, "len", &i, FALSE, FALSE);675 define_type (level + 1, "*val", t->subtype, FALSE, FALSE);856 fprintf (headerfile, "struct %s {\n", newbasename); 857 define_type (level + 1, "len", newbasename, &i, FALSE, FALSE); 858 define_type (level + 1, "*val", newbasename, t->subtype, FALSE, FALSE); 676 859 space(level); 677 860 fprintf (headerfile, "} %s;\n", name); … … 686 869 fprintf (headerfile, "heim_general_string %s;\n", name); 687 870 break; 871 case TTeletexString: 872 space(level); 873 fprintf (headerfile, "heim_general_string %s;\n", name); 874 break; 688 875 case TTag: 689 define_type (level, name, t->subtype, typedefp, preservep);876 define_type (level, name, basename, t->subtype, typedefp, preservep); 690 877 break; 691 878 case TChoice: { … … 693 880 Member *m; 694 881 695 space(level); 696 fprintf (headerfile, "struct %s {\n", typedefp ? name : ""); 882 getnewbasename(&newbasename, typedefp, basename, name); 883 884 space(level); 885 fprintf (headerfile, "struct %s {\n", newbasename); 697 886 if (preservep) { 698 887 space(level + 1); … … 726 915 fprintf(headerfile, "heim_octet_string asn1_ellipsis;\n"); 727 916 } else if (m->optional) { 728 char *n; 729 730 asprintf (&n, "*%s", m->gen_name); 731 if (n == NULL) 917 char *n = NULL; 918 919 if (asprintf (&n, "*%s", m->gen_name) < 0 || n == NULL) 732 920 errx(1, "malloc"); 733 define_type (level + 2, n, m->type, FALSE, FALSE);921 define_type (level + 2, n, newbasename, m->type, FALSE, FALSE); 734 922 free (n); 735 923 } else 736 define_type (level + 2, m->gen_name, m->type, FALSE, FALSE);924 define_type (level + 2, m->gen_name, newbasename, m->type, FALSE, FALSE); 737 925 } 738 926 space(level + 1); … … 781 969 abort (); 782 970 } 971 if (newbasename) 972 free(newbasename); 783 973 } 784 974 … … 794 984 795 985 fprintf (headerfile, "typedef "); 796 define_type (0, s->gen_name, s-> type, TRUE, preservep);986 define_type (0, s->gen_name, s->gen_name, s->type, TRUE, preservep); 797 987 798 988 fprintf (headerfile, "\n"); 799 989 } 800 801 990 802 991 void 803 992 generate_type (const Symbol *s) 804 993 { 994 FILE *h; 995 const char * exp; 996 805 997 if (!one_code_file) 806 998 generate_header_of_codefile(s->gen_name); 807 999 808 1000 generate_type_header (s); 809 generate_type_encode (s); 810 generate_type_decode (s); 811 generate_type_free (s); 812 generate_type_length (s); 813 generate_type_copy (s); 1001 1002 if (template_flag) 1003 generate_template(s); 1004 1005 if (template_flag == 0 || is_template_compat(s) == 0) { 1006 generate_type_encode (s); 1007 generate_type_decode (s); 1008 generate_type_free (s); 1009 generate_type_length (s); 1010 generate_type_copy (s); 1011 } 814 1012 generate_type_seq (s); 815 1013 generate_glue (s->type, s->gen_name); 816 fprintf(headerfile, "\n\n"); 1014 1015 /* generate prototypes */ 1016 1017 if (is_export(s->name)) { 1018 h = headerfile; 1019 exp = "ASN1EXP "; 1020 } else { 1021 h = privheaderfile; 1022 exp = ""; 1023 } 1024 1025 fprintf (h, 1026 "%sint ASN1CALL " 1027 "decode_%s(const unsigned char *, size_t, %s *, size_t *);\n", 1028 exp, 1029 s->gen_name, s->gen_name); 1030 fprintf (h, 1031 "%sint ASN1CALL " 1032 "encode_%s(unsigned char *, size_t, const %s *, size_t *);\n", 1033 exp, 1034 s->gen_name, s->gen_name); 1035 fprintf (h, 1036 "%ssize_t ASN1CALL length_%s(const %s *);\n", 1037 exp, 1038 s->gen_name, s->gen_name); 1039 fprintf (h, 1040 "%sint ASN1CALL copy_%s (const %s *, %s *);\n", 1041 exp, 1042 s->gen_name, s->gen_name, s->gen_name); 1043 fprintf (h, 1044 "%svoid ASN1CALL free_%s (%s *);\n", 1045 exp, 1046 s->gen_name, s->gen_name); 1047 1048 fprintf(h, "\n\n"); 817 1049 818 1050 if (!one_code_file) { -
trunk/server/source4/heimdal/lib/asn1/gen_copy.c
r414 r745 111 111 fprintf(codefile, "case %s:\n", m->label); 112 112 113 asprintf (&fs, "%s(%s)->%s%s", 114 m->optional ? "" : "&", from, 115 t->type == TChoice ? "u." : "", m->gen_name); 113 if (asprintf (&fs, "%s(%s)->%s%s", 114 m->optional ? "" : "&", from, 115 t->type == TChoice ? "u." : "", m->gen_name) < 0) 116 errx(1, "malloc"); 116 117 if (fs == NULL) 117 118 errx(1, "malloc"); 118 asprintf (&ts, "%s(%s)->%s%s", 119 m->optional ? "" : "&", to, 120 t->type == TChoice ? "u." : "", m->gen_name); 119 if (asprintf (&ts, "%s(%s)->%s%s", 120 m->optional ? "" : "&", to, 121 t->type == TChoice ? "u." : "", m->gen_name) < 0) 122 errx(1, "malloc"); 121 123 if (ts == NULL) 122 124 errx(1, "malloc"); … … 156 158 case TSetOf: 157 159 case TSequenceOf: { 158 char *f; 159 char *T; 160 char *f = NULL, *T = NULL; 160 161 161 162 fprintf (codefile, "if(((%s)->val = " … … 167 168 "for((%s)->len = 0; (%s)->len < (%s)->len; (%s)->len++){\n", 168 169 to, to, from, to); 169 asprintf(&f, "&(%s)->val[(%s)->len]", from, to); 170 if (asprintf(&f, "&(%s)->val[(%s)->len]", from, to) < 0) 171 errx(1, "malloc"); 170 172 if (f == NULL) 171 173 errx(1, "malloc"); 172 asprintf(&T, "&(%s)->val[(%s)->len]", to, to); 174 if (asprintf(&T, "&(%s)->val[(%s)->len]", to, to) < 0) 175 errx(1, "malloc"); 173 176 if (T == NULL) 174 177 errx(1, "malloc"); … … 185 188 copy_primitive ("general_string", from, to); 186 189 break; 190 case TTeletexString: 191 copy_primitive ("general_string", from, to); 192 break; 187 193 case TUTCTime: 188 194 fprintf(codefile, "*(%s) = *(%s);\n", to, from); … … 226 232 used_fail = 0; 227 233 228 fprintf (headerfile, 229 "int copy_%s (const %s *, %s *);\n", 230 s->gen_name, s->gen_name, s->gen_name); 231 232 fprintf (codefile, "int\n" 234 fprintf (codefile, "int ASN1CALL\n" 233 235 "copy_%s(const %s *from, %s *to)\n" 234 236 "{\n" -
trunk/server/source4/heimdal/lib/asn1/gen_decode.c
r414 r745 57 57 } 58 58 59 static int60 is_primitive_type(int type)61 {62 switch(type) {63 case TInteger:64 case TBoolean:65 case TOctetString:66 case TBitString:67 case TEnumerated:68 case TGeneralizedTime:69 case TGeneralString:70 case TOID:71 case TUTCTime:72 case TUTF8String:73 case TPrintableString:74 case TIA5String:75 case TBMPString:76 case TUniversalString:77 case TVisibleString:78 case TNull:79 return 1;80 default:81 return 0;82 }83 }84 85 59 static void 86 60 find_tag (const Type *t, … … 110 84 *tag = UT_GeneralString; 111 85 break; 86 case TTeletexString: 87 *cl = ASN1_C_UNIV; 88 *ty = PRIM; 89 *tag = UT_TeletexString; 90 break; 112 91 case TGeneralizedTime: 113 92 *cl = ASN1_C_UNIV; … … 165 144 if ((t->symbol->stype == Stype && t->symbol->type == NULL) 166 145 || t->symbol->stype == SUndefined) { 167 error_message("%s is imported or still undefined, "168 " can't generate tag checking data in CHOICE "169 "without this information",170 t->symbol->name);146 lex_error_message("%s is imported or still undefined, " 147 " can't generate tag checking data in CHOICE " 148 "without this information", 149 t->symbol->name); 171 150 exit(1); 172 151 } … … 342 321 343 322 ASN1_TAILQ_FOREACH(m, t->members, members) { 344 char *s ;323 char *s = NULL; 345 324 346 325 if (m->ellipsis) 347 326 continue; 348 327 349 asprintf (&s, "%s(%s)->%s", m->optional ? "" : "&", 350 name, m->gen_name); 351 if (s == NULL) 328 if (asprintf (&s, "%s(%s)->%s", m->optional ? "" : "&", 329 name, m->gen_name) < 0 || s == NULL) 352 330 errx(1, "malloc"); 353 331 decode_type (s, m->type, m->optional, forwstr, m->gen_name, NULL); … … 385 363 valuename(m->type->tag.tagclass, m->type->tag.tagvalue)); 386 364 387 asprintf (&s, "%s(%s)->%s", m->optional ? "" : "&", name, m->gen_name); 388 if (s == NULL) 365 if (asprintf (&s, "%s(%s)->%s", m->optional ? "" : "&", name, m->gen_name) < 0 || s == NULL) 389 366 errx(1, "malloc"); 390 367 if(m->optional) … … 410 387 char *s; 411 388 412 asprintf (&s, "%s->%s", name, m->gen_name); 413 if (s == NULL) 389 if (asprintf (&s, "%s->%s", name, m->gen_name) < 0 || s == NULL) 414 390 errx(1, "malloc"); 415 391 fprintf(codefile, "if((members & (1 << %d)) == 0)\n", memno); … … 428 404 case TSetOf: 429 405 case TSequenceOf: { 430 char *n ;431 char *sname ;406 char *n = NULL; 407 char *sname = NULL; 432 408 433 409 fprintf (codefile, … … 463 439 name, tmpstr); 464 440 465 asprintf (&n, "&(%s)->val[(%s)->len]", name, name); 466 if (n == NULL) 441 if (asprintf (&n, "&(%s)->val[(%s)->len]", name, name) < 0 || n == NULL) 467 442 errx(1, "malloc"); 468 asprintf (&sname, "%s_s_of", tmpstr); 469 if (sname == NULL) 443 if (asprintf (&sname, "%s_s_of", tmpstr) < 0 || sname == NULL) 470 444 errx(1, "malloc"); 471 445 decode_type (n, t->subtype, 0, forwstr, sname, NULL); … … 490 464 decode_primitive ("general_string", name, forwstr); 491 465 break; 466 case TTeletexString: 467 decode_primitive ("general_string", name, forwstr); 468 break; 492 469 case TTag:{ 493 char *tname , *typestring;470 char *tname = NULL, *typestring = NULL; 494 471 char *ide = NULL; 495 472 496 asprintf(&typestring, "%s_type", tmpstr); 473 if (asprintf(&typestring, "%s_type", tmpstr) < 0 || typestring == NULL) 474 errx(1, "malloc"); 497 475 498 476 fprintf(codefile, … … 547 525 "if (%s_datalen > len) { e = ASN1_OVERRUN; %s; }\n" 548 526 "len = %s_datalen;\n", tmpstr, forwstr, tmpstr); 549 asprintf (&tname, "%s_Tag", tmpstr); 550 if (tname == NULL) 527 if (asprintf (&tname, "%s_Tag", tmpstr) < 0 || tname == NULL) 551 528 errx(1, "malloc"); 552 529 decode_type (name, t->subtype, 0, forwstr, tname, ide); … … 587 564 ASN1_TAILQ_FOREACH(m, t->members, members) { 588 565 const Type *tt = m->type; 589 char *s ;566 char *s = NULL; 590 567 Der_class cl; 591 568 Der_type ty; … … 605 582 ty ? "CONS" : "PRIM", 606 583 valuename(cl, tag)); 607 asprintf (&s, "%s(%s)->u.%s", m->optional ? "" : "&", 608 name, m->gen_name); 609 if (s == NULL) 584 if (asprintf (&s, "%s(%s)->u.%s", m->optional ? "" : "&", 585 name, m->gen_name) < 0 || s == NULL) 610 586 errx(1, "malloc"); 611 587 decode_type (s, m->type, m->optional, forwstr, m->gen_name, NULL); … … 686 662 int preserve = preserve_type(s->name) ? TRUE : FALSE; 687 663 688 fprintf (headerfile, 689 "int " 690 "decode_%s(const unsigned char *, size_t, %s *, size_t *);\n", 691 s->gen_name, s->gen_name); 692 693 fprintf (codefile, "int\n" 664 fprintf (codefile, "int ASN1CALL\n" 694 665 "decode_%s(const unsigned char *p," 695 666 " size_t len, %s *data, size_t *size)\n" … … 704 675 case TGeneralizedTime: 705 676 case TGeneralString: 677 case TTeletexString: 706 678 case TUTF8String: 707 679 case TPrintableString: -
trunk/server/source4/heimdal/lib/asn1/gen_encode.c
r414 r745 260 260 261 261 ASN1_TAILQ_FOREACH_REVERSE(m, t->members, memhead, members) { 262 char *s ;262 char *s = NULL; 263 263 264 264 if (m->ellipsis) 265 265 continue; 266 266 267 asprintf (&s, "%s(%s)->%s", m->optional ? "" : "&", name, m->gen_name); 268 if (s == NULL) 267 if (asprintf (&s, "%s(%s)->%s", m->optional ? "" : "&", name, m->gen_name) < 0 || s == NULL) 269 268 errx(1, "malloc"); 270 269 fprintf(codefile, "/* %s */\n", m->name); … … 290 289 "{\n" 291 290 "struct heim_octet_string *val;\n" 292 "size_t elen , totallen = 0;\n"293 "int eret ;\n");291 "size_t elen = 0, totallen = 0;\n" 292 "int eret = 0;\n"); 294 293 295 294 fprintf(codefile, … … 353 352 } 354 353 case TSequenceOf: { 355 char * n;356 char * sname;354 char *sname = NULL; 355 char *n = NULL; 357 356 358 357 fprintf (codefile, … … 361 360 "ret = 0;\n", 362 361 name, tmpstr); 363 asprintf (&n, "&(%s)->val[i]", name); 364 if (n == NULL) 362 if (asprintf (&n, "&(%s)->val[i]", name) < 0 || n == NULL) 365 363 errx(1, "malloc"); 366 asprintf (&sname, "%s_S_Of", tmpstr); 367 if (sname == NULL) 364 if (asprintf (&sname, "%s_S_Of", tmpstr) < 0 || sname == NULL) 368 365 errx(1, "malloc"); 369 366 encode_type (n, t->subtype, sname); … … 384 381 constructed = 0; 385 382 break; 383 case TTeletexString: 384 encode_primitive ("general_string", name); 385 constructed = 0; 386 break; 386 387 case TTag: { 387 char *tname ;388 char *tname = NULL; 388 389 int c; 389 asprintf (&tname, "%s_tag", tmpstr); 390 if (tname == NULL) 390 if (asprintf (&tname, "%s_tag", tmpstr) < 0 || tname == NULL) 391 391 errx(1, "malloc"); 392 392 c = encode_type (name, t->subtype, tname); … … 402 402 case TChoice:{ 403 403 Member *m, *have_ellipsis = NULL; 404 char *s ;404 char *s = NULL; 405 405 406 406 if (t->members == NULL) … … 409 409 fprintf(codefile, "\n"); 410 410 411 asprintf (&s, "(%s)", name); 412 if (s == NULL) 411 if (asprintf (&s, "(%s)", name) < 0 || s == NULL) 413 412 errx(1, "malloc"); 414 413 fprintf(codefile, "switch(%s->element) {\n", s); 415 414 416 415 ASN1_TAILQ_FOREACH_REVERSE(m, t->members, memhead, members) { 417 char *s2 ;416 char *s2 = NULL; 418 417 419 418 if (m->ellipsis) { … … 423 422 424 423 fprintf (codefile, "case %s: {", m->label); 425 asprintf(&s2, "%s(%s)->u.%s", m->optional ? "" : "&", 426 s, m->gen_name); 427 if (s2 == NULL) 424 if (asprintf(&s2, "%s(%s)->u.%s", m->optional ? "" : "&", 425 s, m->gen_name) < 0 || s2 == NULL) 428 426 errx(1, "malloc"); 429 427 if (m->optional) … … 505 503 generate_type_encode (const Symbol *s) 506 504 { 507 fprintf (headerfile, 508 "int " 509 "encode_%s(unsigned char *, size_t, const %s *, size_t *);\n", 510 s->gen_name, s->gen_name); 511 512 fprintf (codefile, "int\n" 505 fprintf (codefile, "int ASN1CALL\n" 513 506 "encode_%s(unsigned char *p, size_t len," 514 507 " const %s *data, size_t *size)\n" … … 522 515 case TGeneralizedTime: 523 516 case TGeneralString: 517 case TTeletexString: 524 518 case TUTCTime: 525 519 case TUTF8String: -
trunk/server/source4/heimdal/lib/asn1/gen_free.c
r414 r745 94 94 if(t->type == TChoice) 95 95 fprintf(codefile, "case %s:\n", m->label); 96 asprintf (&s, "%s(%s)->%s%s", 97 m->optional ? "" : "&", name, 98 t->type == TChoice ? "u." : "", m->gen_name); 99 if (s == NULL) 96 if (asprintf (&s, "%s(%s)->%s%s", 97 m->optional ? "" : "&", name, 98 t->type == TChoice ? "u." : "", m->gen_name) < 0 || s == NULL) 100 99 errx(1, "malloc"); 101 100 if(m->optional) … … 129 128 130 129 fprintf (codefile, "while((%s)->len){\n", name); 131 asprintf (&n, "&(%s)->val[(%s)->len-1]", name, name); 132 if (n == NULL) 130 if (asprintf (&n, "&(%s)->val[(%s)->len-1]", name, name) < 0 || n == NULL) 133 131 errx(1, "malloc"); 134 132 free_type(n, t->subtype, FALSE); … … 144 142 } 145 143 case TGeneralString: 144 free_primitive ("general_string", name); 145 break; 146 case TTeletexString: 146 147 free_primitive ("general_string", name); 147 148 break; … … 178 179 generate_type_free (const Symbol *s) 179 180 { 180 int preserve = preserve_type(s->name) ? TRUE : FALSE; 181 182 fprintf (headerfile, 183 "void free_%s (%s *);\n", 184 s->gen_name, s->gen_name); 185 186 fprintf (codefile, "void\n" 187 "free_%s(%s *data)\n" 188 "{\n", 189 s->gen_name, s->gen_name); 190 191 free_type ("data", s->type, preserve); 192 fprintf (codefile, "}\n\n"); 181 int preserve = preserve_type(s->name) ? TRUE : FALSE; 182 183 fprintf (codefile, "void ASN1CALL\n" 184 "free_%s(%s *data)\n" 185 "{\n", 186 s->gen_name, s->gen_name); 187 188 free_type ("data", s->type, preserve); 189 fprintf (codefile, "}\n\n"); 193 190 } 194 191 -
trunk/server/source4/heimdal/lib/asn1/gen_glue.c
r414 r745 3 3 * (Royal Institute of Technology, Stockholm, Sweden). 4 4 * All rights reserved. 5 * 6 * Portions Copyright (c) 2009 Apple Inc. All rights reserved. 5 7 * 6 8 * Redistribution and use in source and binary forms, with or without … … 71 73 "%s int2%s(unsigned n)\n" 72 74 "{\n" 73 "\t%s flags;\n\n", 75 "\t%s flags;\n\n" 76 "\tmemset(&flags, 0, sizeof(flags));\n\n", 74 77 gen_name, gen_name, gen_name); 75 78 … … 93 96 Member *m; 94 97 95 fprintf (headerfile, 96 "const struct units * asn1_%s_units(void);", 97 gen_name); 98 if (template_flag) { 99 fprintf (headerfile, 100 "extern const struct units *asn1_%s_table_units;\n", 101 gen_name); 102 fprintf (headerfile, "#define asn1_%s_units() (asn1_%s_table_units)\n", 103 gen_name, gen_name); 104 } else { 105 fprintf (headerfile, 106 "const struct units * asn1_%s_units(void);\n", 107 gen_name); 108 } 98 109 99 110 fprintf (codefile, … … 112 123 "};\n\n"); 113 124 114 fprintf (codefile, 115 "const struct units * asn1_%s_units(void){\n" 116 "return %s_units;\n" 117 "}\n\n", 118 gen_name, gen_name); 125 if (template_flag) 126 fprintf (codefile, 127 "const struct units * asn1_%s_table_units = %s_units;\n", 128 gen_name, gen_name); 129 else 130 fprintf (codefile, 131 "const struct units * asn1_%s_units(void){\n" 132 "return %s_units;\n" 133 "}\n\n", 134 gen_name, gen_name); 119 135 120 136 -
trunk/server/source4/heimdal/lib/asn1/gen_length.c
r414 r745 44 44 } 45 45 46 /* XXX same as der_length_tag */ 46 47 static size_t 47 48 length_tag(unsigned int tag) … … 149 150 fprintf(codefile, "case %s:\n", m->label); 150 151 151 asprintf (&s, "%s(%s)->%s%s", 152 m->optional ? "" : "&", name, 153 t->type == TChoice ? "u." : "", m->gen_name); 154 if (s == NULL) 152 if (asprintf (&s, "%s(%s)->%s%s", 153 m->optional ? "" : "&", name, 154 t->type == TChoice ? "u." : "", m->gen_name) < 0 || s == NULL) 155 155 errx(1, "malloc"); 156 156 if (m->optional) … … 183 183 case TSetOf: 184 184 case TSequenceOf: { 185 char *n ;186 char *sname ;185 char *n = NULL; 186 char *sname = NULL; 187 187 188 188 fprintf (codefile, 189 189 "{\n" 190 " int %s_oldret = %s;\n"190 "size_t %s_oldret = %s;\n" 191 191 "int i;\n" 192 192 "%s = 0;\n", … … 194 194 195 195 fprintf (codefile, "for(i = (%s)->len - 1; i >= 0; --i){\n", name); 196 fprintf (codefile, " int %s_for_oldret = %s;\n"196 fprintf (codefile, "size_t %s_for_oldret = %s;\n" 197 197 "%s = 0;\n", tmpstr, variable, variable); 198 asprintf (&n, "&(%s)->val[i]", name); 199 if (n == NULL) 198 if (asprintf (&n, "&(%s)->val[i]", name) < 0 || n == NULL) 200 199 errx(1, "malloc"); 201 asprintf (&sname, "%s_S_Of", tmpstr); 202 if (sname == NULL) 200 if (asprintf (&sname, "%s_S_Of", tmpstr) < 0 || sname == NULL) 203 201 errx(1, "malloc"); 204 202 length_type(n, t->subtype, variable, sname); … … 220 218 length_primitive ("general_string", name, variable); 221 219 break; 220 case TTeletexString: 221 length_primitive ("general_string", name, variable); 222 break; 222 223 case TUTCTime: 223 224 length_primitive ("utctime", name, variable); … … 245 246 break; 246 247 case TTag:{ 247 char *tname; 248 asprintf(&tname, "%s_tag", tmpstr); 249 if (tname == NULL) 248 char *tname = NULL; 249 if (asprintf(&tname, "%s_tag", tmpstr) < 0 || tname == NULL) 250 250 errx(1, "malloc"); 251 251 length_type (name, t->subtype, variable, tname); … … 267 267 generate_type_length (const Symbol *s) 268 268 { 269 fprintf (headerfile,270 "size_t length_%s(const %s *);\n",271 s->gen_name, s->gen_name);272 273 269 fprintf (codefile, 274 "size_t \n"270 "size_t ASN1CALL\n" 275 271 "length_%s(const %s *data)\n" 276 272 "{\n" -
trunk/server/source4/heimdal/lib/asn1/gen_locl.h
r414 r745 53 53 #include "asn1-common.h" 54 54 #include "der.h" 55 #include "der-private.h" 55 56 56 57 void generate_type (const Symbol *); … … 75 76 void close_generate(void); 76 77 void add_import(const char *); 78 void add_export(const char *); 79 int is_export(const char *); 77 80 int yyparse(void); 81 int is_primitive_type(int); 78 82 79 83 int preserve_type(const char *); … … 83 87 void close_codefile(void); 84 88 89 int is_template_compat (const Symbol *); 90 void generate_template(const Symbol *); 91 void gen_template_import(const Symbol *); 85 92 86 extern FILE *headerfile, *codefile, *logfile; 93 94 extern FILE *privheaderfile, *headerfile, *codefile, *logfile, *templatefile; 87 95 extern int support_ber; 96 extern int template_flag; 88 97 extern int rfc1510_bitstring; 89 98 extern int one_code_file; -
trunk/server/source4/heimdal/lib/asn1/gen_seq.c
r414 r745 48 48 type = type->subtype; 49 49 50 if (type->type != TSequenceOf ) {51 printf("%s not seq of %d\n", s->name, (int)type->type);50 if (type->type != TSequenceOf && type->type != TSetOf) { 51 fprintf(stderr, "%s not seq of %d\n", s->name, (int)type->type); 52 52 return; 53 53 } … … 68 68 69 69 fprintf (headerfile, 70 " intadd_%s (%s *, const %s *);\n"71 " intremove_%s (%s *, unsigned int);\n",70 "ASN1EXP int ASN1CALL add_%s (%s *, const %s *);\n" 71 "ASN1EXP int ASN1CALL remove_%s (%s *, unsigned int);\n", 72 72 s->gen_name, s->gen_name, subname, 73 73 s->gen_name, s->gen_name); 74 74 75 fprintf (codefile, "int \n"75 fprintf (codefile, "int ASN1CALL\n" 76 76 "add_%s(%s *data, const %s *element)\n" 77 77 "{\n", … … 94 94 fprintf (codefile, "}\n\n"); 95 95 96 fprintf (codefile, "int \n"96 fprintf (codefile, "int ASN1CALL\n" 97 97 "remove_%s(%s *data, unsigned int element)\n" 98 98 "{\n", -
trunk/server/source4/heimdal/lib/asn1/krb5.asn1
r414 r745 3 3 KERBEROS5 DEFINITIONS ::= 4 4 BEGIN 5 EXPORTS 6 AD-AND-OR, 7 AD-IF-RELEVANT, 8 AD-KDCIssued, 9 AD-LoginAlias, 10 AP-REP, 11 AP-REQ, 12 AS-REP, 13 AS-REQ, 14 AUTHDATA-TYPE, 15 Authenticator, 16 AuthorizationData, 17 AuthorizationDataElement, 18 CKSUMTYPE, 19 ChangePasswdDataMS, 20 Checksum, 21 ENCTYPE, 22 ETYPE-INFO, 23 ETYPE-INFO-ENTRY, 24 ETYPE-INFO2, 25 ETYPE-INFO2-ENTRY, 26 EncAPRepPart, 27 EncASRepPart, 28 EncKDCRepPart, 29 EncKrbCredPart, 30 EncKrbPrivPart, 31 EncTGSRepPart, 32 EncTicketPart, 33 EncryptedData, 34 EncryptionKey, 35 EtypeList, 36 HostAddress, 37 HostAddresses, 38 KDC-REQ-BODY, 39 KDCOptions, 40 KDC-REP, 41 KRB-CRED, 42 KRB-ERROR, 43 KRB-PRIV, 44 KRB-SAFE, 45 KRB-SAFE-BODY, 46 KRB5SignedPath, 47 KRB5SignedPathData, 48 KRB5SignedPathPrincipals, 49 KerberosString, 50 KerberosTime, 51 KrbCredInfo, 52 LR-TYPE, 53 LastReq, 54 METHOD-DATA, 55 NAME-TYPE, 56 PA-ClientCanonicalized, 57 PA-ClientCanonicalizedNames, 58 PA-DATA, 59 PA-ENC-TS-ENC, 60 PA-PAC-REQUEST, 61 PA-S4U2Self, 62 PA-SERVER-REFERRAL-DATA, 63 PA-ServerReferralData, 64 PA-SvrReferralData, 65 PADATA-TYPE, 66 Principal, 67 PrincipalName, 68 Principals, 69 Realm, 70 TGS-REP, 71 TGS-REQ, 72 Ticket, 73 TicketFlags, 74 TransitedEncoding, 75 TypedData 76 ; 5 77 6 78 NAME-TYPE ::= INTEGER { … … 101 173 KRB5-PADATA-PKINIT-KX(147), -- krb-wg-anon 102 174 KRB5-PADATA-PKU2U-NAME(148), -- zhu-pku2u 175 KRB5-PADATA-REQ-ENC-PA-REP(149), -- 103 176 KRB5-PADATA-SUPPORTED-ETYPES(165) -- MS-KILE 104 177 } … … 119 192 KRB5-AUTHDATA-WIN2K-PAC(128), 120 193 KRB5-AUTHDATA-GSS-API-ETYPE-NEGOTIATION(129), -- Authenticator only 121 KRB5-AUTHDATA-SIGNTICKET-OLD(-17), 122 KRB5-AUTHDATA-SIGNTICKET(142) 194 KRB5-AUTHDATA-SIGNTICKET-OLDER(-17), 195 KRB5-AUTHDATA-SIGNTICKET-OLD(142), 196 KRB5-AUTHDATA-SIGNTICKET(512) 123 197 } 124 198 … … 246 320 transited-policy-checked(12), 247 321 ok-as-delegate(13), 248 anonymous(14) 322 anonymous(14), 323 enc-pa-rep(15) 249 324 } 250 325 … … 257 332 allow-postdate(5), 258 333 postdated(6), 259 unused7(7),260 334 renewable(8), 261 unused9(9),262 unused10(10),263 unused11(11),264 335 request-anonymous(14), 265 336 canonicalize(15), … … 646 717 -- never encoded on the wire, just used to checksum over 647 718 KRB5SignedPathData ::= SEQUENCE { 648 encticket[0] EncTicketPart, 649 delegated[1] Principals OPTIONAL 719 client[0] Principal OPTIONAL, 720 authtime[1] KerberosTime, 721 delegated[2] Principals OPTIONAL, 722 method_data[3] METHOD-DATA OPTIONAL 650 723 } 651 724 … … 656 729 cksum[1] Checksum, 657 730 -- srvs delegated though 658 delegated[2] Principals OPTIONAL 731 delegated[2] Principals OPTIONAL, 732 method_data[3] METHOD-DATA OPTIONAL 659 733 } 660 734 -
trunk/server/source4/heimdal/lib/asn1/lex.c
r414 r745 1 1 #include "config.h" 2 2 3 #line 3 " heimdal/lib/asn1/lex.c"3 #line 3 "lex.c" 4 4 5 5 #define YY_INT_ALIGNED short int … … 10 10 #define YY_FLEX_MAJOR_VERSION 2 11 11 #define YY_FLEX_MINOR_VERSION 5 12 #define YY_FLEX_SUBMINOR_VERSION 3 412 #define YY_FLEX_SUBMINOR_VERSION 35 13 13 #if YY_FLEX_SUBMINOR_VERSION > 0 14 14 #define FLEX_BETA … … 55 55 typedef unsigned short int flex_uint16_t; 56 56 typedef unsigned int flex_uint32_t; 57 #endif /* ! C99 */58 57 59 58 /* Limits of integral types. */ … … 85 84 #define UINT32_MAX (4294967295U) 86 85 #endif 86 87 #endif /* ! C99 */ 87 88 88 89 #endif /* ! FLEXINT_H */ … … 142 143 /* Size of default input buffer. */ 143 144 #ifndef YY_BUF_SIZE 145 #ifdef __ia64__ 146 /* On IA-64, the buffer size is 16k, not 8k. 147 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. 148 * Ditto for the __ia64__ case accordingly. 149 */ 150 #define YY_BUF_SIZE 32768 151 #else 144 152 #define YY_BUF_SIZE 16384 153 #endif /* __ia64__ */ 145 154 #endif 146 155 … … 179 188 180 189 #define unput(c) yyunput( c, (yytext_ptr) ) 181 182 /* The following is because we cannot portably get our hands on size_t183 * (without autoconf's help, which isn't available because we want184 * flex-generated scanners to compile on their own).185 * Given that the standard has decreed that size_t exists since 1989,186 * I guess we can afford to depend on it. Manoj.187 */188 190 189 191 #ifndef YY_TYPEDEF_YY_SIZE_T … … 856 858 857 859 /* This is for broken old lexes (solaris 10 and hpux) */ 858 #line 8 58 "heimdal/lib/asn1/lex.c"860 #line 860 "lex.c" 859 861 860 862 #define INITIAL 0 … … 873 875 874 876 static int yy_init_globals (void ); 877 878 /* Accessor methods to globals. 879 These are made visible to non-reentrant scanners for convenience. */ 880 881 int yylex_destroy (void ); 882 883 int yyget_debug (void ); 884 885 void yyset_debug (int debug_flag ); 886 887 YY_EXTRA_TYPE yyget_extra (void ); 888 889 void yyset_extra (YY_EXTRA_TYPE user_defined ); 890 891 FILE *yyget_in (void ); 892 893 void yyset_in (FILE * in_str ); 894 895 FILE *yyget_out (void ); 896 897 void yyset_out (FILE * out_str ); 898 899 int yyget_leng (void ); 900 901 char *yyget_text (void ); 902 903 int yyget_lineno (void ); 904 905 void yyset_lineno (int line_number ); 875 906 876 907 /* Macros after this point can all be overridden by user definitions in … … 908 939 /* Amount of stuff to slurp up with each read. */ 909 940 #ifndef YY_READ_BUF_SIZE 941 #ifdef __ia64__ 942 /* On IA-64, the buffer size is 16k, not 8k */ 943 #define YY_READ_BUF_SIZE 16384 944 #else 910 945 #define YY_READ_BUF_SIZE 8192 946 #endif /* __ia64__ */ 911 947 #endif 912 948 … … 916 952 * we now use fwrite(). 917 953 */ 918 #define ECHO fwrite( yytext, yyleng, 1, yyout)954 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) 919 955 #endif 920 956 … … 927 963 { \ 928 964 int c = '*'; \ 929 int n; \965 size_t n; \ 930 966 for ( n = 0; n < max_size && \ 931 967 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ … … 1011 1047 #line 68 "lex.l" 1012 1048 1013 #line 10 13 "heimdal/lib/asn1/lex.c"1049 #line 1049 "lex.c" 1014 1050 1015 1051 if ( !(yy_init) ) … … 1636 1672 &e, 0); 1637 1673 if(e == y) 1638 error_message("malformed constant (%s)", yytext);1674 lex_error_message("malformed constant (%s)", yytext); 1639 1675 else 1640 1676 return NUMBER; … … 1673 1709 YY_RULE_SETUP 1674 1710 #line 273 "lex.l" 1675 { error_message("Ignoring char(%c)\n", *yytext); }1711 { lex_error_message("Ignoring char(%c)\n", *yytext); } 1676 1712 YY_BREAK 1677 1713 case 95: … … 1680 1716 ECHO; 1681 1717 YY_BREAK 1682 #line 1 682 "heimdal/lib/asn1/lex.c"1718 #line 1718 "lex.c" 1683 1719 case YY_STATE_EOF(INITIAL): 1684 1720 yyterminate(); … … 2438 2474 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will 2439 2475 * scan from a @e copy of @a bytes. 2440 * @param bytes the byte buffer to scan2441 * @param len the number of bytes in the buffer pointed to by @a bytes.2476 * @param yybytes the byte buffer to scan 2477 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. 2442 2478 * 2443 2479 * @return the newly allocated buffer state object. … … 2691 2727 2692 2728 void 2693 error_message (const char *format, ...)2729 lex_error_message (const char *format, ...) 2694 2730 { 2695 2731 va_list args; … … 2705 2741 unterminated(const char *type, unsigned start_lineno) 2706 2742 { 2707 error_message("unterminated %s, possibly started on line %d\n", type, start_lineno);2708 } 2709 2743 lex_error_message("unterminated %s, possibly started on line %d\n", type, start_lineno); 2744 } 2745 -
trunk/server/source4/heimdal/lib/asn1/lex.h
r414 r745 36 36 #include <roken.h> 37 37 38 void error_message (const char *, ...)38 void lex_error_message (const char *, ...) 39 39 __attribute__ ((format (printf, 1, 2))); 40 40 extern int error_flag; -
trunk/server/source4/heimdal/lib/asn1/lex.l
r414 r745 259 259 &e, 0); 260 260 if(e == y) 261 error_message("malformed constant (%s)", yytext);261 lex_error_message("malformed constant (%s)", yytext); 262 262 else 263 263 return NUMBER; … … 271 271 \.\.\. { return ELLIPSIS; } 272 272 \.\. { return RANGE; } 273 . { error_message("Ignoring char(%c)\n", *yytext); }273 . { lex_error_message("Ignoring char(%c)\n", *yytext); } 274 274 %% 275 275 … … 283 283 284 284 void 285 error_message (const char *format, ...)285 lex_error_message (const char *format, ...) 286 286 { 287 287 va_list args; … … 297 297 unterminated(const char *type, unsigned start_lineno) 298 298 { 299 error_message("unterminated %s, possibly started on line %d\n", type, start_lineno);299 lex_error_message("unterminated %s, possibly started on line %d\n", type, start_lineno); 300 300 } -
trunk/server/source4/heimdal/lib/asn1/main.c
r414 r745 64 64 65 65 int support_ber; 66 int template_flag; 66 67 int rfc1510_bitstring; 67 68 int one_code_file; … … 70 71 int help_flag; 71 72 struct getargs args[] = { 73 { "template", 0, arg_flag, &template_flag }, 72 74 { "encode-rfc1510-bit-string", 0, arg_flag, &rfc1510_bitstring }, 73 75 { "decode-dce-ber", 0, arg_flag, &support_ber }, -
trunk/server/source4/heimdal/lib/asn1/rfc2459.asn1
r414 r745 52 52 id-secsig-sha-1 OBJECT IDENTIFIER ::= { iso(1) identified-organization(3) 53 53 oiw(14) secsig(3) algorithm(2) 26 } 54 55 id-secsig-sha-1WithRSAEncryption OBJECT IDENTIFIER ::= { iso(1) identified-organization(3) 56 oiw(14) secsig(3) algorithm(2) 29 } 54 57 55 58 id-nistAlgorithm OBJECT IDENTIFIER ::= { … … 151 154 AttributeValue ::= heim_any 152 155 153 TeletexStringx ::= [UNIVERSAL 20] IMPLICIT OCTET STRING154 155 156 DirectoryString ::= CHOICE { 156 157 ia5String IA5String, 157 teletexString TeletexString x,158 teletexString TeletexString, 158 159 printableString PrintableString, 159 160 universalString UniversalString, … … 242 243 j INTEGER OPTIONAL, -- subgroup factor 243 244 validationParms ValidationParms OPTIONAL -- ValidationParms 245 } 246 247 -- As defined by PKCS3 248 DHParameter ::= SEQUENCE { 249 prime INTEGER, -- odd prime, p=jq +1 250 base INTEGER, -- generator, g 251 privateValueLength INTEGER OPTIONAL 244 252 } 245 253 -
trunk/server/source4/heimdal/lib/asn1/symbol.c
r414 r745 35 35 #include "lex.h" 36 36 37 RCSID("$Id$");38 39 37 static Hashtab *htab; 40 38 … … 69 67 70 68 for (p = s; *p; ++p) 71 if (*p == '-' )69 if (*p == '-' || *p == '.') 72 70 *p = '_'; 73 71 } … … 96 94 Symbol *s = ptr; 97 95 if (s->stype == SUndefined) { 98 error_message("%s is still undefined\n", s->name);96 lex_error_message("%s is still undefined\n", s->name); 99 97 *(int *) arg = 1; 100 98 } -
trunk/server/source4/heimdal/lib/asn1/symbol.h
r414 r745 45 45 TEnumerated, 46 46 TGeneralString, 47 TTeletexString, 47 48 TGeneralizedTime, 48 49 TIA5String, -
trunk/server/source4/heimdal/lib/asn1/test.asn1
r414 r745 7 7 IMPORTS heim_any FROM heim; 8 8 9 TESTuint32 ::= INTEGER (0..4294967295) 10 9 11 TESTLargeTag ::= SEQUENCE { 10 foo[127] INTEGER (-2147483648..2147483647) 12 foo[127] INTEGER (-2147483648..2147483647), 13 bar[128] INTEGER (-2147483648..2147483647) 11 14 } 12 15 … … 58 61 } 59 62 63 TESTOptional ::= SEQUENCE { 64 zero [0] INTEGER (-2147483648..2147483647) OPTIONAL, 65 one [1] INTEGER (-2147483648..2147483647) OPTIONAL 66 } 67 60 68 61 69 TESTCONTAINING ::= OCTET STRING ( CONTAINING INTEGER ) … … 93 101 TESTOSSize1 ::= OCTET STRING SIZE (1..2) 94 102 103 TESTSeqOfSeq ::= SEQUENCE OF SEQUENCE { 104 zero [0] TESTInteger 105 } 106 107 TESTSeqOfSeq2 ::= SEQUENCE OF SEQUENCE { 108 string [0] GeneralString 109 } 110 111 TESTSeqOfSeq3 ::= SEQUENCE OF SEQUENCE { 112 zero [0] TESTInteger, 113 string [0] GeneralString 114 } 115 116 TESTSeqOf2 ::= SEQUENCE { 117 strings SEQUENCE OF GeneralString 118 } 119 120 TESTSeqOf3 ::= SEQUENCE { 121 strings SEQUENCE OF GeneralString OPTIONAL 122 } 123 124 TESTPreserve ::= SEQUENCE { 125 zero [0] TESTInteger, 126 one [1] TESTInteger 127 } 128 129 TESTBitString ::= BIT STRING { 130 zero(0), 131 eight(8), 132 thirtyone(31) 133 } 134 95 135 END -
trunk/server/source4/heimdal/lib/asn1/timegm.c
r414 r745 43 43 } 44 44 45 static const unsigned ndays[2][12] ={ 46 {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, 47 {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}}; 48 45 49 /* 46 50 * This is a simplifed version of timegm(3) that doesn't accept out of … … 52 56 _der_timegm (struct tm *tm) 53 57 { 54 static const unsigned ndays[2][12] ={55 {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},56 {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}};57 58 time_t res = 0; 58 59 unsigned i; … … 85 86 return res; 86 87 } 88 89 struct tm * 90 _der_gmtime(time_t t, struct tm *tm) 91 { 92 time_t secday = t % (3600 * 24); 93 time_t days = t / (3600 * 24); 94 95 memset(tm, 0, sizeof(*tm)); 96 97 tm->tm_sec = secday % 60; 98 tm->tm_min = (secday % 3600) / 60; 99 tm->tm_hour = secday / 3600; 100 101 tm->tm_year = 70; 102 while(1) { 103 unsigned dayinyear = (is_leap(tm->tm_year) ? 366 : 365); 104 if (days < dayinyear) 105 break; 106 tm->tm_year += 1; 107 days -= dayinyear; 108 } 109 tm->tm_mon = 0; 110 111 while (1) { 112 unsigned daysinmonth = ndays[is_leap(tm->tm_year)][tm->tm_mon]; 113 if (days < daysinmonth) 114 break; 115 days -= daysinmonth; 116 tm->tm_mon++; 117 } 118 tm->tm_mday = days + 1; 119 120 return tm; 121 }
Note:
See TracChangeset
for help on using the changeset viewer.