Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
38 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source4/heimdal/lib/asn1/asn1-common.h

    r414 r745  
    33#include <stddef.h>
    44#include <time.h>
     5#include <krb5-types.h>
    56
    67#ifndef __asn1_common_definitions__
     
    2021typedef char *heim_general_string;
    2122typedef char *heim_utf8_string;
    22 typedef char *heim_printable_string;
    23 typedef char *heim_ia5_string;
     23typedef struct heim_octet_string heim_printable_string;
     24typedef struct heim_octet_string heim_ia5_string;
    2425
    2526typedef struct heim_bmp_string {
     
    6465  } while (0)
    6566
     67#ifdef _WIN32
     68#ifndef ASN1_LIB
     69#define ASN1EXP  __declspec(dllimport)
     70#else
     71#define ASN1EXP
    6672#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  
    2525error_code INDEF_OVERRUN,       "ASN.1 BER indefinte encoding overrun"
    2626error_code INDEF_UNDERRUN,      "ASN.1 BER indefinte encoding underun"
     27error_code GOT_BER,             "ASN.1 got BER encoded when expected DER"
     28error_code INDEF_EXTRA_DATA,    "ASN.1 EoC tag contained data"
    2729end
  • trunk/server/source4/heimdal/lib/asn1/asn1_gen.c

    r414 r745  
    4747{
    4848    char buf[2048];
    49     char *fnout;
     49    char *fnout = NULL;
    5050    const char *bname;
    5151    unsigned long line = 0;
     
    6363        bname = fn;
    6464
    65     asprintf(&fnout, "%s.out", bname);
    66     if (fnout == NULL)
     65    if (asprintf(&fnout, "%s.out", bname) < 0 || fnout == NULL)
    6766        errx(1, "malloc");
    6867
  • 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.  */
    23
    34/* Skeleton implementation for Bison's Yacc-like parsers in C
    4 
    5    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
     5   
     6      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
    67   Free Software Foundation, Inc.
    7 
    8    This program is free software; you can redistribute it and/or modify
     8   
     9   This program is free software: you can redistribute it and/or modify
    910   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   
    1314   This program is distributed in the hope that it will be useful,
    1415   but WITHOUT ANY WARRANTY; without even the implied warranty of
    1516   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1617   GNU General Public License for more details.
    17 
     18   
    1819   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/>.  */
    2221
    2322/* As a special exception, you may create a larger work that contains
     
    3029   Bison output files to be licensed under the GNU General Public
    3130   License without this special exception.
    32 
     31   
    3332   This special exception was added by the Free Software Foundation in
    3433   version 2.2 of Bison.  */
     
    4847
    4948/* Bison version.  */
    50 #define YYBISON_VERSION "2.3"
     49#define YYBISON_VERSION "2.4.1"
    5150
    5251/* Skeleton name.  */
     
    5655#define YYPURE 0
    5756
     57/* Push parsers.  */
     58#define YYPUSH 0
     59
     60/* Pull parsers.  */
     61#define YYPULL 1
     62
    5863/* Using locations.  */
    5964#define YYLSP_NEEDED 0
    6065
     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
     84RCSID("$Id$");
     85
     86static Type *new_type (Typetype t);
     87static struct constraint_spec *new_constraint_spec(enum ctype);
     88static Type *new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype);
     89void yyerror (const char *);
     90static struct objid *new_objid(const char *label, int value);
     91static void add_oid_to_tail(struct objid *, struct objid *);
     92static void fix_labels(Symbol *s);
     93
     94struct 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
    61125
    62126
     
    248312
    249313
    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 YYDEBUG
    283 # define YYDEBUG 0
    284 #endif
    285 
    286 /* Enabling verbose error messages.  */
    287 #ifdef YYERROR_VERBOSE
    288 # undef YYERROR_VERBOSE
    289 # define YYERROR_VERBOSE 1
    290 #else
    291 # define YYERROR_VERBOSE 0
    292 #endif
    293 
    294 /* Enabling the token table.  */
    295 #ifndef YYTOKEN_TABLE
    296 # define YYTOKEN_TABLE 0
    297 #endif
    298 
    299314#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
    300315typedef 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
    303321    int constant;
    304322    struct value *value;
     
    313331    struct memhead *members;
    314332    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
    319340# define yystype YYSTYPE /* obsolescent; will be withdrawn */
    320341# define YYSTYPE_IS_DECLARED 1
    321 # define YYSTYPE_IS_TRIVIAL 1
    322 #endif
    323 
     342#endif
    324343
    325344
     
    327346
    328347
    329 /* Line 216 of yacc.c.  */
    330 #line 331 "heimdal/lib/asn1/asn1parse.y"
     348/* Line 264 of yacc.c  */
     349#line 350 "asn1parse.c"
    331350
    332351#ifdef short
     
    403422     || defined __cplusplus || defined _MSC_VER)
    404423static int
    405 YYID (int i)
     424YYID (int yyi)
    406425#else
    407426static int
    408 YYID (i)
    409     int i;
    410 #endif
    411 {
    412   return i;
     427YYID (yyi)
     428    int yyi;
     429#endif
     430{
     431  return yyi;
    413432}
    414433#endif
     
    491510union yyalloc
    492511{
    493   yytype_int16 yyss;
    494   YYSTYPE yyvs;
    495   };
     512  yytype_int16 yyss_alloc;
     513  YYSTYPE yyvs_alloc;
     514};
    496515
    497516/* The size of the maximum gap between one aligned stack and the next.  */
     
    527546   stack.  Advance YYPTR to a properly aligned location for the next
    528547   stack.  */
    529 # define YYSTACK_RELOCATE(Stack)                                        \
     548# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
    530549    do                                                                  \
    531550      {                                                                 \
    532551        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;                                    \
    535554        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
    536555        yyptr += yynewbytes / sizeof (*yyptr);                          \
     
    543562#define YYFINAL  6
    544563/* YYLAST -- Last index in YYTABLE.  */
    545 #define YYLAST   195
     564#define YYLAST   203
    546565
    547566/* YYNTOKENS -- Number of terminals.  */
    548567#define YYNTOKENS  98
    549568/* YYNNTS -- Number of nonterminals.  */
    550 #define YYNNTS  68
     569#define YYNNTS  69
    551570/* YYNRULES -- Number of rules.  */
    552 #define YYNRULES  136
     571#define YYNRULES  140
    553572/* YYNRULES -- Number of states.  */
    554 #define YYNSTATES  214
     573#define YYNSTATES  220
    555574
    556575/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
     
    607626{
    608627       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
    622642};
    623643
     
    625645static const yytype_int16 yyrhs[] =
    626646{
    627       99,     0,    -1,    86,   151,    21,   100,   101,    84,     8,
     647      99,     0,    -1,    86,   152,    21,   100,   101,    84,     8,
    628648     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
    666687};
    667688
     
    669690static const yytype_uint16 yyrline[] =
    670691{
    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
    685707};
    686708#endif
     
    714736  "$accept", "ModuleDefinition", "TagDefault", "ExtensionDefault",
    715737  "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",
    729752  "CharacterStringValue", "BooleanValue", "IntegerValue", "SignedNumber",
    730753  "NullValue", "ObjectIdentifierValue", 0
     
    755778       0,    98,    99,   100,   100,   100,   100,   101,   101,   102,
    756779     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
    769793};
    770794
     
    772796static const yytype_uint8 yyr2[] =
    773797{
    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,
    777801       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,
    786811       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
    787        1,     1,     1,     1,     1,     1,     1
     812       1
    788813};
    789814
     
    793818static const yytype_uint8 yydefact[] =
    794819{
    795        0,   113,     0,   115,     0,   112,     1,   118,   119,     0,
    796      115,     6,     0,   114,   116,     0,     0,     0,     8,     0,
    797        5,     3,     4,     0,     0,   117,     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       39,    40,    31,    26,    70,    71,    27,    41,    90,    30,
    804       94,    19,    22,   113,    56,     0,     0,     0,     0,    48,
    805       58,    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      128,   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,    82
     820       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
    817842};
    818843
     
    820845static const yytype_int16 yydefgoto[] =
    821846{
    822       -1,     2,    18,    24,    30,    31,    33,    34,    35,    39,
    823       40,    36,    41,    69,    70,    71,    99,    72,   125,   126,
    824       73,   127,    74,    75,    76,    77,   104,    78,    79,    80,
    825       81,    82,    83,    84,    85,    86,   114,   161,   162,   163,
    826      164,    87,    88,   111,   117,    42,    89,    90,   121,   122,
    827      123,   167,   168,     4,   135,     9,    10,   136,   137,   138,
    828      139,   140,   141,   142,   143,   144,   145,   146
     847      -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
    829854};
    830855
    831856/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    832857   STATE-NUM.  */
    833 #define YYPACT_NINF -113
     858#define YYPACT_NINF -119
    834859static const yytype_int16 yypact[] =
    835860{
    836      -74,   -67,    38,   -69,    23,  -113,  -113,   -44,  -113,   -41,
    837      -69,     4,   -26,  -113,  -113,    -3,     1,    10,    52,   -10,
    838     -113,  -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     -113,  -113,  -113,  -113,  -113,  -113,  -113,  -113,  -113,  -113,
    844     -113,  -113,  -113,  -113,  -113,  -113,  -113,  -113,   -17,  -113,
    845     -113,  -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     -113,  -113,  -113,  -113,  -113,  -113,  -113,   -63,  -113,  -113,
    851     -113,   -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,  -113
     861     -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
    858883};
    859884
     
    861886static const yytype_int16 yypgoto[] =
    862887{
    863     -113,  -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     -113,  -113,  -113,  -113,  -113,  -113,  -113,  -113,  -113,  -113,
    867     -113,  -113,  -113,  -113,  -113,  -113,  -113,  -113,   -60,  -113,
    868       22,  -113,    -5,    97,     2,   184,  -113,  -112,  -113,  -113,
    869     -113,  -113,  -113,  -113,  -113,    21,  -113,  -113
     888    -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
    870895};
    871896
     
    874899   number is the opposite.  If zero, do what YYDEFACT says.
    875900   If YYTABLE_NINF, syntax error.  */
    876 #define YYTABLE_NINF -13
     901#define YYTABLE_NINF -11
    877902static const yytype_int16 yytable[] =
    878903{
    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
    899925};
    900926
    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
     927static 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
    923950};
    924951
     
    927954static const yytype_uint8 yystos[] =
    928955{
    929        0,    86,    99,    94,   151,   152,     0,    86,    89,   153,
    930      154,    21,    92,    95,   153,     7,    27,    38,   100,    89,
    931       70,    70,    70,    29,   101,    93,    39,    84,     8,    40,
    932      102,   103,    86,   104,   105,   106,   109,    24,    86,   107,
    933      108,   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      127,   128,   129,   130,   131,   132,   133,   139,   140,   144,
    938      145,   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       95,    95,   111,    95,    97,    12,   111,    12,    93,    92,
    948       91,    95,    85,   148,   155,   163,    85,   117,   155,    46,
    949      155,    94,    23,   155,    89,   150,    93,    93,    93,    93,
    950       95,    12,    93,   155
     956       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
    951978};
    952979
     
    11331160     || defined __cplusplus || defined _MSC_VER)
    11341161static void
    1135 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
     1162yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
    11361163#else
    11371164static void
    1138 yy_stack_print (bottom, top)
    1139     yytype_int16 *bottom;
    1140     yytype_int16 *top;
     1165yy_stack_print (yybottom, yytop)
     1166    yytype_int16 *yybottom;
     1167    yytype_int16 *yytop;
    11411168#endif
    11421169{
    11431170  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    }
    11461176  YYFPRINTF (stderr, "\n");
    11471177}
     
    11771207  for (yyi = 0; yyi < yynrhs; yyi++)
    11781208    {
    1179       fprintf (stderr, "   $%d = ", yyi + 1);
     1209      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
    11801210      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
    11811211                       &(yyvsp[(yyi + 1) - (yynrhs)])
    11821212                                       );
    1183       fprintf (stderr, "\n");
     1213      YYFPRINTF (stderr, "\n");
    11841214    }
    11851215}
     
    14641494}
    14651495
    1466 
    1467 
    14681496/* Prevent warnings from -Wmissing-prototypes.  */
    1469 
    14701497#ifdef YYPARSE_PARAM
    14711498#if defined __STDC__ || defined __cplusplus
     
    14831510
    14841511
    1485 
    1486 /* The look-ahead symbol.  */
     1512/* The lookahead symbol.  */
    14871513int yychar;
    14881514
    1489 /* The semantic value of the look-ahead symbol.  */
     1515/* The semantic value of the lookahead symbol.  */
    14901516YYSTYPE yylval;
    14911517
     
    14951521
    14961522
    1497 /*----------.
    1498 | yyparse.  |
    1499 `----------*/
     1523/*-------------------------.
     1524| yyparse or yypush_parse.  |
     1525`-------------------------*/
    15001526
    15011527#ifdef YYPARSE_PARAM
     
    15211547#endif
    15221548{
    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
    15251574  int yyn;
    15261575  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
    15311582#if YYERROR_VERBOSE
    15321583  /* Buffer for error messages, and its allocated size.  */
     
    15361587#endif
    15371588
    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 yyoverflow
    1544      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 
    15581589#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 the
    1563      action routines.  */
    1564   YYSTYPE yyval;
    1565 
    15661590
    15671591  /* The number of symbols on the RHS of the reduced rule.
     
    15691593  int yylen = 0;
    15701594
     1595  yytoken = 0;
     1596  yyss = yyssa;
     1597  yyvs = yyvsa;
     1598  yystacksize = YYINITDEPTH;
     1599
    15711600  YYDPRINTF ((stderr, "Starting parse\n"));
    15721601
     
    15741603  yyerrstatus = 0;
    15751604  yynerrs = 0;
    1576   yychar = YYEMPTY;             /* Cause a token to be read.  */
     1605  yychar = YYEMPTY; /* Cause a token to be read.  */
    15771606
    15781607  /* Initialize stack pointers.
     
    15801609     so that they stay on the same level as the state stack.
    15811610     The wasted elements are never initialized.  */
    1582 
    15831611  yyssp = yyss;
    15841612  yyvsp = yyvs;
     
    16101638        yytype_int16 *yyss1 = yyss;
    16111639
    1612 
    16131640        /* Each stack pointer address is followed by the size of the
    16141641           data in use in that stack, in bytes.  This used to be a
     
    16181645                    &yyss1, yysize * sizeof (*yyssp),
    16191646                    &yyvs1, yysize * sizeof (*yyvsp),
    1620 
    16211647                    &yystacksize);
    16221648
     
    16411667        if (! yyptr)
    16421668          goto yyexhaustedlab;
    1643         YYSTACK_RELOCATE (yyss);
    1644         YYSTACK_RELOCATE (yyvs);
    1645 
     1669        YYSTACK_RELOCATE (yyss_alloc, yyss);
     1670        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
    16461671#  undef YYSTACK_RELOCATE
    16471672        if (yyss1 != yyssa)
     
    16541679      yyvsp = yyvs + yysize - 1;
    16551680
    1656 
    16571681      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
    16581682                  (unsigned long int) yystacksize));
     
    16631687
    16641688  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
     1689
     1690  if (yystate == YYFINAL)
     1691    YYACCEPT;
    16651692
    16661693  goto yybackup;
     
    16721699
    16731700  /* 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.  */
    16771704  yyn = yypact[yystate];
    16781705  if (yyn == YYPACT_NINF)
    16791706    goto yydefault;
    16801707
    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.  */
    16841711  if (yychar == YYEMPTY)
    16851712    {
     
    17131740    }
    17141741
    1715   if (yyn == YYFINAL)
    1716     YYACCEPT;
    1717 
    17181742  /* Count tokens shifted since error; after three, turn off error
    17191743     status.  */
     
    17211745    yyerrstatus--;
    17221746
    1723   /* Shift the look-ahead token.  */
     1747  /* Shift the lookahead token.  */
    17241748  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
    17251749
    1726   /* Discard the shifted token unless it is eof.  */
    1727   if (yychar != YYEOF)
    1728     yychar = YYEMPTY;
     1750  /* Discard the shifted token.  */
     1751  yychar = YYEMPTY;
    17291752
    17301753  yystate = yyn;
     
    17661789    {
    17671790        case 2:
    1768 #line 235 "heimdal/lib/asn1/asn1parse.y"
     1791
     1792/* Line 1455 of yacc.c  */
     1793#line 241 "asn1parse.c"
    17691794    {
    17701795                        checkundefined();
     
    17731798
    17741799  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"); }
    17771804    break;
    17781805
    17791806  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"); }
    17821811    break;
    17831812
    17841813  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"); }
    17871818    break;
    17881819
    17891820  case 17:
    1790 #line 270 "heimdal/lib/asn1/asn1parse.y"
     1821
     1822/* Line 1455 of yacc.c  */
     1823#line 276 "asn1parse.c"
    17911824    {
    17921825                    struct string_list *sl;
     
    17941827                        Symbol *s = addsym(sl->string);
    17951828                        s->stype = Stype;
     1829                        gen_template_import(s);
    17961830                    }
    17971831                    add_import((yyvsp[(3) - (4)].name));
     
    17991833    break;
    18001834
    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"
    18031850    {
    18041851                    (yyval.sl) = emalloc(sizeof(*(yyval.sl)));
     
    18081855    break;
    18091856
    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"
    18121861    {
    18131862                    (yyval.sl) = emalloc(sizeof(*(yyval.sl)));
     
    18171866    break;
    18181867
    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"
    18211872    {
    18221873                    Symbol *s = addsym ((yyvsp[(1) - (3)].name));
     
    18281879    break;
    18291880
    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"
    18321885    {
    18331886                        (yyval.type) = new_tag(ASN1_C_UNIV, UT_Boolean,
     
    18361889    break;
    18371890
    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"
    18401895    {
    18411896                    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");
    18431898                    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");
    18451900                    (yyval.range) = ecalloc(1, sizeof(*(yyval.range)));
    18461901                    (yyval.range)->min = (yyvsp[(2) - (5)].value)->u.integervalue;
     
    18491904    break;
    18501905
    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"
    18531910    {   
    18541911                    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");
    18561913                    (yyval.range) = ecalloc(1, sizeof(*(yyval.range)));
    18571914                    (yyval.range)->min = (yyvsp[(2) - (5)].value)->u.integervalue;
     
    18601917    break;
    18611918
    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"
    18641923    {   
    18651924                    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");
    18671926                    (yyval.range) = ecalloc(1, sizeof(*(yyval.range)));
    18681927                    (yyval.range)->min = (yyvsp[(4) - (5)].value)->u.integervalue + 2;
     
    18711930    break;
    18721931
    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"
    18751936    {
    18761937                    if((yyvsp[(2) - (3)].value)->type != integervalue)
    1877                         error_message("Non-integer used in limit");
     1938                        lex_error_message("Non-integer used in limit");
    18781939                    (yyval.range) = ecalloc(1, sizeof(*(yyval.range)));
    18791940                    (yyval.range)->min = (yyvsp[(2) - (3)].value)->u.integervalue;
     
    18821943    break;
    18831944
    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"
    18861949    {
    18871950                        (yyval.type) = new_tag(ASN1_C_UNIV, UT_Integer,
     
    18901953    break;
    18911954
    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"
    18941959    {
    18951960                        (yyval.type) = new_type(TInteger);
     
    18991964    break;
    19001965
    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"
    19031970    {
    19041971                  (yyval.type) = new_type(TInteger);
     
    19081975    break;
    19091976
    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"
    19121981    {
    19131982                        (yyval.members) = emalloc(sizeof(*(yyval.members)));
     
    19171986    break;
    19181987
    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"
    19211992    {
    19221993                        ASN1_TAILQ_INSERT_TAIL((yyvsp[(1) - (3)].members), (yyvsp[(3) - (3)].member), members);
     
    19251996    break;
    19261997
    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"
    19292002    { (yyval.members) = (yyvsp[(1) - (3)].members); }
    19302003    break;
    19312004
    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"
    19342009    {
    19352010                        (yyval.member) = emalloc(sizeof(*(yyval.member)));
     
    19442019    break;
    19452020
    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"
    19482025    {
    19492026                  (yyval.type) = new_type(TInteger);
     
    19532030    break;
    19542031
    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"
    19572036    {
    19582037                  (yyval.type) = new_type(TBitString);
     
    19632042    break;
    19642043
    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"
    19672048    {
    19682049                  (yyval.type) = new_type(TBitString);
     
    19722053    break;
    19732054
    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"
    19762059    {
    19772060                        (yyval.type) = new_tag(ASN1_C_UNIV, UT_OID,
     
    19802063    break;
    19812064
    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"
    19842069    {
    19852070                    Type *t = new_type(TOctetString);
     
    19902075    break;
    19912076
    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"
    19942081    {
    19952082                        (yyval.type) = new_tag(ASN1_C_UNIV, UT_Null,
     
    19982085    break;
    19992086
    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"
    20022091    { (yyval.range) = NULL; }
    20032092    break;
    20042093
    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"
    20072098    { (yyval.range) = (yyvsp[(2) - (2)].range); }
    20082099    break;
    20092100
    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"
    20122105    {
    20132106                  (yyval.type) = new_type(TSequence);
     
    20172110    break;
    20182111
    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"
    20212116    {
    20222117                  (yyval.type) = new_type(TSequence);
     
    20262121    break;
    20272122
    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"
    20302127    {
    20312128                  (yyval.type) = new_type(TSequenceOf);
     
    20362133    break;
    20372134
    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"
    20402139    {
    20412140                  (yyval.type) = new_type(TSet);
     
    20452144    break;
    20462145
    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"
    20492150    {
    20502151                  (yyval.type) = new_type(TSet);
     
    20542155    break;
    20552156
    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"
    20582161    {
    20592162                  (yyval.type) = new_type(TSetOf);
     
    20632166    break;
    20642167
    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"
    20672172    {
    20682173                  (yyval.type) = new_type(TChoice);
     
    20712176    break;
    20722177
    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"
    20752182    {
    20762183                  Symbol *s = addsym((yyvsp[(1) - (1)].name));
    20772184                  (yyval.type) = new_type(TType);
    20782185                  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));
    20802187                  else
    20812188                    (yyval.type)->symbol = s;
     
    20832190    break;
    20842191
    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"
    20872196    {
    20882197                        (yyval.type) = new_tag(ASN1_C_UNIV, UT_GeneralizedTime,
     
    20912200    break;
    20922201
    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"
    20952206    {
    20962207                        (yyval.type) = new_tag(ASN1_C_UNIV, UT_UTCTime,
     
    20992210    break;
    21002211
    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"
    21032216    {
    21042217                    /* if (Constraint.type == contentConstrant) {
     
    21152228    break;
    21162229
    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"
    21192234    {
    21202235                    (yyval.constraint_spec) = (yyvsp[(2) - (3)].constraint_spec);
     
    21222237    break;
    21232238
    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"
    21262243    {
    21272244                    (yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS);
     
    21312248    break;
    21322249
    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"
    21352254    {
    21362255                    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");
    21382257                    (yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS);
    21392258                    (yyval.constraint_spec)->u.content.type = NULL;
     
    21422261    break;
    21432262
    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"
    21462267    {
    21472268                    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");
    21492270                    (yyval.constraint_spec) = new_constraint_spec(CT_CONTENTS);
    21502271                    (yyval.constraint_spec)->u.content.type = (yyvsp[(2) - (5)].type);
     
    21532274    break;
    21542275
    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"
    21572280    {
    21582281                    (yyval.constraint_spec) = new_constraint_spec(CT_USER);
     
    21602283    break;
    21612284
    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"
    21642289    {
    21652290                        (yyval.type) = new_type(TTag);
     
    21742299    break;
    21752300
    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"
    21782305    {
    21792306                        (yyval.tag).tagclass = (yyvsp[(2) - (4)].constant);
     
    21832310    break;
    21842311
    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"
    21872316    {
    21882317                        (yyval.constant) = ASN1_C_CONTEXT;
     
    21902319    break;
    21912320
    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"
    21942325    {
    21952326                        (yyval.constant) = ASN1_C_UNIV;
     
    21972328    break;
    21982329
    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"
    22012334    {
    22022335                        (yyval.constant) = ASN1_C_APPL;
     
    22042337    break;
    22052338
    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"
    22082343    {
    22092344                        (yyval.constant) = ASN1_C_PRIVATE;
     
    22112346    break;
    22122347
    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"
    22152352    {
    22162353                        (yyval.constant) = TE_EXPLICIT;
     
    22182355    break;
    22192356
    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"
    22222361    {
    22232362                        (yyval.constant) = TE_EXPLICIT;
     
    22252364    break;
    22262365
    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"
    22292370    {
    22302371                        (yyval.constant) = TE_IMPLICIT;
     
    22322373    break;
    22332374
    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"
    22362379    {
    22372380                        Symbol *s;
     
    22442387    break;
    22452388
    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"
    22482393    {
    22492394                        (yyval.type) = new_tag(ASN1_C_UNIV, UT_GeneralString,
     
    22522397    break;
    22532398
    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"
    22562413    {
    22572414                        (yyval.type) = new_tag(ASN1_C_UNIV, UT_UTF8String,
     
    22602417    break;
    22612418
    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"
    22642423    {
    22652424                        (yyval.type) = new_tag(ASN1_C_UNIV, UT_PrintableString,
     
    22682427    break;
    22692428
    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"
    22722433    {
    22732434                        (yyval.type) = new_tag(ASN1_C_UNIV, UT_VisibleString,
     
    22762437    break;
    22772438
    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"
    22802443    {
    22812444                        (yyval.type) = new_tag(ASN1_C_UNIV, UT_IA5String,
     
    22842447    break;
    22852448
    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"
    22882453    {
    22892454                        (yyval.type) = new_tag(ASN1_C_UNIV, UT_BMPString,
     
    22922457    break;
    22932458
    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"
    22962463    {
    22972464                        (yyval.type) = new_tag(ASN1_C_UNIV, UT_UniversalString,
     
    23002467    break;
    23012468
    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"
    23042473    {
    23052474                        (yyval.members) = emalloc(sizeof(*(yyval.members)));
     
    23092478    break;
    23102479
    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"
    23132484    {
    23142485                        ASN1_TAILQ_INSERT_TAIL((yyvsp[(1) - (3)].members), (yyvsp[(3) - (3)].member), members);
     
    23172488    break;
    23182489
    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"
    23212494    {
    23222495                        struct member *m = ecalloc(1, sizeof(*m));
     
    23292502    break;
    23302503
    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"
    23332508    {
    23342509                  (yyval.member) = emalloc(sizeof(*(yyval.member)));
     
    23412516    break;
    23422517
    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"
    23452522    {
    23462523                        (yyval.member) = (yyvsp[(1) - (1)].member);
     
    23502527    break;
    23512528
    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"
    23542533    {
    23552534                        (yyval.member) = (yyvsp[(1) - (2)].member);
     
    23592538    break;
    23602539
    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"
    23632544    {
    23642545                        (yyval.member) = (yyvsp[(1) - (3)].member);
     
    23682549    break;
    23692550
    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"
    23722555    {
    23732556                        (yyval.members) = emalloc(sizeof(*(yyval.members)));
     
    23772560    break;
    23782561
    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"
    23812566    {
    23822567                        ASN1_TAILQ_INSERT_TAIL((yyvsp[(1) - (3)].members), (yyvsp[(3) - (3)].member), members);
     
    23852570    break;
    23862571
    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"
    23892576    {
    23902577                  (yyval.member) = emalloc(sizeof(*(yyval.member)));
     
    23992586    break;
    24002587
    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"
    24032592    { (yyval.objid) = NULL; }
    24042593    break;
    24052594
    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"
    24082599    {
    24092600                        (yyval.objid) = (yyvsp[(2) - (3)].objid);
     
    24112602    break;
    24122603
    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"
    24152608    {
    24162609                        (yyval.objid) = NULL;
     
    24182611    break;
    24192612
    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"
    24222617    {
    24232618                        if ((yyvsp[(2) - (2)].objid)) {
     
    24302625    break;
    24312626
    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"
    24342631    {
    24352632                        (yyval.objid) = new_objid((yyvsp[(1) - (4)].name), (yyvsp[(3) - (4)].constant));
     
    24372634    break;
    24382635
    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"
    24412640    {
    24422641                    Symbol *s = addsym((yyvsp[(1) - (1)].name));
    24432642                    if(s->stype != SValue ||
    24442643                       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",
    24462645                                      s->name);
    24472646                        exit(1);
     
    24512650    break;
    24522651
    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"
    24552656    {
    24562657                    (yyval.objid) = new_objid(NULL, (yyvsp[(1) - (1)].constant));
     
    24582659    break;
    24592660
    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"
    24622665    {
    24632666                        Symbol *s = addsym((yyvsp[(1) - (1)].name));
    24642667                        if(s->stype != SValue)
    2465                                 error_message ("%s is not a value\n",
     2668                                lex_error_message ("%s is not a value\n",
    24662669                                                s->name);
    24672670                        else
     
    24702673    break;
    24712674
    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"
    24742679    {
    24752680                        (yyval.value) = emalloc(sizeof(*(yyval.value)));
     
    24792684    break;
    24802685
    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"
    24832690    {
    24842691                        (yyval.value) = emalloc(sizeof(*(yyval.value)));
     
    24882695    break;
    24892696
    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"
    24922701    {
    24932702                        (yyval.value) = emalloc(sizeof(*(yyval.value)));
     
    24972706    break;
    24982707
    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"
    25012712    {
    25022713                        (yyval.value) = emalloc(sizeof(*(yyval.value)));
     
    25062717    break;
    25072718
    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"
    25162731    {
    25172732                        (yyval.value) = emalloc(sizeof(*(yyval.value)));
     
    25222737
    25232738
    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"
    25262742      default: break;
    25272743    }
     
    25332749
    25342750  *++yyvsp = yyval;
    2535 
    25362751
    25372752  /* Now `shift' the result of the reduction.  Determine what state
     
    25992814  if (yyerrstatus == 3)
    26002815    {
    2601       /* If just tried and failed to reuse look-ahead token after an
     2816      /* If just tried and failed to reuse lookahead token after an
    26022817         error, discard it.  */
    26032818
     
    26162831    }
    26172832
    2618   /* Else will try to reuse look-ahead token after shifting the error
     2833  /* Else will try to reuse lookahead token after shifting the error
    26192834     token.  */
    26202835  goto yyerrlab1;
     
    26732888    }
    26742889
    2675   if (yyn == YYFINAL)
    2676     YYACCEPT;
    2677 
    26782890  *++yyvsp = yylval;
    26792891
     
    27002912  goto yyreturn;
    27012913
    2702 #ifndef yyoverflow
     2914#if !defined(yyoverflow) || YYERROR_VERBOSE
    27032915/*-------------------------------------------------.
    27042916| yyexhaustedlab -- memory exhaustion comes here.  |
     
    27112923
    27122924yyreturn:
    2713   if (yychar != YYEOF && yychar != YYEMPTY)
     2925  if (yychar != YYEMPTY)
    27142926     yydestruct ("Cleanup: discarding lookahead",
    27152927                 yytoken, &yylval);
     
    27372949
    27382950
    2739 #line 922 "heimdal/lib/asn1/asn1parse.y"
     2951
     2952/* Line 1675 of yacc.c  */
     2953#line 944 "asn1parse.c"
    27402954
    27412955
     
    27432957yyerror (const char *s)
    27442958{
    2745      error_message ("%s\n", s);
     2959     lex_error_message ("%s\n", s);
    27462960}
    27472961
     
    28083022        return;
    28093023    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");
    28113026        if (m->label == NULL)
    28123027            errx(1, "malloc");
     
    28253040fix_labels(Symbol *s)
    28263041{
    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)
    28303044        errx(1, "malloc");
    28313045    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.  */
    23
    34/* Skeleton interface for Bison's Yacc-like parsers in C
    4 
    5    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
     5   
     6      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
    67   Free Software Foundation, Inc.
    7 
    8    This program is free software; you can redistribute it and/or modify
     8   
     9   This program is free software: you can redistribute it and/or modify
    910   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   
    1314   This program is distributed in the hope that it will be useful,
    1415   but WITHOUT ANY WARRANTY; without even the implied warranty of
    1516   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1617   GNU General Public License for more details.
    17 
     18   
    1819   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/>.  */
    2221
    2322/* As a special exception, you may create a larger work that contains
     
    3029   Bison output files to be licensed under the GNU General Public
    3130   License without this special exception.
    32 
     31   
    3332   This special exception was added by the Free Software Foundation in
    3433   version 2.2 of Bison.  */
     34
    3535
    3636/* Tokens.  */
     
    223223#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
    224224typedef union YYSTYPE
    225 #line 65 "heimdal/lib/asn1/asn1parse.y"
    226225{
     226
     227/* Line 1676 of yacc.c  */
     228#line 71 "asn1parse.c"
     229
    227230    int constant;
    228231    struct value *value;
     
    237240    struct memhead *members;
    238241    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
    243249# define yystype YYSTYPE /* obsolescent; will be withdrawn */
    244250# define YYSTYPE_IS_DECLARED 1
    245 # define YYSTYPE_IS_TRIVIAL 1
    246251#endif
    247252
    248253extern YYSTYPE yylval;
    249254
     255
  • trunk/server/source4/heimdal/lib/asn1/asn1parse.y

    r414 r745  
    33 * (Royal Institute of Technology, Stockholm, Sweden).
    44 * All rights reserved.
     5 *
     6 * Portions Copyright (c) 2009 Apple Inc. All rights reserved.
    57 *
    68 * Redistribution and use in source and binary forms, with or without
     
    6062    struct string_list *next;
    6163};
     64
     65/* Declarations for Bison */
     66#define YYMALLOC malloc
     67#define YYFREE   free
    6268
    6369%}
     
    240246TagDefault      : kw_EXPLICIT kw_TAGS
    241247                | kw_IMPLICIT kw_TAGS
    242                       { error_message("implicit tagging is not supported"); }
     248                      { lex_error_message("implicit tagging is not supported"); }
    243249                | kw_AUTOMATIC kw_TAGS
    244                       { error_message("automatic tagging is not supported"); }
     250                      { lex_error_message("automatic tagging is not supported"); }
    245251                | /* empty */
    246252                ;
    247253
    248254ExtensionDefault: kw_EXTENSIBILITY kw_IMPLIED
    249                       { error_message("no extensibility options supported"); }
     255                      { lex_error_message("no extensibility options supported"); }
    250256                | /* empty */
    251257                ;
    252258
    253 ModuleBody      : /* Exports */ Imports AssignmentList
     259ModuleBody      : Exports Imports AssignmentList
    254260                | /* empty */
    255261                ;
     
    273279                        Symbol *s = addsym(sl->string);
    274280                        s->stype = Stype;
     281                        gen_template_import(s);
    275282                    }
    276283                    add_import($3);
    277284                }
     285                ;
     286
     287Exports         : 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 */
    278295                ;
    279296
     
    341358                {
    342359                    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");
    344361                    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");
    346363                    $$ = ecalloc(1, sizeof(*$$));
    347364                    $$->min = $2->u.integervalue;
     
    351368                {       
    352369                    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");
    354371                    $$ = ecalloc(1, sizeof(*$$));
    355372                    $$->min = $2->u.integervalue;
     
    359376                {       
    360377                    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");
    362379                    $$ = ecalloc(1, sizeof(*$$));
    363380                    $$->min = $4->u.integervalue + 2;
     
    367384                {
    368385                    if($2->type != integervalue)
    369                         error_message("Non-integer used in limit");
     386                        lex_error_message("Non-integer used in limit");
    370387                    $$ = ecalloc(1, sizeof(*$$));
    371388                    $$->min = $2->u.integervalue;
     
    538555                  $$ = new_type(TType);
    539556                  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);
    541558                  else
    542559                    $$->symbol = s;
     
    594611                {
    595612                    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");
    597614                    $$ = new_constraint_spec(CT_CONTENTS);
    598615                    $$->u.content.type = NULL;
     
    602619                {
    603620                    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");
    605622                    $$ = new_constraint_spec(CT_CONTENTS);
    606623                    $$->u.content.type = $2;
     
    688705                                     TE_EXPLICIT, new_type(TGeneralString));
    689706                }
     707                | kw_TeletexString
     708                {
     709                        $$ = new_tag(ASN1_C_UNIV, UT_TeletexString,
     710                                     TE_EXPLICIT, new_type(TTeletexString));
     711                }
    690712                | kw_UTF8String
    691713                {
     
    834856                    if(s->stype != SValue ||
    835857                       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",
    837859                                      s->name);
    838860                        exit(1);
     
    867889                        Symbol *s = addsym($1);
    868890                        if(s->stype != SValue)
    869                                 error_message ("%s is not a value\n",
     891                                lex_error_message ("%s is not a value\n",
    870892                                                s->name);
    871893                        else
     
    925947yyerror (const char *s)
    926948{
    927      error_message ("%s\n", s);
     949     lex_error_message ("%s\n", s);
    928950}
    929951
     
    9901012        return;
    9911013    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");
    9931016        if (m->label == NULL)
    9941017            errx(1, "malloc");
     
    10071030fix_labels(Symbol *s)
    10081031{
    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)
    10121034        errx(1, "malloc");
    10131035    fix_labels2(s->type, p);
  • trunk/server/source4/heimdal/lib/asn1/cms.asn1

    r414 r745  
    55
    66IMPORTS CertificateSerialNumber, AlgorithmIdentifier, Name,
    7         Attribute, Certificate, Name, SubjectKeyIdentifier FROM rfc2459
     7        Attribute, Certificate, SubjectKeyIdentifier FROM rfc2459
    88        heim_any, heim_any_set FROM heim;
    99
  • trunk/server/source4/heimdal/lib/asn1/cms.opt

    r414 r745  
    11--decode-dce-ber
     2--sequence=DigestAlgorithmIdentifiers
  • trunk/server/source4/heimdal/lib/asn1/der.h

    r414 r745  
    9595} heim_ber_time_t;
    9696
     97struct asn1_template;
     98
    9799#include <der-protos.h>
    98100
  • trunk/server/source4/heimdal/lib/asn1/der_cmp.c

    r414 r745  
    5454
    5555int
     56der_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
     62int
     63der_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
     69int
    5670der_heim_bit_string_cmp(const heim_bit_string *p,
    5771                        const heim_bit_string *q)
  • trunk/server/source4/heimdal/lib/asn1/der_copy.c

    r414 r745  
    33 * (Royal Institute of Technology, Stockholm, Sweden).
    44 * All rights reserved.
     5 *
     6 * Portions Copyright (c) 2009 Apple Inc. All rights reserved.
    57 *
    68 * Redistribution and use in source and binary forms, with or without
     
    4749
    4850int
     51der_copy_integer (const int *from, int *to)
     52{
     53    *to = *from;
     54    return 0;
     55}
     56
     57int
     58der_copy_unsigned (const unsigned *from, unsigned *to)
     59{
     60    *to = *from;
     61    return 0;
     62}
     63
     64int
     65der_copy_generalized_time (const time_t *from, time_t *to)
     66{
     67    *to = *from;
     68    return 0;
     69}
     70
     71int
     72der_copy_utctime (const time_t *from, time_t *to)
     73{
     74    *to = *from;
     75    return 0;
     76}
     77
     78int
    4979der_copy_utf8string (const heim_utf8_string *from, heim_utf8_string *to)
    5080{
     
    5686                       heim_printable_string *to)
    5787{
    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;
    5995}
    6096
    6197int
    62 der_copy_ia5_string (const heim_printable_string *from,
    63                      heim_printable_string *to)
     98der_copy_ia5_string (const heim_ia5_string *from,
     99                     heim_ia5_string *to)
    64100{
    65     return der_copy_general_string(from, to);
     101    return der_copy_printable_string(from, to);
    66102}
    67103
  • trunk/server/source4/heimdal/lib/asn1/der_free.c

    r414 r745  
    33 * (Royal Institute of Technology, Stockholm, Sweden).
    44 * All rights reserved.
     5 *
     6 * Portions Copyright (c) 2009 Apple Inc. All rights reserved.
    57 *
    68 * Redistribution and use in source and binary forms, with or without
     
    4446
    4547void
     48der_free_integer (int *i)
     49{
     50    *i = 0;
     51}
     52
     53void
     54der_free_unsigned (unsigned *u)
     55{
     56    *u = 0;
     57}
     58
     59void
     60der_free_generalized_time(time_t *t)
     61{
     62    *t = 0;
     63}
     64
     65void
     66der_free_utctime(time_t *t)
     67{
     68    *t = 0;
     69}
     70
     71
     72void
    4673der_free_utf8string (heim_utf8_string *str)
    4774{
     
    5380der_free_printable_string (heim_printable_string *str)
    5481{
    55     free(*str);
    56     *str = NULL;
     82    der_free_octet_string(str);
    5783}
    5884
     
    6086der_free_ia5_string (heim_ia5_string *str)
    6187{
    62     free(*str);
    63     *str = NULL;
     88    der_free_octet_string(str);
    6489}
    6590
  • trunk/server/source4/heimdal/lib/asn1/der_get.c

    r414 r745  
    168168
    169169int
    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);
     170der_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
     183int
     184der_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);
    181188}
    182189
  • trunk/server/source4/heimdal/lib/asn1/der_length.c

    r414 r745  
    33 * (Royal Institute of Technology, Stockholm, Sweden).
    44 * All rights reserved.
     5 *
     6 * Portions Copyright (c) 2009 Apple Inc. All rights reserved.
    57 *
    68 * Redistribution and use in source and binary forms, with or without
     
    114116
    115117size_t
     118der_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
     131size_t
    116132der_length_integer (const int *data)
    117133{
     
    146162der_length_printable_string (const heim_printable_string *data)
    147163{
    148     return strlen(*data);
     164    return data->length;
    149165}
    150166
     
    152168der_length_ia5_string (const heim_ia5_string *data)
    153169{
    154     return strlen(*data);
     170    return data->length;
    155171}
    156172
  • trunk/server/source4/heimdal/lib/asn1/der_locl.h

    r414 r745  
    5353#include <asn1_err.h>
    5454#include <der.h>
     55#include <der-private.h>
     56#include "asn1-template.h"
    5557
    5658time_t _der_timegm (struct tm *);
     59struct tm * _der_gmtime(time_t t, struct tm *);
    5760size_t _heim_len_unsigned (unsigned);
    5861size_t _heim_len_int (int);
  • trunk/server/source4/heimdal/lib/asn1/der_put.c

    r414 r745  
    182182                          const heim_printable_string *str, size_t *size)
    183183{
    184     return der_put_general_string(p, len, str, size);
     184    return der_put_octet_string(p, len, str, size);
    185185}
    186186
     
    189189                    const heim_ia5_string *str, size_t *size)
    190190{
    191     return der_put_general_string(p, len, str, size);
     191    return der_put_octet_string(p, len, str, size);
    192192}
    193193
     
    427427_heim_time2generalizedtime (time_t t, heim_octet_string *s, int gtimep)
    428428{
    429      struct tm *tm;
     429     struct tm tm;
    430430     const size_t len = gtimep ? 15 : 13;
    431431
     
    434434         return ENOMEM;
    435435     s->length = len;
    436      tm = gmtime (&t);
     436     _der_gmtime(t, &tm);
    437437     if (gtimep)
    438438         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);
    441441     else
    442442         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);
    445445
    446446     return 0;
  • trunk/server/source4/heimdal/lib/asn1/digest.asn1

    r414 r745  
    101101}
    102102
     103NTLMRequest2 ::= 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
     112NTLMReply ::= SEQUENCE {
     113    success             [0] BOOLEAN,
     114    flags               [1] INTEGER (0..4294967295),
     115    sessionkey          [2] OCTET STRING OPTIONAL
     116}
     117
    103118DigestReqInner ::= CHOICE {
    104119    init                [0] DigestInit,
  • trunk/server/source4/heimdal/lib/asn1/extra.c

    r414 r745  
    33 * (Royal Institute of Technology, Stockholm, Sweden).
    44 * All rights reserved.
     5 *
     6 * Portions Copyright (c) 2009 Apple Inc. All rights reserved.
    57 *
    68 * Redistribution and use in source and binary forms, with or without
     
    4143                const heim_any *data, size_t *size)
    4244{
    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);
    5046}
    5147
     
    9288free_heim_any(heim_any *data)
    9389{
    94     free(data->data);
    95     data->data = NULL;
     90    der_free_octet_string(data);
    9691}
    9792
     
    105100copy_heim_any(const heim_any *from, heim_any *to)
    106101{
    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);
    113103}
    114104
     
    117107                    const heim_any_set *data, size_t *size)
    118108{
    119     return encode_heim_any(p, len, data, size);
     109    return der_put_octet_string (p, len, data, size);
    120110}
    121 
    122111
    123112int
     
    125114                heim_any_set *data, size_t *size)
    126115{
    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);
    135117}
    136118
     
    138120free_heim_any_set(heim_any_set *data)
    139121{
    140     free_heim_any(data);
     122    der_free_octet_string(data);
    141123}
    142124
     
    144126length_heim_any_set(const heim_any *data)
    145127{
    146     return length_heim_any(data);
     128    return data->length;
    147129}
    148130
     
    150132copy_heim_any_set(const heim_any_set *from, heim_any_set *to)
    151133{
    152     return copy_heim_any(from, to);
     134    return der_copy_octet_string(from, to);
    153135}
    154136
     
    156138heim_any_cmp(const heim_any_set *p, const heim_any_set *q)
    157139{
    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);
    161141}
  • trunk/server/source4/heimdal/lib/asn1/gen.c

    r414 r745  
    33 * (Royal Institute of Technology, Stockholm, Sweden).
    44 * All rights reserved.
     5 *
     6 * Portions Copyright (c) 2009 Apple Inc. All rights reserved.
    57 *
    68 * Redistribution and use in source and binary forms, with or without
     
    3638RCSID("$Id$");
    3739
    38 FILE *headerfile, *codefile, *logfile;
     40FILE *privheaderfile, *headerfile, *codefile, *logfile, *templatefile;
    3941
    4042#define STEM "asn1"
    4143
    4244static const char *orig_filename;
    43 static char *header;
     45static char *privheader, *header, *template;
    4446static const char *headerbase = STEM;
    4547
     
    6769}
    6870
     71/*
     72 * List of all exported symbols
     73 */
     74
     75struct sexport {
     76    const char *name;
     77    int defined;
     78    struct sexport *next;
     79};
     80
     81static struct sexport *exports = NULL;
     82
     83void
     84add_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
     93int
     94is_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
    69110const char *
    70111get_filename (void)
     
    76117init_generate (const char *filename, const char *base)
    77118{
    78     char *fn;
     119    char *fn = NULL;
    79120
    80121    orig_filename = filename;
     
    86127
    87128    /* public header file */
    88     asprintf(&header, "%s.h", headerbase);
    89     if (header == NULL)
     129    if (asprintf(&header, "%s.h", headerbase) < 0 || header == NULL)
    90130        errx(1, "malloc");
    91     asprintf(&fn, "%s.hx", headerbase);
    92     if (fn == NULL)
     131    if (asprintf(&fn, "%s.hx", headerbase) < 0 || fn == NULL)
    93132        errx(1, "malloc");
    94133    headerfile = fopen (fn, "w");
     
    96135        err (1, "open %s", fn);
    97136    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");
    99153    fprintf (headerfile,
    100154             "/* Generated from %s */\n"
     
    128182             );
    129183    fprintf (headerfile,
    130              "typedef char *heim_printable_string;\n\n"
     184             "typedef struct heim_octet_string heim_printable_string;\n\n"
    131185             );
    132186    fprintf (headerfile,
    133              "typedef char *heim_ia5_string;\n\n"
     187             "typedef struct heim_octet_string heim_ia5_string;\n\n"
    134188             );
    135189    fprintf (headerfile,
     
    175229          "  } while (0)\n\n",
    176230          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);
    177243    fprintf (headerfile, "struct units;\n\n");
    178244    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)
    181246        errx(1, "malloc");
    182247    logfile = fopen(fn, "w");
    183248    if (logfile == NULL)
    184249        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,
    256260             "/* Generated from %s */\n"
    257261             "/* Do not edit */\n\n"
     
    263267             "#include <limits.h>\n"
    264268             "#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
     282void
     283close_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
     298void
     299gen_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
     319void
     320gen_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
     340void
     341generate_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",
    265367             orig_filename);
    266368
    267369    fprintf (codefile,
    268              "#include <%s.h>\n",
    269              headerbase);
     370             "#include <%s>\n"
     371             "#include <%s>\n",
     372             header, privheader);
    270373    fprintf (codefile,
    271374             "#include <asn1_err.h>\n"
    272375             "#include <der.h>\n"
     376             "#include <der-private.h>\n"
     377             "#include <asn1-template.h>\n"
    273378             "#include <parse_units.h>\n\n");
    274379
     
    303408        struct objid *o, **list;
    304409        unsigned int i, len;
     410        char *gen_upper;
    305411
    306412        if (!one_code_file)
     
    328434        }
    329435
    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 
    338436        fprintf (codefile, "static unsigned oid_%s_variable_num[%d] =  {",
    339437                 s->gen_name, len);
     
    347445                 s->gen_name, len, s->gen_name);
    348446
    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 
    355447        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);
    356465
    357466        if (!one_code_file)
     
    362471    default:
    363472        abort();
     473    }
     474}
     475
     476int
     477is_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;
    364500    }
    365501}
     
    495631        fprintf (headerfile, "GeneralString");
    496632        break;
     633    case TTeletexString:
     634        fprintf (headerfile, "TeletexString");
     635        break;
    497636    case TTag: {
    498637        const char *classnames[] = { "UNIVERSAL ", "APPLICATION ",
     
    548687
    549688static void
    550 define_type (int level, const char *name, Type *t, int typedefp, int preservep)
    551 {
     689getnewbasename(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
     703static void
     704define_type (int level, const char *name, const char *basename, Type *t, int typedefp, int preservep)
     705{
     706    char *newbasename = NULL;
     707
    552708    switch (t->type) {
    553709    case TType:
     
    600756            fprintf (headerfile, "heim_bit_string %s;\n", name);
    601757        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);
    603762            ASN1_TAILQ_FOREACH(m, t->members, members) {
    604                 char *n;
     763                char *n = NULL;
    605764       
    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)
    608776                    errx(1, "malloc");
    609                 define_type (level + 1, n, &i, FALSE, FALSE);
     777                define_type (level + 1, n, newbasename, &i, FALSE, FALSE);
    610778                free (n);
     779                n = NULL;
     780                pos++;
    611781            }
     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
    612792            space(level);
    613793            fprintf (headerfile, "} %s;\n\n", name);
     
    636816        Member *m;
    637817
    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);
    640822        if (t->type == TSequence && preservep) {
    641823            space(level + 1);
     
    646828                ;
    647829            } 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)
    652833                    errx(1, "malloc");
    653                 define_type (level + 1, n, m->type, FALSE, FALSE);
     834                define_type (level + 1, n, newbasename, m->type, FALSE, FALSE);
    654835                free (n);
    655836            } 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);
    657838        }
    658839        space(level);
     
    665846        struct range range = { 0, INT_MAX };
    666847
     848        getnewbasename(&newbasename, typedefp, basename, name);
     849
    667850        i.type = TInteger;
    668851        i.range = &range;
     
    671854
    672855        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);
    676859        space(level);
    677860        fprintf (headerfile, "} %s;\n", name);
     
    686869        fprintf (headerfile, "heim_general_string %s;\n", name);
    687870        break;
     871    case TTeletexString:
     872        space(level);
     873        fprintf (headerfile, "heim_general_string %s;\n", name);
     874        break;
    688875    case TTag:
    689         define_type (level, name, t->subtype, typedefp, preservep);
     876        define_type (level, name, basename, t->subtype, typedefp, preservep);
    690877        break;
    691878    case TChoice: {
     
    693880        Member *m;
    694881
    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);
    697886        if (preservep) {
    698887            space(level + 1);
     
    726915                fprintf(headerfile, "heim_octet_string asn1_ellipsis;\n");
    727916            } 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)
    732920                    errx(1, "malloc");
    733                 define_type (level + 2, n, m->type, FALSE, FALSE);
     921                define_type (level + 2, n, newbasename, m->type, FALSE, FALSE);
    734922                free (n);
    735923            } 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);
    737925        }
    738926        space(level + 1);
     
    781969        abort ();
    782970    }
     971    if (newbasename)
     972        free(newbasename);
    783973}
    784974
     
    794984
    795985    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);
    797987
    798988    fprintf (headerfile, "\n");
    799989}
    800 
    801990
    802991void
    803992generate_type (const Symbol *s)
    804993{
     994    FILE *h;
     995    const char * exp;
     996
    805997    if (!one_code_file)
    806998        generate_header_of_codefile(s->gen_name);
    807999
    8081000    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    }
    8141012    generate_type_seq (s);
    8151013    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");
    8171049
    8181050    if (!one_code_file) {
  • trunk/server/source4/heimdal/lib/asn1/gen_copy.c

    r414 r745  
    111111                fprintf(codefile, "case %s:\n", m->label);
    112112
    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");
    116117            if (fs == NULL)
    117118                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");
    121123            if (ts == NULL)
    122124                errx(1, "malloc");
     
    156158    case TSetOf:
    157159    case TSequenceOf: {
    158         char *f;
    159         char *T;
     160        char *f = NULL, *T = NULL;
    160161
    161162        fprintf (codefile, "if(((%s)->val = "
     
    167168                "for((%s)->len = 0; (%s)->len < (%s)->len; (%s)->len++){\n",
    168169                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");
    170172        if (f == NULL)
    171173            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");
    173176        if (T == NULL)
    174177            errx(1, "malloc");
     
    185188        copy_primitive ("general_string", from, to);
    186189        break;
     190    case TTeletexString:
     191        copy_primitive ("general_string", from, to);
     192        break;
    187193    case TUTCTime:
    188194        fprintf(codefile, "*(%s) = *(%s);\n", to, from);
     
    226232  used_fail = 0;
    227233
    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"
    233235           "copy_%s(const %s *from, %s *to)\n"
    234236           "{\n"
  • trunk/server/source4/heimdal/lib/asn1/gen_decode.c

    r414 r745  
    5757}
    5858
    59 static int
    60 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 
    8559static void
    8660find_tag (const Type *t,
     
    11084        *tag = UT_GeneralString;
    11185        break;
     86    case TTeletexString:
     87        *cl  = ASN1_C_UNIV;
     88        *ty  = PRIM;
     89        *tag = UT_TeletexString;
     90        break;
    11291    case TGeneralizedTime:
    11392        *cl  = ASN1_C_UNIV;
     
    165144        if ((t->symbol->stype == Stype && t->symbol->type == NULL)
    166145            || 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);
    171150            exit(1);
    172151        }
     
    342321
    343322        ASN1_TAILQ_FOREACH(m, t->members, members) {
    344             char *s;
     323            char *s = NULL;
    345324
    346325            if (m->ellipsis)
    347326                continue;
    348327
    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)
    352330                errx(1, "malloc");
    353331            decode_type (s, m->type, m->optional, forwstr, m->gen_name, NULL);
     
    385363                    valuename(m->type->tag.tagclass, m->type->tag.tagvalue));
    386364
    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)
    389366                errx(1, "malloc");
    390367            if(m->optional)
     
    410387            char *s;
    411388
    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)
    414390                errx(1, "malloc");
    415391            fprintf(codefile, "if((members & (1 << %d)) == 0)\n", memno);
     
    428404    case TSetOf:
    429405    case TSequenceOf: {
    430         char *n;
    431         char *sname;
     406        char *n = NULL;
     407        char *sname = NULL;
    432408
    433409        fprintf (codefile,
     
    463439                 name, tmpstr);
    464440
    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)
    467442            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)
    470444            errx(1, "malloc");
    471445        decode_type (n, t->subtype, 0, forwstr, sname, NULL);
     
    490464        decode_primitive ("general_string", name, forwstr);
    491465        break;
     466    case TTeletexString:
     467        decode_primitive ("general_string", name, forwstr);
     468        break;
    492469    case TTag:{
    493         char *tname, *typestring;
     470        char *tname = NULL, *typestring = NULL;
    494471        char *ide = NULL;
    495472
    496         asprintf(&typestring, "%s_type", tmpstr);
     473        if (asprintf(&typestring, "%s_type", tmpstr) < 0 || typestring == NULL)
     474            errx(1, "malloc");
    497475
    498476        fprintf(codefile,
     
    547525                    "if (%s_datalen > len) { e = ASN1_OVERRUN; %s; }\n"
    548526                    "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)
    551528            errx(1, "malloc");
    552529        decode_type (name, t->subtype, 0, forwstr, tname, ide);
     
    587564        ASN1_TAILQ_FOREACH(m, t->members, members) {
    588565            const Type *tt = m->type;
    589             char *s;
     566            char *s = NULL;
    590567            Der_class cl;
    591568            Der_type  ty;
     
    605582                    ty ? "CONS" : "PRIM",
    606583                    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)
    610586                errx(1, "malloc");
    611587            decode_type (s, m->type, m->optional, forwstr, m->gen_name, NULL);
     
    686662    int preserve = preserve_type(s->name) ? TRUE : FALSE;
    687663
    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"
    694665             "decode_%s(const unsigned char *p,"
    695666             " size_t len, %s *data, size_t *size)\n"
     
    704675    case TGeneralizedTime:
    705676    case TGeneralString:
     677    case TTeletexString:
    706678    case TUTF8String:
    707679    case TPrintableString:
  • trunk/server/source4/heimdal/lib/asn1/gen_encode.c

    r414 r745  
    260260
    261261        ASN1_TAILQ_FOREACH_REVERSE(m, t->members, memhead, members) {
    262             char *s;
     262            char *s = NULL;
    263263
    264264            if (m->ellipsis)
    265265                continue;
    266266
    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)
    269268                errx(1, "malloc");
    270269            fprintf(codefile, "/* %s */\n", m->name);
     
    290289                "{\n"
    291290                "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");
    294293
    295294        fprintf(codefile,
     
    353352    }
    354353    case TSequenceOf: {
    355         char *n;
    356         char *sname;
     354        char *sname = NULL;
     355        char *n = NULL;
    357356
    358357        fprintf (codefile,
     
    361360                 "ret = 0;\n",
    362361                 name, tmpstr);
    363         asprintf (&n, "&(%s)->val[i]", name);
    364         if (n == NULL)
     362        if (asprintf (&n, "&(%s)->val[i]", name) < 0 || n == NULL)
    365363            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)
    368365            errx(1, "malloc");
    369366        encode_type (n, t->subtype, sname);
     
    384381        constructed = 0;
    385382        break;
     383    case TTeletexString:
     384        encode_primitive ("general_string", name);
     385        constructed = 0;
     386        break;
    386387    case TTag: {
    387         char *tname;
     388        char *tname = NULL;
    388389        int c;
    389         asprintf (&tname, "%s_tag", tmpstr);
    390         if (tname == NULL)
     390        if (asprintf (&tname, "%s_tag", tmpstr) < 0 || tname == NULL)
    391391            errx(1, "malloc");
    392392        c = encode_type (name, t->subtype, tname);
     
    402402    case TChoice:{
    403403        Member *m, *have_ellipsis = NULL;
    404         char *s;
     404        char *s = NULL;
    405405
    406406        if (t->members == NULL)
     
    409409        fprintf(codefile, "\n");
    410410
    411         asprintf (&s, "(%s)", name);
    412         if (s == NULL)
     411        if (asprintf (&s, "(%s)", name) < 0 || s == NULL)
    413412            errx(1, "malloc");
    414413        fprintf(codefile, "switch(%s->element) {\n", s);
    415414
    416415        ASN1_TAILQ_FOREACH_REVERSE(m, t->members, memhead, members) {
    417             char *s2;
     416            char *s2 = NULL;
    418417
    419418            if (m->ellipsis) {
     
    423422
    424423            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)
    428426                errx(1, "malloc");
    429427            if (m->optional)
     
    505503generate_type_encode (const Symbol *s)
    506504{
    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"
    513506             "encode_%s(unsigned char *p, size_t len,"
    514507             " const %s *data, size_t *size)\n"
     
    522515    case TGeneralizedTime:
    523516    case TGeneralString:
     517    case TTeletexString:
    524518    case TUTCTime:
    525519    case TUTF8String:
  • trunk/server/source4/heimdal/lib/asn1/gen_free.c

    r414 r745  
    9494            if(t->type == TChoice)
    9595                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)
    10099                errx(1, "malloc");
    101100            if(m->optional)
     
    129128
    130129        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)
    133131            errx(1, "malloc");
    134132        free_type(n, t->subtype, FALSE);
     
    144142    }
    145143    case TGeneralString:
     144        free_primitive ("general_string", name);
     145        break;
     146    case TTeletexString:
    146147        free_primitive ("general_string", name);
    147148        break;
     
    178179generate_type_free (const Symbol *s)
    179180{
    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");
    193190}
    194191
  • trunk/server/source4/heimdal/lib/asn1/gen_glue.c

    r414 r745  
    33 * (Royal Institute of Technology, Stockholm, Sweden).
    44 * All rights reserved.
     5 *
     6 * Portions Copyright (c) 2009 Apple Inc. All rights reserved.
    57 *
    68 * Redistribution and use in source and binary forms, with or without
     
    7173             "%s int2%s(unsigned n)\n"
    7274             "{\n"
    73              "\t%s flags;\n\n",
     75             "\t%s flags;\n\n"
     76             "\tmemset(&flags, 0, sizeof(flags));\n\n",
    7477             gen_name, gen_name, gen_name);
    7578
     
    9396    Member *m;
    9497
    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    }
    98109
    99110    fprintf (codefile,
     
    112123             "};\n\n");
    113124
    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);
    119135
    120136
  • trunk/server/source4/heimdal/lib/asn1/gen_length.c

    r414 r745  
    4444}
    4545
     46/* XXX same as der_length_tag */
    4647static size_t
    4748length_tag(unsigned int tag)
     
    149150                fprintf(codefile, "case %s:\n", m->label);
    150151
    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)
    155155                errx(1, "malloc");
    156156            if (m->optional)
     
    183183    case TSetOf:
    184184    case TSequenceOf: {
    185         char *n;
    186         char *sname;
     185        char *n = NULL;
     186        char *sname = NULL;
    187187
    188188        fprintf (codefile,
    189189                 "{\n"
    190                  "int %s_oldret = %s;\n"
     190                 "size_t %s_oldret = %s;\n"
    191191                 "int i;\n"
    192192                 "%s = 0;\n",
     
    194194
    195195        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"
    197197                 "%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)
    200199            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)
    203201            errx(1, "malloc");
    204202        length_type(n, t->subtype, variable, sname);
     
    220218        length_primitive ("general_string", name, variable);
    221219        break;
     220    case TTeletexString:
     221        length_primitive ("general_string", name, variable);
     222        break;
    222223    case TUTCTime:
    223224        length_primitive ("utctime", name, variable);
     
    245246        break;
    246247    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)
    250250            errx(1, "malloc");
    251251        length_type (name, t->subtype, variable, tname);
     
    267267generate_type_length (const Symbol *s)
    268268{
    269     fprintf (headerfile,
    270              "size_t length_%s(const %s *);\n",
    271              s->gen_name, s->gen_name);
    272 
    273269    fprintf (codefile,
    274              "size_t\n"
     270             "size_t ASN1CALL\n"
    275271             "length_%s(const %s *data)\n"
    276272             "{\n"
  • trunk/server/source4/heimdal/lib/asn1/gen_locl.h

    r414 r745  
    5353#include "asn1-common.h"
    5454#include "der.h"
     55#include "der-private.h"
    5556
    5657void generate_type (const Symbol *);
     
    7576void close_generate(void);
    7677void add_import(const char *);
     78void add_export(const char *);
     79int is_export(const char *);
    7780int yyparse(void);
     81int is_primitive_type(int);
    7882
    7983int preserve_type(const char *);
     
    8387void close_codefile(void);
    8488
     89int is_template_compat (const Symbol *);
     90void generate_template(const Symbol *);
     91void gen_template_import(const Symbol *);
    8592
    86 extern FILE *headerfile, *codefile, *logfile;
     93
     94extern FILE *privheaderfile, *headerfile, *codefile, *logfile, *templatefile;
    8795extern int support_ber;
     96extern int template_flag;
    8897extern int rfc1510_bitstring;
    8998extern int one_code_file;
  • trunk/server/source4/heimdal/lib/asn1/gen_seq.c

    r414 r745  
    4848        type = type->subtype;
    4949
    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);
    5252        return;
    5353    }
     
    6868
    6969    fprintf (headerfile,
    70              "int  add_%s  (%s *, const %s *);\n"
    71              "int  remove_%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",
    7272             s->gen_name, s->gen_name, subname,
    7373             s->gen_name, s->gen_name);
    7474
    75     fprintf (codefile, "int\n"
     75    fprintf (codefile, "int ASN1CALL\n"
    7676             "add_%s(%s *data, const %s *element)\n"
    7777             "{\n",
     
    9494    fprintf (codefile, "}\n\n");
    9595
    96     fprintf (codefile, "int\n"
     96    fprintf (codefile, "int ASN1CALL\n"
    9797             "remove_%s(%s *data, unsigned int element)\n"
    9898             "{\n",
  • trunk/server/source4/heimdal/lib/asn1/krb5.asn1

    r414 r745  
    33KERBEROS5 DEFINITIONS ::=
    44BEGIN
     5EXPORTS
     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        ;
    577
    678NAME-TYPE ::= INTEGER {
     
    101173        KRB5-PADATA-PKINIT-KX(147),             -- krb-wg-anon
    102174        KRB5-PADATA-PKU2U-NAME(148),            -- zhu-pku2u
     175        KRB5-PADATA-REQ-ENC-PA-REP(149),        --
    103176        KRB5-PADATA-SUPPORTED-ETYPES(165)       -- MS-KILE
    104177}
     
    119192        KRB5-AUTHDATA-WIN2K-PAC(128),
    120193        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)
    123197}
    124198
     
    246320        transited-policy-checked(12),
    247321        ok-as-delegate(13),
    248         anonymous(14)
     322        anonymous(14),
     323        enc-pa-rep(15)
    249324}
    250325
     
    257332        allow-postdate(5),
    258333        postdated(6),
    259         unused7(7),
    260334        renewable(8),
    261         unused9(9),
    262         unused10(10),
    263         unused11(11),
    264335        request-anonymous(14),
    265336        canonicalize(15),
     
    646717-- never encoded on the wire, just used to checksum over
    647718KRB5SignedPathData ::= 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
    650723}
    651724
     
    656729        cksum[1]        Checksum,
    657730        -- srvs delegated though
    658         delegated[2]    Principals OPTIONAL
     731        delegated[2]    Principals OPTIONAL,
     732        method_data[3]  METHOD-DATA OPTIONAL
    659733}
    660734
  • trunk/server/source4/heimdal/lib/asn1/lex.c

    r414 r745  
    11#include "config.h"
    22
    3 #line 3 "heimdal/lib/asn1/lex.c"
     3#line 3 "lex.c"
    44
    55#define  YY_INT_ALIGNED short int
     
    1010#define YY_FLEX_MAJOR_VERSION 2
    1111#define YY_FLEX_MINOR_VERSION 5
    12 #define YY_FLEX_SUBMINOR_VERSION 34
     12#define YY_FLEX_SUBMINOR_VERSION 35
    1313#if YY_FLEX_SUBMINOR_VERSION > 0
    1414#define FLEX_BETA
     
    5555typedef unsigned short int flex_uint16_t;
    5656typedef unsigned int flex_uint32_t;
    57 #endif /* ! C99 */
    5857
    5958/* Limits of integral types. */
     
    8584#define UINT32_MAX             (4294967295U)
    8685#endif
     86
     87#endif /* ! C99 */
    8788
    8889#endif /* ! FLEXINT_H */
     
    142143/* Size of default input buffer. */
    143144#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
    144152#define YY_BUF_SIZE 16384
     153#endif /* __ia64__ */
    145154#endif
    146155
     
    179188
    180189#define unput(c) yyunput( c, (yytext_ptr)  )
    181 
    182 /* The following is because we cannot portably get our hands on size_t
    183  * (without autoconf's help, which isn't available because we want
    184  * 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  */
    188190
    189191#ifndef YY_TYPEDEF_YY_SIZE_T
     
    856858
    857859/* This is for broken old lexes (solaris 10 and hpux) */
    858 #line 858 "heimdal/lib/asn1/lex.c"
     860#line 860 "lex.c"
    859861
    860862#define INITIAL 0
     
    873875
    874876static int yy_init_globals (void );
     877
     878/* Accessor methods to globals.
     879   These are made visible to non-reentrant scanners for convenience. */
     880
     881int yylex_destroy (void );
     882
     883int yyget_debug (void );
     884
     885void yyset_debug (int debug_flag  );
     886
     887YY_EXTRA_TYPE yyget_extra (void );
     888
     889void yyset_extra (YY_EXTRA_TYPE user_defined  );
     890
     891FILE *yyget_in (void );
     892
     893void yyset_in  (FILE * in_str  );
     894
     895FILE *yyget_out (void );
     896
     897void yyset_out  (FILE * out_str  );
     898
     899int yyget_leng (void );
     900
     901char *yyget_text (void );
     902
     903int yyget_lineno (void );
     904
     905void yyset_lineno (int line_number  );
    875906
    876907/* Macros after this point can all be overridden by user definitions in
     
    908939/* Amount of stuff to slurp up with each read. */
    909940#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
    910945#define YY_READ_BUF_SIZE 8192
     946#endif /* __ia64__ */
    911947#endif
    912948
     
    916952 * we now use fwrite().
    917953 */
    918 #define ECHO fwrite( yytext, yyleng, 1, yyout )
     954#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
    919955#endif
    920956
     
    927963                { \
    928964                int c = '*'; \
    929                 int n; \
     965                size_t n; \
    930966                for ( n = 0; n < max_size && \
    931967                             (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
     
    10111047#line 68 "lex.l"
    10121048
    1013 #line 1013 "heimdal/lib/asn1/lex.c"
     1049#line 1049 "lex.c"
    10141050
    10151051        if ( !(yy_init) )
     
    16361672                                                   &e, 0);
    16371673                          if(e == y)
    1638                             error_message("malformed constant (%s)", yytext);
     1674                            lex_error_message("malformed constant (%s)", yytext);
    16391675                          else
    16401676                            return NUMBER;
     
    16731709YY_RULE_SETUP
    16741710#line 273 "lex.l"
    1675 { error_message("Ignoring char(%c)\n", *yytext); }
     1711{ lex_error_message("Ignoring char(%c)\n", *yytext); }
    16761712        YY_BREAK
    16771713case 95:
     
    16801716ECHO;
    16811717        YY_BREAK
    1682 #line 1682 "heimdal/lib/asn1/lex.c"
     1718#line 1718 "lex.c"
    16831719case YY_STATE_EOF(INITIAL):
    16841720        yyterminate();
     
    24382474/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
    24392475 * scan from a @e copy of @a bytes.
    2440  * @param bytes the byte buffer to scan
    2441  * @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.
    24422478 *
    24432479 * @return the newly allocated buffer state object.
     
    26912727
    26922728void
    2693 error_message (const char *format, ...)
     2729lex_error_message (const char *format, ...)
    26942730{
    26952731    va_list args;
     
    27052741unterminated(const char *type, unsigned start_lineno)
    27062742{
    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  
    3636#include <roken.h>
    3737
    38 void error_message (const char *, ...)
     38void lex_error_message (const char *, ...)
    3939__attribute__ ((format (printf, 1, 2)));
    4040extern int error_flag;
  • trunk/server/source4/heimdal/lib/asn1/lex.l

    r414 r745  
    259259                                                   &e, 0);
    260260                          if(e == y)
    261                             error_message("malformed constant (%s)", yytext);
     261                            lex_error_message("malformed constant (%s)", yytext);
    262262                          else
    263263                            return NUMBER;
     
    271271\.\.\.                  { return ELLIPSIS; }
    272272\.\.                    { return RANGE; }
    273 .                       { error_message("Ignoring char(%c)\n", *yytext); }
     273.                       { lex_error_message("Ignoring char(%c)\n", *yytext); }
    274274%%
    275275
     
    283283
    284284void
    285 error_message (const char *format, ...)
     285lex_error_message (const char *format, ...)
    286286{
    287287    va_list args;
     
    297297unterminated(const char *type, unsigned start_lineno)
    298298{
    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);
    300300}
  • trunk/server/source4/heimdal/lib/asn1/main.c

    r414 r745  
    6464
    6565int support_ber;
     66int template_flag;
    6667int rfc1510_bitstring;
    6768int one_code_file;
     
    7071int help_flag;
    7172struct getargs args[] = {
     73    { "template", 0, arg_flag, &template_flag },
    7274    { "encode-rfc1510-bit-string", 0, arg_flag, &rfc1510_bitstring },
    7375    { "decode-dce-ber", 0, arg_flag, &support_ber },
  • trunk/server/source4/heimdal/lib/asn1/rfc2459.asn1

    r414 r745  
    5252id-secsig-sha-1 OBJECT IDENTIFIER ::= { iso(1) identified-organization(3)
    5353        oiw(14) secsig(3) algorithm(2) 26 }
     54
     55id-secsig-sha-1WithRSAEncryption OBJECT IDENTIFIER ::= { iso(1) identified-organization(3)
     56        oiw(14) secsig(3) algorithm(2) 29 }
    5457
    5558id-nistAlgorithm OBJECT IDENTIFIER ::= {
     
    151154AttributeValue ::=   heim_any
    152155
    153 TeletexStringx ::= [UNIVERSAL 20] IMPLICIT OCTET STRING
    154 
    155156DirectoryString ::= CHOICE {
    156157        ia5String       IA5String,
    157         teletexString   TeletexStringx,
     158        teletexString   TeletexString,
    158159        printableString PrintableString,
    159160        universalString UniversalString,
     
    242243        j               INTEGER OPTIONAL, -- subgroup factor
    243244        validationParms ValidationParms OPTIONAL -- ValidationParms
     245}
     246
     247-- As defined by PKCS3
     248DHParameter ::= SEQUENCE {
     249        prime           INTEGER, -- odd prime, p=jq +1
     250        base            INTEGER, -- generator, g
     251        privateValueLength INTEGER OPTIONAL
    244252}
    245253
  • trunk/server/source4/heimdal/lib/asn1/symbol.c

    r414 r745  
    3535#include "lex.h"
    3636
    37 RCSID("$Id$");
    38 
    3937static Hashtab *htab;
    4038
     
    6967
    7068    for (p = s; *p; ++p)
    71         if (*p == '-')
     69        if (*p == '-' || *p == '.')
    7270            *p = '_';
    7371}
     
    9694    Symbol *s = ptr;
    9795    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);
    9997        *(int *) arg = 1;
    10098    }
  • trunk/server/source4/heimdal/lib/asn1/symbol.h

    r414 r745  
    4545    TEnumerated,
    4646    TGeneralString,
     47    TTeletexString,
    4748    TGeneralizedTime,
    4849    TIA5String,
  • trunk/server/source4/heimdal/lib/asn1/test.asn1

    r414 r745  
    77IMPORTS heim_any FROM heim;
    88
     9TESTuint32 ::= INTEGER (0..4294967295)
     10
    911TESTLargeTag ::= SEQUENCE {
    10         foo[127] INTEGER (-2147483648..2147483647)
     12        foo[127] INTEGER (-2147483648..2147483647),
     13        bar[128] INTEGER (-2147483648..2147483647)
    1114}
    1215
     
    5861}
    5962
     63TESTOptional ::= SEQUENCE {
     64          zero [0] INTEGER (-2147483648..2147483647) OPTIONAL,
     65          one [1] INTEGER (-2147483648..2147483647) OPTIONAL
     66}
     67
    6068
    6169TESTCONTAINING ::= OCTET STRING ( CONTAINING INTEGER )
     
    93101TESTOSSize1 ::= OCTET STRING SIZE (1..2)
    94102
     103TESTSeqOfSeq ::= SEQUENCE OF SEQUENCE {
     104        zero [0] TESTInteger
     105}
     106
     107TESTSeqOfSeq2 ::= SEQUENCE OF SEQUENCE {
     108        string [0] GeneralString
     109}
     110
     111TESTSeqOfSeq3 ::= SEQUENCE OF SEQUENCE {
     112        zero [0] TESTInteger,
     113        string [0] GeneralString
     114}
     115
     116TESTSeqOf2 ::= SEQUENCE {
     117        strings SEQUENCE OF GeneralString
     118}
     119
     120TESTSeqOf3 ::= SEQUENCE {
     121        strings SEQUENCE OF GeneralString OPTIONAL
     122}
     123
     124TESTPreserve ::= SEQUENCE {
     125        zero [0] TESTInteger,
     126        one [1] TESTInteger
     127}
     128
     129TESTBitString ::= BIT STRING {
     130              zero(0),
     131              eight(8),
     132              thirtyone(31)
     133}
     134
    95135END
  • trunk/server/source4/heimdal/lib/asn1/timegm.c

    r414 r745  
    4343}
    4444
     45static 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
    4549/*
    4650 * This is a simplifed version of timegm(3) that doesn't accept out of
     
    5256_der_timegm (struct tm *tm)
    5357{
    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}};
    5758  time_t res = 0;
    5859  unsigned i;
     
    8586  return res;
    8687}
     88
     89struct 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.