diff --git a/docbook-schema/README b/docbook-schema/README deleted file mode 100644 index c636682..0000000 --- a/docbook-schema/README +++ /dev/null @@ -1,3 +0,0 @@ -This directory contains Relax NG Compact schema files, for use with -Emacs. These files were download from http://www.docbook.org/rng/4.5/ -on 2012-07-16. diff --git a/docbook-schema/calstblx.rnc b/docbook-schema/calstblx.rnc deleted file mode 100644 index b6a2483..0000000 --- a/docbook-schema/calstblx.rnc +++ /dev/null @@ -1,164 +0,0 @@ -# ...................................................................... - -# DocBook CALS Table Model V4.5 ........................................ - -# File calstblx.mod .................................................... - -# Copyright 1992-2002 HaL Computer Systems, Inc., -# O'Reilly & Associates, Inc., ArborText, Inc., Fujitsu Software -# Corporation, Norman Walsh, Sun Microsystems, Inc., and the -# Organization for the Advancement of Structured Information -# Standards (OASIS). -# -# This DTD is based on the CALS Table Model -# PUBLIC "-//USA-DOD//DTD Table Model 951010//EN" -# -# $Id: calstblx.dtd 6340 2006-10-03 13:23:24Z nwalsh $ -# -# Permission to use, copy, modify and distribute the DocBook DTD -# and its accompanying documentation for any purpose and without fee -# is hereby granted in perpetuity, provided that the above copyright -# notice and this paragraph appear in all copies. The copyright -# holders make no representation about the suitability of the DTD for -# any purpose. It is provided "as is" without expressed or implied -# warranty. -# -# If you modify the DocBook DTD in any way, except for declaring and -# referencing additional sets of general entities and declaring -# additional notations, label your DTD as a variant of DocBook. See -# the maintenance documentation for more information. -# -# Please direct all questions, bug reports, or suggestions for -# changes to the docbook@lists.oasis-open.org mailing list. For more -# information, see http://www.oasis-open.org/docbook/. - -# ...................................................................... - -# This module contains the definitions for the CALS Table Model -# converted to XML. It has been modified slightly for use in the -# combined HTML/CALS models supported by DocBook V4.5. - -# These definitions are not directly related to the table model, but are -# used in the default CALS table model and are usually defined elsewhere -# (and prior to the inclusion of this table module) in a CALS DTD. - -# no if zero(s), -# yes if any other digits value - -yesorno = string -titles = title? -# default for use in entry content - -# The parameter entities as defined below provide the CALS table model -# as published (as part of the Example DTD) in MIL-HDBK-28001. -# -# These following declarations provide the CALS-compliant default definitions -# for these entities. However, these entities can and should be redefined -# (by giving the appropriate parameter entity declaration(s) prior to the -# reference to this Table Model declaration set entity) to fit the needs -# of the current application. -tbl.table-titles.mdl = titles -tbl.table-main.mdl = tgroup+ | graphic+ -tbl.tgroup.mdl = colspec*, spanspec*, thead?, tfoot?, tbody -tbl.tgroup.att = attribute tgroupstyle { text }? -tbl.row.mdl = (entry | entrytbl)+ -tbl.entrytbl.mdl = colspec*, spanspec*, thead?, tbody -# ===== Element and attribute declarations follow. ===== - -# doc:A formal table in a document. -table = element table { table.attlist, tbl.table.mdl } -table.attlist &= - attribute frame { tbl.frame.attval }?, - attribute colsep { yesorno }?, - attribute rowsep { yesorno }?, - tbl.table.att, - bodyatt, - secur -# doc:A wrapper for the main content of a table, or part of a table. -tgroup = element tgroup { tgroup.attlist, tbl.tgroup.mdl } -tgroup.attlist &= - attribute cols { text }, - tbl.tgroup.att, - attribute colsep { yesorno }?, - attribute rowsep { yesorno }?, - attribute align { "left" | "right" | "center" | "justify" | "char" }?, - attribute char { text }?, - attribute charoff { text }?, - secur -# doc:Specifications for a column in a table. -colspec = element colspec { colspec.attlist, empty } -colspec.attlist &= - attribute colnum { text }?, - attribute colname { text }?, - attribute colwidth { text }?, - attribute colsep { yesorno }?, - attribute rowsep { yesorno }?, - attribute align { "left" | "right" | "center" | "justify" | "char" }?, - attribute char { text }?, - attribute charoff { text }? -# doc:Formatting information for a spanned column in a table. -spanspec = element spanspec { spanspec.attlist, empty } -spanspec.attlist &= - attribute namest { text }, - attribute nameend { text }, - attribute spanname { text }, - attribute colsep { yesorno }?, - attribute rowsep { yesorno }?, - attribute align { "left" | "right" | "center" | "justify" | "char" }?, - attribute char { text }?, - attribute charoff { text }? -# doc:A table header consisting of one or more rows. -thead = element thead { thead.attlist, tbl.hdft.mdl } -thead.attlist &= - attribute valign { "top" | "middle" | "bottom" }?, - secur -# doc:A table footer consisting of one or more rows. -tfoot = element tfoot { tfoot.attlist, tbl.hdft.mdl } -tfoot.attlist &= - attribute valign { "top" | "middle" | "bottom" }?, - secur -# doc:A wrapper for the rows of a table or informal table. -tbody = element tbody { tbody.attlist, tbl.tbody.mdl } -tbody.attlist &= - attribute valign { "top" | "middle" | "bottom" }?, - secur -# doc:A row in a table. -row = element row { row.attlist, tbl.row.mdl } -row.attlist &= - attribute rowsep { yesorno }?, - attribute valign { "top" | "middle" | "bottom" }?, - secur -# doc:A subtable appearing in place of an Entry in a table. -entrytbl = element entrytbl { entrytbl.attlist, tbl.entrytbl.mdl } -entrytbl.attlist &= - attribute cols { text }, - tbl.tgroup.att, - attribute colname { text }?, - attribute spanname { text }?, - attribute namest { text }?, - attribute nameend { text }?, - attribute colsep { yesorno }?, - attribute rowsep { yesorno }?, - attribute align { "left" | "right" | "center" | "justify" | "char" }?, - attribute char { text }?, - attribute charoff { text }?, - secur -# doc:A cell in a table. -entry = element entry { entry.attlist, tbl.entry.mdl* } -entry.attlist &= - attribute colname { text }?, - attribute namest { text }?, - attribute nameend { text }?, - attribute spanname { text }?, - attribute morerows { text }?, - attribute colsep { yesorno }?, - attribute rowsep { yesorno }?, - attribute align { "left" | "right" | "center" | "justify" | "char" }?, - attribute char { text }?, - attribute charoff { text }?, - attribute rotate { yesorno }?, - attribute valign { "top" | "middle" | "bottom" }?, - secur -# End of DocBook CALS Table Model V4.5 ................................. - -# ...................................................................... diff --git a/docbook-schema/dbhierx.rnc b/docbook-schema/dbhierx.rnc deleted file mode 100644 index 56015a3..0000000 --- a/docbook-schema/dbhierx.rnc +++ /dev/null @@ -1,1549 +0,0 @@ -# ...................................................................... - -# DocBook document hierarchy module V4.5 ............................... - -# File dbhierx.mod ..................................................... - -# Copyright 1992-2004 HaL Computer Systems, Inc., -# O'Reilly & Associates, Inc., ArborText, Inc., Fujitsu Software -# Corporation, Norman Walsh, Sun Microsystems, Inc., and the -# Organization for the Advancement of Structured Information -# Standards (OASIS). -# -# $Id: dbhierx.mod 6340 2006-10-03 13:23:24Z nwalsh $ -# -# Permission to use, copy, modify and distribute the DocBook DTD -# and its accompanying documentation for any purpose and without fee -# is hereby granted in perpetuity, provided that the above copyright -# notice and this paragraph appear in all copies. The copyright -# holders make no representation about the suitability of the DTD for -# any purpose. It is provided "as is" without expressed or implied -# warranty. -# -# If you modify the DocBook DTD in any way, except for declaring and -# referencing additional sets of general entities and declaring -# additional notations, label your DTD as a variant of DocBook. See -# the maintenance documentation for more information. -# -# Please direct all questions, bug reports, or suggestions for -# changes to the docbook@lists.oasis-open.org mailing list. For more -# information, see http://www.oasis-open.org/docbook/. - -# ...................................................................... - -# This module contains the definitions for the overall document -# hierarchies of DocBook documents. It covers computer documentation -# manuals and manual fragments, as well as reference entries (such as -# man pages) and technical journals or anthologies containing -# articles. -# -# This module depends on the DocBook information pool module. All -# elements and entities referenced but not defined here are assumed -# to be defined in the information pool module. -# -# In DTD driver files referring to this module, please use an entity -# declaration that uses the public identifier shown below: -# -# -# %dbhier; -# -# See the documentation for detailed information on the parameter -# entity and module scheme used in DocBook, customizing DocBook and -# planning for interchange, and changes made since the last release -# of DocBook. - -# ...................................................................... - -# Entities for module inclusions ....................................... - -# ...................................................................... - -# Entities for element classes ......................................... - -local.appendix.class = notAllowed -appendix.class = appendix | local.appendix.class -local.article.class = notAllowed -article.class = article | local.article.class -local.book.class = notAllowed -book.class = book | local.book.class -local.chapter.class = notAllowed -chapter.class = chapter | local.chapter.class -local.index.class = notAllowed -index.class = index | setindex | local.index.class -local.refentry.class = notAllowed -refentry.class = refentry | local.refentry.class -local.section.class = notAllowed -section.class = section | local.section.class -local.nav.class = notAllowed -nav.class = - toc | lot | index | glossary | bibliography | local.nav.class -# Redeclaration placeholder ............................................ - -# For redeclaring entities that are declared after this point while -# retaining their references to the entities that are declared before -# this point - -# ...................................................................... - -# Entities for element mixtures ........................................ -local.divcomponent.mix = notAllowed -divcomponent.mix = - list.class - | admon.class - | linespecific.class - | synop.class - | para.class - | informal.class - | formal.class - | compound.class - | genobj.class - | descobj.class - | ndxterm.class - | beginpage - | forms.hook - | local.divcomponent.mix -local.refcomponent.mix = notAllowed -refcomponent.mix = - list.class - | admon.class - | linespecific.class - | synop.class - | para.class - | informal.class - | formal.class - | compound.class - | genobj.class - | descobj.class - | ndxterm.class - | beginpage - | forms.hook - | local.refcomponent.mix -local.indexdivcomponent.mix = notAllowed -indexdivcomponent.mix = - itemizedlist - | orderedlist - | variablelist - | simplelist - | linespecific.class - | synop.class - | para.class - | informal.class - | anchor - | remark - | link.char.class - | beginpage - | local.indexdivcomponent.mix -local.refname.char.mix = notAllowed -refname.char.mix = text | tech.char.class | local.refname.char.mix -local.partcontent.mix = notAllowed -partcontent.mix = - appendix.class - | chapter.class - | nav.class - | article.class - | preface - | refentry.class - | reference - | local.partcontent.mix -local.refinline.char.mix = notAllowed -refinline.char.mix = - text - | xref.char.class - | gen.char.class - | link.char.class - | tech.char.class - | base.char.class - | docinfo.char.class - | other.char.class - | ndxterm.class - | beginpage - | local.refinline.char.mix -local.refclass.char.mix = notAllowed -refclass.char.mix = text | application | local.refclass.char.mix -# Redeclaration placeholder 2 .......................................... - -# For redeclaring entities that are declared after this point while -# retaining their references to the entities that are declared before -# this point - -# ...................................................................... - -# Entities for content models .......................................... -div.title.content = title, subtitle?, titleabbrev? -bookcomponent.title.content = title, subtitle?, titleabbrev? -sect.title.content = title, subtitle?, titleabbrev? -refsect.title.content = title, subtitle?, titleabbrev? -bookcomponent.content = - (divcomponent.mix+, - (sect1* | refentry.class* | simplesect* | section.class*)) - | (sect1+ | refentry.class+ | simplesect+ | section.class+) -# ...................................................................... - -# Set and SetInfo ...................................................... -local.set.attrib = empty -set.role.attrib = role.attrib -# doc:A collection of books. -set = - element set { - set.attlist, - div.title.content?, - setinfo?, - toc?, - (set | book.class)+, - setindex? - } -# end of set.element - -# FPI: SGML formal public identifier -set.attlist &= - attribute fpi { text }?, - status.attrib, - common.attrib, - set.role.attrib, - local.set.attrib -# end of set.attlist - -# end of set.module -local.setinfo.attrib = empty -setinfo.role.attrib = role.attrib -# doc:Meta-information for a Set. -setinfo = element setinfo { setinfo.attlist, info.class+ } -# end of setinfo.element - -# Contents: IDs of the ToC, Books, and SetIndex that comprise -# the set, in the order of their appearance -setinfo.attlist &= - attribute contents { xsd:IDREFS }?, - common.attrib, - setinfo.role.attrib, - local.setinfo.attrib -# end of setinfo.attlist - -# end of setinfo.module - -# end of set.content.module - -# ...................................................................... - -# Book and BookInfo .................................................... -local.book.attrib = empty -book.role.attrib = role.attrib -# doc:A book. -book = - element book { - book.attlist, - div.title.content?, - bookinfo?, - (dedication - | toc - | lot - | glossary - | bibliography - | preface - | chapter.class - | reference - | part - | article.class - | appendix.class - | index.class - | colophon)* - } -# end of book.element - -# FPI: SGML formal public identifier -book.attlist &= - attribute fpi { text }?, - label.attrib, - status.attrib, - common.attrib, - book.role.attrib, - local.book.attrib -# end of book.attlist - -# end of book.module -local.bookinfo.attrib = empty -bookinfo.role.attrib = role.attrib -# doc:Meta-information for a Book. -bookinfo = element bookinfo { bookinfo.attlist, info.class+ } -# end of bookinfo.element - -# Contents: IDs of the ToC, LoTs, Prefaces, Parts, Chapters, -# Appendixes, References, GLossary, Bibliography, and indexes -# comprising the Book, in the order of their appearance -bookinfo.attlist &= - attribute contents { xsd:IDREFS }?, - common.attrib, - bookinfo.role.attrib, - local.bookinfo.attrib -# end of bookinfo.attlist - -# end of bookinfo.module - -# end of book.content.module - -# ...................................................................... - -# Dedication, ToC, and LoT ............................................. -local.dedication.attrib = empty -dedication.role.attrib = role.attrib -# doc:A wrapper for the dedication section of a book. -dedication = - element dedication { - dedication.attlist, sect.title.content?, legalnotice.mix+ - } -# end of dedication.element -dedication.attlist &= - status.attrib, - common.attrib, - dedication.role.attrib, - local.dedication.attrib -# end of dedication.attlist - -# end of dedication.module -local.colophon.attrib = empty -colophon.role.attrib = role.attrib -# doc:Text at the back of a book describing facts about its production. -colophon = - element colophon { - colophon.attlist, sect.title.content?, textobject.mix+ - } -# end of colophon.element -colophon.attlist &= - status.attrib, - common.attrib, - colophon.role.attrib, - local.colophon.attrib -# end of colophon.attlist - -# end of colophon.module -local.toc.attrib = empty -toc.role.attrib = role.attrib -# doc:A table of contents. -toc = - element toc { - toc.attlist, - beginpage?, - bookcomponent.title.content?, - tocfront*, - (tocpart | tocchap)*, - tocback* - } -# end of toc.element -toc.attlist &= - pagenum.attrib, common.attrib, toc.role.attrib, local.toc.attrib -# end of toc.attlist - -# end of toc.module -local.tocfront.attrib = empty -tocfront.role.attrib = role.attrib -# doc:An entry in a table of contents for a front matter component. -tocfront = element tocfront { tocfront.attlist, para.char.mix* } -# end of tocfront.element - -# to element that this entry represents -tocfront.attlist &= - label.attrib, - linkend.attrib, - pagenum.attrib, - common.attrib, - tocfront.role.attrib, - local.tocfront.attrib -# end of tocfront.attlist - -# end of tocfront.module -local.tocentry.attrib = empty -tocentry.role.attrib = role.attrib -# doc:A component title in a table of contents. -tocentry = element tocentry { tocentry.attlist, para.char.mix* } -# end of tocentry.element - -# to element that this entry represents -tocentry.attlist &= - linkend.attrib, - pagenum.attrib, - common.attrib, - tocentry.role.attrib, - local.tocentry.attrib -# end of tocentry.attlist - -# end of tocentry.module -local.tocpart.attrib = empty -tocpart.role.attrib = role.attrib -# doc:An entry in a table of contents for a part of a book. -tocpart = element tocpart { tocpart.attlist, tocentry+, tocchap* } -# end of tocpart.element -tocpart.attlist &= - common.attrib, tocpart.role.attrib, local.tocpart.attrib -# end of tocpart.attlist - -# end of tocpart.module -local.tocchap.attrib = empty -tocchap.role.attrib = role.attrib -# doc:An entry in a table of contents for a component in the body of a document. -tocchap = element tocchap { tocchap.attlist, tocentry+, toclevel1* } -# end of tocchap.element -tocchap.attlist &= - label.attrib, common.attrib, tocchap.role.attrib, local.tocchap.attrib -# end of tocchap.attlist - -# end of tocchap.module -local.toclevel1.attrib = empty -toclevel1.role.attrib = role.attrib -# doc:A top-level entry within a table of contents entry for a chapter-like component. -toclevel1 = - element toclevel1 { toclevel1.attlist, tocentry+, toclevel2* } -# end of toclevel1.element -toclevel1.attlist &= - common.attrib, toclevel1.role.attrib, local.toclevel1.attrib -# end of toclevel1.attlist - -# end of toclevel1.module -local.toclevel2.attrib = empty -toclevel2.role.attrib = role.attrib -# doc:A second-level entry within a table of contents entry for a chapter-like component. -toclevel2 = - element toclevel2 { toclevel2.attlist, tocentry+, toclevel3* } -# end of toclevel2.element -toclevel2.attlist &= - common.attrib, toclevel2.role.attrib, local.toclevel2.attrib -# end of toclevel2.attlist - -# end of toclevel2.module -local.toclevel3.attrib = empty -toclevel3.role.attrib = role.attrib -# doc:A third-level entry within a table of contents entry for a chapter-like component. -toclevel3 = - element toclevel3 { toclevel3.attlist, tocentry+, toclevel4* } -# end of toclevel3.element -toclevel3.attlist &= - common.attrib, toclevel3.role.attrib, local.toclevel3.attrib -# end of toclevel3.attlist - -# end of toclevel3.module -local.toclevel4.attrib = empty -toclevel4.role.attrib = role.attrib -# doc:A fourth-level entry within a table of contents entry for a chapter-like component. -toclevel4 = - element toclevel4 { toclevel4.attlist, tocentry+, toclevel5* } -# end of toclevel4.element -toclevel4.attlist &= - common.attrib, toclevel4.role.attrib, local.toclevel4.attrib -# end of toclevel4.attlist - -# end of toclevel4.module -local.toclevel5.attrib = empty -toclevel5.role.attrib = role.attrib -# doc:A fifth-level entry within a table of contents entry for a chapter-like component. -toclevel5 = element toclevel5 { toclevel5.attlist, tocentry+ } -# end of toclevel5.element -toclevel5.attlist &= - common.attrib, toclevel5.role.attrib, local.toclevel5.attrib -# end of toclevel5.attlist - -# end of toclevel5.module -local.tocback.attrib = empty -tocback.role.attrib = role.attrib -# doc:An entry in a table of contents for a back matter component. -tocback = element tocback { tocback.attlist, para.char.mix* } -# end of tocback.element - -# to element that this entry represents -tocback.attlist &= - label.attrib, - linkend.attrib, - pagenum.attrib, - common.attrib, - tocback.role.attrib, - local.tocback.attrib -# end of tocback.attlist - -# end of tocback.module - -# end of toc.content.module -local.lot.attrib = empty -lot.role.attrib = role.attrib -# doc:A list of the titles of formal objects (as tables or figures) in a document. -lot = - element lot { - lot.attlist, beginpage?, bookcomponent.title.content?, lotentry* - } -# end of lot.element -lot.attlist &= - label.attrib, common.attrib, lot.role.attrib, local.lot.attrib -# end of lot.attlist - -# end of lot.module -local.lotentry.attrib = empty -lotentry.role.attrib = role.attrib -# doc:An entry in a list of titles. -lotentry = element lotentry { lotentry.attlist, para.char.mix* } -# end of lotentry.element - -# SrcCredit: Information about the source of the entry, -# as for a list of illustrations - -# linkend: to element that this entry represents -lotentry.attlist &= - linkend.attrib, - pagenum.attrib, - attribute srccredit { text }?, - common.attrib, - lotentry.role.attrib, - local.lotentry.attrib -# end of lotentry.attlist - -# end of lotentry.module - -# end of lot.content.module - -# ...................................................................... - -# Appendix, Chapter, Part, Preface, Reference, PartIntro ............... -local.appendix.attrib = empty -appendix.role.attrib = role.attrib -# doc:An appendix in a Book or Article. -appendix = - element appendix { - appendix.attlist, - beginpage?, - appendixinfo?, - bookcomponent.title.content, - nav.class*, - tocchap?, - bookcomponent.content, - nav.class* - } -# end of appendix.element -appendix.attlist &= - label.attrib, - status.attrib, - common.attrib, - appendix.role.attrib, - local.appendix.attrib -# end of appendix.attlist - -# end of appendix.module -local.chapter.attrib = empty -chapter.role.attrib = role.attrib -# doc:A chapter, as of a book. -chapter = - element chapter { - chapter.attlist, - beginpage?, - chapterinfo?, - bookcomponent.title.content, - nav.class*, - tocchap?, - bookcomponent.content, - nav.class* - } -# end of chapter.element -chapter.attlist &= - label.attrib, - status.attrib, - common.attrib, - chapter.role.attrib, - local.chapter.attrib -# end of chapter.attlist - -# end of chapter.module - -# Note that Part was to have its content model reduced in V4.5. This -# change will not be made after all. -local.part.attrib = empty -part.role.attrib = role.attrib -# doc:A division in a book. -part = - element part { - part.attlist, - beginpage?, - partinfo?, - bookcomponent.title.content, - partintro?, - partcontent.mix+ - } -# end of part.element -part.attlist &= - label.attrib, - status.attrib, - common.attrib, - part.role.attrib, - local.part.attrib -# end of part.attlist - -# ELEMENT PartIntro (defined below) - -# end of part.module -local.preface.attrib = empty -preface.role.attrib = role.attrib -# doc:Introductory matter preceding the first chapter of a book. -preface = - element preface { - preface.attlist, - beginpage?, - prefaceinfo?, - bookcomponent.title.content, - nav.class*, - tocchap?, - bookcomponent.content, - nav.class* - } -# end of preface.element -preface.attlist &= - status.attrib, - common.attrib, - preface.role.attrib, - local.preface.attrib -# end of preface.attlist - -# end of preface.module -local.reference.attrib = empty -reference.role.attrib = role.attrib -# doc:A collection of reference entries. -reference = - element reference { - reference.attlist, - beginpage?, - referenceinfo?, - bookcomponent.title.content, - partintro?, - refentry.class+ - } -# end of reference.element -reference.attlist &= - label.attrib, - status.attrib, - common.attrib, - reference.role.attrib, - local.reference.attrib -# end of reference.attlist - -# ELEMENT PartIntro (defined below) - -# end of reference.module -local.partintro.attrib = empty -partintro.role.attrib = role.attrib -# doc:An introduction to the contents of a part. -partintro = - element partintro { - partintro.attlist, div.title.content?, bookcomponent.content - } -# end of partintro.element -partintro.attlist &= - label.attrib, - common.attrib, - partintro.role.attrib, - local.partintro.attrib -# end of partintro.attlist - -# end of partintro.module - -# ...................................................................... - -# Other Info elements .................................................. -local.appendixinfo.attrib = empty -appendixinfo.role.attrib = role.attrib -# doc:Meta-information for an Appendix. -appendixinfo = - element appendixinfo { appendixinfo.attlist, info.class+ } -# end of appendixinfo.element -appendixinfo.attlist &= - common.attrib, appendixinfo.role.attrib, local.appendixinfo.attrib -# end of appendixinfo.attlist - -# end of appendixinfo.module -local.bibliographyinfo.attrib = empty -bibliographyinfo.role.attrib = role.attrib -# doc:Meta-information for a Bibliography. -bibliographyinfo = - element bibliographyinfo { bibliographyinfo.attlist, info.class+ } -# end of bibliographyinfo.element -bibliographyinfo.attlist &= - common.attrib, - bibliographyinfo.role.attrib, - local.bibliographyinfo.attrib -# end of bibliographyinfo.attlist - -# end of bibliographyinfo.module -local.chapterinfo.attrib = empty -chapterinfo.role.attrib = role.attrib -# doc:Meta-information for a Chapter. -chapterinfo = element chapterinfo { chapterinfo.attlist, info.class+ } -# end of chapterinfo.element -chapterinfo.attlist &= - common.attrib, chapterinfo.role.attrib, local.chapterinfo.attrib -# end of chapterinfo.attlist - -# end of chapterinfo.module -local.glossaryinfo.attrib = empty -glossaryinfo.role.attrib = role.attrib -# doc:Meta-information for a Glossary. -glossaryinfo = - element glossaryinfo { glossaryinfo.attlist, info.class+ } -# end of glossaryinfo.element -glossaryinfo.attlist &= - common.attrib, glossaryinfo.role.attrib, local.glossaryinfo.attrib -# end of glossaryinfo.attlist - -# end of glossaryinfo.module -local.indexinfo.attrib = empty -indexinfo.role.attrib = role.attrib -# doc:Meta-information for an Index. -indexinfo = element indexinfo { indexinfo.attlist, info.class+ } -# end of indexinfo.element -indexinfo.attlist &= - common.attrib, indexinfo.role.attrib, local.indexinfo.attrib -# end of indexinfo.attlist - -# end of indexinfo.module -local.setindexinfo.attrib = empty -setindexinfo.role.attrib = role.attrib -# doc:Meta-information for a SetIndex. -setindexinfo = - element setindexinfo { setindexinfo.attlist, info.class+ } -# end of setindexinfo.element -setindexinfo.attlist &= - common.attrib, setindexinfo.role.attrib, local.setindexinfo.attrib -# end of setindexinfo.attlist - -# end of setindexinfo.module -local.partinfo.attrib = empty -partinfo.role.attrib = role.attrib -# doc:Meta-information for a Part. -partinfo = element partinfo { partinfo.attlist, info.class+ } -# end of partinfo.element -partinfo.attlist &= - common.attrib, partinfo.role.attrib, local.partinfo.attrib -# end of partinfo.attlist - -# end of partinfo.module -local.prefaceinfo.attrib = empty -prefaceinfo.role.attrib = role.attrib -# doc:Meta-information for a Preface. -prefaceinfo = element prefaceinfo { prefaceinfo.attlist, info.class+ } -# end of prefaceinfo.element -prefaceinfo.attlist &= - common.attrib, prefaceinfo.role.attrib, local.prefaceinfo.attrib -# end of prefaceinfo.attlist - -# end of prefaceinfo.module -local.refentryinfo.attrib = empty -refentryinfo.role.attrib = role.attrib -# doc:Meta-information for a Refentry. -refentryinfo = - element refentryinfo { refentryinfo.attlist, info.class+ } -# end of refentryinfo.element -refentryinfo.attlist &= - common.attrib, refentryinfo.role.attrib, local.refentryinfo.attrib -# end of refentryinfo.attlist - -# end of refentryinfo.module -local.refsectioninfo.attrib = empty -refsectioninfo.role.attrib = role.attrib -# doc:Meta-information for a refsection. -refsectioninfo = - element refsectioninfo { refsectioninfo.attlist, info.class+ } -# end of refsectioninfo.element -refsectioninfo.attlist &= - common.attrib, refsectioninfo.role.attrib, local.refsectioninfo.attrib -# end of refsectioninfo.attlist - -# end of refsectioninfo.module -local.refsect1info.attrib = empty -refsect1info.role.attrib = role.attrib -# doc:Meta-information for a RefSect1. -refsect1info = - element refsect1info { refsect1info.attlist, info.class+ } -# end of refsect1info.element -refsect1info.attlist &= - common.attrib, refsect1info.role.attrib, local.refsect1info.attrib -# end of refsect1info.attlist - -# end of refsect1info.module -local.refsect2info.attrib = empty -refsect2info.role.attrib = role.attrib -# doc:Meta-information for a RefSect2. -refsect2info = - element refsect2info { refsect2info.attlist, info.class+ } -# end of refsect2info.element -refsect2info.attlist &= - common.attrib, refsect2info.role.attrib, local.refsect2info.attrib -# end of refsect2info.attlist - -# end of refsect2info.module -local.refsect3info.attrib = empty -refsect3info.role.attrib = role.attrib -# doc:Meta-information for a RefSect3. -refsect3info = - element refsect3info { refsect3info.attlist, info.class+ } -# end of refsect3info.element -refsect3info.attlist &= - common.attrib, refsect3info.role.attrib, local.refsect3info.attrib -# end of refsect3info.attlist - -# end of refsect3info.module -local.refsynopsisdivinfo.attrib = empty -refsynopsisdivinfo.role.attrib = role.attrib -# doc:Meta-information for a RefSynopsisDiv. -refsynopsisdivinfo = - element refsynopsisdivinfo { refsynopsisdivinfo.attlist, info.class+ } -# end of refsynopsisdivinfo.element -refsynopsisdivinfo.attlist &= - common.attrib, - refsynopsisdivinfo.role.attrib, - local.refsynopsisdivinfo.attrib -# end of refsynopsisdivinfo.attlist - -# end of refsynopsisdivinfo.module -local.referenceinfo.attrib = empty -referenceinfo.role.attrib = role.attrib -# doc:Meta-information for a Reference. -referenceinfo = - element referenceinfo { referenceinfo.attlist, info.class+ } -# end of referenceinfo.element -referenceinfo.attlist &= - common.attrib, referenceinfo.role.attrib, local.referenceinfo.attrib -# end of referenceinfo.attlist - -# end of referenceinfo.module -local.sect1info.attrib = empty -sect1info.role.attrib = role.attrib -# doc:Meta-information for a Sect1. -sect1info = element sect1info { sect1info.attlist, info.class+ } -# end of sect1info.element -sect1info.attlist &= - common.attrib, sect1info.role.attrib, local.sect1info.attrib -# end of sect1info.attlist -local.sect2info.attrib = empty -sect2info.role.attrib = role.attrib -# doc:Meta-information for a Sect2. -sect2info = element sect2info { sect2info.attlist, info.class+ } -# end of sect2info.element -sect2info.attlist &= - common.attrib, sect2info.role.attrib, local.sect2info.attrib -# end of sect2info.attlist -local.sect3info.attrib = empty -sect3info.role.attrib = role.attrib -# doc:Meta-information for a Sect3. -sect3info = element sect3info { sect3info.attlist, info.class+ } -# end of sect3info.element -sect3info.attlist &= - common.attrib, sect3info.role.attrib, local.sect3info.attrib -# end of sect3info.attlist -local.sect4info.attrib = empty -sect4info.role.attrib = role.attrib -# doc:Meta-information for a Sect4. -sect4info = element sect4info { sect4info.attlist, info.class+ } -# end of sect4info.element -sect4info.attlist &= - common.attrib, sect4info.role.attrib, local.sect4info.attrib -# end of sect4info.attlist -local.sect5info.attrib = empty -sect5info.role.attrib = role.attrib -# doc:Meta-information for a Sect5. -sect5info = element sect5info { sect5info.attlist, info.class+ } -# end of sect5info.element -sect5info.attlist &= - common.attrib, sect5info.role.attrib, local.sect5info.attrib -# end of sect5info.attlist - -# ...................................................................... - -# Section (parallel to Sect*) ......................................... -local.section.attrib = empty -section.role.attrib = role.attrib -# doc:A recursive section. -section = - element section { - section.attlist, - sectioninfo?, - sect.title.content, - nav.class*, - ((divcomponent.mix+, - (refentry.class* | section.class* | simplesect*)) - | refentry.class+ - | section.class+ - | simplesect+), - nav.class* - } -# end of section.element -section.attlist &= - label.attrib, - status.attrib, - common.attrib, - section.role.attrib, - local.section.attrib -# end of section.attlist - -# end of section.module -sectioninfo.role.attrib = role.attrib -local.sectioninfo.attrib = empty -# doc:Meta-information for a recursive section. -sectioninfo = element sectioninfo { sectioninfo.attlist, info.class+ } -# end of sectioninfo.element -sectioninfo.attlist &= - common.attrib, sectioninfo.role.attrib, local.sectioninfo.attrib -# end of sectioninfo.attlist - -# end of sectioninfo.module - -# end of section.content.module - -# ...................................................................... - -# Sect1, Sect2, Sect3, Sect4, Sect5 .................................... -local.sect1.attrib = empty -sect1.role.attrib = role.attrib -# doc:A top-level section of document. -sect1 = - element sect1 { - sect1.attlist, - sect1info?, - sect.title.content, - nav.class*, - ((divcomponent.mix+, (refentry.class* | sect2* | simplesect*)) - | refentry.class+ - | sect2+ - | simplesect+), - nav.class* - } -# end of sect1.element - -# Renderas: Indicates the format in which the heading should -# appear -sect1.attlist &= - attribute renderas { "sect2" | "sect3" | "sect4" | "sect5" }?, - label.attrib, - status.attrib, - common.attrib, - sect1.role.attrib, - local.sect1.attrib -# end of sect1.attlist - -# end of sect1.module -local.sect2.attrib = empty -sect2.role.attrib = role.attrib -# doc:A subsection within a Sect1. -sect2 = - element sect2 { - sect2.attlist, - sect2info?, - sect.title.content, - nav.class*, - ((divcomponent.mix+, (refentry.class* | sect3* | simplesect*)) - | refentry.class+ - | sect3+ - | simplesect+), - nav.class* - } -# end of sect2.element - -# Renderas: Indicates the format in which the heading should -# appear -sect2.attlist &= - attribute renderas { "sect1" | "sect3" | "sect4" | "sect5" }?, - label.attrib, - status.attrib, - common.attrib, - sect2.role.attrib, - local.sect2.attrib -# end of sect2.attlist - -# end of sect2.module -local.sect3.attrib = empty -sect3.role.attrib = role.attrib -# doc:A subsection within a Sect2. -sect3 = - element sect3 { - sect3.attlist, - sect3info?, - sect.title.content, - nav.class*, - ((divcomponent.mix+, (refentry.class* | sect4* | simplesect*)) - | refentry.class+ - | sect4+ - | simplesect+), - nav.class* - } -# end of sect3.element - -# Renderas: Indicates the format in which the heading should -# appear -sect3.attlist &= - attribute renderas { "sect1" | "sect2" | "sect4" | "sect5" }?, - label.attrib, - status.attrib, - common.attrib, - sect3.role.attrib, - local.sect3.attrib -# end of sect3.attlist - -# end of sect3.module -local.sect4.attrib = empty -sect4.role.attrib = role.attrib -# doc:A subsection within a Sect3. -sect4 = - element sect4 { - sect4.attlist, - sect4info?, - sect.title.content, - nav.class*, - ((divcomponent.mix+, (refentry.class* | sect5* | simplesect*)) - | refentry.class+ - | sect5+ - | simplesect+), - nav.class* - } -# end of sect4.element - -# Renderas: Indicates the format in which the heading should -# appear -sect4.attlist &= - attribute renderas { "sect1" | "sect2" | "sect3" | "sect5" }?, - label.attrib, - status.attrib, - common.attrib, - sect4.role.attrib, - local.sect4.attrib -# end of sect4.attlist - -# end of sect4.module -local.sect5.attrib = empty -sect5.role.attrib = role.attrib -# doc:A subsection within a Sect4. -sect5 = - element sect5 { - sect5.attlist, - sect5info?, - sect.title.content, - nav.class*, - ((divcomponent.mix+, (refentry.class* | simplesect*)) - | refentry.class+ - | simplesect+), - nav.class* - } -# end of sect5.element - -# Renderas: Indicates the format in which the heading should -# appear -sect5.attlist &= - attribute renderas { "sect1" | "sect2" | "sect3" | "sect4" }?, - label.attrib, - status.attrib, - common.attrib, - sect5.role.attrib, - local.sect5.attrib -# end of sect5.attlist - -# end of sect5.module -local.simplesect.attrib = empty -simplesect.role.attrib = role.attrib -# doc:A section of a document with no subdivisions. -simplesect = - element simplesect { - simplesect.attlist, sect.title.content, divcomponent.mix+ - } -# end of simplesect.element -simplesect.attlist &= - common.attrib, simplesect.role.attrib, local.simplesect.attrib -# end of simplesect.attlist - -# end of simplesect.module - -# ...................................................................... - -# Bibliography ......................................................... -local.bibliography.attrib = empty -bibliography.role.attrib = role.attrib -# doc:A bibliography. -bibliography = - element bibliography { - bibliography.attlist, - bibliographyinfo?, - bookcomponent.title.content?, - component.mix*, - (bibliodiv+ | (biblioentry | bibliomixed)+) - } -# end of bibliography.element -bibliography.attlist &= - status.attrib, - common.attrib, - bibliography.role.attrib, - local.bibliography.attrib -# end of bibliography.attlist - -# end of bibliography.module -local.bibliodiv.attrib = empty -bibliodiv.role.attrib = role.attrib -# doc:A section of a Bibliography. -bibliodiv = - element bibliodiv { - bibliodiv.attlist, - sect.title.content?, - component.mix*, - (biblioentry | bibliomixed)+ - } -# end of bibliodiv.element -bibliodiv.attlist &= - status.attrib, - common.attrib, - bibliodiv.role.attrib, - local.bibliodiv.attrib -# end of bibliodiv.attlist - -# end of bibliodiv.module - -# end of bibliography.content.module - -# ...................................................................... - -# Glossary ............................................................. -local.glossary.attrib = empty -glossary.role.attrib = role.attrib -# doc:A glossary. -glossary = - element glossary { - glossary.attlist, - glossaryinfo?, - bookcomponent.title.content?, - component.mix*, - (glossdiv+ | glossentry+), - bibliography? - } -# end of glossary.element -glossary.attlist &= - status.attrib, - common.attrib, - glossary.role.attrib, - local.glossary.attrib -# end of glossary.attlist - -# end of glossary.module -local.glossdiv.attrib = empty -glossdiv.role.attrib = role.attrib -# doc:A division in a Glossary. -glossdiv = - element glossdiv { - glossdiv.attlist, sect.title.content, component.mix*, glossentry+ - } -# end of glossdiv.element -glossdiv.attlist &= - status.attrib, - common.attrib, - glossdiv.role.attrib, - local.glossdiv.attrib -# end of glossdiv.attlist - -# end of glossdiv.module - -# end of glossary.content.module - -# ...................................................................... - -# Index and SetIndex ................................................... -local.indexes.attrib = empty -indexes.role.attrib = role.attrib -# doc:An index. -index = - element index { - index.attlist, - indexinfo?, - bookcomponent.title.content?, - component.mix*, - (indexdiv* | indexentry*) - } -# end of index.element -index.attlist &= - attribute type { text }?, - common.attrib, - indexes.role.attrib, - local.indexes.attrib -# end of index.attlist - -# doc:An index to a set of books. -setindex = - element setindex { - setindex.attlist, - setindexinfo?, - bookcomponent.title.content?, - component.mix*, - (indexdiv* | indexentry*) - } -# end of setindex.element -setindex.attlist &= - common.attrib, indexes.role.attrib, local.indexes.attrib -# end of setindex.attlist - -# end of indexes.module - -# SegmentedList in this content is useful for marking up permuted -# indices. -local.indexdiv.attrib = empty -indexdiv.role.attrib = role.attrib -# doc:A division in an index. -indexdiv = - element indexdiv { - indexdiv.attlist, - sect.title.content?, - (indexdivcomponent.mix*, (indexentry+ | segmentedlist)) - } -# end of indexdiv.element -indexdiv.attlist &= - common.attrib, indexdiv.role.attrib, local.indexdiv.attrib -# end of indexdiv.attlist - -# end of indexdiv.module - -# Index entries appear in the index, not the text. -local.indexentry.attrib = empty -indexentry.role.attrib = role.attrib -# doc:An entry in an index. -indexentry = - element indexentry { - indexentry.attlist, - primaryie, - (seeie | seealsoie)*, - (secondaryie, (seeie | seealsoie | tertiaryie)*)* - } -# end of indexentry.element -indexentry.attlist &= - common.attrib, indexentry.role.attrib, local.indexentry.attrib -# end of indexentry.attlist - -# end of indexentry.module -local.primsecterie.attrib = empty -primsecterie.role.attrib = role.attrib -# doc:A primary term in an index entry, not in the text. -primaryie = element primaryie { primaryie.attlist, ndxterm.char.mix* } -# end of primaryie.element - -# to IndexTerms that these entries represent -primaryie.attlist &= - linkends.attrib, - common.attrib, - primsecterie.role.attrib, - local.primsecterie.attrib -# end of primaryie.attlist - -# doc:A secondary term in an index entry, rather than in the text. -secondaryie = - element secondaryie { secondaryie.attlist, ndxterm.char.mix* } -# end of secondaryie.element - -# to IndexTerms that these entries represent -secondaryie.attlist &= - linkends.attrib, - common.attrib, - primsecterie.role.attrib, - local.primsecterie.attrib -# end of secondaryie.attlist - -# doc:A tertiary term in an index entry, rather than in the text. -tertiaryie = - element tertiaryie { tertiaryie.attlist, ndxterm.char.mix* } -# end of tertiaryie.element - -# to IndexTerms that these entries represent -tertiaryie.attlist &= - linkends.attrib, - common.attrib, - primsecterie.role.attrib, - local.primsecterie.attrib -# end of tertiaryie.attlist - -# end of primsecterie.module -local.seeie.attrib = empty -seeie.role.attrib = role.attrib -# doc:A See entry in an index, rather than in the text. -seeie = element seeie { seeie.attlist, ndxterm.char.mix* } -# end of seeie.element - -# to IndexEntry to look up -seeie.attlist &= - linkend.attrib, common.attrib, seeie.role.attrib, local.seeie.attrib -# end of seeie.attlist - -# end of seeie.module -local.seealsoie.attrib = empty -seealsoie.role.attrib = role.attrib -# doc:A See also entry in an index, rather than in the text. -seealsoie = element seealsoie { seealsoie.attlist, ndxterm.char.mix* } -# end of seealsoie.element - -# to related IndexEntries -seealsoie.attlist &= - linkends.attrib, - common.attrib, - seealsoie.role.attrib, - local.seealsoie.attrib -# end of seealsoie.attlist - -# end of seealsoie.module - -# end of index.content.module - -# ...................................................................... - -# RefEntry ............................................................. -local.refentry.attrib = empty -refentry.role.attrib = role.attrib -# doc:A reference page (originally a UNIX man-style reference page). -refentry = - element refentry { - refentry.attlist, - beginpage?, - ndxterm.class*, - refentryinfo?, - refmeta?, - (remark | link.char.class)*, - refnamediv+, - refsynopsisdiv?, - (refsect1+ | refsection+) - } -# end of refentry.element -refentry.attlist &= - status.attrib, - common.attrib, - refentry.role.attrib, - local.refentry.attrib -# end of refentry.attlist - -# end of refentry.module -local.refmeta.attrib = empty -refmeta.role.attrib = role.attrib -# doc:Meta-information for a reference entry. -refmeta = - element refmeta { - refmeta.attlist, - ndxterm.class*, - refentrytitle, - manvolnum?, - refmiscinfo*, - ndxterm.class* - } -# end of refmeta.element -refmeta.attlist &= - common.attrib, refmeta.role.attrib, local.refmeta.attrib -# end of refmeta.attlist - -# end of refmeta.module -local.refmiscinfo.attrib = empty -refmiscinfo.role.attrib = role.attrib -# doc:Meta-information for a reference entry other than the title and volume number. -refmiscinfo = - element refmiscinfo { refmiscinfo.attlist, docinfo.char.mix* } -# end of refmiscinfo.element - -# Class: Freely assignable parameter; no default -refmiscinfo.attlist &= - attribute class { text }?, - common.attrib, - refmiscinfo.role.attrib, - local.refmiscinfo.attrib -# end of refmiscinfo.attlist - -# end of refmiscinfo.module -local.refnamediv.attrib = empty -refnamediv.role.attrib = role.attrib -# doc:The name, purpose, and classification of a reference page. -refnamediv = - element refnamediv { - refnamediv.attlist, - refdescriptor?, - refname+, - refpurpose, - refclass*, - (remark | link.char.class)* - } -# end of refnamediv.element -refnamediv.attlist &= - common.attrib, refnamediv.role.attrib, local.refnamediv.attrib -# end of refnamediv.attlist - -# end of refnamediv.module -local.refdescriptor.attrib = empty -refdescriptor.role.attrib = role.attrib -# doc:A description of the topic of a reference page. -refdescriptor = - element refdescriptor { refdescriptor.attlist, refname.char.mix* } -# end of refdescriptor.element -refdescriptor.attlist &= - common.attrib, refdescriptor.role.attrib, local.refdescriptor.attrib -# end of refdescriptor.attlist - -# end of refdescriptor.module -local.refname.attrib = empty -refname.role.attrib = role.attrib -# doc:The name of (one of) the subject(s) of a reference page. -refname = element refname { refname.attlist, refname.char.mix* } -# end of refname.element -refname.attlist &= - common.attrib, refname.role.attrib, local.refname.attrib -# end of refname.attlist - -# end of refname.module -local.refpurpose.attrib = empty -refpurpose.role.attrib = role.attrib -# doc:A short (one sentence) synopsis of the topic of a reference page. -refpurpose = - element refpurpose { refpurpose.attlist, refinline.char.mix* } -# end of refpurpose.element -refpurpose.attlist &= - common.attrib, refpurpose.role.attrib, local.refpurpose.attrib -# end of refpurpose.attlist - -# end of refpurpose.module -local.refclass.attrib = empty -refclass.role.attrib = role.attrib -# doc:The scope or other indication of applicability of a reference entry. -refclass = element refclass { refclass.attlist, refclass.char.mix* } -# end of refclass.element -refclass.attlist &= - common.attrib, refclass.role.attrib, local.refclass.attrib -# end of refclass.attlist - -# end of refclass.module -local.refsynopsisdiv.attrib = empty -refsynopsisdiv.role.attrib = role.attrib -# doc:A syntactic synopsis of the subject of the reference page. -refsynopsisdiv = - element refsynopsisdiv { - refsynopsisdiv.attlist, - refsynopsisdivinfo?, - refsect.title.content?, - ((refcomponent.mix+, refsect2*) | refsect2+) - } -# end of refsynopsisdiv.element -refsynopsisdiv.attlist &= - common.attrib, refsynopsisdiv.role.attrib, local.refsynopsisdiv.attrib -# end of refsynopsisdiv.attlist - -# end of refsynopsisdiv.module -local.refsection.attrib = empty -refsection.role.attrib = role.attrib -# doc:A recursive section in a refentry. -refsection = - element refsection { - refsection.attlist, - refsectioninfo?, - refsect.title.content, - ((refcomponent.mix+, refsection*) | refsection+) - } -# end of refsection.element -refsection.attlist &= - status.attrib, - common.attrib, - refsection.role.attrib, - local.refsection.attrib -# end of refsection.attlist - -# end of refsection.module -local.refsect1.attrib = empty -refsect1.role.attrib = role.attrib -# doc:A major subsection of a reference entry. -refsect1 = - element refsect1 { - refsect1.attlist, - refsect1info?, - refsect.title.content, - ((refcomponent.mix+, refsect2*) | refsect2+) - } -# end of refsect1.element -refsect1.attlist &= - status.attrib, - common.attrib, - refsect1.role.attrib, - local.refsect1.attrib -# end of refsect1.attlist - -# end of refsect1.module -local.refsect2.attrib = empty -refsect2.role.attrib = role.attrib -# doc:A subsection of a RefSect1. -refsect2 = - element refsect2 { - refsect2.attlist, - refsect2info?, - refsect.title.content, - ((refcomponent.mix+, refsect3*) | refsect3+) - } -# end of refsect2.element -refsect2.attlist &= - status.attrib, - common.attrib, - refsect2.role.attrib, - local.refsect2.attrib -# end of refsect2.attlist - -# end of refsect2.module -local.refsect3.attrib = empty -refsect3.role.attrib = role.attrib -# doc:A subsection of a RefSect2. -refsect3 = - element refsect3 { - refsect3.attlist, - refsect3info?, - refsect.title.content, - refcomponent.mix+ - } -# end of refsect3.element -refsect3.attlist &= - status.attrib, - common.attrib, - refsect3.role.attrib, - local.refsect3.attrib -# end of refsect3.attlist - -# end of refsect3.module - -# end of refentry.content.module - -# ...................................................................... - -# Article .............................................................. - -# An Article is a chapter-level, stand-alone document that is often, -# but need not be, collected into a Book. -local.article.attrib = empty -article.role.attrib = role.attrib -# doc:An article. -article = - element article { - article.attlist, - div.title.content?, - articleinfo?, - tocchap?, - lot*, - bookcomponent.content, - (nav.class | appendix.class | colophon | ackno)* - } -# end of article.element - -# Class: Indicates the type of a particular article; -# all articles have the same structure and general purpose. -# No default. - -# ParentBook: ID of the enclosing Book -article.attlist &= - attribute class { - "journalarticle" - | "productsheet" - | "whitepaper" - | "techreport" - | "specification" - | "faq" - }?, - attribute parentbook { xsd:IDREF }?, - status.attrib, - common.attrib, - article.role.attrib, - local.article.attrib -# end of article.attlist - -# end of article.module - -# End of DocBook document hierarchy module V4.5 ........................ - -# ...................................................................... diff --git a/docbook-schema/dbnotnx.rnc b/docbook-schema/dbnotnx.rnc deleted file mode 100644 index 9beb245..0000000 --- a/docbook-schema/dbnotnx.rnc +++ /dev/null @@ -1,85 +0,0 @@ -# ...................................................................... - -# DocBook notations module V4.5 ........................................ - -# File dbnotnx.mod ..................................................... - -# Copyright 1992-2004 HaL Computer Systems, Inc., -# O'Reilly & Associates, Inc., ArborText, Inc., Fujitsu Software -# Corporation, Norman Walsh, Sun Microsystems, Inc., and the -# Organization for the Advancement of Structured Information -# Standards (OASIS). -# -# $Id: dbnotnx.mod 6340 2006-10-03 13:23:24Z nwalsh $ -# -# Permission to use, copy, modify and distribute the DocBook DTD -# and its accompanying documentation for any purpose and without fee -# is hereby granted in perpetuity, provided that the above copyright -# notice and this paragraph appear in all copies. The copyright -# holders make no representation about the suitability of the DTD for -# any purpose. It is provided "as is" without expressed or implied -# warranty. -# -# If you modify the DocBook DTD in any way, except for declaring and -# referencing additional sets of general entities and declaring -# additional notations, label your DTD as a variant of DocBook. See -# the maintenance documentation for more information. -# -# Please direct all questions, bug reports, or suggestions for -# changes to the docbook@lists.oasis-open.org mailing list. For more -# information, see http://www.oasis-open.org/docbook/. - -# ...................................................................... - -# This module contains the notation declarations used by DocBook. -# -# In DTD driver files referring to this module, please use an entity -# declaration that uses the public identifier shown below: -# -# -# %dbnotn; -# -# See the documentation for detailed information on the parameter -# entity and module scheme used in DocBook, customizing DocBook and -# planning for interchange, and changes made since the last release -# of DocBook. - -local.notation.class = notAllowed -notation.class = - "BMP" - | "CGM-CHAR" - | "CGM-BINARY" - | "CGM-CLEAR" - | "DITROFF" - | "DVI" - | "EPS" - | "EQN" - | "FAX" - | "GIF" - | "GIF87a" - | "GIF89a" - | "JPG" - | "JPEG" - | "IGES" - | "PCX" - | "PIC" - | "PNG" - | "PS" - | "SGML" - | "TBL" - | "TEX" - | "TIFF" - | "WMF" - | "WPG" - | "SVG" - | "PDF" - | "SWF" - | "linespecific" - | local.notation.class -# WordPerfect Graphic format - -# End of DocBook notations module V4.5 ................................. - -# ...................................................................... diff --git a/docbook-schema/dbpoolx.rnc b/docbook-schema/dbpoolx.rnc deleted file mode 100644 index 47100a3..0000000 --- a/docbook-schema/dbpoolx.rnc +++ /dev/null @@ -1,5785 +0,0 @@ -# ...................................................................... - -# DocBook XML information pool module V4.5 ............................. - -# File dbpoolx.mod ..................................................... - -# Copyright 1992-2004 HaL Computer Systems, Inc., -# O'Reilly & Associates, Inc., ArborText, Inc., Fujitsu Software -# Corporation, Norman Walsh, Sun Microsystems, Inc., and the -# Organization for the Advancement of Structured Information -# Standards (OASIS). -# -# $Id: dbpoolx.mod 6340 2006-10-03 13:23:24Z nwalsh $ -# -# Permission to use, copy, modify and distribute the DocBook XML DTD -# and its accompanying documentation for any purpose and without fee -# is hereby granted in perpetuity, provided that the above copyright -# notice and this paragraph appear in all copies. The copyright -# holders make no representation about the suitability of the DTD for -# any purpose. It is provided "as is" without expressed or implied -# warranty. -# -# If you modify the DocBook XML DTD in any way, except for declaring and -# referencing additional sets of general entities and declaring -# additional notations, label your DTD as a variant of DocBook. See -# the maintenance documentation for more information. -# -# Please direct all questions, bug reports, or suggestions for -# changes to the docbook@lists.oasis-open.org mailing list. For more -# information, see http://www.oasis-open.org/docbook/. - -# ...................................................................... - -# This module contains the definitions for the objects, inline -# elements, and so on that are available to be used as the main -# content of DocBook documents. Some elements are useful for general -# publishing, and others are useful specifically for computer -# documentation. -# -# This module has the following dependencies on other modules: -# -# o It assumes that a %notation.class; entity is defined by the -# driver file or other high-level module. This entity is -# referenced in the NOTATION attributes for the graphic-related and -# ModeSpec elements. -# -# o It assumes that an appropriately parameterized table module is -# available for use with the table-related elements. -# -# In DTD driver files referring to this module, please use an entity -# declaration that uses the public identifier shown below: -# -# -# %dbpool; -# -# See the documentation for detailed information on the parameter -# entity and module scheme used in DocBook, customizing DocBook and -# planning for interchange, and changes made since the last release -# of DocBook. - -# ...................................................................... - -# Forms entities ....................................................... - -# These PEs provide the hook by which the forms module can be inserted - -# into the DTD. - -namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0" - -forminlines.hook = notAllowed -forms.hook = notAllowed -# ...................................................................... - -# General-purpose semantics entities ................................... -yesorno.attvals = string -# ...................................................................... - -# Entities for module inclusions ....................................... - -# ...................................................................... - -# Entities for element classes and mixtures ............................ - -# "Ubiquitous" classes: ndxterm.class and beginpage -local.ndxterm.class = notAllowed -ndxterm.class = indexterm | local.ndxterm.class -# Object-level classes ................................................. -local.list.class = notAllowed -list.class = - calloutlist - | glosslist - | bibliolist - | itemizedlist - | orderedlist - | segmentedlist - | simplelist - | variablelist - | local.list.class -local.admon.class = notAllowed -admon.class = - caution | important | note | tip | warning | local.admon.class -local.linespecific.class = notAllowed -linespecific.class = - literallayout - | programlisting - | programlistingco - | screen - | screenco - | screenshot - | local.linespecific.class -local.method.synop.class = notAllowed -method.synop.class = - constructorsynopsis - | destructorsynopsis - | methodsynopsis - | local.method.synop.class -local.synop.class = notAllowed -synop.class = - synopsis - | cmdsynopsis - | funcsynopsis - | classsynopsis - | fieldsynopsis - | method.synop.class - | local.synop.class -local.para.class = notAllowed -para.class = formalpara | para | simpara | local.para.class -local.informal.class = notAllowed -informal.class = - address - | blockquote - | graphic - | graphicco - | mediaobject - | mediaobjectco - | informalequation - | informalexample - | informalfigure - | informaltable - | local.informal.class -local.formal.class = notAllowed -formal.class = equation | example | figure | table | local.formal.class -# The DocBook TC may produce an official EBNF module for DocBook. - -# This PE provides the hook by which it can be inserted into the DTD. -ebnf.block.hook = notAllowed -local.compound.class = notAllowed -compound.class = - msgset - | procedure - | sidebar - | qandaset - | task - | ebnf.block.hook - | local.compound.class -local.genobj.class = notAllowed -genobj.class = - anchor | bridgehead | remark | highlights | local.genobj.class -local.descobj.class = notAllowed -descobj.class = abstract | authorblurb | epigraph | local.descobj.class -# Character-level classes .............................................. -local.xref.char.class = notAllowed -xref.char.class = footnoteref | xref | biblioref | local.xref.char.class -local.gen.char.class = notAllowed -gen.char.class = - abbrev - | acronym - | citation - | citerefentry - | citetitle - | citebiblioid - | emphasis - | firstterm - | foreignphrase - | glossterm - | termdef - | footnote - | phrase - | orgname - | quote - | trademark - | wordasword - | personname - | local.gen.char.class -local.link.char.class = notAllowed -link.char.class = link | olink | ulink | local.link.char.class -# The DocBook TC may produce an official EBNF module for DocBook. - -# This PE provides the hook by which it can be inserted into the DTD. -ebnf.inline.hook = notAllowed -local.tech.char.class = notAllowed -tech.char.class = - action - | application - | classname - | methodname - | interfacename - | exceptionname - | ooclass - | oointerface - | ooexception - | package - | command - | computeroutput - | database - | email - | envar - | errorcode - | errorname - | errortype - | errortext - | filename - | function - | guibutton - | guiicon - | guilabel - | guimenu - | guimenuitem - | guisubmenu - | hardware - | interface - | keycap - | keycode - | keycombo - | keysym - | literal - | code - | constant - | markup - | medialabel - | menuchoice - | mousebutton - | option - | optional - | parameter - | prompt - | property - | replaceable - | returnvalue - | sgmltag - | structfield - | structname - | symbol - | systemitem - | uri - | \token - | type - | userinput - | varname - | ebnf.inline.hook - | local.tech.char.class -local.base.char.class = notAllowed -base.char.class = anchor | local.base.char.class -local.docinfo.char.class = notAllowed -docinfo.char.class = - author - | authorinitials - | corpauthor - | corpcredit - | modespec - | othercredit - | productname - | productnumber - | revhistory - | local.docinfo.char.class -local.other.char.class = notAllowed -other.char.class = - remark | subscript | superscript | local.other.char.class -local.inlineobj.char.class = notAllowed -inlineobj.char.class = - inlinegraphic - | inlinemediaobject - | inlineequation - | local.inlineobj.char.class -# ...................................................................... - -# Entities for content models .......................................... -formalobject.title.content = title, titleabbrev? -# Redeclaration placeholder ............................................ - -# For redeclaring entities that are declared after this point while -# retaining their references to the entities that are declared before -# this point - -# Object-level mixtures ................................................ - -# list admn line synp para infm form cmpd gen desc -# Component mixture X X X X X X X X X X -# Sidebar mixture X X X X X X X a X -# Footnote mixture X X X X X -# Example mixture X X X X X -# Highlights mixture X X X -# Paragraph mixture X X X X -# Admonition mixture X X X X X X b c -# Figure mixture X X X -# Table entry mixture X X X X d -# Glossary def mixture X X X X X e -# Legal notice mixture X X X X f -# -# a. Just Procedure; not Sidebar itself or MsgSet. -# b. No MsgSet. -# c. No Highlights. -# d. Just Graphic; no other informal objects. -# e. No Anchor, BridgeHead, or Highlights. -# f. Just BlockQuote; no other informal objects. -local.component.mix = notAllowed -component.mix = - list.class - | admon.class - | linespecific.class - | synop.class - | para.class - | informal.class - | formal.class - | compound.class - | genobj.class - | descobj.class - | ndxterm.class - | beginpage - | forms.hook - | local.component.mix -local.sidebar.mix = notAllowed -sidebar.mix = - list.class - | admon.class - | linespecific.class - | synop.class - | para.class - | informal.class - | formal.class - | procedure - | genobj.class - | ndxterm.class - | beginpage - | forms.hook - | local.sidebar.mix -local.qandaset.mix = notAllowed -qandaset.mix = - list.class - | admon.class - | linespecific.class - | synop.class - | para.class - | informal.class - | formal.class - | procedure - | genobj.class - | ndxterm.class - | forms.hook - | local.qandaset.mix -local.revdescription.mix = notAllowed -revdescription.mix = - list.class - | admon.class - | linespecific.class - | synop.class - | para.class - | informal.class - | formal.class - | procedure - | genobj.class - | ndxterm.class - | local.revdescription.mix -local.footnote.mix = notAllowed -footnote.mix = - list.class - | linespecific.class - | synop.class - | para.class - | informal.class - | local.footnote.mix -local.example.mix = notAllowed -example.mix = - list.class - | linespecific.class - | synop.class - | para.class - | informal.class - | ndxterm.class - | beginpage - | procedure - | forms.hook - | local.example.mix -local.highlights.mix = notAllowed -highlights.mix = - list.class - | admon.class - | para.class - | ndxterm.class - | local.highlights.mix -# %formal.class; is explicitly excluded from many contexts in which -# paragraphs are used -local.para.mix = notAllowed -para.mix = - list.class - | admon.class - | linespecific.class - | informal.class - | formal.class - | local.para.mix -local.admon.mix = notAllowed -admon.mix = - list.class - | linespecific.class - | synop.class - | para.class - | informal.class - | formal.class - | procedure - | sidebar - | anchor - | bridgehead - | remark - | ndxterm.class - | beginpage - | forms.hook - | local.admon.mix -local.figure.mix = notAllowed -figure.mix = - linespecific.class - | synop.class - | informal.class - | ndxterm.class - | beginpage - | forms.hook - | local.figure.mix -local.tabentry.mix = notAllowed -tabentry.mix = - list.class - | admon.class - | linespecific.class - | para.class - | graphic - | mediaobject - | forms.hook - | local.tabentry.mix -local.glossdef.mix = notAllowed -glossdef.mix = - list.class - | linespecific.class - | synop.class - | para.class - | informal.class - | formal.class - | remark - | ndxterm.class - | beginpage - | local.glossdef.mix -local.legalnotice.mix = notAllowed -legalnotice.mix = - list.class - | admon.class - | linespecific.class - | para.class - | blockquote - | ndxterm.class - | beginpage - | local.legalnotice.mix -local.textobject.mix = notAllowed -textobject.mix = - list.class - | admon.class - | linespecific.class - | para.class - | blockquote - | local.textobject.mix -local.mediaobject.mix = notAllowed -mediaobject.mix = - videoobject - | audioobject - | imageobject - | imageobjectco - | textobject - | local.mediaobject.mix -local.listpreamble.mix = notAllowed -listpreamble.mix = - admon.class - | linespecific.class - | synop.class - | para.class - | informal.class - | genobj.class - | descobj.class - | ndxterm.class - | beginpage - | forms.hook - | local.listpreamble.mix -# Character-level mixtures ............................................. - -# sgml.features - -# not [sgml.features[ - -# ]] not sgml.features - -# #PCD xref word link cptr base dnfo othr inob (synop) -# para.char.mix X X X X X X X X X -# title.char.mix X X X X X X X X X -# ndxterm.char.mix X X X X X X X X a -# cptr.char.mix X X X X X a -# smallcptr.char.mix X b a -# word.char.mix X c X X X a -# docinfo.char.mix X d X b X a -# -# a. Just InlineGraphic; no InlineEquation. -# b. Just Replaceable; no other computer terms. -# c. Just Emphasis and Trademark; no other word elements. -# d. Just Acronym, Emphasis, and Trademark; no other word elements. -local.para.char.mix = notAllowed -para.char.mix = - text - | xref.char.class - | gen.char.class - | link.char.class - | tech.char.class - | base.char.class - | docinfo.char.class - | other.char.class - | inlineobj.char.class - | synop.class - | ndxterm.class - | beginpage - | forminlines.hook - | local.para.char.mix -local.title.char.mix = notAllowed -title.char.mix = - text - | xref.char.class - | gen.char.class - | link.char.class - | tech.char.class - | base.char.class - | docinfo.char.class - | other.char.class - | inlineobj.char.class - | ndxterm.class - | local.title.char.mix -local.ndxterm.char.mix = notAllowed -ndxterm.char.mix = - text - | xref.char.class - | gen.char.class - | link.char.class - | tech.char.class - | base.char.class - | docinfo.char.class - | other.char.class - | inlinegraphic - | inlinemediaobject - | local.ndxterm.char.mix -local.cptr.char.mix = notAllowed -cptr.char.mix = - text - | link.char.class - | tech.char.class - | base.char.class - | other.char.class - | inlinegraphic - | inlinemediaobject - | ndxterm.class - | beginpage - | local.cptr.char.mix -local.smallcptr.char.mix = notAllowed -smallcptr.char.mix = - text - | replaceable - | inlinegraphic - | inlinemediaobject - | ndxterm.class - | beginpage - | local.smallcptr.char.mix -local.word.char.mix = notAllowed -word.char.mix = - text - | acronym - | emphasis - | trademark - | link.char.class - | base.char.class - | other.char.class - | inlinegraphic - | inlinemediaobject - | ndxterm.class - | beginpage - | local.word.char.mix -local.docinfo.char.mix = notAllowed -docinfo.char.mix = - text - | link.char.class - | emphasis - | trademark - | replaceable - | other.char.class - | inlinegraphic - | inlinemediaobject - | ndxterm.class - | local.docinfo.char.mix -# ENTITY % bibliocomponent.mix (see Bibliographic section, below) - -# ENTITY % person.ident.mix (see Bibliographic section, below) - -# ...................................................................... - -# Entities for attributes and attribute components ..................... - -# Effectivity attributes ............................................... - -# Arch: Computer or chip architecture to which element applies; no -# default -arch.attrib = attribute arch { text }? -# Condition: General-purpose effectivity attribute -condition.attrib = attribute condition { text }? -# Conformance: Standards conformance characteristics -conformance.attrib = attribute conformance { xsd:NMTOKENS }? -# OS: Operating system to which element applies; no default -os.attrib = attribute os { text }? -# Revision: Editorial revision to which element belongs; no default -revision.attrib = attribute revision { text }? -# Security: Security classification; no default -security.attrib = attribute security { text }? -# UserLevel: Level of user experience to which element applies; no -# default -userlevel.attrib = attribute userlevel { text }? -# Vendor: Computer vendor to which element applies; no default -vendor.attrib = attribute vendor { text }? -# Wordsize: Computer word size (32 bit, 64 bit, etc.); no default -wordsize.attrib = attribute wordsize { text }? -local.effectivity.attrib = empty -effectivity.attrib = - arch.attrib, - condition.attrib, - conformance.attrib, - os.attrib, - revision.attrib, - security.attrib, - userlevel.attrib, - vendor.attrib, - wordsize.attrib, - local.effectivity.attrib -# Common attributes .................................................... - -# Id: Unique identifier of element; no default -id.attrib = attribute id { xsd:ID }? -# Id: Unique identifier of element; a value must be supplied; no -# default -idreq.attrib = attribute id { xsd:ID } -# Lang: Indicator of language in which element is written, for -# translation, character set management, etc.; no default -lang.attrib = attribute lang { text }? -# Remap: Previous role of element before conversion; no default -remap.attrib = attribute remap { text }? -# Role: New role of element in local environment; no default -role.attrib = attribute role { text }? -# XRefLabel: Alternate labeling string for XRef text generation; -# default is usually title or other appropriate label text already -# contained in element -xreflabel.attrib = attribute xreflabel { text }? -# RevisionFlag: Revision status of element; default is that element -# wasn't revised -revisionflag.attrib = - attribute revisionflag { "changed" | "added" | "deleted" | "off" }? -local.common.attrib = empty -# dir: Bidirectional override -dir.attrib = attribute dir { "ltr" | "rtl" | "lro" | "rlo" }? -# xml:base: base URI -xml-base.attrib = attribute xml:base { text }? -# Role is included explicitly on each element -common.attrib = - id.attrib, - lang.attrib, - remap.attrib, - xreflabel.attrib, - revisionflag.attrib, - effectivity.attrib, - dir.attrib, - xml-base.attrib, - local.common.attrib -# Role is included explicitly on each element -idreq.common.attrib = - idreq.attrib, - lang.attrib, - remap.attrib, - xreflabel.attrib, - revisionflag.attrib, - effectivity.attrib, - dir.attrib, - xml-base.attrib, - local.common.attrib -# Semi-common attributes and other attribute entities .................. -local.graphics.attrib = empty -# EntityRef: Name of an external entity containing the content -# of the graphic - -# FileRef: Filename, qualified by a pathname if desired, -# designating the file containing the content of the graphic - -# Format: Notation of the element content, if any - -# SrcCredit: Information about the source of the Graphic - -# Width: Same as CALS reprowid (desired width) - -# Depth: Same as CALS reprodep (desired depth) - -# Align: Same as CALS hplace with 'none' removed; #IMPLIED means -# application-specific - -# Scale: Conflation of CALS hscale and vscale - -# Scalefit: Same as CALS scalefit -graphics.attrib = - attribute entityref { xsd:ENTITY }?, - attribute fileref { text }?, - attribute format { notation.class }?, - attribute srccredit { text }?, - attribute width { text }?, - attribute contentwidth { text }?, - attribute depth { text }?, - attribute contentdepth { text }?, - attribute align { "left" | "right" | "center" }?, - attribute valign { "top" | "middle" | "bottom" }?, - attribute scale { text }?, - attribute scalefit { yesorno.attvals }?, - local.graphics.attrib -local.keyaction.attrib = empty -# Action: Key combination type; default is unspecified if one -# child element, Simul if there is more than one; if value is -# Other, the OtherAction attribute must have a nonempty value - -# OtherAction: User-defined key combination type -keyaction.attrib = - attribute action { - "click" | "double-click" | "press" | "seq" | "simul" | "other" - }?, - attribute otheraction { text }?, - local.keyaction.attrib -# Label: Identifying number or string; default is usually the -# appropriate number or string autogenerated by a formatter -label.attrib = attribute label { text }? -# xml:space: whitespace treatment -xml-space.attrib = attribute xml:space { "preserve" }? -# Format: whether element is assumed to contain significant white -# space -linespecific.attrib = - [ a:defaultValue = "linespecific" ] - attribute format { "linespecific" }?, - xml-space.attrib, - attribute linenumbering { "numbered" | "unnumbered" }?, - attribute continuation { "continues" | "restarts" }?, - attribute startinglinenumber { text }?, - attribute language { text }? -# Linkend: link to related information; no default -linkend.attrib = attribute linkend { xsd:IDREF }? -# Linkend: required link to related information -linkendreq.attrib = attribute linkend { xsd:IDREF } -# Linkends: link to one or more sets of related information; no -# default -linkends.attrib = attribute linkends { xsd:IDREFS }? -local.mark.attrib = empty -mark.attrib = - attribute mark { text }?, - local.mark.attrib -# MoreInfo: whether element's content has an associated RefEntry -moreinfo.attrib = - [ a:defaultValue = "none" ] - attribute moreinfo { "refentry" | "none" }? -# Pagenum: number of page on which element appears; no default -pagenum.attrib = attribute pagenum { text }? -local.status.attrib = empty -# Status: Editorial or publication status of the element -# it applies to, such as "in review" or "approved for distribution" -status.attrib = - attribute status { text }?, - local.status.attrib -# Width: width of the longest line in the element to which it -# pertains, in number of characters -width.attrib = attribute width { text }? -# ...................................................................... - -# Title elements ....................................................... -local.title.attrib = empty -title.role.attrib = role.attrib -# doc:The text of the title of a section of a document or of a formal block-level element. -title = element title { title.attlist, title.char.mix* } -# end of title.element -title.attlist &= - pagenum.attrib, common.attrib, title.role.attrib, local.title.attrib -# end of title.attlist - -# end of title.module -local.titleabbrev.attrib = empty -titleabbrev.role.attrib = role.attrib -# doc:The abbreviation of a Title. -titleabbrev = - element titleabbrev { titleabbrev.attlist, title.char.mix* } -# end of titleabbrev.element -titleabbrev.attlist &= - common.attrib, titleabbrev.role.attrib, local.titleabbrev.attrib -# end of titleabbrev.attlist - -# end of titleabbrev.module -local.subtitle.attrib = empty -subtitle.role.attrib = role.attrib -# doc:The subtitle of a document. -subtitle = element subtitle { subtitle.attlist, title.char.mix* } -# end of subtitle.element -subtitle.attlist &= - common.attrib, subtitle.role.attrib, local.subtitle.attrib -# end of subtitle.attlist - -# end of subtitle.module - -# ...................................................................... - -# Bibliographic entities and elements .................................. - -# The bibliographic elements are typically used in the document -# hierarchy. They do not appear in content models of information -# pool elements. See also the document information elements, -# below. -local.person.ident.mix = notAllowed -person.ident.mix = - honorific - | firstname - | surname - | lineage - | othername - | affiliation - | authorblurb - | contrib - | local.person.ident.mix -local.bibliocomponent.mix = notAllowed -bibliocomponent.mix = - abbrev - | abstract - | address - | artpagenums - | author - | authorgroup - | authorinitials - | bibliomisc - | biblioset - | collab - | confgroup - | contractnum - | contractsponsor - | copyright - | corpauthor - | corpname - | corpcredit - | date - | edition - | editor - | invpartnumber - | isbn - | issn - | issuenum - | orgname - | biblioid - | citebiblioid - | bibliosource - | bibliorelation - | bibliocoverage - | othercredit - | pagenums - | printhistory - | productname - | productnumber - | pubdate - | publisher - | publishername - | pubsnumber - | releaseinfo - | revhistory - | seriesvolnums - | subtitle - | title - | titleabbrev - | volumenum - | citetitle - | personname - | person.ident.mix - | ndxterm.class - | local.bibliocomponent.mix -# I don't think this is well placed, but it needs to be here because of - -# the reference to bibliocomponent.mix -local.info.class = notAllowed -info.class = - graphic - | mediaobject - | legalnotice - | modespec - | subjectset - | keywordset - | itermset - | bibliocomponent.mix - | local.info.class -# BiblioList ........................ -local.bibliolist.attrib = empty -bibliolist.role.attrib = role.attrib -# doc:A wrapper for a set of bibliography entries. -bibliolist = - element bibliolist { - bibliolist.attlist, - blockinfo?, - formalobject.title.content?, - (biblioentry | bibliomixed)+ - } -# end of bibliolist.element -bibliolist.attlist &= - common.attrib, bibliolist.role.attrib, local.bibliolist.attrib -# end of bibliolist.attlist - -# end of bibliolist.module -local.biblioentry.attrib = empty -biblioentry.role.attrib = role.attrib -# doc:An entry in a Bibliography. -biblioentry = - element biblioentry { - biblioentry.attlist, (articleinfo | bibliocomponent.mix)+ - } -# end of biblioentry.element -biblioentry.attlist &= - common.attrib, biblioentry.role.attrib, local.biblioentry.attrib -# end of biblioentry.attlist - -# end of biblioentry.module -local.bibliomixed.attrib = empty -bibliomixed.role.attrib = role.attrib -# doc:An entry in a Bibliography. -bibliomixed = - element bibliomixed { - bibliomixed.attlist, (text | bibliocomponent.mix | bibliomset)* - } -# end of bibliomixed.element -bibliomixed.attlist &= - common.attrib, bibliomixed.role.attrib, local.bibliomixed.attrib -# end of bibliomixed.attlist - -# end of bibliomixed.module -local.articleinfo.attrib = empty -articleinfo.role.attrib = role.attrib -# doc:Meta-information for an Article. -articleinfo = element articleinfo { articleinfo.attlist, info.class+ } -# end of articleinfo.element -articleinfo.attlist &= - common.attrib, articleinfo.role.attrib, local.articleinfo.attrib -# end of articleinfo.attlist - -# end of articleinfo.module -local.biblioset.attrib = empty -biblioset.role.attrib = role.attrib -# doc:A "raw" container for related bibliographic information. -biblioset = - element biblioset { biblioset.attlist, bibliocomponent.mix+ } -# end of biblioset.element - -# Relation: Relationship of elements contained within BiblioSet -biblioset.attlist &= - attribute relation { text }?, - common.attrib, - biblioset.role.attrib, - local.biblioset.attrib -# end of biblioset.attlist - -# end of biblioset.module -bibliomset.role.attrib = role.attrib -local.bibliomset.attrib = empty -# doc:A "cooked" container for related bibliographic information. -bibliomset = - element bibliomset { - bibliomset.attlist, (text | bibliocomponent.mix | bibliomset)* - } -# end of bibliomset.element - -# Relation: Relationship of elements contained within BiblioMSet -bibliomset.attlist &= - attribute relation { text }?, - common.attrib, - bibliomset.role.attrib, - local.bibliomset.attrib -# end of bibliomset.attlist - -# end of bibliomset.module -local.bibliomisc.attrib = empty -bibliomisc.role.attrib = role.attrib -# doc:Untyped bibliographic information. -bibliomisc = element bibliomisc { bibliomisc.attlist, para.char.mix* } -# end of bibliomisc.element -bibliomisc.attlist &= - common.attrib, bibliomisc.role.attrib, local.bibliomisc.attrib -# end of bibliomisc.attlist - -# end of bibliomisc.module - -# ...................................................................... - -# Subject, Keyword, and ITermSet elements .............................. -local.subjectset.attrib = empty -subjectset.role.attrib = role.attrib -# doc:A set of terms describing the subject matter of a document. -subjectset = element subjectset { subjectset.attlist, subject+ } -# end of subjectset.element - -# Scheme: Controlled vocabulary employed in SubjectTerms -subjectset.attlist &= - attribute scheme { xsd:NMTOKEN }?, - common.attrib, - subjectset.role.attrib, - local.subjectset.attrib -# end of subjectset.attlist - -# end of subjectset.module -local.subject.attrib = empty -subject.role.attrib = role.attrib -# doc:One of a group of terms describing the subject matter of a document. -subject = element subject { subject.attlist, subjectterm+ } -# end of subject.element - -# Weight: Ranking of this group of SubjectTerms relative -# to others, 0 is low, no highest value specified -subject.attlist &= - attribute weight { text }?, - common.attrib, - subject.role.attrib, - local.subject.attrib -# end of subject.attlist - -# end of subject.module -local.subjectterm.attrib = empty -subjectterm.role.attrib = role.attrib -# doc:A term in a group of terms describing the subject matter of a document. -subjectterm = element subjectterm { subjectterm.attlist, text } -# end of subjectterm.element -subjectterm.attlist &= - common.attrib, subjectterm.role.attrib, local.subjectterm.attrib -# end of subjectterm.attlist - -# end of subjectterm.module - -# end of subjectset.content.module -local.keywordset.attrib = empty -keywordset.role.attrib = role.attrib -# doc:A set of keywords describing the content of a document. -keywordset = element keywordset { keywordset.attlist, keyword+ } -# end of keywordset.element -keywordset.attlist &= - common.attrib, keywordset.role.attrib, local.keywordset.attrib -# end of keywordset.attlist - -# end of keywordset.module -local.keyword.attrib = empty -keyword.role.attrib = role.attrib -# doc:One of a set of keywords describing the content of a document. -keyword = element keyword { keyword.attlist, text } -# end of keyword.element -keyword.attlist &= - common.attrib, keyword.role.attrib, local.keyword.attrib -# end of keyword.attlist - -# end of keyword.module - -# end of keywordset.content.module -local.itermset.attrib = empty -itermset.role.attrib = role.attrib -# doc:A set of index terms in the meta-information of a document. -itermset = element itermset { itermset.attlist, indexterm+ } -# end of itermset.element -itermset.attlist &= - common.attrib, itermset.role.attrib, local.itermset.attrib -# end of itermset.attlist - -# end of itermset.module - -# Bibliographic info for "blocks" -local.blockinfo.attrib = empty -blockinfo.role.attrib = role.attrib -# doc:Meta-information for a block element. -blockinfo = element blockinfo { blockinfo.attlist, info.class+ } -# end of blockinfo.element -blockinfo.attlist &= - common.attrib, blockinfo.role.attrib, local.blockinfo.attrib -# end of blockinfo.attlist - -# end of blockinfo.module - -# ...................................................................... - -# Compound (section-ish) elements ...................................... - -# Message set ...................... -local.msgset.attrib = empty -msgset.role.attrib = role.attrib -# doc:A detailed set of messages, usually error messages. -msgset = - element msgset { - msgset.attlist, - blockinfo?, - formalobject.title.content?, - (msgentry+ | simplemsgentry+) - } -# end of msgset.element -msgset.attlist &= common.attrib, msgset.role.attrib, local.msgset.attrib -# end of msgset.attlist - -# end of msgset.module -local.msgentry.attrib = empty -msgentry.role.attrib = role.attrib -# doc:A wrapper for an entry in a message set. -msgentry = - element msgentry { msgentry.attlist, msg+, msginfo?, msgexplan* } -# end of msgentry.element -msgentry.attlist &= - common.attrib, msgentry.role.attrib, local.msgentry.attrib -# end of msgentry.attlist - -# end of msgentry.module -local.simplemsgentry.attrib = empty -simplemsgentry.role.attrib = role.attrib -# doc:A wrapper for a simpler entry in a message set. -simplemsgentry = - element simplemsgentry { simplemsgentry.attlist, msgtext, msgexplan+ } -# end of simplemsgentry.element -simplemsgentry.attlist &= - attribute audience { text }?, - attribute level { text }?, - attribute origin { text }?, - common.attrib, - simplemsgentry.role.attrib, - local.simplemsgentry.attrib -# end of simplemsgentry.attlist - -# end of simplemsgentry.module -local.msg.attrib = empty -msg.role.attrib = role.attrib -# doc:A message in a message set. -msg = element msg { msg.attlist, title?, msgmain, (msgsub | msgrel)* } -# end of msg.element -msg.attlist &= common.attrib, msg.role.attrib, local.msg.attrib -# end of msg.attlist - -# end of msg.module -local.msgmain.attrib = empty -msgmain.role.attrib = role.attrib -# doc:The primary component of a message in a message set. -msgmain = element msgmain { msgmain.attlist, title?, msgtext } -# end of msgmain.element -msgmain.attlist &= - common.attrib, msgmain.role.attrib, local.msgmain.attrib -# end of msgmain.attlist - -# end of msgmain.module -local.msgsub.attrib = empty -msgsub.role.attrib = role.attrib -# doc:A subcomponent of a message in a message set. -msgsub = element msgsub { msgsub.attlist, title?, msgtext } -# end of msgsub.element -msgsub.attlist &= common.attrib, msgsub.role.attrib, local.msgsub.attrib -# end of msgsub.attlist - -# end of msgsub.module -local.msgrel.attrib = empty -msgrel.role.attrib = role.attrib -# doc:A related component of a message in a message set. -msgrel = element msgrel { msgrel.attlist, title?, msgtext } -# end of msgrel.element -msgrel.attlist &= common.attrib, msgrel.role.attrib, local.msgrel.attrib -# end of msgrel.attlist - -# end of msgrel.module - -# MsgText (defined in the Inlines section, below) -local.msginfo.attrib = empty -msginfo.role.attrib = role.attrib -# doc:Information about a message in a message set. -msginfo = - element msginfo { msginfo.attlist, (msglevel | msgorig | msgaud)* } -# end of msginfo.element -msginfo.attlist &= - common.attrib, msginfo.role.attrib, local.msginfo.attrib -# end of msginfo.attlist - -# end of msginfo.module -local.msglevel.attrib = empty -msglevel.role.attrib = role.attrib -# doc:The level of importance or severity of a message in a message set. -msglevel = element msglevel { msglevel.attlist, smallcptr.char.mix* } -# end of msglevel.element -msglevel.attlist &= - common.attrib, msglevel.role.attrib, local.msglevel.attrib -# end of msglevel.attlist - -# end of msglevel.module -local.msgorig.attrib = empty -msgorig.role.attrib = role.attrib -# doc:The origin of a message in a message set. -msgorig = element msgorig { msgorig.attlist, smallcptr.char.mix* } -# end of msgorig.element -msgorig.attlist &= - common.attrib, msgorig.role.attrib, local.msgorig.attrib -# end of msgorig.attlist - -# end of msgorig.module -local.msgaud.attrib = empty -msgaud.role.attrib = role.attrib -# doc:The audience to which a message in a message set is relevant. -msgaud = element msgaud { msgaud.attlist, para.char.mix* } -# end of msgaud.element -msgaud.attlist &= common.attrib, msgaud.role.attrib, local.msgaud.attrib -# end of msgaud.attlist - -# end of msgaud.module -local.msgexplan.attrib = empty -msgexplan.role.attrib = role.attrib -# doc:Explanatory material relating to a message in a message set. -msgexplan = - element msgexplan { msgexplan.attlist, title?, component.mix+ } -# end of msgexplan.element -msgexplan.attlist &= - common.attrib, msgexplan.role.attrib, local.msgexplan.attrib -# end of msgexplan.attlist - -# end of msgexplan.module - -# end of msgset.content.module -local.task.attrib = empty -task.role.attrib = role.attrib -# doc:A task to be completed. -task = - element task { - task.attlist, - blockinfo?, - ndxterm.class*, - formalobject.title.content, - tasksummary?, - taskprerequisites?, - procedure, - example*, - taskrelated? - } -# end of task.element -task.attlist &= common.attrib, task.role.attrib, local.task.attrib -# end of task.attlist - -# end of task.module -local.tasksummary.attrib = empty -tasksummary.role.attrib = role.attrib -# doc:A summary of a task. -tasksummary = - element tasksummary { - tasksummary.attlist, - blockinfo?, - formalobject.title.content?, - component.mix+ - } -# end of tasksummary.element -tasksummary.attlist &= - common.attrib, tasksummary.role.attrib, local.tasksummary.attrib -# end of tasksummary.attlist - -# end of tasksummary.module -local.taskprerequisites.attrib = empty -taskprerequisites.role.attrib = role.attrib -# doc:The prerequisites for a task. -taskprerequisites = - element taskprerequisites { - taskprerequisites.attlist, - blockinfo?, - formalobject.title.content?, - component.mix+ - } -# end of taskprerequisites.element -taskprerequisites.attlist &= - common.attrib, - taskprerequisites.role.attrib, - local.taskprerequisites.attrib -# end of taskprerequisites.attlist - -# end of taskprerequisites.module -local.taskrelated.attrib = empty -taskrelated.role.attrib = role.attrib -# doc:Information related to a task. -taskrelated = - element taskrelated { - taskrelated.attlist, - blockinfo?, - formalobject.title.content?, - component.mix+ - } -# end of taskrelated.element -taskrelated.attlist &= - common.attrib, taskrelated.role.attrib, local.taskrelated.attrib -# end of taskrelated.attlist - -# end of taskrelated.module - -# end of task.content.module - -# QandASet ........................ -local.qandaset.attrib = empty -qandaset.role.attrib = role.attrib -# doc:A question-and-answer set. -qandaset = - element qandaset { - qandaset.attlist, - blockinfo?, - formalobject.title.content?, - qandaset.mix*, - (qandadiv+ | qandaentry+) - } -# end of qandaset.element -qandaset.attlist &= - attribute defaultlabel { "qanda" | "number" | "none" }?, - common.attrib, - qandaset.role.attrib, - local.qandaset.attrib -# end of qandaset.attlist - -# end of qandaset.module -local.qandadiv.attrib = empty -qandadiv.role.attrib = role.attrib -# doc:A titled division in a QandASet. -qandadiv = - element qandadiv { - qandadiv.attlist, - blockinfo?, - formalobject.title.content?, - qandaset.mix*, - (qandadiv+ | qandaentry+) - } -# end of qandadiv.element -qandadiv.attlist &= - common.attrib, qandadiv.role.attrib, local.qandadiv.attrib -# end of qandadiv.attlist - -# end of qandadiv.module -local.qandaentry.attrib = empty -qandaentry.role.attrib = role.attrib -# doc:A question/answer set within a QandASet. -qandaentry = - element qandaentry { - qandaentry.attlist, blockinfo?, revhistory?, question, answer* - } -# end of qandaentry.element -qandaentry.attlist &= - common.attrib, qandaentry.role.attrib, local.qandaentry.attrib -# end of qandaentry.attlist - -# end of qandaentry.module -local.question.attrib = empty -question.role.attrib = role.attrib -# doc:A question in a QandASet. -question = element question { question.attlist, label?, qandaset.mix+ } -# end of question.element -question.attlist &= - common.attrib, question.role.attrib, local.question.attrib -# end of question.attlist - -# end of question.module -local.answer.attrib = empty -answer.role.attrib = role.attrib -# doc:An answer to a question posed in a QandASet. -answer = - element answer { answer.attlist, label?, qandaset.mix*, qandaentry* } -# end of answer.element -answer.attlist &= common.attrib, answer.role.attrib, local.answer.attrib -# end of answer.attlist - -# end of answer.module -local.label.attrib = empty -label.role.attrib = role.attrib -# doc:A label on a Question or Answer. -label = element label { label.attlist, word.char.mix* } -# end of label.element -label.attlist &= common.attrib, label.role.attrib, local.label.attrib -# end of label.attlist - -# end of label.module - -# end of qandaset.content.module - -# Procedure ........................ -local.procedure.attrib = empty -procedure.role.attrib = role.attrib -# doc:A list of operations to be performed in a well-defined sequence. -procedure = - element procedure { - procedure.attlist, - blockinfo?, - formalobject.title.content?, - component.mix*, - step+ - } -# end of procedure.element -procedure.attlist &= - common.attrib, procedure.role.attrib, local.procedure.attrib -# end of procedure.attlist - -# end of procedure.module -local.step.attrib = empty -step.role.attrib = role.attrib -# doc:A unit of action in a procedure. -step = - element step { - step.attlist, - title?, - ((component.mix+, - ((substeps | stepalternatives), component.mix*)?) - | ((substeps | stepalternatives), component.mix*)) - } -# end of step.element - -# Performance: Whether the Step must be performed - -# not #REQUIRED! -step.attlist &= - [ a:defaultValue = "required" ] - attribute performance { "optional" | "required" }?, - common.attrib, - step.role.attrib, - local.step.attrib -# end of step.attlist - -# end of step.module -local.substeps.attrib = empty -substeps.role.attrib = role.attrib -# doc:A wrapper for steps that occur within steps in a procedure. -substeps = element substeps { substeps.attlist, step+ } -# end of substeps.element - -# Performance: whether entire set of substeps must be performed - -# not #REQUIRED! -substeps.attlist &= - [ a:defaultValue = "required" ] - attribute performance { "optional" | "required" }?, - common.attrib, - substeps.role.attrib, - local.substeps.attrib -# end of substeps.attlist - -# end of substeps.module -local.stepalternatives.attrib = empty -stepalternatives.role.attrib = role.attrib -# doc:Alternative steps in a procedure. -stepalternatives = - element stepalternatives { stepalternatives.attlist, step+ } -# end of stepalternatives.element - -# Performance: Whether (one of) the alternatives must be performed - -# not #REQUIRED! -stepalternatives.attlist &= - [ a:defaultValue = "required" ] - attribute performance { "optional" | "required" }?, - common.attrib, - stepalternatives.role.attrib, - local.stepalternatives.attrib -# end of stepalternatives.attlist - -# end of stepalternatives.module - -# end of procedure.content.module - -# Sidebar .......................... -local.sidebarinfo.attrib = empty -sidebarinfo.role.attrib = role.attrib -# doc:Meta-information for a Sidebar. -sidebarinfo = element sidebarinfo { sidebarinfo.attlist, info.class+ } -# end of sidebarinfo.element -sidebarinfo.attlist &= - common.attrib, sidebarinfo.role.attrib, local.sidebarinfo.attrib -# end of sidebarinfo.attlist - -# end of sidebarinfo.module -local.sidebar.attrib = empty -sidebar.role.attrib = role.attrib -# doc:A portion of a document that is isolated from the main narrative flow. -sidebar = - element sidebar { - sidebar.attlist, - sidebarinfo?, - formalobject.title.content?, - sidebar.mix+ - } -# end of sidebar.element -sidebar.attlist &= - common.attrib, sidebar.role.attrib, local.sidebar.attrib -# end of sidebar.attlist - -# end of sidebar.module - -# end of sidebar.content.model - -# ...................................................................... - -# Paragraph-related elements ........................................... -local.abstract.attrib = empty -abstract.role.attrib = role.attrib -# doc:A summary. -abstract = element abstract { abstract.attlist, title?, para.class+ } -# end of abstract.element -abstract.attlist &= - common.attrib, abstract.role.attrib, local.abstract.attrib -# end of abstract.attlist - -# end of abstract.module -local.authorblurb.attrib = empty -authorblurb.role.attrib = role.attrib -# doc:A short description or note about an author. -authorblurb = - element authorblurb { authorblurb.attlist, title?, para.class+ } -# end of authorblurb.element -authorblurb.attlist &= - common.attrib, authorblurb.role.attrib, local.authorblurb.attrib -# end of authorblurb.attlist - -# end of authorblurb.module -local.personblurb.attrib = empty -personblurb.role.attrib = role.attrib -# doc:A short description or note about a person. -personblurb = - element personblurb { personblurb.attlist, title?, para.class+ } -# end of personblurb.element -personblurb.attlist &= - common.attrib, personblurb.role.attrib, local.personblurb.attrib -# end of personblurb.attlist - -# end of personblurb.module -local.blockquote.attrib = empty -blockquote.role.attrib = role.attrib -# doc:A quotation set off from the main text. -blockquote = - element blockquote { - blockquote.attlist, blockinfo?, title?, attribution?, component.mix+ - } -# end of blockquote.element -blockquote.attlist &= - common.attrib, blockquote.role.attrib, local.blockquote.attrib -# end of blockquote.attlist - -# end of blockquote.module -local.attribution.attrib = empty -attribution.role.attrib = role.attrib -# doc:The source of a block quote or epigraph. -attribution = - element attribution { attribution.attlist, para.char.mix* } -# end of attribution.element -attribution.attlist &= - common.attrib, attribution.role.attrib, local.attribution.attrib -# end of attribution.attlist - -# end of attribution.module -local.bridgehead.attrib = empty -bridgehead.role.attrib = role.attrib -# doc:A free-floating heading. -bridgehead = element bridgehead { bridgehead.attlist, title.char.mix* } -# end of bridgehead.element - -# Renderas: Indicates the format in which the BridgeHead -# should appear -bridgehead.attlist &= - attribute renderas { - "other" | "sect1" | "sect2" | "sect3" | "sect4" | "sect5" - }?, - common.attrib, - bridgehead.role.attrib, - local.bridgehead.attrib -# end of bridgehead.attlist - -# end of bridgehead.module -local.remark.attrib = empty -remark.role.attrib = role.attrib -# doc:A remark (or comment) intended for presentation in a draft manuscript. -remark = element remark { remark.attlist, para.char.mix* } -# end of remark.element -remark.attlist &= common.attrib, remark.role.attrib, local.remark.attrib -# end of remark.attlist - -# end of remark.module -local.epigraph.attrib = empty -epigraph.role.attrib = role.attrib -# doc:A short inscription at the beginning of a document or component. -epigraph = - element epigraph { - epigraph.attlist, attribution?, (para.class | literallayout)+ - } -# end of epigraph.element -epigraph.attlist &= - common.attrib, epigraph.role.attrib, local.epigraph.attrib -# end of epigraph.attlist - -# Attribution (defined above) - -# end of epigraph.module -local.footnote.attrib = empty -footnote.role.attrib = role.attrib -# doc:A footnote. -footnote = element footnote { footnote.attlist, footnote.mix+ } -# end of footnote.element -footnote.attlist &= - label.attrib, - common.attrib, - footnote.role.attrib, - local.footnote.attrib -# end of footnote.attlist - -# end of footnote.module -local.highlights.attrib = empty -highlights.role.attrib = role.attrib -# doc:A summary of the main points of the discussed component. -highlights = element highlights { highlights.attlist, highlights.mix+ } -# end of highlights.element -highlights.attlist &= - common.attrib, highlights.role.attrib, local.highlights.attrib -# end of highlights.attlist - -# end of highlights.module -local.formalpara.attrib = empty -formalpara.role.attrib = role.attrib -# doc:A paragraph with a title. -formalpara = - element formalpara { formalpara.attlist, title, ndxterm.class*, para } -# end of formalpara.element -formalpara.attlist &= - common.attrib, formalpara.role.attrib, local.formalpara.attrib -# end of formalpara.attlist - -# end of formalpara.module -local.para.attrib = empty -para.role.attrib = role.attrib -# doc:A paragraph. -para = element para { para.attlist, (para.char.mix | para.mix)* } -# end of para.element -para.attlist &= common.attrib, para.role.attrib, local.para.attrib -# end of para.attlist - -# end of para.module -local.simpara.attrib = empty -simpara.role.attrib = role.attrib -# doc:A paragraph that contains only text and inline markup, no block elements. -simpara = element simpara { simpara.attlist, para.char.mix* } -# end of simpara.element -simpara.attlist &= - common.attrib, simpara.role.attrib, local.simpara.attrib -# end of simpara.attlist - -# end of simpara.module -local.admon.attrib = empty -admon.role.attrib = role.attrib -# doc:A note of caution. -caution = element caution { caution.attlist, title?, admon.mix+ } -# end of caution.element -caution.attlist &= common.attrib, admon.role.attrib, local.admon.attrib -# end of caution.attlist - -# doc:An admonition set off from the text. -important = element important { important.attlist, title?, admon.mix+ } -# end of important.element -important.attlist &= - common.attrib, admon.role.attrib, local.admon.attrib -# end of important.attlist - -# doc:A message set off from the text. -note = element note { note.attlist, title?, admon.mix+ } -# end of note.element -note.attlist &= common.attrib, admon.role.attrib, local.admon.attrib -# end of note.attlist - -# doc:A suggestion to the user, set off from the text. -tip = element tip { tip.attlist, title?, admon.mix+ } -# end of tip.element -tip.attlist &= common.attrib, admon.role.attrib, local.admon.attrib -# end of tip.attlist - -# doc:An admonition set off from the text. -warning = element warning { warning.attlist, title?, admon.mix+ } -# end of warning.element -warning.attlist &= common.attrib, admon.role.attrib, local.admon.attrib -# end of warning.attlist - -# end of admon.module - -# ...................................................................... - -# Lists ................................................................ - -# GlossList ........................ -local.glosslist.attrib = empty -glosslist.role.attrib = role.attrib -# doc:A wrapper for a set of GlossEntrys. -glosslist = - element glosslist { - glosslist.attlist, - blockinfo?, - formalobject.title.content?, - glossentry+ - } -# end of glosslist.element -glosslist.attlist &= - common.attrib, glosslist.role.attrib, local.glosslist.attrib -# end of glosslist.attlist - -# end of glosslist.module -local.glossentry.attrib = empty -glossentry.role.attrib = role.attrib -# doc:An entry in a Glossary or GlossList. -glossentry = - element glossentry { - glossentry.attlist, - glossterm, - acronym?, - abbrev?, - ndxterm.class*, - revhistory?, - (glosssee | glossdef+) - } -# end of glossentry.element - -# SortAs: String by which the GlossEntry is to be sorted -# (alphabetized) in lieu of its proper content -glossentry.attlist &= - attribute sortas { text }?, - common.attrib, - glossentry.role.attrib, - local.glossentry.attrib -# end of glossentry.attlist - -# end of glossentry.module - -# GlossTerm (defined in the Inlines section, below) -local.glossdef.attrib = empty -glossdef.role.attrib = role.attrib -# doc:A definition in a GlossEntry. -glossdef = - element glossdef { glossdef.attlist, glossdef.mix+, glossseealso* } -# end of glossdef.element - -# Subject: List of subjects; keywords for the definition -glossdef.attlist &= - attribute subject { text }?, - common.attrib, - glossdef.role.attrib, - local.glossdef.attrib -# end of glossdef.attlist - -# end of glossdef.module -local.glosssee.attrib = empty -glosssee.role.attrib = role.attrib -# doc:A cross-reference from one GlossEntry to another. -glosssee = element glosssee { glosssee.attlist, para.char.mix* } -# end of glosssee.element - -# OtherTerm: Reference to the GlossEntry whose GlossTerm -# should be displayed at the point of the GlossSee -glosssee.attlist &= - attribute otherterm { xsd:IDREF }?, - common.attrib, - glosssee.role.attrib, - local.glosssee.attrib -# end of glosssee.attlist - -# end of glosssee.module -local.glossseealso.attrib = empty -glossseealso.role.attrib = role.attrib -# doc:A cross-reference from one GlossEntry to another. -glossseealso = - element glossseealso { glossseealso.attlist, para.char.mix* } -# end of glossseealso.element - -# OtherTerm: Reference to the GlossEntry whose GlossTerm -# should be displayed at the point of the GlossSeeAlso -glossseealso.attlist &= - attribute otherterm { xsd:IDREF }?, - common.attrib, - glossseealso.role.attrib, - local.glossseealso.attrib -# end of glossseealso.attlist - -# end of glossseealso.module - -# end of glossentry.content.module - -# ItemizedList and OrderedList ..... -local.itemizedlist.attrib = empty -itemizedlist.role.attrib = role.attrib -# doc:A list in which each entry is marked with a bullet or other dingbat. -itemizedlist = - element itemizedlist { - itemizedlist.attlist, - blockinfo?, - formalobject.title.content?, - listpreamble.mix*, - listitem+ - } -# end of itemizedlist.element - -# Spacing: Whether the vertical space in the list should be -# compressed - -# Mark: Keyword, e.g., bullet, dash, checkbox, none; -# list of keywords and defaults are implementation specific -itemizedlist.attlist &= - attribute spacing { "normal" | "compact" }?, - mark.attrib, - common.attrib, - itemizedlist.role.attrib, - local.itemizedlist.attrib -# end of itemizedlist.attlist - -# end of itemizedlist.module -local.orderedlist.attrib = empty -orderedlist.role.attrib = role.attrib -# doc:A list in which each entry is marked with a sequentially incremented label. -orderedlist = - element orderedlist { - orderedlist.attlist, - blockinfo?, - formalobject.title.content?, - listpreamble.mix*, - listitem+ - } -# end of orderedlist.element - -# Numeration: Style of ListItem numbered; default is expected -# to be Arabic - -# InheritNum: Specifies for a nested list that the numbering -# of ListItems should include the number of the item -# within which they are nested (e.g., 1a and 1b within 1, -# rather than a and b) - -# Continuation: Where list numbering begins afresh (Restarts, -# the default) or continues that of the immediately preceding -# list (Continues) - -# Spacing: Whether the vertical space in the list should be -# compressed -orderedlist.attlist &= - attribute numeration { - "arabic" | "upperalpha" | "loweralpha" | "upperroman" | "lowerroman" - }?, - [ a:defaultValue = "ignore" ] - attribute inheritnum { "inherit" | "ignore" }?, - [ a:defaultValue = "restarts" ] - attribute continuation { "continues" | "restarts" }?, - attribute spacing { "normal" | "compact" }?, - common.attrib, - orderedlist.role.attrib, - local.orderedlist.attrib -# end of orderedlist.attlist - -# end of orderedlist.module -local.listitem.attrib = empty -listitem.role.attrib = role.attrib -# doc:A wrapper for the elements of a list item. -listitem = element listitem { listitem.attlist, component.mix+ } -# end of listitem.element - -# Override: Indicates the mark to be used for this ListItem -# instead of the default mark or the mark specified by -# the Mark attribute on the enclosing ItemizedList -listitem.attlist &= - attribute override { text }?, - common.attrib, - listitem.role.attrib, - local.listitem.attrib -# end of listitem.attlist - -# end of listitem.module - -# SegmentedList .................... -local.segmentedlist.attrib = empty -segmentedlist.role.attrib = role.attrib -# doc:A segmented list, a list of sets of elements. -segmentedlist = - element segmentedlist { - segmentedlist.attlist, - formalobject.title.content?, - segtitle+, - seglistitem+ - } -# end of segmentedlist.element -segmentedlist.attlist &= - common.attrib, segmentedlist.role.attrib, local.segmentedlist.attrib -# end of segmentedlist.attlist - -# end of segmentedlist.module -local.segtitle.attrib = empty -segtitle.role.attrib = role.attrib -# doc:The title of an element of a list item in a segmented list. -segtitle = element segtitle { segtitle.attlist, title.char.mix* } -# end of segtitle.element -segtitle.attlist &= - common.attrib, segtitle.role.attrib, local.segtitle.attrib -# end of segtitle.attlist - -# end of segtitle.module -local.seglistitem.attrib = empty -seglistitem.role.attrib = role.attrib -# doc:A list item in a segmented list. -seglistitem = element seglistitem { seglistitem.attlist, seg+ } -# end of seglistitem.element -seglistitem.attlist &= - common.attrib, seglistitem.role.attrib, local.seglistitem.attrib -# end of seglistitem.attlist - -# end of seglistitem.module -local.seg.attrib = empty -seg.role.attrib = role.attrib -# doc:An element of a list item in a segmented list. -seg = element seg { seg.attlist, para.char.mix* } -# end of seg.element -seg.attlist &= common.attrib, seg.role.attrib, local.seg.attrib -# end of seg.attlist - -# end of seg.module - -# end of segmentedlist.content.module - -# SimpleList ....................... -local.simplelist.attrib = empty -simplelist.role.attrib = role.attrib -# doc:An undecorated list of single words or short phrases. -simplelist = element simplelist { simplelist.attlist, member+ } -# end of simplelist.element - -# Columns: The number of columns the array should contain - -# Type: How the Members of the SimpleList should be -# formatted: Inline (members separated with commas etc. -# inline), Vert (top to bottom in n Columns), or Horiz (in -# the direction of text flow) in n Columns. If Column -# is 1 or implied, Type=Vert and Type=Horiz give the same -# results. -simplelist.attlist &= - attribute columns { text }?, - [ a:defaultValue = "vert" ] - attribute type { "inline" | "vert" | "horiz" }?, - common.attrib, - simplelist.role.attrib, - local.simplelist.attrib -# end of simplelist.attlist - -# end of simplelist.module -local.member.attrib = empty -member.role.attrib = role.attrib -# doc:An element of a simple list. -member = element member { member.attlist, para.char.mix* } -# end of member.element -member.attlist &= common.attrib, member.role.attrib, local.member.attrib -# end of member.attlist - -# end of member.module - -# end of simplelist.content.module - -# VariableList ..................... -local.variablelist.attrib = empty -variablelist.role.attrib = role.attrib -# doc:A list in which each entry is composed of a set of one or more terms and an associated description. -variablelist = - element variablelist { - variablelist.attlist, - blockinfo?, - formalobject.title.content?, - listpreamble.mix*, - varlistentry+ - } -# end of variablelist.element - -# TermLength: Length beyond which the presentation engine -# may consider the Term too long and select an alternate -# presentation of the Term and, or, its associated ListItem. -variablelist.attlist &= - attribute termlength { text }?, - attribute spacing { "normal" | "compact" }?, - common.attrib, - variablelist.role.attrib, - local.variablelist.attrib -# end of variablelist.attlist - -# end of variablelist.module -local.varlistentry.attrib = empty -varlistentry.role.attrib = role.attrib -# doc:A wrapper for a set of terms and the associated description in a variable list. -varlistentry = - element varlistentry { varlistentry.attlist, term+, listitem } -# end of varlistentry.element -varlistentry.attlist &= - common.attrib, varlistentry.role.attrib, local.varlistentry.attrib -# end of varlistentry.attlist - -# end of varlistentry.module -local.term.attrib = empty -term.role.attrib = role.attrib -# doc:The word or phrase being defined or described in a variable list. -term = element term { term.attlist, para.char.mix* } -# end of term.element -term.attlist &= common.attrib, term.role.attrib, local.term.attrib -# end of term.attlist - -# end of term.module - -# ListItem (defined above) - -# end of variablelist.content.module - -# CalloutList ...................... -local.calloutlist.attrib = empty -calloutlist.role.attrib = role.attrib -# doc:A list of Callouts. -calloutlist = - element calloutlist { - calloutlist.attlist, formalobject.title.content?, callout+ - } -# end of calloutlist.element -calloutlist.attlist &= - common.attrib, calloutlist.role.attrib, local.calloutlist.attrib -# end of calloutlist.attlist - -# end of calloutlist.module -local.callout.attrib = empty -callout.role.attrib = role.attrib -# doc:A “called out” description of a marked Area. -callout = element callout { callout.attlist, component.mix+ } -# end of callout.element - -# AreaRefs: IDs of one or more Areas or AreaSets described -# by this Callout -callout.attlist &= - attribute arearefs { xsd:IDREFS }, - common.attrib, - callout.role.attrib, - local.callout.attrib -# end of callout.attlist - -# end of callout.module - -# end of calloutlist.content.module - -# ...................................................................... - -# Objects .............................................................. - -# Examples etc. .................... -local.example.attrib = empty -example.role.attrib = role.attrib -# doc:A formal example, with a title. -example = - element example { - example.attlist, - blockinfo?, - formalobject.title.content, - example.mix+ - } -# end of example.element -example.attlist &= - attribute floatstyle { text }?, - label.attrib, - width.attrib, - common.attrib, - example.role.attrib, - local.example.attrib -# end of example.attlist - -# end of example.module -local.informalexample.attrib = empty -informalexample.role.attrib = role.attrib -# doc:A displayed example without a title. -informalexample = - element informalexample { - informalexample.attlist, blockinfo?, example.mix+ - } -# end of informalexample.element -informalexample.attlist &= - attribute floatstyle { text }?, - width.attrib, - common.attrib, - informalexample.role.attrib, - local.informalexample.attrib -# end of informalexample.attlist - -# end of informalexample.module -local.programlistingco.attrib = empty -programlistingco.role.attrib = role.attrib -# doc:A program listing with associated areas used in callouts. -programlistingco = - element programlistingco { - programlistingco.attlist, areaspec, programlisting, calloutlist* - } -# end of programlistingco.element -programlistingco.attlist &= - common.attrib, - programlistingco.role.attrib, - local.programlistingco.attrib -# end of programlistingco.attlist - -# CalloutList (defined above in Lists) - -# end of informalexample.module -local.areaspec.attrib = empty -areaspec.role.attrib = role.attrib -# doc:A collection of regions in a graphic or code example. -areaspec = element areaspec { areaspec.attlist, (area | areaset)+ } -# end of areaspec.element - -# Units: global unit of measure in which coordinates in -# this spec are expressed: -# -# - CALSPair "x1,y1 x2,y2": lower-left and upper-right -# coordinates in a rectangle describing repro area in which -# graphic is placed, where X and Y dimensions are each some -# number 0..10000 (taken from CALS graphic attributes) -# -# - LineColumn "line column": line number and column number -# at which to start callout text in "linespecific" content -# -# - LineRange "startline endline": whole lines from startline -# to endline in "linespecific" content -# -# - LineColumnPair "line1 col1 line2 col2": starting and ending -# points of area in "linespecific" content that starts at -# first position and ends at second position (including the -# beginnings of any intervening lines) -# -# - Other: directive to look at value of OtherUnits attribute -# to get implementation-specific keyword -# -# The default is implementation-specific; usually dependent on -# the parent element (GraphicCO gets CALSPair, ProgramListingCO -# and ScreenCO get LineColumn) - -# OtherUnits: User-defined units -areaspec.attlist &= - attribute units { - "calspair" | "linecolumn" | "linerange" | "linecolumnpair" | "other" - }?, - attribute otherunits { xsd:NMTOKEN }?, - common.attrib, - areaspec.role.attrib, - local.areaspec.attrib -# end of areaspec.attlist - -# end of areaspec.module -local.area.attrib = empty -area.role.attrib = role.attrib -# doc:A region defined for a Callout in a graphic or code example. -area = element area { area.attlist, empty } -# end of area.element - -# bug number/symbol override or initialization - -# to any related information - -# Units: unit of measure in which coordinates in this -# area are expressed; inherits from AreaSet and AreaSpec - -# OtherUnits: User-defined units -area.attlist &= - label.attrib, - linkends.attrib, - attribute units { - "calspair" | "linecolumn" | "linerange" | "linecolumnpair" | "other" - }?, - attribute otherunits { xsd:NMTOKEN }?, - attribute coords { text }, - idreq.common.attrib, - area.role.attrib, - local.area.attrib -# end of area.attlist - -# end of area.module -local.areaset.attrib = empty -areaset.role.attrib = role.attrib -# doc:A set of related areas in a graphic or code example. -areaset = element areaset { areaset.attlist, area+ } -# end of areaset.element - -# bug number/symbol override or initialization - -# Units: unit of measure in which coordinates in this -# area are expressed; inherits from AreaSpec -areaset.attlist &= - label.attrib, - attribute units { - "calspair" | "linecolumn" | "linerange" | "linecolumnpair" | "other" - }?, - attribute otherunits { xsd:NMTOKEN }?, - attribute coords { text }, - idreq.common.attrib, - areaset.role.attrib, - local.areaset.attrib -# end of areaset.attlist - -# end of areaset.module - -# end of areaspec.content.module -local.programlisting.attrib = empty -programlisting.role.attrib = role.attrib -# doc:A literal listing of all or part of a program. -programlisting = - element programlisting { - programlisting.attlist, - (para.char.mix | co | coref | lineannotation | textobject)* - } -# end of programlisting.element -programlisting.attlist &= - width.attrib, - linespecific.attrib, - common.attrib, - programlisting.role.attrib, - local.programlisting.attrib -# end of programlisting.attlist - -# end of programlisting.module -local.literallayout.attrib = empty -literallayout.role.attrib = role.attrib -# doc:A block of text in which line breaks and white space are to be reproduced faithfully. -literallayout = - element literallayout { - literallayout.attlist, - (para.char.mix | co | coref | textobject | lineannotation)* - } -# end of literallayout.element -literallayout.attlist &= - width.attrib, - linespecific.attrib, - [ a:defaultValue = "normal" ] - attribute class { "monospaced" | "normal" }?, - common.attrib, - literallayout.role.attrib, - local.literallayout.attrib -# end of literallayout.attlist - -# LineAnnotation (defined in the Inlines section, below) - -# end of literallayout.module -local.screenco.attrib = empty -screenco.role.attrib = role.attrib -# doc:A screen with associated areas used in callouts. -screenco = - element screenco { screenco.attlist, areaspec, screen, calloutlist* } -# end of screenco.element -screenco.attlist &= - common.attrib, screenco.role.attrib, local.screenco.attrib -# end of screenco.attlist - -# AreaSpec (defined above) - -# CalloutList (defined above in Lists) - -# end of screenco.module -local.screen.attrib = empty -screen.role.attrib = role.attrib -# doc:Text that a user sees or might see on a computer screen. -screen = - element screen { - screen.attlist, - (para.char.mix | co | coref | textobject | lineannotation)* - } -# end of screen.element -screen.attlist &= - width.attrib, - linespecific.attrib, - common.attrib, - screen.role.attrib, - local.screen.attrib -# end of screen.attlist - -# end of screen.module -local.screenshot.attrib = empty -screenshot.role.attrib = role.attrib -# doc:A representation of what the user sees or might see on a computer screen. -screenshot = - element screenshot { - screenshot.attlist, - screeninfo?, - (graphic | graphicco | mediaobject | mediaobjectco) - } -# end of screenshot.element -screenshot.attlist &= - common.attrib, screenshot.role.attrib, local.screenshot.attrib -# end of screenshot.attlist - -# end of screenshot.module -local.screeninfo.attrib = empty -screeninfo.role.attrib = role.attrib -# doc:Information about how a screen shot was produced. -screeninfo = element screeninfo { screeninfo.attlist, para.char.mix* } -# end of screeninfo.element -screeninfo.attlist &= - common.attrib, screeninfo.role.attrib, local.screeninfo.attrib -# end of screeninfo.attlist - -# end of screeninfo.module - -# end of screenshot.content.module - -# Figures etc. ..................... -local.figure.attrib = empty -figure.role.attrib = role.attrib -# doc:A formal figure, generally an illustration, with a title. -figure = - element figure { - figure.attlist, - blockinfo?, - formalobject.title.content, - (figure.mix | link.char.class)+ - } -# end of figure.element - -# Float: Whether the Figure is supposed to be rendered -# where convenient (yes (1) value) or at the place it occurs -# in the text (no (0) value, the default) -figure.attlist &= - [ a:defaultValue = "0" ] attribute float { yesorno.attvals }?, - attribute floatstyle { text }?, - attribute pgwide { yesorno.attvals }?, - label.attrib, - common.attrib, - figure.role.attrib, - local.figure.attrib -# end of figure.attlist - -# end of figure.module -local.informalfigure.attrib = empty -informalfigure.role.attrib = role.attrib -# doc:A untitled figure. -informalfigure = - element informalfigure { - informalfigure.attlist, blockinfo?, (figure.mix | link.char.class)+ - } -# end of informalfigure.element - -# Float: Whether the Figure is supposed to be rendered -# where convenient (yes (1) value) or at the place it occurs -# in the text (no (0) value, the default) -informalfigure.attlist &= - [ a:defaultValue = "0" ] attribute float { yesorno.attvals }?, - attribute floatstyle { text }?, - attribute pgwide { yesorno.attvals }?, - label.attrib, - common.attrib, - informalfigure.role.attrib, - local.informalfigure.attrib -# end of informalfigure.attlist - -# end of informalfigure.module -local.graphicco.attrib = empty -graphicco.role.attrib = role.attrib -# doc:A graphic that contains callout areas. -graphicco = - element graphicco { - graphicco.attlist, areaspec, graphic, calloutlist* - } -# end of graphicco.element -graphicco.attlist &= - common.attrib, graphicco.role.attrib, local.graphicco.attrib -# end of graphicco.attlist - -# AreaSpec (defined above in Examples) - -# CalloutList (defined above in Lists) - -# end of graphicco.module - -# Graphical data can be the content of Graphic, or you can reference -# an external file either as an entity (Entitref) or a filename -# (Fileref). -local.graphic.attrib = empty -graphic.role.attrib = role.attrib -# doc:A displayed graphical object (not an inline). -graphic = element graphic { graphic.attlist, empty } -# end of graphic.element -graphic.attlist &= - graphics.attrib, - common.attrib, - graphic.role.attrib, - local.graphic.attrib -# end of graphic.attlist - -# end of graphic.module -local.inlinegraphic.attrib = empty -inlinegraphic.role.attrib = role.attrib -# doc:An object containing or pointing to graphical data that will be rendered inline. -inlinegraphic = element inlinegraphic { inlinegraphic.attlist, empty } -# end of inlinegraphic.element -inlinegraphic.attlist &= - graphics.attrib, - common.attrib, - inlinegraphic.role.attrib, - local.inlinegraphic.attrib -# end of inlinegraphic.attlist - -# end of inlinegraphic.module -local.mediaobject.attrib = empty -mediaobject.role.attrib = role.attrib -# doc:A displayed media object (video, audio, image, etc.). -mediaobject = - element mediaobject { - mediaobject.attlist, objectinfo?, mediaobject.mix+, caption? - } -# end of mediaobject.element -mediaobject.attlist &= - common.attrib, mediaobject.role.attrib, local.mediaobject.attrib -# end of mediaobject.attlist - -# end of mediaobject.module -local.inlinemediaobject.attrib = empty -inlinemediaobject.role.attrib = role.attrib -# doc:An inline media object (video, audio, image, and so on). -inlinemediaobject = - element inlinemediaobject { - inlinemediaobject.attlist, objectinfo?, mediaobject.mix+ - } -# end of inlinemediaobject.element -inlinemediaobject.attlist &= - common.attrib, - inlinemediaobject.role.attrib, - local.inlinemediaobject.attrib -# end of inlinemediaobject.attlist - -# end of inlinemediaobject.module -local.videoobject.attrib = empty -videoobject.role.attrib = role.attrib -# doc:A wrapper for video data and its associated meta-information. -videoobject = - element videoobject { videoobject.attlist, objectinfo?, videodata } -# end of videoobject.element -videoobject.attlist &= - common.attrib, videoobject.role.attrib, local.videoobject.attrib -# end of videoobject.attlist - -# end of videoobject.module -local.audioobject.attrib = empty -audioobject.role.attrib = role.attrib -# doc:A wrapper for audio data and its associated meta-information. -audioobject = - element audioobject { audioobject.attlist, objectinfo?, audiodata } -# end of audioobject.element -audioobject.attlist &= - common.attrib, audioobject.role.attrib, local.audioobject.attrib -# end of audioobject.attlist - -# end of audioobject.module -local.imageobject.attrib = empty -imageobject.role.attrib = role.attrib -# doc:A wrapper for image data and its associated meta-information. -imageobject = - element imageobject { imageobject.attlist, objectinfo?, imagedata } -# end of imageobject.element -imageobject.attlist &= - common.attrib, imageobject.role.attrib, local.imageobject.attrib -# end of imageobject.attlist - -# end of imageobject.module -local.textobject.attrib = empty -textobject.role.attrib = role.attrib -# doc:A wrapper for a text description of an object and its associated meta-information. -textobject = - element textobject { - textobject.attlist, - objectinfo?, - (phrase | textdata | textobject.mix+) - } -# end of textobject.element -textobject.attlist &= - common.attrib, textobject.role.attrib, local.textobject.attrib -# end of textobject.attlist - -# end of textobject.module -local.objectinfo.attrib = empty -objectinfo.role.attrib = role.attrib -# doc:Meta-information for an object. -objectinfo = element objectinfo { objectinfo.attlist, info.class+ } -# end of objectinfo.element -objectinfo.attlist &= - common.attrib, objectinfo.role.attrib, local.objectinfo.attrib -# end of objectinfo.attlist - -# end of objectinfo.module - -# EntityRef: Name of an external entity containing the content -# of the object data - -# FileRef: Filename, qualified by a pathname if desired, -# designating the file containing the content of the object data - -# Format: Notation of the element content, if any - -# SrcCredit: Information about the source of the image -local.objectdata.attrib = empty -objectdata.attrib = - attribute entityref { xsd:ENTITY }?, - attribute fileref { text }?, - attribute format { notation.class }?, - attribute srccredit { text }?, - local.objectdata.attrib -local.videodata.attrib = empty -videodata.role.attrib = role.attrib -# doc:Pointer to external video data. -videodata = element videodata { videodata.attlist, empty } -# end of videodata.element - -# Width: Same as CALS reprowid (desired width) - -# Depth: Same as CALS reprodep (desired depth) - -# Align: Same as CALS hplace with 'none' removed; #IMPLIED means -# application-specific - -# Scale: Conflation of CALS hscale and vscale - -# Scalefit: Same as CALS scalefit -videodata.attlist &= - attribute width { text }?, - attribute contentwidth { text }?, - attribute depth { text }?, - attribute contentdepth { text }?, - attribute align { "left" | "right" | "center" }?, - attribute valign { "top" | "middle" | "bottom" }?, - attribute scale { text }?, - attribute scalefit { yesorno.attvals }?, - objectdata.attrib, - common.attrib, - videodata.role.attrib, - local.videodata.attrib -# end of videodata.attlist - -# end of videodata.module -local.audiodata.attrib = empty -audiodata.role.attrib = role.attrib -# doc:Pointer to external audio data. -audiodata = element audiodata { audiodata.attlist, empty } -# end of audiodata.element -audiodata.attlist &= - objectdata.attrib, - common.attrib, - audiodata.role.attrib, - local.audiodata.attrib -# end of audiodata.attlist - -# end of audiodata.module -local.imagedata.attrib = empty -imagedata.role.attrib = role.attrib -# doc:Pointer to external image data. -imagedata = element imagedata { imagedata.attlist, empty } -# end of imagedata.element - -# Width: Same as CALS reprowid (desired width) - -# Depth: Same as CALS reprodep (desired depth) - -# Align: Same as CALS hplace with 'none' removed; #IMPLIED means -# application-specific - -# Scale: Conflation of CALS hscale and vscale - -# Scalefit: Same as CALS scalefit -imagedata.attlist &= - attribute width { text }?, - attribute contentwidth { text }?, - attribute depth { text }?, - attribute contentdepth { text }?, - attribute align { "left" | "right" | "center" }?, - attribute valign { "top" | "middle" | "bottom" }?, - attribute scale { text }?, - attribute scalefit { yesorno.attvals }?, - objectdata.attrib, - common.attrib, - imagedata.role.attrib, - local.imagedata.attrib -# end of imagedata.attlist - -# end of imagedata.module -local.textdata.attrib = empty -textdata.role.attrib = role.attrib -# doc:Pointer to external text data. -textdata = element textdata { textdata.attlist, empty } -# end of textdata.element -textdata.attlist &= - attribute encoding { text }?, - objectdata.attrib, - common.attrib, - textdata.role.attrib, - local.textdata.attrib -# end of textdata.attlist - -# end of textdata.module -local.mediaobjectco.attrib = empty -mediaobjectco.role.attrib = role.attrib -# doc:A media object that contains callouts. -mediaobjectco = - element mediaobjectco { - mediaobjectco.attlist, - objectinfo?, - imageobjectco, - (imageobjectco | textobject)* - } -# end of mediaobjectco.element -mediaobjectco.attlist &= - common.attrib, mediaobjectco.role.attrib, local.mediaobjectco.attrib -# end of mediaobjectco.attlist - -# end of mediaobjectco.module -local.imageobjectco.attrib = empty -imageobjectco.role.attrib = role.attrib -# doc:A wrapper for an image object with callouts. -imageobjectco = - element imageobjectco { - imageobjectco.attlist, areaspec, imageobject, calloutlist* - } -# end of imageobjectco.element -imageobjectco.attlist &= - common.attrib, imageobjectco.role.attrib, local.imageobjectco.attrib -# end of imageobjectco.attlist - -# end of imageobjectco.module - -# end of mediaobject.content.module - -# Equations ........................ - -# This PE provides a mechanism for replacing equation content, - -# perhaps adding a new or different model (e.g., MathML) -equation.content = alt?, (graphic+ | mediaobject+ | mathphrase+) -inlineequation.content = - alt?, (graphic+ | inlinemediaobject+ | mathphrase+) -local.equation.attrib = empty -equation.role.attrib = role.attrib -# doc:A displayed mathematical equation. -equation = - element equation { - equation.attlist, - blockinfo?, - formalobject.title.content?, - (informalequation | equation.content) - } -# end of equation.element -equation.attlist &= - attribute floatstyle { text }?, - label.attrib, - common.attrib, - equation.role.attrib, - local.equation.attrib -# end of equation.attlist - -# end of equation.module -local.informalequation.attrib = empty -informalequation.role.attrib = role.attrib -# doc:A displayed mathematical equation without a title. -informalequation = - element informalequation { - informalequation.attlist, blockinfo?, equation.content - } -# end of informalequation.element -informalequation.attlist &= - attribute floatstyle { text }?, - common.attrib, - informalequation.role.attrib, - local.informalequation.attrib -# end of informalequation.attlist - -# end of informalequation.module -local.inlineequation.attrib = empty -inlineequation.role.attrib = role.attrib -# doc:A mathematical equation or expression occurring inline. -inlineequation = - element inlineequation { - inlineequation.attlist, inlineequation.content - } -# end of inlineequation.element -inlineequation.attlist &= - common.attrib, inlineequation.role.attrib, local.inlineequation.attrib -# end of inlineequation.attlist - -# end of inlineequation.module -local.alt.attrib = empty -alt.role.attrib = role.attrib -# doc:Text representation for a graphical element. -alt = element alt { alt.attlist, text } -# end of alt.element -alt.attlist &= common.attrib, alt.role.attrib, local.alt.attrib -# end of alt.attlist - -# end of alt.module -local.mathphrase.attrib = empty -mathphrase.role.attrib = role.attrib -# doc:A mathematical phrase, an expression that can be represented with ordinary text and a small amount of markup. -mathphrase = - element mathphrase { - mathphrase.attlist, (text | subscript | superscript | emphasis)* - } -# end of mathphrase.element -mathphrase.attlist &= - common.attrib, mathphrase.role.attrib, local.mathphrase.attrib -# end of mathphrase.attlist - -# end of mathphrase.module - -# Tables ........................... - -# Choose a table model. CALS or OASIS XML Exchange - -# Do we allow the HTML table model as well? - -# ====================================================== - -# xhtmltbl.mod defines HTML tables and sets parameter -# entities so that, when the CALS table module is read, -# we end up allowing any table to be CALS or HTML. -# i.e. This include must come first! - -# ====================================================== -include "htmltblx.rnc" -# end of allow.html.tables - -# Add label and role attributes to table and informaltable - -# Add common attributes to Table, TGroup, TBody, THead, TFoot, Row, -# EntryTbl, and Entry (and InformalTable element). - -# Content model for Table. - -# Allow either objects or inlines; beware of REs between elements. - -# Reference CALS Table Model -include "calstblx.rnc" -# end of table.module - -# Note that InformalTable is dependent on some of the entity -# declarations that customize Table. -local.informaltable.attrib = empty -# the following entity may have been declared by the XHTML table module - -# doc:A table without a title. -informaltable = - element informaltable { - informaltable.attlist, blockinfo?, informal.tbl.table.mdl - } -# end of informaltable.element - -# Frame, Colsep, and Rowsep must be repeated because -# they are not in entities in the table module. - -# includes TabStyle, ToCentry, ShortEntry, -# Orient, PgWide - -# includes Label - -# includes common attributes -informaltable.attlist &= - attribute frame { tbl.frame.attval }?, - attribute colsep { yesorno.attvals }?, - attribute rowsep { yesorno.attvals }?, - common.table.attribs, - tbl.table.att, - local.informaltable.attrib -# end of informaltable.attlist - -# end of informaltable.module -local.caption.attrib = empty -caption.role.attrib = role.attrib -# doc:A caption. -caption = element caption { caption.attlist, (text | textobject.mix)* } -# end of caption.element - -# attrs comes from HTML tables ... - -# common.attrib, but without ID because ID is in attrs -caption.attlist.content = - caption.role.attrib, - attrs, - attribute align { "top" | "bottom" | "left" | "right" }?, - local.caption.attrib -caption.attlist &= caption.attlist.content -# end of caption.attlist - -# end of caption.module - -# ...................................................................... - -# Synopses ............................................................. - -# Synopsis ......................... -local.synopsis.attrib = empty -synopsis.role.attrib = role.attrib -# doc:A general-purpose element for representing the syntax of commands or functions. -synopsis = - element synopsis { - synopsis.attlist, - (para.char.mix - | graphic - | mediaobject - | co - | coref - | textobject - | lineannotation)* - } -# end of synopsis.element -synopsis.attlist &= - label.attrib, - linespecific.attrib, - common.attrib, - synopsis.role.attrib, - local.synopsis.attrib -# end of synopsis.attlist - -# LineAnnotation (defined in the Inlines section, below) - -# end of synopsis.module - -# CmdSynopsis ...................... -local.cmdsynopsis.attrib = empty -cmdsynopsis.role.attrib = role.attrib -# doc:A syntax summary for a software command. -cmdsynopsis = - element cmdsynopsis { - cmdsynopsis.attlist, (command | arg | group | sbr)+, synopfragment* - } -# end of cmdsynopsis.element - -# Sepchar: Character that should separate command and all -# top-level arguments; alternate value might be e.g., Δ -cmdsynopsis.attlist &= - label.attrib, - [ a:defaultValue = " " ] attribute sepchar { text }?, - attribute cmdlength { text }?, - common.attrib, - cmdsynopsis.role.attrib, - local.cmdsynopsis.attrib -# end of cmdsynopsis.attlist - -# end of cmdsynopsis.module -local.arg.attrib = empty -arg.role.attrib = role.attrib -# doc:An argument in a CmdSynopsis. -arg = - element arg { - arg.attlist, - (text - | arg - | group - | option - | synopfragmentref - | replaceable - | sbr)* - } -# end of arg.element - -# Choice: Whether Arg must be supplied: Opt (optional to -# supply, e.g. [arg]; the default), Req (required to supply, -# e.g. {arg}), or Plain (required to supply, e.g. arg) - -# Rep: whether Arg is repeatable: Norepeat (e.g. arg without -# ellipsis; the default), or Repeat (e.g. arg...) -arg.attlist &= - [ a:defaultValue = "opt" ] - attribute choice { "opt" | "req" | "plain" }?, - [ a:defaultValue = "norepeat" ] - attribute rep { "norepeat" | "repeat" }?, - common.attrib, - arg.role.attrib, - local.arg.attrib -# end of arg.attlist - -# end of arg.module -local.group.attrib = empty -group.role.attrib = role.attrib -# doc:A group of elements in a CmdSynopsis. -group = - element group { - group.attlist, - (arg | group | option | synopfragmentref | replaceable | sbr)+ - } -# end of group.element - -# Choice: Whether Group must be supplied: Opt (optional to -# supply, e.g. [g1|g2|g3]; the default), Req (required to -# supply, e.g. {g1|g2|g3}), Plain (required to supply, -# e.g. g1|g2|g3), OptMult (can supply zero or more, e.g. -# [[g1|g2|g3]]), or ReqMult (must supply one or more, e.g. -# {{g1|g2|g3}}) - -# Rep: whether Group is repeatable: Norepeat (e.g. group -# without ellipsis; the default), or Repeat (e.g. group...) -group.attlist &= - [ a:defaultValue = "opt" ] - attribute choice { "opt" | "req" | "plain" }?, - [ a:defaultValue = "norepeat" ] - attribute rep { "norepeat" | "repeat" }?, - common.attrib, - group.role.attrib, - local.group.attrib -# end of group.attlist - -# end of group.module -local.sbr.attrib = empty -# Synopsis break -sbr.role.attrib = role.attrib -# doc:An explicit line break in a command synopsis. -sbr = element sbr { sbr.attlist, empty } -# end of sbr.element -sbr.attlist &= common.attrib, sbr.role.attrib, local.sbr.attrib -# end of sbr.attlist - -# end of sbr.module -local.synopfragmentref.attrib = empty -synopfragmentref.role.attrib = role.attrib -# doc:A reference to a fragment of a command synopsis. -synopfragmentref = - element synopfragmentref { synopfragmentref.attlist, text } -# end of synopfragmentref.element - -# to SynopFragment of complex synopsis -# material for separate referencing -synopfragmentref.attlist &= - linkendreq.attrib, - common.attrib, - synopfragmentref.role.attrib, - local.synopfragmentref.attrib -# end of synopfragmentref.attlist - -# end of synopfragmentref.module -local.synopfragment.attrib = empty -synopfragment.role.attrib = role.attrib -# doc:A portion of a CmdSynopsis broken out from the main body of the synopsis. -synopfragment = - element synopfragment { synopfragment.attlist, (arg | group)+ } -# end of synopfragment.element -synopfragment.attlist &= - idreq.common.attrib, - synopfragment.role.attrib, - local.synopfragment.attrib -# end of synopfragment.attlist - -# end of synopfragment.module - -# Command (defined in the Inlines section, below) - -# Option (defined in the Inlines section, below) - -# Replaceable (defined in the Inlines section, below) - -# end of cmdsynopsis.content.module - -# FuncSynopsis ..................... -local.funcsynopsis.attrib = empty -funcsynopsis.role.attrib = role.attrib -# doc:The syntax summary for a function definition. -funcsynopsis = - element funcsynopsis { - funcsynopsis.attlist, (funcsynopsisinfo | funcprototype)+ - } -# end of funcsynopsis.element -funcsynopsis.attlist &= - label.attrib, - common.attrib, - funcsynopsis.role.attrib, - local.funcsynopsis.attrib -# end of funcsynopsis.attlist - -# end of funcsynopsis.module -local.funcsynopsisinfo.attrib = empty -funcsynopsisinfo.role.attrib = role.attrib -# doc:Information supplementing the FuncDefs of a FuncSynopsis. -funcsynopsisinfo = - element funcsynopsisinfo { - funcsynopsisinfo.attlist, - (cptr.char.mix | textobject | lineannotation)* - } -# end of funcsynopsisinfo.element -funcsynopsisinfo.attlist &= - linespecific.attrib, - common.attrib, - funcsynopsisinfo.role.attrib, - local.funcsynopsisinfo.attrib -# end of funcsynopsisinfo.attlist - -# end of funcsynopsisinfo.module -local.funcprototype.attrib = empty -funcprototype.role.attrib = role.attrib -# doc:The prototype of a function. -funcprototype = - element funcprototype { - funcprototype.attlist, - modifier*, - funcdef, - (void | varargs | (paramdef+, varargs?)), - modifier* - } -# end of funcprototype.element -funcprototype.attlist &= - common.attrib, funcprototype.role.attrib, local.funcprototype.attrib -# end of funcprototype.attlist - -# end of funcprototype.module -local.funcdef.attrib = empty -funcdef.role.attrib = role.attrib -# doc:A function (subroutine) name and its return type. -funcdef = - element funcdef { - funcdef.attlist, (text | type | replaceable | function)* - } -# end of funcdef.element -funcdef.attlist &= - common.attrib, funcdef.role.attrib, local.funcdef.attrib -# end of funcdef.attlist - -# end of funcdef.module -local.void.attrib = empty -void.role.attrib = role.attrib -# doc:An empty element in a function synopsis indicating that the function in question takes no arguments. -void = element void { void.attlist, empty } -# end of void.element -void.attlist &= common.attrib, void.role.attrib, local.void.attrib -# end of void.attlist - -# end of void.module -local.varargs.attrib = empty -varargs.role.attrib = role.attrib -# doc:An empty element in a function synopsis indicating a variable number of arguments. -varargs = element varargs { varargs.attlist, empty } -# end of varargs.element -varargs.attlist &= - common.attrib, varargs.role.attrib, local.varargs.attrib -# end of varargs.attlist - -# end of varargs.module - -# Processing assumes that only one Parameter will appear in a -# ParamDef, and that FuncParams will be used at most once, for -# providing information on the "inner parameters" for parameters that -# are pointers to functions. -local.paramdef.attrib = empty -paramdef.role.attrib = role.attrib -# doc:Information about a function parameter in a programming language. -paramdef = - element paramdef { - paramdef.attlist, - (text | initializer | type | replaceable | parameter | funcparams)* - } -# end of paramdef.element -paramdef.attlist &= - attribute choice { "opt" | "req" }?, - common.attrib, - paramdef.role.attrib, - local.paramdef.attrib -# end of paramdef.attlist - -# end of paramdef.module -local.funcparams.attrib = empty -funcparams.role.attrib = role.attrib -# doc:Parameters for a function referenced through a function pointer in a synopsis. -funcparams = element funcparams { funcparams.attlist, cptr.char.mix* } -# end of funcparams.element -funcparams.attlist &= - common.attrib, funcparams.role.attrib, local.funcparams.attrib -# end of funcparams.attlist - -# end of funcparams.module - -# LineAnnotation (defined in the Inlines section, below) - -# Replaceable (defined in the Inlines section, below) - -# Function (defined in the Inlines section, below) - -# Parameter (defined in the Inlines section, below) - -# end of funcsynopsis.content.module - -# ClassSynopsis ..................... -local.classsynopsis.attrib = empty -classsynopsis.role.attrib = role.attrib -# doc:The syntax summary for a class definition. -classsynopsis = - element classsynopsis { - classsynopsis.attlist, - (ooclass | oointerface | ooexception)+, - (classsynopsisinfo | fieldsynopsis | method.synop.class)* - } -# end of classsynopsis.element -classsynopsis.attlist &= - attribute language { text }?, - [ a:defaultValue = "class" ] - attribute class { "class" | "interface" }?, - common.attrib, - classsynopsis.role.attrib, - local.classsynopsis.attrib -# end of classsynopsis.attlist - -# end of classsynopsis.module -local.classsynopsisinfo.attrib = empty -classsynopsisinfo.role.attrib = role.attrib -# doc:Information supplementing the contents of a ClassSynopsis. -classsynopsisinfo = - element classsynopsisinfo { - classsynopsisinfo.attlist, - (cptr.char.mix | textobject | lineannotation)* - } -# end of classsynopsisinfo.element -classsynopsisinfo.attlist &= - linespecific.attrib, - common.attrib, - classsynopsisinfo.role.attrib, - local.classsynopsisinfo.attrib -# end of classsynopsisinfo.attlist - -# end of classsynopsisinfo.module -local.ooclass.attrib = empty -ooclass.role.attrib = role.attrib -# doc:A class in an object-oriented programming language. -ooclass = - element ooclass { ooclass.attlist, (modifier | package)*, classname } -# end of ooclass.element -ooclass.attlist &= - common.attrib, ooclass.role.attrib, local.ooclass.attrib -# end of ooclass.attlist - -# end of ooclass.module -local.oointerface.attrib = empty -oointerface.role.attrib = role.attrib -# doc:An interface in an object-oriented programming language. -oointerface = - element oointerface { - oointerface.attlist, (modifier | package)*, interfacename - } -# end of oointerface.element -oointerface.attlist &= - common.attrib, oointerface.role.attrib, local.oointerface.attrib -# end of oointerface.attlist - -# end of oointerface.module -local.ooexception.attrib = empty -ooexception.role.attrib = role.attrib -# doc:An exception in an object-oriented programming language. -ooexception = - element ooexception { - ooexception.attlist, (modifier | package)*, exceptionname - } -# end of ooexception.element -ooexception.attlist &= - common.attrib, ooexception.role.attrib, local.ooexception.attrib -# end of ooexception.attlist - -# end of ooexception.module -local.modifier.attrib = empty -modifier.role.attrib = role.attrib -# doc:Modifiers in a synopsis. -modifier = element modifier { modifier.attlist, smallcptr.char.mix* } -# end of modifier.element -modifier.attlist &= - common.attrib, modifier.role.attrib, local.modifier.attrib -# end of modifier.attlist - -# end of modifier.module -local.interfacename.attrib = empty -interfacename.role.attrib = role.attrib -# doc:The name of an interface. -interfacename = - element interfacename { interfacename.attlist, cptr.char.mix* } -# end of interfacename.element -interfacename.attlist &= - common.attrib, interfacename.role.attrib, local.interfacename.attrib -# end of interfacename.attlist - -# end of interfacename.module -local.exceptionname.attrib = empty -exceptionname.role.attrib = role.attrib -# doc:The name of an exception. -exceptionname = - element exceptionname { exceptionname.attlist, smallcptr.char.mix* } -# end of exceptionname.element -exceptionname.attlist &= - common.attrib, exceptionname.role.attrib, local.exceptionname.attrib -# end of exceptionname.attlist - -# end of exceptionname.module -local.fieldsynopsis.attrib = empty -fieldsynopsis.role.attrib = role.attrib -# doc:The name of a field in a class definition. -fieldsynopsis = - element fieldsynopsis { - fieldsynopsis.attlist, modifier*, type?, varname, initializer? - } -# end of fieldsynopsis.element -fieldsynopsis.attlist &= - attribute language { text }?, - common.attrib, - fieldsynopsis.role.attrib, - local.fieldsynopsis.attrib -# end of fieldsynopsis.attlist - -# end of fieldsynopsis.module -local.initializer.attrib = empty -initializer.role.attrib = role.attrib -# doc:The initializer for a FieldSynopsis. -initializer = - element initializer { initializer.attlist, smallcptr.char.mix* } -# end of initializer.element -initializer.attlist &= - common.attrib, initializer.role.attrib, local.initializer.attrib -# end of initializer.attlist - -# end of initializer.module -local.constructorsynopsis.attrib = empty -constructorsynopsis.role.attrib = role.attrib -# doc:A syntax summary for a constructor. -constructorsynopsis = - element constructorsynopsis { - constructorsynopsis.attlist, - modifier*, - methodname?, - (methodparam+ | void?), - exceptionname* - } -# end of constructorsynopsis.element -constructorsynopsis.attlist &= - attribute language { text }?, - common.attrib, - constructorsynopsis.role.attrib, - local.constructorsynopsis.attrib -# end of constructorsynopsis.attlist - -# end of constructorsynopsis.module -local.destructorsynopsis.attrib = empty -destructorsynopsis.role.attrib = role.attrib -# doc:A syntax summary for a destructor. -destructorsynopsis = - element destructorsynopsis { - destructorsynopsis.attlist, - modifier*, - methodname?, - (methodparam+ | void?), - exceptionname* - } -# end of destructorsynopsis.element -destructorsynopsis.attlist &= - attribute language { text }?, - common.attrib, - destructorsynopsis.role.attrib, - local.destructorsynopsis.attrib -# end of destructorsynopsis.attlist - -# end of destructorsynopsis.module -local.methodsynopsis.attrib = empty -methodsynopsis.role.attrib = role.attrib -# doc:A syntax summary for a method. -methodsynopsis = - element methodsynopsis { - methodsynopsis.attlist, - modifier*, - (type | void)?, - methodname, - (methodparam+ | void?), - exceptionname*, - modifier* - } -# end of methodsynopsis.element -methodsynopsis.attlist &= - attribute language { text }?, - common.attrib, - methodsynopsis.role.attrib, - local.methodsynopsis.attrib -# end of methodsynopsis.attlist - -# end of methodsynopsis.module -local.methodname.attrib = empty -methodname.role.attrib = role.attrib -# doc:The name of a method. -methodname = - element methodname { methodname.attlist, smallcptr.char.mix* } -# end of methodname.element -methodname.attlist &= - common.attrib, methodname.role.attrib, local.methodname.attrib -# end of methodname.attlist - -# end of methodname.module -local.methodparam.attrib = empty -methodparam.role.attrib = role.attrib -# doc:Parameters to a method. -methodparam = - element methodparam { - methodparam.attlist, - modifier*, - type?, - ((parameter, initializer?) | funcparams), - modifier* - } -# end of methodparam.element -methodparam.attlist &= - [ a:defaultValue = "req" ] - attribute choice { "opt" | "req" | "plain" }?, - [ a:defaultValue = "norepeat" ] - attribute rep { "norepeat" | "repeat" }?, - common.attrib, - methodparam.role.attrib, - local.methodparam.attrib -# end of methodparam.attlist - -# end of methodparam.module - -# end of classsynopsis.content.module - -# ...................................................................... - -# Document information entities and elements ........................... - -# The document information elements include some elements that are -# currently used only in the document hierarchy module. They are -# defined here so that they will be available for use in customized -# document hierarchies. - -# .................................. - -# Ackno ............................ -local.ackno.attrib = empty -ackno.role.attrib = role.attrib -# doc:Acknowledgements in an Article. -ackno = element ackno { ackno.attlist, docinfo.char.mix* } -# end of ackno.element -ackno.attlist &= common.attrib, ackno.role.attrib, local.ackno.attrib -# end of ackno.attlist - -# end of ackno.module - -# Address .......................... -local.address.attrib = empty -address.role.attrib = role.attrib -# doc:A real-world address, generally a postal address. -address = - element address { - address.attlist, - (text - | personname - | person.ident.mix - | street - | pob - | postcode - | city - | state - | country - | phone - | fax - | email - | otheraddr)* - } -# end of address.element -address.attlist &= - linespecific.attrib, - common.attrib, - address.role.attrib, - local.address.attrib -# end of address.attlist - -# end of address.module -local.street.attrib = empty -street.role.attrib = role.attrib -# doc:A street address in an address. -street = element street { street.attlist, docinfo.char.mix* } -# end of street.element -street.attlist &= common.attrib, street.role.attrib, local.street.attrib -# end of street.attlist - -# end of street.module -local.pob.attrib = empty -pob.role.attrib = role.attrib -# doc:A post office box in an address. -pob = element pob { pob.attlist, docinfo.char.mix* } -# end of pob.element -pob.attlist &= common.attrib, pob.role.attrib, local.pob.attrib -# end of pob.attlist - -# end of pob.module -local.postcode.attrib = empty -postcode.role.attrib = role.attrib -# doc:A postal code in an address. -postcode = element postcode { postcode.attlist, docinfo.char.mix* } -# end of postcode.element -postcode.attlist &= - common.attrib, postcode.role.attrib, local.postcode.attrib -# end of postcode.attlist - -# end of postcode.module -local.city.attrib = empty -city.role.attrib = role.attrib -# doc:The name of a city in an address. -city = element city { city.attlist, docinfo.char.mix* } -# end of city.element -city.attlist &= common.attrib, city.role.attrib, local.city.attrib -# end of city.attlist - -# end of city.module -local.state.attrib = empty -state.role.attrib = role.attrib -# doc:A state or province in an address. -state = element state { state.attlist, docinfo.char.mix* } -# end of state.element -state.attlist &= common.attrib, state.role.attrib, local.state.attrib -# end of state.attlist - -# end of state.module -local.country.attrib = empty -country.role.attrib = role.attrib -# doc:The name of a country. -country = element country { country.attlist, docinfo.char.mix* } -# end of country.element -country.attlist &= - common.attrib, country.role.attrib, local.country.attrib -# end of country.attlist - -# end of country.module -local.phone.attrib = empty -phone.role.attrib = role.attrib -# doc:A telephone number. -phone = element phone { phone.attlist, docinfo.char.mix* } -# end of phone.element -phone.attlist &= common.attrib, phone.role.attrib, local.phone.attrib -# end of phone.attlist - -# end of phone.module -local.fax.attrib = empty -fax.role.attrib = role.attrib -# doc:A fax number. -fax = element fax { fax.attlist, docinfo.char.mix* } -# end of fax.element -fax.attlist &= common.attrib, fax.role.attrib, local.fax.attrib -# end of fax.attlist - -# end of fax.module - -# Email (defined in the Inlines section, below) -local.otheraddr.attrib = empty -otheraddr.role.attrib = role.attrib -# doc:Uncategorized information in address. -otheraddr = element otheraddr { otheraddr.attlist, docinfo.char.mix* } -# end of otheraddr.element -otheraddr.attlist &= - common.attrib, otheraddr.role.attrib, local.otheraddr.attrib -# end of otheraddr.attlist - -# end of otheraddr.module - -# end of address.content.module - -# Affiliation ...................... -local.affiliation.attrib = empty -affiliation.role.attrib = role.attrib -# doc:The institutional affiliation of an individual. -affiliation = - element affiliation { - affiliation.attlist, - shortaffil?, - jobtitle*, - orgname?, - orgdiv*, - address* - } -# end of affiliation.element -affiliation.attlist &= - common.attrib, affiliation.role.attrib, local.affiliation.attrib -# end of affiliation.attlist - -# end of affiliation.module -local.shortaffil.attrib = empty -shortaffil.role.attrib = role.attrib -# doc:A brief description of an affiliation. -shortaffil = - element shortaffil { shortaffil.attlist, docinfo.char.mix* } -# end of shortaffil.element -shortaffil.attlist &= - common.attrib, shortaffil.role.attrib, local.shortaffil.attrib -# end of shortaffil.attlist - -# end of shortaffil.module -local.jobtitle.attrib = empty -jobtitle.role.attrib = role.attrib -# doc:The title of an individual in an organization. -jobtitle = element jobtitle { jobtitle.attlist, docinfo.char.mix* } -# end of jobtitle.element -jobtitle.attlist &= - common.attrib, jobtitle.role.attrib, local.jobtitle.attrib -# end of jobtitle.attlist - -# end of jobtitle.module - -# OrgName (defined elsewhere in this section) -local.orgdiv.attrib = empty -orgdiv.role.attrib = role.attrib -# doc:A division of an organization. -orgdiv = element orgdiv { orgdiv.attlist, docinfo.char.mix* } -# end of orgdiv.element -orgdiv.attlist &= common.attrib, orgdiv.role.attrib, local.orgdiv.attrib -# end of orgdiv.attlist - -# end of orgdiv.module - -# Address (defined elsewhere in this section) - -# end of affiliation.content.module - -# ArtPageNums ...................... -local.artpagenums.attrib = empty -artpagenums.role.attrib = role.attrib -# doc:The page numbers of an article as published. -artpagenums = - element artpagenums { artpagenums.attlist, docinfo.char.mix* } -# end of artpagenums.element -artpagenums.attlist &= - common.attrib, artpagenums.role.attrib, local.artpagenums.attrib -# end of artpagenums.attlist - -# end of artpagenums.module - -# PersonName -local.personname.attrib = empty -personname.role.attrib = role.attrib -# doc:The personal name of an individual. -personname = - element personname { - personname.attlist, - (honorific | firstname | surname | lineage | othername)+ - } -# end of personname.element -personname.attlist &= - common.attrib, personname.role.attrib, local.personname.attrib -# end of personname.attlist - -# end of personname.module - -# Author ........................... -local.author.attrib = empty -author.role.attrib = role.attrib -# doc:The name of an individual author. -author = - element author { - author.attlist, - (personname | person.ident.mix+), - (personblurb | email | address)* - } -# end of author.element -author.attlist &= common.attrib, author.role.attrib, local.author.attrib -# end of author.attlist - -# (see "Personal identity elements" for %person.ident.mix;) - -# end of author.module - -# AuthorGroup ...................... -local.authorgroup.attrib = empty -authorgroup.role.attrib = role.attrib -# doc:Wrapper for author information when a document has multiple authors or collabarators. -authorgroup = - element authorgroup { - authorgroup.attlist, - (author | editor | collab | corpauthor | corpcredit | othercredit)+ - } -# end of authorgroup.element -authorgroup.attlist &= - common.attrib, authorgroup.role.attrib, local.authorgroup.attrib -# end of authorgroup.attlist - -# end of authorgroup.module - -# Author (defined elsewhere in this section) - -# Editor (defined elsewhere in this section) -local.collab.attrib = empty -collab.role.attrib = role.attrib -# doc:Identifies a collaborator. -collab = element collab { collab.attlist, collabname, affiliation* } -# end of collab.element -collab.attlist &= common.attrib, collab.role.attrib, local.collab.attrib -# end of collab.attlist - -# end of collab.module -local.collabname.attrib = empty -collabname.role.attrib = role.attrib -# doc:The name of a collaborator. -collabname = - element collabname { collabname.attlist, docinfo.char.mix* } -# end of collabname.element -collabname.attlist &= - common.attrib, collabname.role.attrib, local.collabname.attrib -# end of collabname.attlist - -# end of collabname.module - -# Affiliation (defined elsewhere in this section) - -# end of collab.content.module - -# CorpAuthor (defined elsewhere in this section) - -# OtherCredit (defined elsewhere in this section) - -# end of authorgroup.content.module - -# AuthorInitials ................... -local.authorinitials.attrib = empty -authorinitials.role.attrib = role.attrib -# doc:The initials or other short identifier for an author. -authorinitials = - element authorinitials { authorinitials.attlist, docinfo.char.mix* } -# end of authorinitials.element -authorinitials.attlist &= - common.attrib, authorinitials.role.attrib, local.authorinitials.attrib -# end of authorinitials.attlist - -# end of authorinitials.module - -# ConfGroup ........................ -local.confgroup.attrib = empty -confgroup.role.attrib = role.attrib -# doc:A wrapper for document meta-information about a conference. -confgroup = - element confgroup { - confgroup.attlist, - (confdates | conftitle | confnum | address | confsponsor)* - } -# end of confgroup.element -confgroup.attlist &= - common.attrib, confgroup.role.attrib, local.confgroup.attrib -# end of confgroup.attlist - -# end of confgroup.module -local.confdates.attrib = empty -confdates.role.attrib = role.attrib -# doc:The dates of a conference for which a document was written. -confdates = element confdates { confdates.attlist, docinfo.char.mix* } -# end of confdates.element -confdates.attlist &= - common.attrib, confdates.role.attrib, local.confdates.attrib -# end of confdates.attlist - -# end of confdates.module -local.conftitle.attrib = empty -conftitle.role.attrib = role.attrib -# doc:The title of a conference for which a document was written. -conftitle = element conftitle { conftitle.attlist, docinfo.char.mix* } -# end of conftitle.element -conftitle.attlist &= - common.attrib, conftitle.role.attrib, local.conftitle.attrib -# end of conftitle.attlist - -# end of conftitle.module -local.confnum.attrib = empty -confnum.role.attrib = role.attrib -# doc:An identifier, frequently numerical, associated with a conference for which a document was written. -confnum = element confnum { confnum.attlist, docinfo.char.mix* } -# end of confnum.element -confnum.attlist &= - common.attrib, confnum.role.attrib, local.confnum.attrib -# end of confnum.attlist - -# end of confnum.module - -# Address (defined elsewhere in this section) -local.confsponsor.attrib = empty -confsponsor.role.attrib = role.attrib -# doc:The sponsor of a conference for which a document was written. -confsponsor = - element confsponsor { confsponsor.attlist, docinfo.char.mix* } -# end of confsponsor.element -confsponsor.attlist &= - common.attrib, confsponsor.role.attrib, local.confsponsor.attrib -# end of confsponsor.attlist - -# end of confsponsor.module - -# end of confgroup.content.module - -# ContractNum ...................... -local.contractnum.attrib = empty -contractnum.role.attrib = role.attrib -# doc:The contract number of a document. -contractnum = - element contractnum { contractnum.attlist, docinfo.char.mix* } -# end of contractnum.element -contractnum.attlist &= - common.attrib, contractnum.role.attrib, local.contractnum.attrib -# end of contractnum.attlist - -# end of contractnum.module - -# ContractSponsor .................. -local.contractsponsor.attrib = empty -contractsponsor.role.attrib = role.attrib -# doc:The sponsor of a contract. -contractsponsor = - element contractsponsor { contractsponsor.attlist, docinfo.char.mix* } -# end of contractsponsor.element -contractsponsor.attlist &= - common.attrib, - contractsponsor.role.attrib, - local.contractsponsor.attrib -# end of contractsponsor.attlist - -# end of contractsponsor.module - -# Copyright ........................ -local.copyright.attrib = empty -copyright.role.attrib = role.attrib -# doc:Copyright information about a document. -copyright = element copyright { copyright.attlist, year+, holder* } -# end of copyright.element -copyright.attlist &= - common.attrib, copyright.role.attrib, local.copyright.attrib -# end of copyright.attlist - -# end of copyright.module -local.year.attrib = empty -year.role.attrib = role.attrib -# doc:The year of publication of a document. -year = element year { year.attlist, docinfo.char.mix* } -# end of year.element -year.attlist &= common.attrib, year.role.attrib, local.year.attrib -# end of year.attlist - -# end of year.module -local.holder.attrib = empty -holder.role.attrib = role.attrib -# doc:The name of the individual or organization that holds a copyright. -holder = element holder { holder.attlist, docinfo.char.mix* } -# end of holder.element -holder.attlist &= common.attrib, holder.role.attrib, local.holder.attrib -# end of holder.attlist - -# end of holder.module - -# end of copyright.content.module - -# CorpAuthor ....................... -local.corpauthor.attrib = empty -corpauthor.role.attrib = role.attrib -# doc:A corporate author, as opposed to an individual. -corpauthor = - element corpauthor { corpauthor.attlist, docinfo.char.mix* } -# end of corpauthor.element -corpauthor.attlist &= - common.attrib, corpauthor.role.attrib, local.corpauthor.attrib -# end of corpauthor.attlist - -# end of corpauthor.module - -# CorpCredit ...................... -local.corpcredit.attrib = empty -corpcredit.role.attrib = role.attrib -# doc:A corporation or organization credited in a document. -corpcredit = - element corpcredit { corpcredit.attlist, docinfo.char.mix* } -# end of corpcredit.element -corpcredit.attlist &= - attribute class { - "graphicdesigner" - | "productioneditor" - | "copyeditor" - | "technicaleditor" - | "translator" - | "other" - }?, - common.attrib, - corpcredit.role.attrib, - local.corpcredit.attrib -# end of corpcredit.attlist - -# end of corpcredit.module - -# CorpName ......................... -local.corpname.attrib = empty -# doc:The name of a corporation. -corpname = element corpname { corpname.attlist, docinfo.char.mix* } -# end of corpname.element -corpname.role.attrib = role.attrib -corpname.attlist &= - common.attrib, corpname.role.attrib, local.corpname.attrib -# end of corpname.attlist - -# end of corpname.module - -# Date ............................. -local.date.attrib = empty -date.role.attrib = role.attrib -# doc:The date of publication or revision of a document. -date = element date { date.attlist, docinfo.char.mix* } -# end of date.element -date.attlist &= common.attrib, date.role.attrib, local.date.attrib -# end of date.attlist - -# end of date.module - -# Edition .......................... -local.edition.attrib = empty -edition.role.attrib = role.attrib -# doc:The name or number of an edition of a document. -edition = element edition { edition.attlist, docinfo.char.mix* } -# end of edition.element -edition.attlist &= - common.attrib, edition.role.attrib, local.edition.attrib -# end of edition.attlist - -# end of edition.module - -# Editor ........................... -local.editor.attrib = empty -editor.role.attrib = role.attrib -# doc:The name of the editor of a document. -editor = - element editor { - editor.attlist, - (personname | person.ident.mix+), - (personblurb | email | address)* - } -# end of editor.element -editor.attlist &= common.attrib, editor.role.attrib, local.editor.attrib -# end of editor.attlist - -# (see "Personal identity elements" for %person.ident.mix;) - -# end of editor.module - -# ISBN ............................. -local.isbn.attrib = empty -isbn.role.attrib = role.attrib -# doc:The International Standard Book Number of a document. -isbn = element isbn { isbn.attlist, docinfo.char.mix* } -# end of isbn.element -isbn.attlist &= common.attrib, isbn.role.attrib, local.isbn.attrib -# end of isbn.attlist - -# end of isbn.module - -# ISSN ............................. -local.issn.attrib = empty -issn.role.attrib = role.attrib -# doc:The International Standard Serial Number of a periodical. -issn = element issn { issn.attlist, docinfo.char.mix* } -# end of issn.element -issn.attlist &= common.attrib, issn.role.attrib, local.issn.attrib -# end of issn.attlist - -# end of issn.module - -# BiblioId ................. -biblio.class.attrib = - attribute class { - "uri" - | "doi" - | "isbn" - | "isrn" - | "issn" - | "libraryofcongress" - | "pubnumber" - | "other" - }?, - attribute otherclass { text }? -local.biblioid.attrib = empty -biblioid.role.attrib = role.attrib -# doc:An identifier for a document. -biblioid = element biblioid { biblioid.attlist, docinfo.char.mix* } -# end of biblioid.element -biblioid.attlist &= - biblio.class.attrib, - common.attrib, - biblioid.role.attrib, - local.biblioid.attrib -# end of biblioid.attlist - -# end of biblioid.module - -# CiteBiblioId ................. -local.citebiblioid.attrib = empty -citebiblioid.role.attrib = role.attrib -# doc:A citation of a bibliographic identifier. -citebiblioid = - element citebiblioid { citebiblioid.attlist, docinfo.char.mix* } -# end of citebiblioid.element -citebiblioid.attlist &= - biblio.class.attrib, - common.attrib, - citebiblioid.role.attrib, - local.citebiblioid.attrib -# end of citebiblioid.attlist - -# end of citebiblioid.module - -# BiblioSource ................. -local.bibliosource.attrib = empty -bibliosource.role.attrib = role.attrib -# doc:The source of a document. -bibliosource = - element bibliosource { bibliosource.attlist, docinfo.char.mix* } -# end of bibliosource.element -bibliosource.attlist &= - biblio.class.attrib, - common.attrib, - bibliosource.role.attrib, - local.bibliosource.attrib -# end of bibliosource.attlist - -# end of bibliosource.module - -# BiblioRelation ................. -local.bibliorelation.attrib = empty -local.bibliorelation.types = notAllowed -bibliorelation.type.attrib = - attribute type { - "isversionof" - | "hasversion" - | "isreplacedby" - | "replaces" - | "isrequiredby" - | "requires" - | "ispartof" - | "haspart" - | "isreferencedby" - | "references" - | "isformatof" - | "hasformat" - | "othertype" - | local.bibliorelation.types - }?, - attribute othertype { text }? -bibliorelation.role.attrib = role.attrib -# doc:The relationship of a document to another. -bibliorelation = - element bibliorelation { bibliorelation.attlist, docinfo.char.mix* } -# end of bibliorelation.element -bibliorelation.attlist &= - biblio.class.attrib, - bibliorelation.type.attrib, - common.attrib, - bibliorelation.role.attrib, - local.bibliorelation.attrib -# end of bibliorelation.attlist - -# end of bibliorelation.module - -# BiblioCoverage ................. -local.bibliocoverage.attrib = empty -bibliocoverage.role.attrib = role.attrib -# doc:The spatial or temporal coverage of a document. -bibliocoverage = - element bibliocoverage { bibliocoverage.attlist, docinfo.char.mix* } -# end of bibliocoverage.element -bibliocoverage.attlist &= - attribute spatial { - "dcmipoint" | "iso3166" | "dcmibox" | "tgn" | "otherspatial" - }?, - attribute otherspatial { text }?, - attribute temporal { "dcmiperiod" | "w3c-dtf" | "othertemporal" }?, - attribute othertemporal { text }?, - common.attrib, - bibliocoverage.role.attrib, - local.bibliocoverage.attrib -# end of bibliocoverage.attlist - -# end of bibliocoverage.module - -# InvPartNumber .................... -local.invpartnumber.attrib = empty -invpartnumber.role.attrib = role.attrib -# doc:An inventory part number. -invpartnumber = - element invpartnumber { invpartnumber.attlist, docinfo.char.mix* } -# end of invpartnumber.element -invpartnumber.attlist &= - common.attrib, invpartnumber.role.attrib, local.invpartnumber.attrib -# end of invpartnumber.attlist - -# end of invpartnumber.module - -# IssueNum ......................... -local.issuenum.attrib = empty -issuenum.role.attrib = role.attrib -# doc:The number of an issue of a journal. -issuenum = element issuenum { issuenum.attlist, docinfo.char.mix* } -# end of issuenum.element -issuenum.attlist &= - common.attrib, issuenum.role.attrib, local.issuenum.attrib -# end of issuenum.attlist - -# end of issuenum.module - -# LegalNotice ...................... -local.legalnotice.attrib = empty -legalnotice.role.attrib = role.attrib -# doc:A statement of legal obligations or requirements. -legalnotice = - element legalnotice { - legalnotice.attlist, blockinfo?, title?, legalnotice.mix+ - } -# end of legalnotice.element -legalnotice.attlist &= - common.attrib, legalnotice.role.attrib, local.legalnotice.attrib -# end of legalnotice.attlist - -# end of legalnotice.module - -# ModeSpec ......................... -local.modespec.attrib = empty -modespec.role.attrib = role.attrib -# doc:Application-specific information necessary for the completion of an OLink. -modespec = element modespec { modespec.attlist, docinfo.char.mix* } -# end of modespec.element - -# Application: Type of action required for completion -# of the links to which the ModeSpec is relevant (e.g., -# retrieval query) -modespec.attlist &= - attribute application { notation.class }?, - common.attrib, - modespec.role.attrib, - local.modespec.attrib -# end of modespec.attlist - -# end of modespec.module - -# OrgName .......................... -local.orgname.attrib = empty -orgname.role.attrib = role.attrib -# doc:The name of an organization other than a corporation. -orgname = element orgname { orgname.attlist, docinfo.char.mix* } -# end of orgname.element -orgname.attlist &= - common.attrib, - attribute class { - "corporation" | "nonprofit" | "consortium" | "informal" | "other" - }?, - attribute otherclass { text }?, - orgname.role.attrib, - local.orgname.attrib -# end of orgname.attlist - -# end of orgname.module - -# OtherCredit ...................... -local.othercredit.attrib = empty -othercredit.role.attrib = role.attrib -# doc:A person or entity, other than an author or editor, credited in a document. -othercredit = - element othercredit { - othercredit.attlist, - (personname | person.ident.mix+), - (personblurb | email | address)* - } -# end of othercredit.element -othercredit.attlist &= - attribute class { - "graphicdesigner" - | "productioneditor" - | "copyeditor" - | "technicaleditor" - | "translator" - | "other" - }?, - common.attrib, - othercredit.role.attrib, - local.othercredit.attrib -# end of othercredit.attlist - -# (see "Personal identity elements" for %person.ident.mix;) - -# end of othercredit.module - -# PageNums ......................... -local.pagenums.attrib = empty -pagenums.role.attrib = role.attrib -# doc:The numbers of the pages in a book, for use in a bibliographic entry. -pagenums = element pagenums { pagenums.attlist, docinfo.char.mix* } -# end of pagenums.element -pagenums.attlist &= - common.attrib, pagenums.role.attrib, local.pagenums.attrib -# end of pagenums.attlist - -# end of pagenums.module - -# Personal identity elements ....... - -# These elements are used only within Author, Editor, and -# OtherCredit. -local.contrib.attrib = empty -contrib.role.attrib = role.attrib -# doc:A summary of the contributions made to a document by a credited source. -contrib = element contrib { contrib.attlist, docinfo.char.mix* } -# end of contrib.element -contrib.attlist &= - common.attrib, contrib.role.attrib, local.contrib.attrib -# end of contrib.attlist - -# end of contrib.module -local.firstname.attrib = empty -firstname.role.attrib = role.attrib -# doc:The first name of a person. -firstname = element firstname { firstname.attlist, docinfo.char.mix* } -# end of firstname.element -firstname.attlist &= - common.attrib, firstname.role.attrib, local.firstname.attrib -# end of firstname.attlist - -# end of firstname.module -local.honorific.attrib = empty -honorific.role.attrib = role.attrib -# doc:The title of a person. -honorific = element honorific { honorific.attlist, docinfo.char.mix* } -# end of honorific.element -honorific.attlist &= - common.attrib, honorific.role.attrib, local.honorific.attrib -# end of honorific.attlist - -# end of honorific.module -local.lineage.attrib = empty -lineage.role.attrib = role.attrib -# doc:The portion of a person's name indicating a relationship to ancestors. -lineage = element lineage { lineage.attlist, docinfo.char.mix* } -# end of lineage.element -lineage.attlist &= - common.attrib, lineage.role.attrib, local.lineage.attrib -# end of lineage.attlist - -# end of lineage.module -local.othername.attrib = empty -othername.role.attrib = role.attrib -# doc:A component of a persons name that is not a first name, surname, or lineage. -othername = element othername { othername.attlist, docinfo.char.mix* } -# end of othername.element -othername.attlist &= - common.attrib, othername.role.attrib, local.othername.attrib -# end of othername.attlist - -# end of othername.module -local.surname.attrib = empty -surname.role.attrib = role.attrib -# doc:A family name; in western cultures the last name. -surname = element surname { surname.attlist, docinfo.char.mix* } -# end of surname.element -surname.attlist &= - common.attrib, surname.role.attrib, local.surname.attrib -# end of surname.attlist - -# end of surname.module - -# end of person.ident.module - -# PrintHistory ..................... -local.printhistory.attrib = empty -printhistory.role.attrib = role.attrib -# doc:The printing history of a document. -printhistory = - element printhistory { printhistory.attlist, para.class+ } -# end of printhistory.element -printhistory.attlist &= - common.attrib, printhistory.role.attrib, local.printhistory.attrib -# end of printhistory.attlist - -# end of printhistory.module - -# ProductName ...................... -local.productname.attrib = empty -productname.role.attrib = role.attrib -# doc:The formal name of a product. -productname = - element productname { productname.attlist, para.char.mix* } -# end of productname.element - -# Class: More precisely identifies the item the element names -productname.attlist &= - [ a:defaultValue = "trade" ] - attribute class { "service" | "trade" | "registered" | "copyright" }?, - common.attrib, - productname.role.attrib, - local.productname.attrib -# end of productname.attlist - -# end of productname.module - -# ProductNumber .................... -local.productnumber.attrib = empty -productnumber.role.attrib = role.attrib -# doc:A number assigned to a product. -productnumber = - element productnumber { productnumber.attlist, docinfo.char.mix* } -# end of productnumber.element -productnumber.attlist &= - common.attrib, productnumber.role.attrib, local.productnumber.attrib -# end of productnumber.attlist - -# end of productnumber.module - -# PubDate .......................... -local.pubdate.attrib = empty -pubdate.role.attrib = role.attrib -# doc:The date of publication of a document. -pubdate = element pubdate { pubdate.attlist, docinfo.char.mix* } -# end of pubdate.element -pubdate.attlist &= - common.attrib, pubdate.role.attrib, local.pubdate.attrib -# end of pubdate.attlist - -# end of pubdate.module - -# Publisher ........................ -local.publisher.attrib = empty -publisher.role.attrib = role.attrib -# doc:The publisher of a document. -publisher = - element publisher { publisher.attlist, publishername, address* } -# end of publisher.element -publisher.attlist &= - common.attrib, publisher.role.attrib, local.publisher.attrib -# end of publisher.attlist - -# end of publisher.module -local.publishername.attrib = empty -publishername.role.attrib = role.attrib -# doc:The name of the publisher of a document. -publishername = - element publishername { publishername.attlist, docinfo.char.mix* } -# end of publishername.element -publishername.attlist &= - common.attrib, publishername.role.attrib, local.publishername.attrib -# end of publishername.attlist - -# end of publishername.module - -# Address (defined elsewhere in this section) - -# end of publisher.content.module - -# PubsNumber ....................... -local.pubsnumber.attrib = empty -pubsnumber.role.attrib = role.attrib -# doc:A number assigned to a publication other than an ISBN or ISSN or inventory part number. -pubsnumber = - element pubsnumber { pubsnumber.attlist, docinfo.char.mix* } -# end of pubsnumber.element -pubsnumber.attlist &= - common.attrib, pubsnumber.role.attrib, local.pubsnumber.attrib -# end of pubsnumber.attlist - -# end of pubsnumber.module - -# ReleaseInfo ...................... -local.releaseinfo.attrib = empty -releaseinfo.role.attrib = role.attrib -# doc:Information about a particular release of a document. -releaseinfo = - element releaseinfo { releaseinfo.attlist, docinfo.char.mix* } -# end of releaseinfo.element -releaseinfo.attlist &= - common.attrib, releaseinfo.role.attrib, local.releaseinfo.attrib -# end of releaseinfo.attlist - -# end of releaseinfo.module - -# RevHistory ....................... -local.revhistory.attrib = empty -revhistory.role.attrib = role.attrib -# doc:A history of the revisions to a document. -revhistory = element revhistory { revhistory.attlist, revision+ } -# end of revhistory.element -revhistory.attlist &= - common.attrib, revhistory.role.attrib, local.revhistory.attrib -# end of revhistory.attlist - -# end of revhistory.module -local.revision.attrib = empty -revision.role.attrib = role.attrib -# doc:An entry describing a single revision in the history of the revisions to a document. -revision = - element revision { - revision.attlist, - revnumber?, - date, - (author | authorinitials)*, - (revremark | revdescription)? - } -# end of revision.element -revision.attlist &= - common.attrib, revision.role.attrib, local.revision.attrib -# end of revision.attlist - -# end of revision.module -local.revnumber.attrib = empty -revnumber.role.attrib = role.attrib -# doc:A document revision number. -revnumber = element revnumber { revnumber.attlist, docinfo.char.mix* } -# end of revnumber.element -revnumber.attlist &= - common.attrib, revnumber.role.attrib, local.revnumber.attrib -# end of revnumber.attlist - -# end of revnumber.module - -# Date (defined elsewhere in this section) - -# AuthorInitials (defined elsewhere in this section) -local.revremark.attrib = empty -revremark.role.attrib = role.attrib -# doc:A description of a revision to a document. -revremark = element revremark { revremark.attlist, docinfo.char.mix* } -# end of revremark.element -revremark.attlist &= - common.attrib, revremark.role.attrib, local.revremark.attrib -# end of revremark.attlist - -# end of revremark.module -local.revdescription.attrib = empty -revdescription.role.attrib = role.attrib -# doc:A extended description of a revision to a document. -revdescription = - element revdescription { revdescription.attlist, revdescription.mix+ } -# end of revdescription.element -revdescription.attlist &= - common.attrib, revdescription.role.attrib, local.revdescription.attrib -# end of revdescription.attlist - -# end of revdescription.module - -# end of revhistory.content.module - -# SeriesVolNums .................... -local.seriesvolnums.attrib = empty -seriesvolnums.role.attrib = role.attrib -# doc:Numbers of the volumes in a series of books. -seriesvolnums = - element seriesvolnums { seriesvolnums.attlist, docinfo.char.mix* } -# end of seriesvolnums.element -seriesvolnums.attlist &= - common.attrib, seriesvolnums.role.attrib, local.seriesvolnums.attrib -# end of seriesvolnums.attlist - -# end of seriesvolnums.module - -# VolumeNum ........................ -local.volumenum.attrib = empty -volumenum.role.attrib = role.attrib -# doc:The volume number of a document in a set (as of books in a set or articles in a journal). -volumenum = element volumenum { volumenum.attlist, docinfo.char.mix* } -# end of volumenum.element -volumenum.attlist &= - common.attrib, volumenum.role.attrib, local.volumenum.attrib -# end of volumenum.attlist - -# end of volumenum.module - -# .................................. - -# end of docinfo.content.module - -# ...................................................................... - -# Inline, link, and ubiquitous elements ................................ - -# Technical and computer terms ......................................... -local.accel.attrib = empty -accel.role.attrib = role.attrib -# doc:A graphical user interface (GUI) keyboard shortcut. -accel = element accel { accel.attlist, smallcptr.char.mix* } -# end of accel.element -accel.attlist &= common.attrib, accel.role.attrib, local.accel.attrib -# end of accel.attlist - -# end of accel.module -local.action.attrib = empty -action.role.attrib = role.attrib -# doc:A response to a user event. -action = element action { action.attlist, cptr.char.mix* } -# end of action.element -action.attlist &= - moreinfo.attrib, - common.attrib, - action.role.attrib, - local.action.attrib -# end of action.attlist - -# end of action.module -local.application.attrib = empty -application.role.attrib = role.attrib -# doc:The name of a software program. -application = - element application { application.attlist, para.char.mix* } -# end of application.element -application.attlist &= - attribute class { "hardware" | "software" }?, - moreinfo.attrib, - common.attrib, - application.role.attrib, - local.application.attrib -# end of application.attlist - -# end of application.module -local.classname.attrib = empty -classname.role.attrib = role.attrib -# doc:The name of a class, in the object-oriented programming sense. -classname = element classname { classname.attlist, smallcptr.char.mix* } -# end of classname.element -classname.attlist &= - common.attrib, classname.role.attrib, local.classname.attrib -# end of classname.attlist - -# end of classname.module -local.package.attrib = empty -package.role.attrib = role.attrib -# doc:A package. -package = element package { package.attlist, smallcptr.char.mix* } -# end of package.element -package.attlist &= - common.attrib, package.role.attrib, local.package.attrib -# end of package.attlist - -# end of package.module -local.co.attrib = empty -# CO is a callout area of the LineColumn unit type (a single character -# position); the position is directly indicated by the location of CO. -co.role.attrib = role.attrib -# doc:The location of a callout embedded in text. -co = element co { co.attlist, empty } -# end of co.element - -# bug number/symbol override or initialization - -# to any related information -co.attlist &= - label.attrib, - linkends.attrib, - idreq.common.attrib, - co.role.attrib, - local.co.attrib -# end of co.attlist - -# end of co.module -local.coref.attrib = empty -# COREF is a reference to a CO -coref.role.attrib = role.attrib -# doc:A cross reference to a co. -coref = element coref { coref.attlist, empty } -# end of coref.element - -# bug number/symbol override or initialization - -# to any related information -coref.attlist &= - label.attrib, - linkendreq.attrib, - common.attrib, - coref.role.attrib, - local.coref.attrib -# end of coref.attlist - -# end of coref.module -local.command.attrib = empty -command.role.attrib = role.attrib -# doc:The name of an executable program or other software command. -command = element command { command.attlist, cptr.char.mix* } -# end of command.element -command.attlist &= - moreinfo.attrib, - common.attrib, - command.role.attrib, - local.command.attrib -# end of command.attlist - -# end of command.module -local.computeroutput.attrib = empty -computeroutput.role.attrib = role.attrib -# doc:Data, generally text, displayed or presented by a computer. -computeroutput = - element computeroutput { - computeroutput.attlist, (cptr.char.mix | co)* - } -# end of computeroutput.element -computeroutput.attlist &= - moreinfo.attrib, - common.attrib, - computeroutput.role.attrib, - local.computeroutput.attrib -# end of computeroutput.attlist - -# end of computeroutput.module -local.database.attrib = empty -database.role.attrib = role.attrib -# doc:The name of a database, or part of a database. -database = element database { database.attlist, cptr.char.mix* } -# end of database.element - -# Class: Type of database the element names; no default -database.attlist &= - attribute class { - "name" - | "table" - | "field" - | "key1" - | "key2" - | "record" - | "index" - | "view" - | "primarykey" - | "secondarykey" - | "foreignkey" - | "altkey" - | "procedure" - | "datatype" - | "constraint" - | "rule" - | "user" - | "group" - }?, - moreinfo.attrib, - common.attrib, - database.role.attrib, - local.database.attrib -# end of database.attlist - -# end of database.module -local.email.attrib = empty -email.role.attrib = role.attrib -# doc:An email address. -email = element email { email.attlist, docinfo.char.mix* } -# end of email.element -email.attlist &= common.attrib, email.role.attrib, local.email.attrib -# end of email.attlist - -# end of email.module -local.envar.attrib = empty -envar.role.attrib = role.attrib -# doc:A software environment variable. -envar = element envar { envar.attlist, smallcptr.char.mix* } -# end of envar.element -envar.attlist &= common.attrib, envar.role.attrib, local.envar.attrib -# end of envar.attlist - -# end of envar.module -local.errorcode.attrib = empty -errorcode.role.attrib = role.attrib -# doc:An error code. -errorcode = element errorcode { errorcode.attlist, smallcptr.char.mix* } -# end of errorcode.element -errorcode.attlist &= - moreinfo.attrib, - common.attrib, - errorcode.role.attrib, - local.errorcode.attrib -# end of errorcode.attlist - -# end of errorcode.module -local.errorname.attrib = empty -errorname.role.attrib = role.attrib -# doc:An error name. -errorname = element errorname { errorname.attlist, smallcptr.char.mix* } -# end of errorname.element -errorname.attlist &= - common.attrib, errorname.role.attrib, local.errorname.attrib -# end of errorname.attlist - -# end of errorname.module -local.errortext.attrib = empty -errortext.role.attrib = role.attrib -# doc:An error message.. -errortext = element errortext { errortext.attlist, smallcptr.char.mix* } -# end of errortext.element -errortext.attlist &= - common.attrib, errortext.role.attrib, local.errortext.attrib -# end of errortext.attlist - -# end of errortext.module -local.errortype.attrib = empty -errortype.role.attrib = role.attrib -# doc:The classification of an error message. -errortype = element errortype { errortype.attlist, smallcptr.char.mix* } -# end of errortype.element -errortype.attlist &= - common.attrib, errortype.role.attrib, local.errortype.attrib -# end of errortype.attlist - -# end of errortype.module -local.filename.attrib = empty -filename.role.attrib = role.attrib -# doc:The name of a file. -filename = element filename { filename.attlist, cptr.char.mix* } -# end of filename.element - -# Class: Type of filename the element names; no default - -# Path: Search path (possibly system-specific) in which -# file can be found -filename.attlist &= - attribute class { - "headerfile" - | "partition" - | "devicefile" - | "libraryfile" - | "directory" - | "extension" - | "symlink" - }?, - attribute path { text }?, - moreinfo.attrib, - common.attrib, - filename.role.attrib, - local.filename.attrib -# end of filename.attlist - -# end of filename.module -local.function.attrib = empty -function.role.attrib = role.attrib -# doc:The name of a function or subroutine, as in a programming language. -function = element function { function.attlist, cptr.char.mix* } -# end of function.element -function.attlist &= - moreinfo.attrib, - common.attrib, - function.role.attrib, - local.function.attrib -# end of function.attlist - -# end of function.module -local.guibutton.attrib = empty -guibutton.role.attrib = role.attrib -# doc:The text on a button in a GUI. -guibutton = - element guibutton { - guibutton.attlist, - (smallcptr.char.mix | accel | superscript | subscript)* - } -# end of guibutton.element -guibutton.attlist &= - moreinfo.attrib, - common.attrib, - guibutton.role.attrib, - local.guibutton.attrib -# end of guibutton.attlist - -# end of guibutton.module -local.guiicon.attrib = empty -guiicon.role.attrib = role.attrib -# doc:Graphic and/or text appearing as a icon in a GUI. -guiicon = - element guiicon { - guiicon.attlist, - (smallcptr.char.mix | accel | superscript | subscript)* - } -# end of guiicon.element -guiicon.attlist &= - moreinfo.attrib, - common.attrib, - guiicon.role.attrib, - local.guiicon.attrib -# end of guiicon.attlist - -# end of guiicon.module -local.guilabel.attrib = empty -guilabel.role.attrib = role.attrib -# doc:The text of a label in a GUI. -guilabel = - element guilabel { - guilabel.attlist, - (smallcptr.char.mix | accel | superscript | subscript)* - } -# end of guilabel.element -guilabel.attlist &= - moreinfo.attrib, - common.attrib, - guilabel.role.attrib, - local.guilabel.attrib -# end of guilabel.attlist - -# end of guilabel.module -local.guimenu.attrib = empty -guimenu.role.attrib = role.attrib -# doc:The name of a menu in a GUI. -guimenu = - element guimenu { - guimenu.attlist, - (smallcptr.char.mix | accel | superscript | subscript)* - } -# end of guimenu.element -guimenu.attlist &= - moreinfo.attrib, - common.attrib, - guimenu.role.attrib, - local.guimenu.attrib -# end of guimenu.attlist - -# end of guimenu.module -local.guimenuitem.attrib = empty -guimenuitem.role.attrib = role.attrib -# doc:The name of a terminal menu item in a GUI. -guimenuitem = - element guimenuitem { - guimenuitem.attlist, - (smallcptr.char.mix | accel | superscript | subscript)* - } -# end of guimenuitem.element -guimenuitem.attlist &= - moreinfo.attrib, - common.attrib, - guimenuitem.role.attrib, - local.guimenuitem.attrib -# end of guimenuitem.attlist - -# end of guimenuitem.module -local.guisubmenu.attrib = empty -guisubmenu.role.attrib = role.attrib -# doc:The name of a submenu in a GUI. -guisubmenu = - element guisubmenu { - guisubmenu.attlist, - (smallcptr.char.mix | accel | superscript | subscript)* - } -# end of guisubmenu.element -guisubmenu.attlist &= - moreinfo.attrib, - common.attrib, - guisubmenu.role.attrib, - local.guisubmenu.attrib -# end of guisubmenu.attlist - -# end of guisubmenu.module -local.hardware.attrib = empty -hardware.role.attrib = role.attrib -# doc:A physical part of a computer system. -hardware = element hardware { hardware.attlist, cptr.char.mix* } -# end of hardware.element -hardware.attlist &= - moreinfo.attrib, - common.attrib, - hardware.role.attrib, - local.hardware.attrib -# end of hardware.attlist - -# end of hardware.module -local.interface.attrib = empty -interface.role.attrib = role.attrib -# doc:An element of a GUI. -interface = - element interface { interface.attlist, (smallcptr.char.mix | accel)* } -# end of interface.element - -# Class: Type of the Interface item; no default -interface.attlist &= - moreinfo.attrib, - common.attrib, - interface.role.attrib, - local.interface.attrib -# end of interface.attlist - -# end of interface.module -local.keycap.attrib = empty -keycap.role.attrib = role.attrib -# doc:The text printed on a key on a keyboard. -keycap = element keycap { keycap.attlist, cptr.char.mix* } -# end of keycap.element -keycap.attlist &= - attribute function { - "alt" - | "control" - | "shift" - | "meta" - | "escape" - | "enter" - | "tab" - | "backspace" - | "command" - | "option" - | "space" - | "delete" - | "insert" - | "up" - | "down" - | "left" - | "right" - | "home" - | "end" - | "pageup" - | "pagedown" - | "other" - }?, - attribute otherfunction { text }?, - moreinfo.attrib, - common.attrib, - keycap.role.attrib, - local.keycap.attrib -# end of keycap.attlist - -# end of keycap.module -local.keycode.attrib = empty -keycode.role.attrib = role.attrib -# doc:The internal, frequently numeric, identifier for a key on a keyboard. -keycode = element keycode { keycode.attlist, smallcptr.char.mix* } -# end of keycode.element -keycode.attlist &= - common.attrib, keycode.role.attrib, local.keycode.attrib -# end of keycode.attlist - -# end of keycode.module -local.keycombo.attrib = empty -keycombo.role.attrib = role.attrib -# doc:A combination of input actions. -keycombo = - element keycombo { - keycombo.attlist, (keycap | keycombo | keysym | mousebutton)+ - } -# end of keycombo.element -keycombo.attlist &= - keyaction.attrib, - moreinfo.attrib, - common.attrib, - keycombo.role.attrib, - local.keycombo.attrib -# end of keycombo.attlist - -# end of keycombo.module -local.keysym.attrib = empty -keysysm.role.attrib = role.attrib -# doc:The symbolic name of a key on a keyboard. -keysym = element keysym { keysym.attlist, smallcptr.char.mix* } -# end of keysym.element -keysym.attlist &= - common.attrib, keysysm.role.attrib, local.keysym.attrib -# end of keysym.attlist - -# end of keysym.module -local.lineannotation.attrib = empty -lineannotation.role.attrib = role.attrib -# doc:A comment on a line in a verbatim listing. -lineannotation = - element lineannotation { lineannotation.attlist, para.char.mix* } -# end of lineannotation.element -lineannotation.attlist &= - common.attrib, lineannotation.role.attrib, local.lineannotation.attrib -# end of lineannotation.attlist - -# end of lineannotation.module -local.literal.attrib = empty -literal.role.attrib = role.attrib -# doc:Inline text that is some literal value. -literal = element literal { literal.attlist, cptr.char.mix* } -# end of literal.element -literal.attlist &= - moreinfo.attrib, - common.attrib, - literal.role.attrib, - local.literal.attrib -# end of literal.attlist - -# end of literal.module -local.code.attrib = empty -code.role.attrib = role.attrib -# doc:An inline code fragment. -code = element code { code.attlist, cptr.char.mix* } -# end of code.element -code.attlist &= - attribute language { text }?, - common.attrib, - code.role.attrib, - local.code.attrib -# end of code.attlist - -# end of code.module -local.constant.attrib = empty -constant.role.attrib = role.attrib -# doc:A programming or system constant. -constant = element constant { constant.attlist, smallcptr.char.mix* } -# end of constant.element -constant.attlist &= - attribute class { "limit" }?, - common.attrib, - constant.role.attrib, - local.constant.attrib -# end of constant.attlist - -# end of constant.module -local.varname.attrib = empty -varname.role.attrib = role.attrib -# doc:The name of a variable. -varname = element varname { varname.attlist, smallcptr.char.mix* } -# end of varname.element -varname.attlist &= - common.attrib, varname.role.attrib, local.varname.attrib -# end of varname.attlist - -# end of varname.module -local.markup.attrib = empty -markup.role.attrib = role.attrib -# doc:A string of formatting markup in text that is to be represented literally. -markup = element markup { markup.attlist, smallcptr.char.mix* } -# end of markup.element -markup.attlist &= common.attrib, markup.role.attrib, local.markup.attrib -# end of markup.attlist - -# end of markup.module -local.medialabel.attrib = empty -medialabel.role.attrib = role.attrib -# doc:A name that identifies the physical medium on which some information resides. -medialabel = - element medialabel { medialabel.attlist, smallcptr.char.mix* } -# end of medialabel.element - -# Class: Type of medium named by the element; no default -medialabel.attlist &= - attribute class { "cartridge" | "cdrom" | "disk" | "tape" }?, - common.attrib, - medialabel.role.attrib, - local.medialabel.attrib -# end of medialabel.attlist - -# end of medialabel.module -local.menuchoice.attrib = empty -menuchoice.role.attrib = role.attrib -# doc:A selection or series of selections from a menu. -menuchoice = - element menuchoice { - menuchoice.attlist, - shortcut?, - (guibutton - | guiicon - | guilabel - | guimenu - | guimenuitem - | guisubmenu - | interface)+ - } -# end of menuchoice.element -menuchoice.attlist &= - moreinfo.attrib, - common.attrib, - menuchoice.role.attrib, - local.menuchoice.attrib -# end of menuchoice.attlist - -# end of menuchoice.module - -# See also KeyCombo -local.shortcut.attrib = empty -shortcut.role.attrib = role.attrib -# doc:A key combination for an action that is also accessible through a menu. -shortcut = - element shortcut { - shortcut.attlist, (keycap | keycombo | keysym | mousebutton)+ - } -# end of shortcut.element -shortcut.attlist &= - keyaction.attrib, - moreinfo.attrib, - common.attrib, - shortcut.role.attrib, - local.shortcut.attrib -# end of shortcut.attlist - -# end of shortcut.module - -# end of menuchoice.content.module -local.mousebutton.attrib = empty -mousebutton.role.attrib = role.attrib -# doc:The conventional name of a mouse button. -mousebutton = - element mousebutton { mousebutton.attlist, smallcptr.char.mix* } -# end of mousebutton.element -mousebutton.attlist &= - moreinfo.attrib, - common.attrib, - mousebutton.role.attrib, - local.mousebutton.attrib -# end of mousebutton.attlist - -# end of mousebutton.module -local.msgtext.attrib = empty -msgtext.role.attrib = role.attrib -# doc:The actual text of a message component in a message set. -msgtext = element msgtext { msgtext.attlist, component.mix+ } -# end of msgtext.element -msgtext.attlist &= - common.attrib, msgtext.role.attrib, local.msgtext.attrib -# end of msgtext.attlist - -# end of msgtext.module -local.option.attrib = empty -option.role.attrib = role.attrib -# doc:An option for a software command. -option = element option { option.attlist, cptr.char.mix* } -# end of option.element -option.attlist &= common.attrib, option.role.attrib, local.option.attrib -# end of option.attlist - -# end of option.module -local.optional.attrib = empty -optional.role.attrib = role.attrib -# doc:Optional information. -optional = element optional { optional.attlist, cptr.char.mix* } -# end of optional.element -optional.attlist &= - common.attrib, optional.role.attrib, local.optional.attrib -# end of optional.attlist - -# end of optional.module -local.parameter.attrib = empty -parameter.role.attrib = role.attrib -# doc:A value or a symbolic reference to a value. -parameter = element parameter { parameter.attlist, cptr.char.mix* } -# end of parameter.element - -# Class: Type of the Parameter; no default -parameter.attlist &= - attribute class { "command" | "function" | "option" }?, - moreinfo.attrib, - common.attrib, - parameter.role.attrib, - local.parameter.attrib -# end of parameter.attlist - -# end of parameter.module -local.prompt.attrib = empty -prompt.role.attrib = role.attrib -# doc:A character or string indicating the start of an input field in a computer display. -prompt = element prompt { prompt.attlist, (smallcptr.char.mix | co)* } -# end of prompt.element -prompt.attlist &= - moreinfo.attrib, - common.attrib, - prompt.role.attrib, - local.prompt.attrib -# end of prompt.attlist - -# end of prompt.module -local.property.attrib = empty -property.role.attrib = role.attrib -# doc:A unit of data associated with some part of a computer system. -property = element property { property.attlist, cptr.char.mix* } -# end of property.element -property.attlist &= - moreinfo.attrib, - common.attrib, - property.role.attrib, - local.property.attrib -# end of property.attlist - -# end of property.module -local.replaceable.attrib = empty -replaceable.role.attrib = role.attrib -# doc:Content that may or must be replaced by the user. -replaceable = - element replaceable { - replaceable.attlist, - (text - | link.char.class - | optional - | base.char.class - | other.char.class - | inlinegraphic - | inlinemediaobject - | co)* - } -# end of replaceable.element - -# Class: Type of information the element represents; no -# default -replaceable.attlist &= - attribute class { "command" | "function" | "option" | "parameter" }?, - common.attrib, - replaceable.role.attrib, - local.replaceable.attrib -# end of replaceable.attlist - -# end of replaceable.module -local.returnvalue.attrib = empty -returnvalue.role.attrib = role.attrib -# doc:The value returned by a function. -returnvalue = - element returnvalue { returnvalue.attlist, smallcptr.char.mix* } -# end of returnvalue.element -returnvalue.attlist &= - common.attrib, returnvalue.role.attrib, local.returnvalue.attrib -# end of returnvalue.attlist - -# end of returnvalue.module -local.sgmltag.attrib = empty -sgmltag.role.attrib = role.attrib -# doc:A component of SGML markup. -sgmltag = element sgmltag { sgmltag.attlist, smallcptr.char.mix* } -# end of sgmltag.element - -# Class: Type of SGML construct the element names; no default -sgmltag.attlist &= - attribute class { - "attribute" - | "attvalue" - | "element" - | "endtag" - | "emptytag" - | "genentity" - | "numcharref" - | "paramentity" - | "pi" - | "xmlpi" - | "starttag" - | "sgmlcomment" - | "prefix" - | "namespace" - | "localname" - }?, - attribute namespace { text }?, - common.attrib, - sgmltag.role.attrib, - local.sgmltag.attrib -# end of sgmltag.attlist - -# end of sgmltag.module -local.structfield.attrib = empty -structfield.role.attrib = role.attrib -# doc:A field in a structure (in the programming language sense). -structfield = - element structfield { structfield.attlist, smallcptr.char.mix* } -# end of structfield.element -structfield.attlist &= - common.attrib, structfield.role.attrib, local.structfield.attrib -# end of structfield.attlist - -# end of structfield.module -local.structname.attrib = empty -structname.role.attrib = role.attrib -# doc:The name of a structure (in the programming language sense). -structname = - element structname { structname.attlist, smallcptr.char.mix* } -# end of structname.element -structname.attlist &= - common.attrib, structname.role.attrib, local.structname.attrib -# end of structname.attlist - -# end of structname.module -local.symbol.attrib = empty -symbol.role.attrib = role.attrib -# doc:A name that is replaced by a value before processing. -symbol = element symbol { symbol.attlist, smallcptr.char.mix* } -# end of symbol.element - -# Class: Type of symbol; no default -symbol.attlist &= - attribute class { "limit" }?, - common.attrib, - symbol.role.attrib, - local.symbol.attrib -# end of symbol.attlist - -# end of symbol.module -local.systemitem.attrib = empty -systemitem.role.attrib = role.attrib -# doc:A system-related item or term. -systemitem = - element systemitem { - systemitem.attlist, (cptr.char.mix | acronym | co)* - } -# end of systemitem.element - -# Class: Type of system item the element names; no default -systemitem.attlist &= - attribute class { - "constant" - | "daemon" - | "domainname" - | "etheraddress" - | "event" - | "eventhandler" - | "filesystem" - | "fqdomainname" - | "groupname" - | "ipaddress" - | "library" - | "macro" - | "netmask" - | "newsgroup" - | "osname" - | "protocol" - | "resource" - | "systemname" - | "username" - | "process" - | "server" - | "service" - }?, - moreinfo.attrib, - common.attrib, - systemitem.role.attrib, - local.systemitem.attrib -# end of systemitem.attlist - -# end of systemitem.module -local.uri.attrib = empty -uri.role.attrib = role.attrib -# doc:A Uniform Resource Identifier. -uri = element uri { uri.attlist, smallcptr.char.mix* } -# end of uri.element - -# Type: Type of URI; no default -uri.attlist &= - attribute type { text }?, - common.attrib, - uri.role.attrib, - local.uri.attrib -# end of uri.attlist - -# end of uri.module -local.token.attrib = empty -token.role.attrib = role.attrib -# doc:A unit of information. -\token = element token { token.attlist, smallcptr.char.mix* } -# end of token.element -token.attlist &= common.attrib, token.role.attrib, local.token.attrib -# end of token.attlist - -# end of token.module -local.type.attrib = empty -type.role.attrib = role.attrib -# doc:The classification of a value. -type = element type { type.attlist, smallcptr.char.mix* } -# end of type.element -type.attlist &= common.attrib, type.role.attrib, local.type.attrib -# end of type.attlist - -# end of type.module -local.userinput.attrib = empty -userinput.role.attrib = role.attrib -# doc:Data entered by the user. -userinput = - element userinput { userinput.attlist, (cptr.char.mix | co)* } -# end of userinput.element -userinput.attlist &= - moreinfo.attrib, - common.attrib, - userinput.role.attrib, - local.userinput.attrib -# end of userinput.attlist - -# end of userinput.module -local.termdef.attrib = empty -termdef.role.attrib = role.attrib -# doc:An inline definition of a term. -termdef = element termdef { termdef.attlist, para.char.mix* } -# end of termdef.element -termdef.attlist &= - common.attrib, termdef.role.attrib, local.termdef.attrib -# end of termdef.attlist - -# end of termdef.module - -# General words and phrases ............................................ -local.abbrev.attrib = empty -abbrev.role.attrib = role.attrib -# doc:An abbreviation, especially one followed by a period. -abbrev = element abbrev { abbrev.attlist, word.char.mix* } -# end of abbrev.element -abbrev.attlist &= common.attrib, abbrev.role.attrib, local.abbrev.attrib -# end of abbrev.attlist - -# end of abbrev.module -local.acronym.attrib = empty -acronym.role.attrib = role.attrib -# doc:An often pronounceable word made from the initial (or selected) letters of a name or phrase. -acronym = element acronym { acronym.attlist, word.char.mix* } -# end of acronym.element -acronym.attlist &= - common.attrib, acronym.role.attrib, local.acronym.attrib -# end of acronym.attlist - -# end of acronym.module -local.citation.attrib = empty -citation.role.attrib = role.attrib -# doc:An inline bibliographic reference to another published work. -citation = element citation { citation.attlist, para.char.mix* } -# end of citation.element -citation.attlist &= - common.attrib, citation.role.attrib, local.citation.attrib -# end of citation.attlist - -# end of citation.module -local.citerefentry.attrib = empty -citerefentry.role.attrib = role.attrib -# doc:A citation to a reference page. -citerefentry = - element citerefentry { - citerefentry.attlist, refentrytitle, manvolnum? - } -# end of citerefentry.element -citerefentry.attlist &= - common.attrib, citerefentry.role.attrib, local.citerefentry.attrib -# end of citerefentry.attlist - -# end of citerefentry.module -local.refentrytitle.attrib = empty -refentrytitle.role.attrib = role.attrib -# doc:The title of a reference page. -refentrytitle = - element refentrytitle { refentrytitle.attlist, para.char.mix* } -# end of refentrytitle.element -refentrytitle.attlist &= - common.attrib, refentrytitle.role.attrib, local.refentrytitle.attrib -# end of refentrytitle.attlist - -# end of refentrytitle.module -local.manvolnum.attrib = empty -namvolnum.role.attrib = role.attrib -# doc:A reference volume number. -manvolnum = element manvolnum { manvolnum.attlist, word.char.mix* } -# end of manvolnum.element -manvolnum.attlist &= - common.attrib, namvolnum.role.attrib, local.manvolnum.attrib -# end of manvolnum.attlist - -# end of manvolnum.module -local.citetitle.attrib = empty -citetitle.role.attrib = role.attrib -# doc:The title of a cited work. -citetitle = element citetitle { citetitle.attlist, para.char.mix* } -# end of citetitle.element - -# Pubwork: Genre of published work cited; no default -citetitle.attlist &= - attribute pubwork { - "article" - | "book" - | "chapter" - | "part" - | "refentry" - | "section" - | "journal" - | "series" - | "set" - | "manuscript" - | "cdrom" - | "dvd" - | "wiki" - | "gopher" - | "bbs" - | "emailmessage" - | "webpage" - | "newsposting" - }?, - common.attrib, - citetitle.role.attrib, - local.citetitle.attrib -# end of citetitle.attlist - -# end of citetitle.module -local.emphasis.attrib = empty -emphasis.role.attrib = role.attrib -# doc:Emphasized text. -emphasis = element emphasis { emphasis.attlist, para.char.mix* } -# end of emphasis.element -emphasis.attlist &= - common.attrib, emphasis.role.attrib, local.emphasis.attrib -# end of emphasis.attlist - -# end of emphasis.module -local.foreignphrase.attrib = empty -foreignphrase.role.attrib = role.attrib -# doc:A word or phrase in a language other than the primary language of the document. -foreignphrase = - element foreignphrase { foreignphrase.attlist, para.char.mix* } -# end of foreignphrase.element -foreignphrase.attlist &= - common.attrib, foreignphrase.role.attrib, local.foreignphrase.attrib -# end of foreignphrase.attlist - -# end of foreignphrase.module -local.glossterm.attrib = empty -glossterm.role.attrib = role.attrib -# doc:A glossary term. -glossterm = element glossterm { glossterm.attlist, para.char.mix* } -# end of glossterm.element - -# to GlossEntry if Glossterm used in text - -# BaseForm: Provides the form of GlossTerm to be used -# for indexing -glossterm.attlist &= - attribute baseform { text }?, - linkend.attrib, - common.attrib, - glossterm.role.attrib, - local.glossterm.attrib -# end of glossterm.attlist - -# end of glossterm.module -local.firstterm.attrib = empty -firstterm.role.attrib = role.attrib -# doc:The first occurrence of a term. -firstterm = element firstterm { firstterm.attlist, para.char.mix* } -# end of firstterm.element - -# to GlossEntry or other explanation -firstterm.attlist &= - attribute baseform { text }?, - linkend.attrib, - common.attrib, - firstterm.role.attrib, - local.firstterm.attrib -# end of firstterm.attlist - -# end of firstterm.module -local.phrase.attrib = empty -phrase.role.attrib = role.attrib -# doc:A span of text. -phrase = element phrase { phrase.attlist, para.char.mix* } -# end of phrase.element -phrase.attlist &= common.attrib, phrase.role.attrib, local.phrase.attrib -# end of phrase.attlist - -# end of phrase.module -local.quote.attrib = empty -quote.role.attrib = role.attrib -# doc:An inline quotation. -quote = element quote { quote.attlist, para.char.mix* } -# end of quote.element -quote.attlist &= common.attrib, quote.role.attrib, local.quote.attrib -# end of quote.attlist - -# end of quote.module -local.ssscript.attrib = empty -ssscript.role.attrib = role.attrib -# doc:A subscript (as in H{^2}O, the molecular formula for water). -subscript = - element subscript { - subscript.attlist, - (text - | link.char.class - | emphasis - | replaceable - | symbol - | inlinegraphic - | inlinemediaobject - | base.char.class - | other.char.class)* - } -# end of subscript.element -subscript.attlist &= - common.attrib, ssscript.role.attrib, local.ssscript.attrib -# end of subscript.attlist - -# doc:A superscript (as in x^2, the mathematical notation for x multiplied by itself). -superscript = - element superscript { - superscript.attlist, - (text - | link.char.class - | emphasis - | replaceable - | symbol - | inlinegraphic - | inlinemediaobject - | base.char.class - | other.char.class)* - } -# end of superscript.element -superscript.attlist &= - common.attrib, ssscript.role.attrib, local.ssscript.attrib -# end of superscript.attlist - -# end of ssscript.module -local.trademark.attrib = empty -trademark.role.attrib = role.attrib -# doc:A trademark. -trademark = - element trademark { - trademark.attlist, - (text - | link.char.class - | tech.char.class - | base.char.class - | other.char.class - | inlinegraphic - | inlinemediaobject - | emphasis)* - } -# end of trademark.element - -# Class: More precisely identifies the item the element names -trademark.attlist &= - [ a:defaultValue = "trade" ] - attribute class { "service" | "trade" | "registered" | "copyright" }?, - common.attrib, - trademark.role.attrib, - local.trademark.attrib -# end of trademark.attlist - -# end of trademark.module -local.wordasword.attrib = empty -wordasword.role.attrib = role.attrib -# doc:A word meant specifically as a word and not representing anything else. -wordasword = element wordasword { wordasword.attlist, word.char.mix* } -# end of wordasword.element -wordasword.attlist &= - common.attrib, wordasword.role.attrib, local.wordasword.attrib -# end of wordasword.attlist - -# end of wordasword.module - -# Links and cross-references ........................................... -local.link.attrib = empty -link.role.attrib = role.attrib -# doc:A hypertext link. -link = element link { link.attlist, para.char.mix* } -# end of link.element - -# Endterm: ID of element containing text that is to be -# fetched from elsewhere in the document to appear as -# the content of this element - -# to linked-to object - -# Type: Freely assignable parameter -link.attlist &= - attribute endterm { xsd:IDREF }?, - attribute xrefstyle { text }?, - attribute type { text }?, - linkendreq.attrib, - common.attrib, - link.role.attrib, - local.link.attrib -# end of link.attlist - -# end of link.module -local.olink.attrib = empty -olink.role.attrib = role.attrib -# doc:A link that addresses its target indirectly, through an entity. -olink = element olink { olink.attlist, para.char.mix* } -# end of olink.element - -# TargetDocEnt: Name of an entity to be the target of the link - -# LinkMode: ID of a ModeSpec containing instructions for -# operating on the entity named by TargetDocEnt - -# LocalInfo: Information that may be passed to ModeSpec - -# Type: Freely assignable parameter -olink.attlist &= - attribute targetdocent { xsd:ENTITY }?, - attribute linkmode { xsd:IDREF }?, - attribute localinfo { text }?, - attribute type { text }?, - attribute targetdoc { text }?, - attribute targetptr { text }?, - attribute xrefstyle { text }?, - common.attrib, - olink.role.attrib, - local.olink.attrib -# end of olink.attlist - -# end of olink.module -local.ulink.attrib = empty -ulink.role.attrib = role.attrib -# doc:A link that addresses its target by means of a URL (Uniform Resource Locator). -ulink = element ulink { ulink.attlist, para.char.mix* } -# end of ulink.element - -# URL: uniform resource locator; the target of the ULink - -# Type: Freely assignable parameter -ulink.attlist &= - attribute url { text }, - attribute type { text }?, - attribute xrefstyle { text }?, - common.attrib, - ulink.role.attrib, - local.ulink.attrib -# end of ulink.attlist - -# end of ulink.module -local.footnoteref.attrib = empty -footnoteref.role.attrib = role.attrib -# doc:A cross reference to a footnote (a footnote mark). -footnoteref = element footnoteref { footnoteref.attlist, empty } -# end of footnoteref.element - -# to footnote content supplied elsewhere -footnoteref.attlist &= - linkendreq.attrib, - label.attrib, - common.attrib, - footnoteref.role.attrib, - local.footnoteref.attrib -# end of footnoteref.attlist - -# end of footnoteref.module -local.xref.attrib = empty -xref.role.attrib = role.attrib -# doc:A cross reference to another part of the document. -xref = element xref { xref.attlist, empty } -# end of xref.element - -# Endterm: ID of element containing text that is to be -# fetched from elsewhere in the document to appear as -# the content of this element - -# to linked-to object -xref.attlist &= - attribute endterm { xsd:IDREF }?, - attribute xrefstyle { text }?, - common.attrib, - linkendreq.attrib, - xref.role.attrib, - local.xref.attrib -# end of xref.attlist - -# end of xref.module -local.biblioref.attrib = empty -biblioref.role.attrib = role.attrib -# doc:A cross reference to a bibliographic entry. -biblioref = element biblioref { biblioref.attlist, empty } -# end of biblioref.element -biblioref.attlist &= - attribute endterm { xsd:IDREF }?, - attribute xrefstyle { text }?, - attribute units { text }?, - attribute begin { text }?, - attribute end { text }?, - common.attrib, - linkendreq.attrib, - biblioref.role.attrib, - local.biblioref.attrib -# end of biblioref.attlist - -# end of biblioref.module - -# Ubiquitous elements .................................................. -local.anchor.attrib = empty -anchor.role.attrib = role.attrib -# doc:A spot in the document. -anchor = element anchor { anchor.attlist, empty } -# end of anchor.element - -# required - -# replaces Lang -anchor.attlist &= - idreq.attrib, - pagenum.attrib, - remap.attrib, - xreflabel.attrib, - revisionflag.attrib, - effectivity.attrib, - anchor.role.attrib, - local.anchor.attrib -# end of anchor.attlist - -# end of anchor.module -local.beginpage.attrib = empty -beginpage.role.attrib = role.attrib -# doc:The location of a page break in a print version of the document. -beginpage = element beginpage { beginpage.attlist, empty } -# end of beginpage.element - -# PageNum: Number of page that begins at this point -beginpage.attlist &= - pagenum.attrib, - common.attrib, - beginpage.role.attrib, - local.beginpage.attrib -# end of beginpage.attlist - -# end of beginpage.module - -# IndexTerms appear in the text flow for generating or linking an -# index. -local.indexterm.attrib = empty -indexterm.role.attrib = role.attrib -# doc:A wrapper for terms to be indexed. -indexterm = - element indexterm { - indexterm.attlist, - primary?, - ((secondary, - ((tertiary, (see | seealso+)?) - | see - | seealso+)?) - | see - | seealso+)? - } -# end of indexterm.element - -# Scope: Indicates which generated indices the IndexTerm -# should appear in: Global (whole document set), Local (this -# document only), or All (both) - -# Significance: Whether this IndexTerm is the most pertinent -# of its series (Preferred) or not (Normal, the default) - -# Class: Indicates type of IndexTerm; default is Singular, -# or EndOfRange if StartRef is supplied; StartOfRange value -# must be supplied explicitly on starts of ranges - -# StartRef: ID of the IndexTerm that starts the indexing -# range ended by this IndexTerm - -# Zone: IDs of the elements to which the IndexTerm applies, -# and indicates that the IndexTerm applies to those entire -# elements rather than the point at which the IndexTerm -# occurs -indexterm.attlist &= - pagenum.attrib, - attribute scope { "all" | "global" | "local" }?, - [ a:defaultValue = "normal" ] - attribute significance { "preferred" | "normal" }?, - attribute class { "singular" | "startofrange" | "endofrange" }?, - attribute startref { xsd:IDREF }?, - attribute zone { xsd:IDREFS }?, - attribute type { text }?, - common.attrib, - indexterm.role.attrib, - local.indexterm.attrib -# end of indexterm.attlist - -# end of indexterm.module -local.primsecter.attrib = empty -primsecter.role.attrib = role.attrib -# doc:The primary word or phrase under which an index term should be sorted. -primary = element primary { primary.attlist, ndxterm.char.mix* } -# end of primary.element - -# SortAs: Alternate sort string for index sorting, e.g., -# "fourteen" for an element containing "14" -primary.attlist &= - attribute sortas { text }?, - common.attrib, - primsecter.role.attrib, - local.primsecter.attrib -# end of primary.attlist - -# doc:A secondary word or phrase in an index term. -secondary = element secondary { secondary.attlist, ndxterm.char.mix* } -# end of secondary.element - -# SortAs: Alternate sort string for index sorting, e.g., -# "fourteen" for an element containing "14" -secondary.attlist &= - attribute sortas { text }?, - common.attrib, - primsecter.role.attrib, - local.primsecter.attrib -# end of secondary.attlist - -# doc:A tertiary word or phrase in an index term. -tertiary = element tertiary { tertiary.attlist, ndxterm.char.mix* } -# end of tertiary.element - -# SortAs: Alternate sort string for index sorting, e.g., -# "fourteen" for an element containing "14" -tertiary.attlist &= - attribute sortas { text }?, - common.attrib, - primsecter.role.attrib, - local.primsecter.attrib -# end of tertiary.attlist - -# end of primsecter.module -local.seeseealso.attrib = empty -seeseealso.role.attrib = role.attrib -# doc:Part of an index term directing the reader instead to another entry in the index. -see = element see { see.attlist, ndxterm.char.mix* } -# end of see.element -see.attlist &= - common.attrib, seeseealso.role.attrib, local.seeseealso.attrib -# end of see.attlist - -# doc:Part of an index term directing the reader also to another entry in the index. -seealso = element seealso { seealso.attlist, ndxterm.char.mix* } -# end of seealso.element -seealso.attlist &= - common.attrib, seeseealso.role.attrib, local.seeseealso.attrib -# end of seealso.attlist - -# end of seeseealso.module - -# end of indexterm.content.module - -# End of DocBook XML information pool module V4.5 ...................... - -# ...................................................................... diff --git a/docbook-schema/docbook.rnc b/docbook-schema/docbook.rnc deleted file mode 100644 index 8a0a75a..0000000 --- a/docbook-schema/docbook.rnc +++ /dev/null @@ -1,499 +0,0 @@ -# ...................................................................... - -# DocBook XML DTD V4.5 ................................................. - -# File docbookx.dtd .................................................... - -# Copyright 1992-2006 HaL Computer Systems, Inc., -# O'Reilly & Associates, Inc., ArborText, Inc., Fujitsu Software -# Corporation, Norman Walsh, Sun Microsystems, Inc., and the -# Organization for the Advancement of Structured Information -# Standards (OASIS). -# -# See also http://docbook.org/specs/ -# -# $Id: docbookx.dtd 6340 2006-10-03 13:23:24Z nwalsh $ -# -# Permission to use, copy, modify and distribute the DocBook XML DTD -# and its accompanying documentation for any purpose and without fee -# is hereby granted in perpetuity, provided that the above copyright -# notice and this paragraph appear in all copies. The copyright -# holders make no representation about the suitability of the DTD for -# any purpose. It is provided "as is" without expressed or implied -# warranty. -# -# If you modify the DocBook DTD in any way, except for declaring and -# referencing additional sets of general entities and declaring -# additional notations, label your DTD as a variant of DocBook. See -# the maintenance documentation for more information. -# -# Please direct all questions, bug reports, or suggestions for -# changes to the docbook@lists.oasis-open.org mailing list. For more -# information, see http://www.oasis-open.org/docbook/. - -# ...................................................................... - -# This is the driver file for V4.5 of the DocBook DTD. -# Please use the following formal public identifier to identify it: -# -# "-//OASIS//DTD DocBook XML V4.5//EN" -# -# For example, if your document's top-level element is Book, and -# you are using DocBook directly, use the FPI in the DOCTYPE -# declaration: -# -# -# -# Or, if you have a higher-level driver file that customizes DocBook, -# use the FPI in the parameter entity declaration: -# -# -# %DocBookDTD; -# -# See the documentation for detailed information on the parameter -# entity and module scheme used in DocBook, customizing DocBook and -# planning for interchange, and changes made since the last release -# of DocBook. - -# ...................................................................... - -# Enable SGML features ................................................. - -# ...................................................................... - -# Notation declarations ................................................ - -include "dbnotnx.rnc" -# ...................................................................... - -# ISO character entity sets ............................................ - -# euro sign, U+20AC NEW - -# ...................................................................... - -# DTD modules .......................................................... - -# Information pool .............. -include "dbpoolx.rnc" -# Redeclaration placeholder ..... - -# Document hierarchy ............ -include "dbhierx.rnc" -start = - articleinfo - | honorific - | legalnotice - | procedure - | simplelist - | keycode - | refsynopsisdiv - | article - | phrase - | destructorsynopsis - | itemizedlist - | audioobject - | link - | sect1info - | xref - | glossaryinfo - | varname - | keywordset - | informalequation - | toc - | pagenums - | lot - | shortcut - | glosslist - | option - | bibliosource - | variablelist - | filename - | pob - | colgroup - | foreignphrase - | group - | substeps - | conftitle - | textobject - | menuchoice - | colspec - | contractsponsor - | tocback - | contractnum - | constant - | dedication - | inlineequation - | bibliographyinfo - | country - | glossseealso - | bridgehead - | mousebutton - | surname - | stepalternatives - | tertiaryie - | mediaobject - | msgentry - | fax - | initializer - | table - | task - | setinfo - | videodata - | bibliodiv - | issuenum - | phone - | state - | refsynopsisdivinfo - | member - | glossentry - | term - | msgtext - | tr - | errortype - | confdates - | inlinegraphic - | th - | segmentedlist - | remark - | preface - | structname - | publisher - | td - | oointerface - | refsection - | type - | taskrelated - | msgrel - | artpagenums - | bibliomixed - | revnumber - | firstterm - | seeie - | spanspec - | toclevel5 - | trademark - | toclevel4 - | toclevel3 - | toclevel2 - | indexentry - | toclevel1 - | colophon - | methodparam - | sidebarinfo - | productnumber - | funcprototype - | inlinemediaobject - | refclass - | lotentry - | paramdef - | classsynopsisinfo - | qandaset - | footnote - | msglevel - | keysym - | citation - | simplemsgentry - | othercredit - | subjectset - | keycap - | orderedlist - | refmiscinfo - | blockinfo - | programlistingco - | abbrev - | sidebar - | informalfigure - | tip - | primaryie - | appendixinfo - | partintro - | glossdiv - | confgroup - | segtitle - | taskprerequisites - | street - | tbody - | caption - | markup - | setindex - | msgsub - | subscript - | orgname - | fieldsynopsis - | refname - | void - | sect5 - | sect4 - | sect3 - | chapter - | sect2 - | sect1 - | modifier - | col - | orgdiv - | city - | bibliolist - | funcparams - | application - | \token - | imageobject - | literal - | funcsynopsis - | olink - | package - | collab - | seealsoie - | primary - | glossterm - | termdef - | area - | ackno - | function - | collabname - | lineannotation - | guisubmenu - | msgexplan - | errorname - | property - | synopfragmentref - | refentryinfo - | entry - | manvolnum - | synopsis - | emphasis - | appendix - | bookinfo - | contrib - | otheraddr - | copyright - | methodname - | email - | ooclass - | videoobject - | abstract - | firstname - | revremark - | glossdef - | guibutton - | informalexample - | screen - | errorcode - | command - | seriesvolnums - | refpurpose - | parameter - | equation - | tfoot - | code - | jobtitle - | sgmltag - | screenco - | holder - | isbn - | corpcredit - | biblioset - | part - | symbol - | row - | bibliomisc - | imagedata - | secondary - | classname - | callout - | screenshot - | bibliomset - | indexterm - | refsect3 - | tocchap - | para - | refsect2 - | refsect1 - | date - | refdescriptor - | wordasword - | epigraph - | audiodata - | hardware - | confsponsor - | authorgroup - | warning - | authorinitials - | medialabel - | varlistentry - | authorblurb - | itermset - | refsect3info - | informaltable - | guimenuitem - | postcode - | subjectterm - | refnamediv - | note - | figure - | envar - | listitem - | methodsynopsis - | affiliation - | funcsynopsisinfo - | structfield - | blockquote - | keyword - | chapterinfo - | tertiary - | year - | subtitle - | personblurb - | refentry - | citebiblioid - | seglistitem - | bibliography - | msg - | constructorsynopsis - | refsect2info - | volumenum - | database - | funcdef - | uri - | graphicco - | biblioid - | msgmain - | printhistory - | glosssee - | beginpage - | glossary - | set - | highlights - | objectinfo - | tocpart - | guiicon - | revhistory - | seg - | see - | msgorig - | areaspec - | partinfo - | index - | sectioninfo - | refsectioninfo - | optional - | confnum - | replaceable - | refsect1info - | corpauthor - | step - | anchor - | arg - | mathphrase - | setindexinfo - | keycombo - | address - | cmdsynopsis - | computeroutput - | literallayout - | qandaentry - | sect5info - | bibliocoverage - | coref - | editor - | superscript - | personname - | pubsnumber - | graphic - | simplesect - | accel - | secondaryie - | biblioref - | publishername - | bibliorelation - | prefaceinfo - | revision - | screeninfo - | sbr - | example - | citetitle - | issn - | invpartnumber - | indexdiv - | sect4info - | corpname - | lineage - | ooexception - | reference - | revdescription - | title - | edition - | co - | msgaud - | guimenu - | shortaffil - | titleabbrev - | msginfo - | refmeta - | qandadiv - | mediaobjectco - | seealso - | exceptionname - | answer - | programlisting - | tgroup - | refentrytitle - | book - | errortext - | varargs - | sect3info - | citerefentry - | tasksummary - | quote - | othername - | prompt - | entrytbl - | interfacename - | acronym - | modespec - | msgset - | thead - | textdata - | userinput - | attribution - | footnoteref - | action - | tocentry - | tocfront - | author - | imageobjectco - | alt - | question - | ulink - | subject - | pubdate - | returnvalue - | label - | caution - | section - | systemitem - | referenceinfo - | sect2info - | calloutlist - | classsynopsis - | productname - | simpara - | synopfragment - | important - | interface - | releaseinfo - | formalpara - | areaset - | biblioentry - | indexinfo - | guilabel -# ...................................................................... - -# Other general entities ............................................... - -# End of DocBook XML DTD V4.5 .......................................... - -# ...................................................................... diff --git a/docbook-schema/htmltblx.rnc b/docbook-schema/htmltblx.rnc deleted file mode 100644 index 7e15972..0000000 --- a/docbook-schema/htmltblx.rnc +++ /dev/null @@ -1,225 +0,0 @@ -# ...................................................................... - -# DocBook XML HTML Table Module V4.5 ................................... - -# File htmltblx.mod .................................................... - -# Copyright 2003-2006 ArborText, Inc., Norman Walsh, Sun Microsystems, -# Inc., and the Organization for the Advancement of Structured Information -# Standards (OASIS). -# -# $Id: htmltblx.mod 6340 2006-10-03 13:23:24Z nwalsh $ -# -# Permission to use, copy, modify and distribute the DocBook XML DTD -# and its accompanying documentation for any purpose and without fee -# is hereby granted in perpetuity, provided that the above copyright -# notice and this paragraph appear in all copies. The copyright -# holders make no representation about the suitability of the DTD for -# any purpose. It is provided "as is" without expressed or implied -# warranty. -# -# If you modify the DocBook XML DTD in any way, except for declaring and -# referencing additional sets of general entities and declaring -# additional notations, label your DTD as a variant of DocBook. See -# the maintenance documentation for more information. -# -# Please direct all questions, bug reports, or suggestions for -# changes to the docbook@lists.oasis-open.org mailing list. For more -# information, see http://www.oasis-open.org/docbook/. - -# ...................................................................... - -# This module contains the definitions for elements that are -# isomorphic to the HTML elements. One could argue we should -# instead have based ourselves on the XHTML Table Module, but the -# HTML one is more like what browsers are likely to accept today -# and users are likely to use. -# -# This module has been developed for use with the DocBook V4.5 -# "union table model" in which elements and attlists common to both -# models are defined (as the union) in the CALS table module by -# setting various parameter entities appropriately in this file. -# -# In DTD driver files referring to this module, please use an entity -# declaration that uses the public identifier shown below: -# -# -# %htmltbl; -# -# See the documentation for detailed information on the parameter -# entity and module scheme used in DocBook, customizing DocBook and -# planning for interchange, and changes made since the last release -# of DocBook. - -# ======================= XHTML Tables ======================================= - -namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0" - -html.coreattrs = - common.attrib, - attribute class { text }?, - attribute style { text }?, - attribute title { text }? -# Does not contain lang or dir because they are in %common.attribs -i18n = attribute xml:lang { xsd:NMTOKEN }? -events = - attribute onclick { text }?, - attribute ondblclick { text }?, - attribute onmousedown { text }?, - attribute onmouseup { text }?, - attribute onmouseover { text }?, - attribute onmousemove { text }?, - attribute onmouseout { text }?, - attribute onkeypress { text }?, - attribute onkeydown { text }?, - attribute onkeyup { text }? -attrs = html.coreattrs, i18n, events -cellhalign = - attribute align { "left" | "center" | "right" | "justify" | "char" }?, - attribute char { text }?, - attribute charoff { text }? -cellvalign = - attribute valign { "top" | "middle" | "bottom" | "baseline" }? -# doc:A group of columns in an HTML table. -colgroup = element colgroup { colgroup.attlist, col* } -# doc:Specifications for a column in an HTML table. -col = element col { col.attlist, empty } -# doc:A row in an HTML table. -tr = element tr { tr.attlist, (th | td)+ } -# doc:A table header entry in an HTML table. -th = - element th { - th.attlist, (para.char.mix | tabentry.mix | table | informaltable)* - } -# doc:A table ntry in an HTML table. -td = - element td { - td.attlist, (para.char.mix | tabentry.mix | table | informaltable)* - } -colgroup.attlist &= - attrs, - [ a:defaultValue = "1" ] attribute span { text }?, - attribute width { text }?, - cellhalign, - cellvalign -col.attlist &= - attrs, - [ a:defaultValue = "1" ] attribute span { text }?, - attribute width { text }?, - cellhalign, - cellvalign -tr.attlist &= - attrs, - cellhalign, - cellvalign, - attribute bgcolor { text }? -th.attlist &= - attrs, - attribute abbr { text }?, - attribute axis { text }?, - attribute headers { xsd:IDREFS }?, - attribute scope { "row" | "col" | "rowgroup" | "colgroup" }?, - [ a:defaultValue = "1" ] attribute rowspan { text }?, - [ a:defaultValue = "1" ] attribute colspan { text }?, - cellhalign, - cellvalign, - attribute nowrap { "nowrap" }?, - attribute bgcolor { text }?, - attribute width { text }?, - attribute height { text }? -td.attlist &= - attrs, - attribute abbr { text }?, - attribute axis { text }?, - attribute headers { xsd:IDREFS }?, - attribute scope { "row" | "col" | "rowgroup" | "colgroup" }?, - [ a:defaultValue = "1" ] attribute rowspan { text }?, - [ a:defaultValue = "1" ] attribute colspan { text }?, - cellhalign, - cellvalign, - attribute nowrap { "nowrap" }?, - attribute bgcolor { text }?, - attribute width { text }?, - attribute height { text }? -# ====================================================== - -# Set up to read in the CALS model configured to -# merge with the XHTML table model - -# ====================================================== -tables.role.attrib = role.attrib -# Add label and role attributes to table and informaltable -bodyatt = - attribute floatstyle { text }?, - attribute rowheader { "firstcol" | "norowheader" }?, - label.attrib -# Add common attributes to Table, TGroup, TBody, THead, TFoot, Row, -# EntryTbl, and Entry (and InformalTable element). -secur = - common.attrib, - attribute class { text }?, - attribute style { text }?, - attribute title { text }?, - i18n, - events, - tables.role.attrib -common.table.attribs = bodyatt, secur -# Content model for Table (that also allows HTML tables) -tbl.table.mdl = - (blockinfo?, - formalobject.title.content, - ndxterm.class*, - textobject*, - (graphic+ | mediaobject+ | tgroup+)) - | (caption, (col* | colgroup*), thead?, tfoot?, (tbody+ | tr+)) -informal.tbl.table.mdl = - (textobject*, (graphic+ | mediaobject+ | tgroup+)) - | ((col* | colgroup*), thead?, tfoot?, (tbody+ | tr+)) -# Attributes for Table (including HTML ones) - -# N.B. rules = (none | groups | rows | cols | all) but it can't be spec'd - -# that way because 'all' already occurs in a different enumeration in - -# CALS tables (frame). -tbl.table.att = - attribute tabstyle { text }?, - attribute tocentry { yesorno.attvals }?, - attribute shortentry { yesorno.attvals }?, - attribute orient { "port" | "land" }?, - attribute pgwide { yesorno.attvals }?, - attribute summary { text }?, - attribute width { text }?, - attribute border { text }?, - attribute rules { text }?, - attribute cellspacing { text }?, - attribute cellpadding { text }?, - attribute align { "left" | "center" | "right" }?, - attribute bgcolor { text }? -tbl.frame.attval = - "void" - | "above" - | "below" - | "hsides" - | "lhs" - | "rhs" - | "vsides" - | "box" - | "border" - | "top" - | "bottom" - | "topbot" - | "all" - | "sides" - | "none" -# Allow either objects or inlines; beware of REs between elements. -tbl.entry.mdl = para.char.mix | tabentry.mix -# thead, tfoot, and tbody are defined in both table models, -# so we set up parameter entities to define union models for them -tbl.hdft.mdl = tr+ | (colspec*, row+) -tbl.tbody.mdl = tr+ | row+ -# End of DocBook XML HTML Table Module V4.5 ............................ - -# ...................................................................... diff --git a/en-US/Author_Group.xml b/en-US/Author_Group.xml deleted file mode 100644 index 62336d8..0000000 --- a/en-US/Author_Group.xml +++ /dev/null @@ -1,35 +0,0 @@ - - -%BOOK_ENTITIES; -]> - - - Florian - Weimer - - Red Hat - Product Security Team - - fweimer@redhat.com - - - Nikos - Mavrogiannopoulos - - Red Hat - Crypto Team - - nmav@redhat.com - - - Robert - Relyea - - Red Hat - Crypto Team - - rrelyea@redhat.com - - - diff --git a/en-US/Book_Info.xml b/en-US/Book_Info.xml deleted file mode 100644 index a02a0da..0000000 --- a/en-US/Book_Info.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - Defensive Coding - A Guide to Improving Software Security - 1 - 1 - Unofficial fork - - - - This document provides guidelines for improving software - security through secure coding. It covers common - programming languages and libraries, and focuses on - concrete recommendations. - - - - - - - - - - - - - diff --git a/en-US/C-Allocators.xml b/en-US/C-Allocators.xml deleted file mode 100644 index 49f4849..0000000 --- a/en-US/C-Allocators.xml +++ /dev/null @@ -1,209 +0,0 @@ - - -
- Memory Allocators - -
- <function>malloc</function> and Related Functions - - The C library interfaces for memory allocation are provided by - malloc, free and - realloc, and the - calloc function. In addition to these - generic functions, there are derived functions such as - strdup which perform allocation using - malloc internally, but do not return - untyped heap memory (which could be used for any object). - - - The C compiler knows about these functions and can use their - expected behavior for optimizations. For instance, the compiler - assumes that an existing pointer (or a pointer derived from an - existing pointer by arithmetic) will not point into the memory - area returned by malloc. - - - If the allocation fails, realloc does not - free the old pointer. Therefore, the idiom ptr = - realloc(ptr, size); is wrong because the memory - pointed to by ptr leaks in case of an error. - -
- Use-after-free errors - - After free, the pointer is invalid. - Further pointer dereferences are not allowed (and are usually - detected by valgrind). Less obvious - is that any use of the old pointer value is - not allowed, either. In particular, comparisons with any other - pointer (or the null pointer) are undefined according to the C - standard. - - - The same rules apply to realloc if the - memory area cannot be enlarged in-place. For instance, the - compiler may assume that a comparison between the old and new - pointer will always return false, so it is impossible to detect - movement this way. - -
-
- Handling Memory Allocation Errors - - Recovering from out-of-memory errors is often difficult or even - impossible. In these cases, malloc and - other allocation functions return a null pointer. Dereferencing - this pointer lead to a crash. Such dereferences can even be - exploitable for code execution if the dereference is combined - with an array subscript. - - - In general, if you cannot check all allocation calls and - handle failure, you should abort the program on allocation - failure, and not rely on the null pointer dereference to - terminate the process. See - - for related memory allocation concerns. - -
-
- -
- <function>alloca</function> and Other Forms of Stack-based - Allocation - - Allocation on the stack is risky because stack overflow checking - is implicit. There is a guard page at the end of the memory - area reserved for the stack. If the program attempts to read - from or write to this guard page, a SIGSEGV - signal is generated and the program typically terminates. - - - This is sufficient for detecting typical stack overflow - situations such as unbounded recursion, but it fails when the - stack grows in increments larger than the size of the guard - page. In this case, it is possible that the stack pointer ends - up pointing into a memory area which has been allocated for a - different purposes. Such misbehavior can be exploitable. - - - A common source for large stack growth are calls to - alloca and related functions such as - strdupa. These functions should be avoided - because of the lack of error checking. (They can be used safely - if the allocated size is less than the page size (typically, - 4096 bytes), but this case is relatively rare.) Additionally, - relying on alloca makes it more difficult - to reorganize the code because it is not allowed to use the - pointer after the function calling alloca - has returned, even if this function has been inlined into its - caller. - - - Similar concerns apply to variable-length - arrays (VLAs), a feature of the C99 standard which - started as a GNU extension. For large objects exceeding the - page size, there is no error checking, either. - - - In both cases, negative or very large sizes can trigger a - stack-pointer wraparound, and the stack pointer and end up - pointing into caller stack frames, which is fatal and can be - exploitable. - - - If you want to use alloca or VLAs for - performance reasons, consider using a small on-stack array (less - than the page size, large enough to fulfill most requests). If - the requested size is small enough, use the on-stack array. - Otherwise, call malloc. When exiting the - function, check if malloc had been called, - and free the buffer as needed. - -
- -
- Array Allocation - - When allocating arrays, it is important to check for overflows. - The calloc function performs such checks. - - - If malloc or realloc - is used, the size check must be written manually. For instance, - to allocate an array of n elements of type - T, check that the requested size is not - greater than ((size_t) -1) / sizeof(T). See - . - -
- -
- Custom Memory Allocators - - Custom memory allocates come in two forms: replacements for - malloc, and completely different interfaces - for memory management. Both approaches can reduce the - effectiveness of valgrind and similar - tools, and the heap corruption detection provided by GNU libc, so - they should be avoided. - - - Memory allocators are difficult to write and contain many - performance and security pitfalls. - - - - - When computing array sizes or rounding up allocation - requests (to the next allocation granularity, or for - alignment purposes), checks for arithmetic overflow are - required. - - - - - Size computations for array allocations need overflow - checking. See . - - - - - It can be difficult to beat well-tuned general-purpose - allocators. In micro benchmarks, pool allocators can show - huge wins, and size-specific pools can reduce internal - fragmentation. But often, utilization of individual pools - is poor, and external fragmentation increases the overall - memory usage. - - - -
- -
- Conservative Garbage Collection - - Garbage collection can be an alternative to explicit memory - management using malloc and - free. The Boehm-Dehmers-Weiser allocator - can be used from C programs, with minimal type annotations. - Performance is competitive with malloc on - 64-bit architectures, especially for multi-threaded programs. - The stop-the-world pauses may be problematic for some real-time - applications, though. - - - However, using a conservative garbage collector may reduce - opportunities for code reduce because once one library in a - program uses garbage collection, the whole process memory needs - to be subject to it, so that no pointers are missed. The - Boehm-Dehmers-Weiser collector also reserves certain signals for - internal use, so it is not fully transparent to the rest of the - program. - -
-
- diff --git a/en-US/C-Language.xml b/en-US/C-Language.xml deleted file mode 100644 index 12b0845..0000000 --- a/en-US/C-Language.xml +++ /dev/null @@ -1,221 +0,0 @@ - - -
- The Core Language - - C provides no memory safety. Most recommendations in this section - deal with this aspect of the language. - - -
- Undefined Behavior - - Some C constructs are defined to be undefined by the C standard. - This does not only mean that the standard does not describe - what happens when the construct is executed. It also allows - optimizing compilers such as GCC to assume that this particular - construct is never reached. In some cases, this has caused - GCC to optimize security checks away. (This is not a flaw in GCC - or the C language. But C certainly has some areas which are more - difficult to use than others.) - - - - Common sources of undefined behavior are: - - - out-of-bounds array accesses - null pointer dereferences - overflow in signed integer arithmetic - -
- -
- Recommendations for Pointers and Array Handling - - Always keep track of the size of the array you are working with. - Often, code is more obviously correct when you keep a pointer - past the last element of the array, and calculate the number of - remaining elements by substracting the current position from - that pointer. The alternative, updating a separate variable - every time when the position is advanced, is usually less - obviously correct. - - - - shows how to extract Pascal-style strings from a character - buffer. The two pointers kept for length checks are - inend and outend. - inp and outp are the - respective positions. - The number of input bytes is checked using the expression - len > (size_t)(inend - inp). - The cast silences a compiler warning; - inend is always larger than - inp. - - - Array processing in C - - - - It is important that the length checks always have the form - len > (size_t)(inend - inp), where - len is a variable of type - size_t which denotes the total - number of bytes which are about to be read or written next. In - general, it is not safe to fold multiple such checks into one, - as in len1 + len2 > (size_t)(inend - inp), - because the expression on the left can overflow or wrap around - (see ), and it - no longer reflects the number of bytes to be processed. - -
- -
- Recommendations for Integer Arithmetic - - Overflow in signed integer arithmetic is undefined. This means - that it is not possible to check for overflow after it happened, - see . - - - Incorrect overflow detection in C - - - - The following approaches can be used to check for overflow, - without actually causing it. - - - - - Use a wider type to perform the calculation, check that the - result is within bounds, and convert the result to the - original type. All intermediate results must be checked in - this way. - - - - - Perform the calculation in the corresponding unsigned type - and use bit fiddling to detect the overflow. - - shows how to perform an overflow check for unsigned integer - addition. For three or more terms, all the intermediate - additions have to be checked in this way. - - - - - Overflow checking for unsigned addition - - - - - - Compute bounds for acceptable input values which are known - to avoid overflow, and reject other values. This is the - preferred way for overflow checking on multiplications, - see . - - - - - - Overflow checking for unsigned multiplication - - - - Basic arithmetic operations are commutative, so for bounds checks, - there are two different but mathematically equivalent - expressions. Sometimes, one of the expressions results in - better code because parts of it can be reduced to a constant. - This applies to overflow checks for multiplication a * - b involving a constant a, where the - expression is reduced to b > C for some - constant C determined at compile time. The - other expression, b && a > ((unsigned)-1) / - b, is more difficult to optimize at compile time. - - - When a value is converted to a signed integer, GCC always - chooses the result based on 2's complement arithmetic. This GCC - extension (which is also implemented by other compilers) helps a - lot when implementing overflow checks. - - - Sometimes, it is necessary to compare unsigned and signed - integer variables. This results in a compiler warning, - comparison between signed and unsigned integer - expressions, because the comparison often gives - unexpected results for negative values. When adding a cast, - make sure that negative values are covered properly. If the - bound is unsigned and the checked quantity is signed, you should - cast the checked quantity to an unsigned type as least as wide - as either operand type. As a result, negative values will fail - the bounds check. (You can still check for negative values - separately for clarity, and the compiler will optimize away this - redundant check.) - - - Legacy code should be compiled with the - GCC option. As a result, GCC will provide 2's complement - semantics for integer arithmetic, including defined behavior on - integer overflow. - -
- -
- Global Variables - - Global variables should be avoided because they usually lead to - thread safety hazards. In any case, they should be declared - static, so that access is restricted to a - single translation unit. - - - Global constants are not a problem, but declaring them can be - tricky. - shows how to declare a constant array of constant strings. - The second const is needed to make the - array constant, and not just the strings. It must be placed - after the *, and not before it. - - - Declaring a constant array of constant strings - - - - Sometimes, static variables local to functions are used as a - replacement for proper memory management. Unlike non-static - local variables, it is possible to return a pointer to static - local variables to the caller. But such variables are - well-hidden, but effectively global (just as static variables at - file scope). It is difficult to add thread safety afterwards if - such interfaces are used. Merely dropping the - static keyword in such cases leads to - undefined behavior. - - - Another source for static local variables is a desire to reduce - stack space usage on embedded platforms, where the stack may - span only a few hundred bytes. If this is the only reason why - the static keyword is used, it can just be - dropped, unless the object is very large (larger than - 128 kilobytes on 32 bit platforms). In the latter case, it is - recommended to allocate the object using - malloc, to obtain proper array checking, for - the same reasons outlined in . - -
-
diff --git a/en-US/C-Libc.xml b/en-US/C-Libc.xml deleted file mode 100644 index 2a48c44..0000000 --- a/en-US/C-Libc.xml +++ /dev/null @@ -1,352 +0,0 @@ - - -
- The C Standard Library - - Parts of the C standard library (and the UNIX and GNU extensions) - are difficult to use, so you should avoid them. - - - Please check the applicable documentation before using the - recommended replacements. Many of these functions allocate - buffers using malloc which your code must - deallocate explicitly using free. - -
- Absolutely Banned Interfaces - - The functions listed below must not be used because they are - almost always unsafe. Use the indicated replacements instead. - - - gets - ⟶ fgets - getwd - ⟶ getcwd - or get_current_dir_name - - - readdir_rreaddir - - - - - - - realpath (with a non-NULL second parameter) - ⟶ realpath with NULL as the second parameter, - or canonicalize_file_name - - - - - - - The constants listed below must not be used, either. Instead, - code must allocate memory dynamically and use interfaces with - length checking. - - - - - NAME_MAX (limit not actually enforced by - the kernel) - - - - - PATH_MAX (limit not actually enforced by - the kernel) - - - - - _PC_NAME_MAX (This limit, returned by the - pathconf function, is not enforced by - the kernel.) - - - - - _PC_PATH_MAX (This limit, returned by the - pathconf function, is not enforced by - the kernel.) - - - - - The following structure members must not be used. - - - - - f_namemax in struct - statvfs (limit not actually enforced by the kernel, - see _PC_NAME_MAX above) - - - -
-
- Functions to Avoid - - The following string manipulation functions can be used securely - in principle, but their use should be avoided because they are - difficult to use correctly. Calls to these functions can be - replaced with asprintf or - vasprintf. (For non-GNU targets, these - functions are available from Gnulib.) In some cases, the - snprintf function might be a suitable - replacement, see . - - - sprintf - strcat - strcpy - vsprintf - - - Use the indicated replacements for the functions below. - - - - - alloca ⟶ - malloc and free - (see ) - - - - - putenv ⟶ - explicit envp argument in process creation - (see ) - - - - - setenv ⟶ - explicit envp argument in process creation - (see ) - - - - - strdupa ⟶ - strdup and free - (see ) - - - - - strndupa ⟶ - strndup and free - (see ) - - - - - system ⟶ - posix_spawn - or fork/execve/ - (see ) - - - - - unsetenv ⟶ - explicit envp argument in process creation - (see ) - - - -
-
- String Functions with Explicit Length Arguments - - The C run-time library provides string manipulation functions - which not just look for NUL characters for string termination, - but also honor explicit lengths provided by the caller. - However, these functions evolved over a long period of time, and - the lengths mean different things depending on the function. - -
- <literal>snprintf</literal> - - The snprintf function provides a way to - construct a string in a statically-sized buffer. (If the buffer - size is allocated on the heap, consider use - asprintf instead.) - - - - - - The second argument to the snprintf call - should always be the size of the buffer in the first argument - (which should be a character array). Elaborate pointer and - length arithmetic can introduce errors and nullify the - security benefits of snprintf. - - - In particular, snprintf is not well-suited - to constructing a string iteratively, by appending to an - existing buffer. snprintf returns one of - two values, -1 on errors, or the number of - characters which would have been written to the - buffer if the buffer were large enough. This means - that adding the result of snprintf to the - buffer pointer to skip over the characters just written is - incorrect and risky. However, as long as the length argument - is not zero, the buffer will remain null-terminated. - works because end -current > 0 is a loop - invariant. After the loop, the result string is in the - buf variable. - - - Repeatedly writing to a buffer using <function>snprintf</function> - - - - If you want to avoid the call to strlen - for performance reasons, you have to check for a negative - return value from snprintf and also check - if the return value is equal to the specified buffer length or - larger. Only if neither condition applies, you may advance - the pointer to the start of the write buffer by the number - return by snprintf. However, this - optimization is rarely worthwhile. - - - Note that it is not permitted to use the same buffer both as - the destination and as a source argument. - -
-
- <literal>vsnprintf</literal> and Format Strings - - If you use vsnprintf (or - vasprintf or even - snprintf) with a format string which is - not a constant, but a function argument, it is important to - annotate the function with a format - function attribute, so that GCC can warn about misuse of your - function (see ). - - - The <literal>format</literal> function attribute - - -
-
- <function>strncpy</function> - - The strncpy function does not ensure that - the target buffer is null-terminated. A common idiom for - ensuring NUL termination is: - - - - - - Another approach uses the strncat - function for this purpose: - - - - -
-
- <function>strncat</function> - - The length argument of the strncat - function specifies the maximum number of characters copied - from the source buffer, excluding the terminating NUL - character. This means that the required number of bytes in - the destination buffer is the length of the original string, - plus the length argument in the strncat - call, plus one. Consequently, this function is rarely - appropriate for performing a length-checked string operation, - with the notable exception of the strcpy - emulation described in . - - - To implement a length-checked string append, you can use an - approach similar to : - - - - - - In many cases, including this one, the string concatenation - can be avoided by combining everything into a single format - string: - - - - - - But you should must not dynamically construct format strings - to avoid concatenation because this would prevent GCC from - type-checking the argument lists. - - - It is not possible to use format strings like - "%s%s" to implement concatenation, unless - you use separate buffers. snprintf does - not support overlapping source and target strings. - -
-
- <function>strlcpy</function> and - <function>strlcat</function> - - Some systems support strlcpy and - strlcat functions which behave this way, - but these functions are not part of GNU libc. - strlcpy is often replaced with - snprintf with a "%s" - format string. See for a caveat - related to the snprintf return value. - - - To emulate strlcat, use the approach - described in . - -
-
- ISO C11 Annex K *<function>_s</function> functions - - ISO C11 adds another set of length-checking functions, but GNU - libc currently does not implement them. - -
-
- Other <function>strn</function>* and - <function>stpn</function>* functions - - GNU libc contains additional functions with different variants - of length checking. Consult the documentation before using - them to find out what the length actually means. - -
-
-
diff --git a/en-US/C-Other.xml b/en-US/C-Other.xml deleted file mode 100644 index e6781af..0000000 --- a/en-US/C-Other.xml +++ /dev/null @@ -1,70 +0,0 @@ - - -
- Other C-related Topics -
- Wrapper Functions - - Some libraries provide wrappers for standard library functions. - Common cases include allocation functions such as - xmalloc which abort the process on - allocation failure (instead of returning a - NULL pointer), or alternatives to relatively - recent library additions such as snprintf - (along with implementations for systems which lack them). - - - In general, such wrappers are a bad idea, particularly if they - are not implemented as inline functions or preprocessor macros. - The compiler lacks knowledge of such wrappers outside the - translation unit which defines them, which means that some - optimizations and security checks are not performed. Adding - __attribute__ annotations to function - declarations can remedy this to some extent, but these - annotations have to be maintained carefully for feature parity - with the standard implementation. - - - At the minimum, you should apply these attributes: - - - - - If you wrap function which accepts are GCC-recognized format - string (for example, a printf-style - function used for logging), you should add a suitable - format attribute, as in . - - - - - If you wrap a function which carries a - warn_unused_result attribute and you - propagate its return value, your wrapper should be declared - with warn_unused_result as well. - - - - - Duplicating the buffer length checks based on the - __builtin_object_size GCC builtin is - desirable if the wrapper processes arrays. (This - functionality is used by the - -D_FORTIFY_SOURCE=2 checks to guard - against static buffer overflows.) However, designing - appropriate interfaces and implementing the checks may not - be entirely straightforward. - - - - - For other attributes (such as malloc), - careful analysis and comparison with the compiler documentation - is required to check if propagating the attribute is - appropriate. Incorrectly applied attributes can result in - undesired behavioral changes in the compiled code. - -
-
diff --git a/en-US/C.xml b/en-US/C.xml deleted file mode 100644 index 4d895f9..0000000 --- a/en-US/C.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - The C Programming Language - - - - - - - diff --git a/en-US/CXX-Language.xml b/en-US/CXX-Language.xml deleted file mode 100644 index ed5275c..0000000 --- a/en-US/CXX-Language.xml +++ /dev/null @@ -1,188 +0,0 @@ - - -
- The Core Language - - C++ includes a large subset of the C language. As far as the C - subset is used, the recommendations in apply. - - -
- Array Allocation with <literal>operator new[]</literal> - - For very large values of n, an expression - like new T[n] can return a pointer to a heap - region which is too small. In other words, not all array - elements are actually backed with heap memory reserved to the - array. Current GCC versions generate code that performs a - computation of the form sizeof(T) * size_t(n) + - cookie_size, where cookie_size is - currently at most 8. This computation can overflow, and GCC - versions prior to 4.8 generated code which did not detect this. - (Fedora 18 was the first release which fixed this in GCC.) - - - The std::vector template can be used instead - an explicit array allocation. (The GCC implementation detects - overflow internally.) - - - If there is no alternative to operator new[] - and the sources will be compiled with older GCC versions, code - which allocates arrays with a variable length must check for - overflow manually. For the new T[n] example, - the size check could be n || (n > 0 && n > - (size_t(-1) - 8) / sizeof(T)). (See .) If there are - additional dimensions (which must be constants according to the - C++ standard), these should be included as factors in the - divisor. - - - These countermeasures prevent out-of-bounds writes and potential - code execution. Very large memory allocations can still lead to - a denial of service. - contains suggestions for mitigating this problem when processing - untrusted data. - - - See - for array allocation advice for C-style memory allocation. - -
- -
- Overloading - - Do not overload functions with versions that have different - security characteristics. For instance, do not implement a - function strcat which works on - std::string arguments. Similarly, do not name - methods after such functions. - -
-
- ABI compatibility and preparing for security updates - - A stable binary interface (ABI) is vastly preferred for security - updates. Without a stable ABI, all reverse dependencies need - recompiling, which can be a lot of work and could even be - impossible in some cases. Ideally, a security update only - updates a single dynamic shared object, and is picked up - automatically after restarting affected processes. - - - Outside of extremely performance-critical code, you should - ensure that a wide range of changes is possible without breaking - ABI. Some very basic guidelines are: - - - - - Avoid inline functions. - - - - - Use the pointer-to-implementation idiom. - - - - - Try to avoid templates. Use them if the increased type - safety provides a benefit to the programmer. - - - - - Move security-critical code out of templated code, so that - it can be patched in a central place if necessary. - - - - - The KDE project publishes a document with more extensive - guidelines on ABI-preserving changes to C++ code, Policies/Binary - Compatibility Issues With C++ - (d-pointer refers to the - pointer-to-implementation idiom). - -
- -
- C++0X and C++11 Support - - GCC offers different language compatibility modes: - - - - - for the original 1998 C++ - standard - - - - - for the 1998 standard with the - changes from the TR1 technical report - - - - - for the 2011 C++ standard. This - option should not be used. - - - - - for several different versions - of C++11 support in development, depending on the GCC - version. This option should not be used. - - - - - - For each of these flags, there are variants which also enable - GNU extensions (mostly language features also found in C99 or - C11): , - , . - Again, should not be used. - - - If you enable C++11 support, the ABI of the standard C++ library - libstdc++ will change in subtle ways. - Currently, no C++ libraries are compiled in C++11 mode, so if - you compile your code in C++11 mode, it will be incompatible - with the rest of the system. Unfortunately, this is also the - case if you do not use any C++11 features. Currently, there is - no safe way to enable C++11 mode (except for freestanding - applications). - - - The meaning of C++0X mode changed from GCC release to GCC - release. Earlier versions were still ABI-compatible with C++98 - mode, but in the most recent versions, switching to C++0X mode - activates C++11 support, with its compatibility problems. - - - Some C++11 features (or approximations thereof) are available - with TR1 support, that is, with or - and in the - <tr1/*> header files. This includes - std::tr1::shared_ptr (from - <tr1/memory>) and - std::tr1::function (from - <tr1/functional>). For other C++11 - features, the Boost C++ library contains replacements. - -
-
- diff --git a/en-US/CXX-Std.xml b/en-US/CXX-Std.xml deleted file mode 100644 index 20490f5..0000000 --- a/en-US/CXX-Std.xml +++ /dev/null @@ -1,202 +0,0 @@ - - -
- The C++ Standard Library - - The C++ standard library includes most of its C counterpart - by reference, see . - -
- Functions That Are Difficult to Use - - This section collects functions and function templates which are - part of the standard library and are difficult to use. - -
- Unpaired Iterators - - Functions which use output operators or iterators which do not - come in pairs (denoting ranges) cannot perform iterator range - checking. - (See ) - Function templates which involve output iterators are - particularly dangerous: - - - std::copy - std::copy_backward - std::copy_if - std::move (three-argument variant) - std::move_backward - std::partition_copy_if - std::remove_copy - std::remove_copy_if - std::replace_copy - std::replace_copy_if - std::swap_ranges - std::transform - - - In addition, std::copy_n, - std::fill_n and - std::generate_n do not perform iterator - checking, either, but there is an explicit count which has to be - supplied by the caller, as opposed to an implicit length - indicator in the form of a pair of forward iterators. - - - These output-iterator-expecting functions should only be used - with unlimited-range output iterators, such as iterators - obtained with the std::back_inserter - function. - - - Other functions use single input or forward iterators, which can - read beyond the end of the input range if the caller is not careful: - - - std::equal - std::is_permutation - std::mismatch - -
-
-
- String Handling with <literal>std::string</literal> - - The std::string class provides a convenient - way to handle strings. Unlike C strings, - std::string objects have an explicit length - (and can contain embedded NUL characters), and storage for its - characters is managed automatically. This section discusses - std::string, but these observations also - apply to other instances of the - std::basic_string template. - - - The pointer returned by the data() member - function does not necessarily point to a NUL-terminated string. - To obtain a C-compatible string pointer, use - c_str() instead, which adds the NUL - terminator. - - - The pointers returned by the data() and - c_str() functions and iterators are only - valid until certain events happen. It is required that the - exact std::string object still exists (even - if it was initially created as a copy of another string object). - Pointers and iterators are also invalidated when non-const - member functions are called, or functions with a non-const - reference parameter. The behavior of the GCC implementation - deviates from that required by the C++ standard if multiple - threads are present. In general, only the first call to a - non-const member function after a structural modification of the - string (such as appending a character) is invalidating, but this - also applies to member function such as the non-const version of - begin(), in violation of the C++ standard. - - - Particular care is necessary when invoking the - c_str() member function on a temporary - object. This is convenient for calling C functions, but the - pointer will turn invalid as soon as the temporary object is - destroyed, which generally happens when the outermost expression - enclosing the expression on which c_str() - is called completes evaluation. Passing the result of - c_str() to a function which does not store - or otherwise leak that pointer is safe, though. - - - Like with std::vector and - std::array, subscribing with - operator[] does not perform bounds checks. - Use the at(size_type) member function - instead. See . - Furthermore, accessing the terminating NUL character using - operator[] is not possible. (In some - implementations, the c_str() member function - writes the NUL character on demand.) - - - Never write to the pointers returned by - data() or c_str() - after casting away const. If you need a - C-style writable string, use a - std::vector<char> object and its - data() member function. In this case, you - have to explicitly add the terminating NUL character. - - - GCC's implementation of std::string is - currently based on reference counting. It is expected that a - future version will remove the reference counting, due to - performance and conformance issues. As a result, code that - implicitly assumes sharing by holding to pointers or iterators - for too long will break, resulting in run-time crashes or worse. - On the other hand, non-const iterator-returning functions will - no longer give other threads an opportunity for invalidating - existing iterators and pointers because iterator invalidation - does not depend on sharing of the internal character array - object anymore. - -
-
- Containers and <literal>operator[]</literal> - - Many sequence containers similar to std::vector - provide both operator[](size_type) and a - member function at(size_type). This applies - to std::vector itself, - std::array, std::string - and other instances of std::basic_string. - - - operator[](size_type) is not required by the - standard to perform bounds checking (and the implementation in - GCC does not). In contrast, at(size_type) - must perform such a check. Therefore, in code which is not - performance-critical, you should prefer - at(size_type) over - operator[](size_type), even though it is - slightly more verbose. - - - The front() and back() - member functions are undefined if a vector object is empty. You - can use vec.at(0) and - vec.at(vec.size() - 1) as checked - replacements. For an empty vector, data() is - defined; it returns an arbitrary pointer, but not necessarily - the NULL pointer. - -
-
- Iterators - - Iterators do not perform any bounds checking. Therefore, all - functions that work on iterators should accept them in pairs, - denoting a range, and make sure that iterators are not moved - outside that range. For forward iterators and bidirectional - iterators, you need to check for equality before moving the - first or last iterator in the range. For random-access - iterators, you need to compute the difference before adding or - subtracting an offset. It is not possible to perform the - operation and check for an invalid operator afterwards. - - - Output iterators cannot be compared for equality. Therefore, it - is impossible to write code that detects that it has been - supplied an output area that is too small, and their use should - be avoided. - - - These issues make some of the standard library functions - difficult to use correctly, see . - -
-
- diff --git a/en-US/CXX.xml b/en-US/CXX.xml deleted file mode 100644 index 8c55567..0000000 --- a/en-US/CXX.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - The C++ Programming Language - - - - - diff --git a/en-US/Defensive_Coding.ent b/en-US/Defensive_Coding.ent deleted file mode 100644 index 79244df..0000000 --- a/en-US/Defensive_Coding.ent +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/en-US/Defensive_Coding.xml b/en-US/Defensive_Coding.xml deleted file mode 100644 index a8b6caa..0000000 --- a/en-US/Defensive_Coding.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - Programming Languages - - - - - - - - - - Specific Programming Tasks - - - - - - - - - - - Implementing Security Features - - - - - - diff --git a/en-US/Features-Authentication.xml b/en-US/Features-Authentication.xml deleted file mode 100644 index e63eaf1..0000000 --- a/en-US/Features-Authentication.xml +++ /dev/null @@ -1,189 +0,0 @@ - - - - Authentication and Authorization - -
- Authenticating Servers - - When connecting to a server, a client has to make sure that it - is actually talking to the server it expects. There are two - different aspects, securing the network path, and making sure - that the expected user runs the process on the target host. - There are several ways to ensure that: - - - - - The server uses a TLS certificate which is valid according - to the web browser public key infrastructure, and the client - verifies the certificate and the host name. - - - - - The server uses a TLS certificate which is expected by the - client (perhaps it is stored in a configuration file read by - the client). In this case, no host name checking is - required. - - - - - On Linux, UNIX domain sockets (of the - PF_UNIX protocol family, sometimes called - PF_LOCAL) are restricted by file system - permissions. If the server socket path is not - world-writable, the server identity cannot be spoofed by - local users. - - - - - Port numbers less than 1024 (trusted - ports) can only be used by - root, so if a UDP or TCP server is - running on the local host and it uses a trusted port, its - identity is assured. (Not all operating systems enforce the - trusted ports concept, and the network might not be trusted, - so it is only useful on the local system.) - - - - - TLS () is the - recommended way for securing connections over untrusted - networks. - - - If the server port number is 1024 is higher, a local user can - impersonate the process by binding to this socket, perhaps after - crashing the real server by exploiting a denial-of-service - vulnerability. - -
- -
- Host-based Authentication - - Host-based authentication uses access control lists (ACLs) to - accept or deny requests from clients. This authentication - method comes in two flavors: IP-based (or, more generally, - address-based) and name-based (with the name coming from DNS or - /etc/hosts). IP-based ACLs often use - prefix notation to extend access to entire subnets. Name-based - ACLs sometimes use wildcards for adding groups of hosts (from - entire DNS subtrees). (In the SSH context, host-based - authentication means something completely different and is not - covered in this section.) - - - Host-based authentication trust the network and may not offer - sufficient granularity, so it has to be considered a weak form - of authentication. On the other hand, IP-based authentication - can be made extremely robust and can be applied very early in - input processing, so it offers an opportunity for significantly - reducing the number of potential attackers for many services. - - - The names returned by gethostbyaddr and - getnameinfo functions cannot be trusted. - (DNS PTR records can be set to arbitrary values, not just names - belong to the address owner.) If these names are used for ACL - matching, a forward lookup using - gethostbyaddr or - getaddrinfo has to be performed. The name - is only valid if the original address is found among the results - of the forward lookup (double-reverse - lookup). - - - An empty ACL should deny all access (deny-by-default). If empty - ACLs permits all access, configuring any access list must switch - to deny-by-default for all unconfigured protocols, in both - name-based and address-based variants. - - - Similarly, if an address or name is not matched by the list, it - should be denied. However, many implementations behave - differently, so the actual behavior must be documented properly. - - - IPv6 addresses can embed IPv4 addresses. There is no - universally correct way to deal with this ambiguity. The - behavior of the ACL implementation should be documented. - -
- -
- UNIX Domain Socket Authentication - - UNIX domain sockets (with address family - AF_UNIX or AF_LOCAL) are - restricted to the local host and offer a special authentication - mechanism: credentials passing. - - - Nowadays, most systems support the - SO_PEERCRED (Linux) or - LOCAL_PEERCRED (FreeBSD) socket options, or - the getpeereid (other BSDs, OS X). - These interfaces provide direct access to the (effective) user - ID on the other end of a domain socket connect, without - cooperation from the other end. - - - Historically, credentials passing was implemented using - ancillary data in the sendmsg and - recvmsg functions. On some systems, only - credentials data that the peer has explicitly sent can be - received, and the kernel checks the data for correctness on the - sending side. This means that both peers need to deal with - ancillary data. Compared to that, the modern interfaces are - easier to use. Both sets of interfaces vary considerably among - UNIX-like systems, unfortunately. - - - If you want to authenticate based on supplementary groups, you - should obtain the user ID using one of these methods, and look - up the list of supplementary groups using - getpwuid (or - getpwuid_r) and - getgrouplist. Using the PID and - information from /proc/PID/status is prone - to race conditions and insecure. - -
- - -
- diff --git a/en-US/Features-HSM.xml b/en-US/Features-HSM.xml deleted file mode 100644 index f8f9b6f..0000000 --- a/en-US/Features-HSM.xml +++ /dev/null @@ -1,180 +0,0 @@ - - - - Hardware Security Modules and Smart Cards - - Hardware Security Modules (HSMs) are specialized hardware intended - to protect private keys on server systems. They store internally - the private keys (e.g., RSA keys), and provide access to operations - with the keys without exposing the keys. That access, is provided using - a standardized API, which across Fedora is PKCS#11. - - - Smart cards are small cards with a micro processor, often combined with a - USB reader resembling a USB stick. They are very similar in nature with - HSMs as they can also be used to protect private keys and are almost - universally accessed via the PKCS#11 API. The main distinguishers from HSMs - is their inferior performance and often, the available hardware protection mechanisms. - - - Typically a smart card or HSM relies on a shared library to provide functionality. - This shared library follows the PKCS#11 API and thus is often referred to as - a PKCS#11 module. In Fedora the opensc - shared module (opensc-pkcs11.so) can be used for the majority - of smart cards available in the market. By convention these modules are located - at /usr/lib64/pkcs11. They can be used directly, or via - a higher level library. - - - All the major crypto libraries (NSS, GnuTLS and OpenSSL in Fedora) support - hardware security modules and smart cards, by providing wrappers over the - PKCS#11 API. However, the level of support varies, as well as the ease of - use of such modules and its integration to the overall library API. - - - - - The PKCS#11 API does provide an API to access HSMs or smart cards, but - does not provide any method of discovering which HSMs or smart cards are - available in the system. In Fedora and modules are registered via p11-kit - configuration files, stored at /etc/pkcs11/modules/. For applications using - engine_pkcs11 or GnuTLS the registered modules are - available without further configuration. Other applications will have to load - the p11-kit-proxy.so module. - - - - - Most crypto libraries support the PKCS#11 URLs scheme - to identify objects stored in an HSM, however that support is not yet universal. - Some support transparent usage of PKCS#11 objects, e.g., specifying - a PKCS#11 object instead of a file, while others require to use - specialized APIs for such objects. - - - - - Objects stored in an HSM or smart card can be protected with a PIN. As such, - libraries typically require to set a PIN handling function for accessing private keys, - or the PIN can be passed along with a PKCS#11 URL and the pin-value parameter. - - - - - Obtaining a Hardware Security Module, or including it on a continuous integration - testing is not always feasible. For testing purposes smart cards supported by the OpenSC - project can be used, as well as software modules like softhsm which - provides a tool to setup a software HSM, and a PKCS#11 library. - - - - - The PKCS#11 API requires applications that use fork to reinitialize the used PKCS#11 - modules. This is an uncommon requirement, which has led to several bugs across - applications in Fedora which used PKCS#11 directly. To make things more complicated - software PKCS#11 module like softhsm do not require this re-initialization - leading to applications working against software modules but failing with hardware - modules or smart cards. The wrapper PKCS#11 APIs provided by NSS, GNUTLS and - engine_pkcs11 (OpenSSL) handle the reinitialization after fork requirement transparently. - - - -
- OpenSSL HSM Support - - OpenSSL does not have native support for PKCS#11. It can - provide PKCS#11 support through the OpenSC's project - pkcs11 engine (formerly known as engine_pkcs11). - As such software intended to use HSMs, must utilize that engine. - - - Engine pkcs11 supports loading stored objects via PKCS#11 URLs. - If no PKCS#11 module is specified the engine will use the system-wide registered - modules via p11-kit-proxy.so. - - - The following example demonstrates the initialization of the pkcs11 engine - and its usage to sign data. - - - Signing data with HSM and OpenSSL - - - -
-
- GNUTLS HSM Support - - GNUTLS supports PKCS#11 natively. Most of the API functions - accepting certificate files, can also accept PKCS#11 URLs, thus - requiring minor or no modifications to applications in order - to support HSMs. In most cases applications must be modified - to install a PIN callback function. - - - The following example demonstrates the initialization of the pkcs11 engine - and its usage to sign data. - - - Signing data with HSM and GnuTLS - - - - The PIN callback function can be either set globally as in - the example above or locally by utilizing functions such as gnutls_privkey_set_pin_function. - An example PIN callback function is shown below. - - - An example PIN callback with GNUTLS - - -
-
- NSS HSM Support - - NSS supports PKCS#11 natively. In fact all NSS crypto operations, - including built-in operations, go through PKCS #11 modules. NSS provides - its own software PKCS #11 module called softoken. NSS automatically - loads any PKCS #11 module specified in its module database, which can - be manipulated with the modutil command. NSS uses the PKCS #11 module - that contains the requested keys to do the crypto operations. As long as - the application opens an NSS database and properly sets a pin callback. If - it runs with native NSS, it should be able to use HSMs that provide PKCS #11 - modules. Modules can also be loaded programatically, though this is less common. - - - - The following example demonstrates a typical NSS application for signing. - - - Signing data with HSM and NSS - - - - To use the example above with an HSM or smart card you will need to do the following. - - - -# add your HSM or token library to an NSS database (in the sample code the database is -# located in the current directory'.') -$ modutil -add "My HSM" -libfile ${path_to_pkcs11_file} -dbdir . -# Find the token name on your HSM -$ modutil -list -dbdir . -# find the cert on your token -$ certutil -L -h ${token_name} -d . -# pass the cert to your signing program -$ NSS_Sign_Example "${token_name}:${cert_name}" - - - - An example PIN callback with NSS - - -
-
diff --git a/en-US/Features-TLS.xml b/en-US/Features-TLS.xml deleted file mode 100644 index eefead6..0000000 --- a/en-US/Features-TLS.xml +++ /dev/null @@ -1,941 +0,0 @@ - - - - Transport Layer Security (TLS) - - Transport Layer Security (TLS, formerly Secure Sockets - Layer/SSL) is the recommended way to to protect integrity and - confidentiality while data is transferred over an untrusted - network connection, and to identify the endpoint. At this - chapter we describe the available libraries in Fedora as well - as known pitfalls, and safe ways to write applications with them. - - - When using any library, in addition to this guide, it is recommended to consult the - library' documentation. - - - NSS documentation - GNUTLS documentation - OpenSSL documentation - OpenJDK documentation - -
- Common Pitfalls - - TLS implementations are difficult to use, and most of them lack - a clean API design. The following sections contain - implementation-specific advice, and some generic pitfalls are - mentioned below. - - - - - Most TLS implementations have questionable default TLS - cipher suites. Most of them enable anonymous Diffie-Hellman - key exchange (but we generally want servers to authenticate - themselves). Many do not disable ciphers which are subject - to brute-force attacks because of restricted key lengths. - Some even disable all variants of AES in the default - configuration. - - - When overriding the cipher suite defaults, it is recommended - to disable all cipher suites which are not present on a - whitelist, instead of simply enabling a list of cipher - suites. This way, if an algorithm is disabled by default in - the TLS implementation in a future security update, the - application will not re-enable it. - - - - - The name which is used in certificate validation must match - the name provided by the user or configuration file. No host - name canonicalization or IP address lookup must be performed. - - - - - The TLS handshake has very poor performance if the TCP Nagle - algorithm is active. You should switch on the - TCP_NODELAY socket option (at least for the - duration of the handshake), or use the Linux-specific - TCP_CORK option. - - - Deactivating the TCP Nagle algorithm - - - - - - Implementing proper session resumption decreases handshake - overhead considerably. This is important if the upper-layer - protocol uses short-lived connections (like most application - of HTTPS). - - - - - Both client and server should work towards an orderly - connection shutdown, that is send - close_notify alerts and respond to them. - This is especially important if the upper-layer protocol - does not provide means to detect connection truncation (like - some uses of HTTP). - - - - - When implementing a server using event-driven programming, - it is important to handle the TLS handshake properly because - it includes multiple network round-trips which can block - when an ordinary TCP accept would not. - Otherwise, a client which fails to complete the TLS - handshake for some reason will prevent the server from - handling input from other clients. - - - - - Unlike regular file descriptors, TLS connections cannot be - passed between processes. Some TLS implementations add - additional restrictions, and TLS connections generally - cannot be used across fork function - calls (see ). - - - -
- OpenSSL Pitfalls - - Some OpenSSL function use tri-state return - values. Correct error checking is extremely - important. Several functions return int - values with the following meaning: - - - - - The value 1 indicates success (for - example, a successful signature verification). - - - - - The value 0 indicates semantic - failure (for example, a signature verification which was - unsuccessful because the signing certificate was - self-signed). - - - - - The value -1 indicates a low-level - error in the system, such as failure to allocate memory - using malloc. - - - - - Treating such tri-state return values as booleans can lead - to security vulnerabilities. Note that some OpenSSL - functions return boolean results or yet another set of - status indicators. Each function needs to be checked - individually. - - - Recovering precise error information is difficult. - - shows how to obtain a more precise error code after a function - call on an SSL object has failed. However, - there are still cases where no detailed error information is - available (e.g., if SSL_shutdown fails - due to a connection teardown by the other end). - - - Obtaining OpenSSL error codes - - - - The OPENSSL_config function is - documented to never fail. In reality, it can terminate the - entire process if there is a failure accessing the - configuration file. An error message is written to standard - error, but which might not be visible if the function is - called from a daemon process. - - - OpenSSL contains two separate ASN.1 DER decoders. One set - of decoders operate on BIO handles (the input/output stream - abstraction provided by OpenSSL); their decoder function - names start with d2i_ and end in - _fp or _bio (e.g., - d2i_X509_fp or - d2i_X509_bio). These decoders must not - be used for parsing data from untrusted sources; instead, - the variants without the _fp and - _bio (e.g., - d2i_X509) shall be used. The BIO - variants have received considerably less testing and are not - very robust. - - - For the same reason, the OpenSSL command line tools (such as - openssl x509) are generally generally less - robust than the actual library code. They use the BIO - functions internally, and not the more robust variants. - - - The command line tools do not always indicate failure in the - exit status of the openssl process. - For instance, a verification failure in openssl - verify result in an exit status of zero. - - - OpenSSL command-line commands, such as openssl - genrsa, do not ensure that physical entropy is used - for key generation—they obtain entropy from - /dev/urandom and other sources, but not - from /dev/random. This can result in - weak keys if the system lacks a proper entropy source (e.g., a - virtual machine with solid state storage). Depending on local - policies, keys generated by these OpenSSL tools should not be - used in high-value, critical functions. - - - The OpenSSL server and client applications (openssl - s_client and openssl s_server) - are debugging tools and should never be - used as generic clients. For instance, the - s_client tool reacts in a - surprising way to lines starting with R and - Q. - - - OpenSSL allows application code to access private key - material over documented interfaces. This can significantly - increase the part of the code base which has to undergo - security certification. - -
-
- GNUTLS Pitfalls - - Older versions of GNUTLS had several peculiarities described - in previous versions of this guide; as of GNUTLS 3.3.10, these - issues are no longer applicable. - -
-
- OpenJDK Pitfalls - - The Java cryptographic framework is highly modular. As a - result, when you request an object implementing some - cryptographic functionality, you cannot be completely sure - that you end up with the well-tested, reviewed implementation - in OpenJDK. - - - OpenJDK (in the source code as published by Oracle) and other - implementations of the Java platform require that the system - administrator has installed so-called unlimited - strength jurisdiction policy files. Without this - step, it is not possible to use the secure algorithms which - offer sufficient cryptographic strength. Most downstream - redistributors of OpenJDK remove this requirement. - - - Some versions of OpenJDK use /dev/random - as the randomness source for nonces and other random data - which is needed for TLS operation, but does not actually - require physical randomness. As a result, TLS applications - can block, waiting for more bits to become available in - /dev/random. - -
-
- NSS Pitfalls - - NSS was not designed to be used by other libraries which can - be linked into applications without modifying them. There is - a lot of global state. There does not seem to be a way to - perform required NSS initialization without race conditions. - - - If the NSPR descriptor is in an unexpected state, the - SSL_ForceHandshake function can succeed, - but no TLS handshake takes place, the peer is not - authenticated, and subsequent data is exchanged in the clear. - - - NSS disables itself if it detects that the process underwent a - fork after the library has been - initialized. This behavior is required by the PKCS#11 API - specification. - -
-
-
- TLS Clients - - Secure use of TLS in a client generally involves all of the - following steps. (Individual instructions for specific TLS - implementations follow in the next sections.) - - - - - The client must configure the TLS library to use a set of - trusted root certificates. These certificates are provided - by the system in various formats and files. These are documented in update-ca-trust - man page in Fedora. Portable applications should not hard-code - any paths; they should rely on APIs which set the default - for the system trust store. - - - - - The client selects sufficiently strong cryptographic - primitives and disables insecure ones (such as no-op - encryption). Compression support and SSL version 3 or lower must be - disabled (including the SSLv2-compatible handshake). - - - - - The client initiates the TLS connection. The Server Name - Indication extension should be used if supported by the - TLS implementation. Before switching to the encrypted - connection state, the contents of all input and output - buffers must be discarded. - - - - - The client needs to validate the peer certificate provided - by the server, that is, the client must check that there - is a cryptographically protected chain from a trusted root - certificate to the peer certificate. (Depending on the - TLS implementation, a TLS handshake can succeed even if - the certificate cannot be validated.) - - - - - The client must check that the configured or user-provided - server name matches the peer certificate provided by the - server. - - - - - It is safe to provide users detailed diagnostics on - certificate validation failures. Other causes of handshake - failures and, generally speaking, any details on other errors - reported by the TLS implementation (particularly exception - tracebacks), must not be divulged in ways that make them - accessible to potential attackers. Otherwise, it is possible - to create decryption oracles. - - - - Depending on the application, revocation checking (against - certificate revocations lists or via OCSP) and session - resumption are important aspects of production-quality - client. These aspects are not yet covered. - - -
- Implementation TLS Clients With OpenSSL - - In the following code, the error handling is only exploratory. - Proper error handling is required for production use, - especially in libraries. - - - - The OpenSSL library needs explicit initialization (see ). - - - OpenSSL library initialization - - - - After that, a context object has to be created, which acts as - a factory for connection objects (). We - use an explicit cipher list so that we do not pick up any - strange ciphers when OpenSSL is upgraded. The actual version - requested in the client hello depends on additional - restrictions in the OpenSSL library. If possible, you should - follow the example code and use the default list of trusted - root certificate authorities provided by the system because - you would have to maintain your own set otherwise, which can - be cumbersome. - - - OpenSSL client context creation - - - - A single context object can be used to create multiple - connection objects. It is safe to use the same - SSL_CTX object for creating connections - concurrently from multiple threads, provided that the - SSL_CTX object is not modified (e.g., - callbacks must not be changed). - - - After creating the TCP socket and disabling the Nagle - algorithm (per ), the actual - connection object needs to be created, as show in . If - the handshake started by SSL_connect - fails, the ssl_print_error_and_exit - function from is called. - - - The certificate_validity_override - function provides an opportunity to override the validity of - the certificate in case the OpenSSL check fails. If such - functionality is not required, the call can be removed, - otherwise, the application developer has to implement it. - - - The host name passed to the functions - SSL_set_tlsext_host_name and - X509_check_host must be the name that was - passed to getaddrinfo or a similar name - resolution function. No host name canonicalization must be - performed. The X509_check_host function - used in the final step for host name matching is currently - only implemented in OpenSSL 1.1, which is not released yet. - In case host name matching fails, the function - certificate_host_name_override is called. - This function should check user-specific certificate store, to - allow a connection even if the host name does not match the - certificate. This function has to be provided by the - application developer. Note that the override must be keyed - by both the certificate and the host - name. - - - Creating a client connection using OpenSSL - - - - The connection object can be used for sending and receiving - data, as in . - It is also possible to create a BIO object - and use the SSL object as the underlying - transport, using BIO_set_ssl. - - - Using an OpenSSL connection to send and receive data - - - - When it is time to close the connection, the - SSL_shutdown function needs to be called - twice for an orderly, synchronous connection termination - (). - This exchanges close_notify alerts with the - server. The additional logic is required to deal with an - unexpected close_notify from the server. - Note that is necessary to explicitly close the underlying - socket after the connection object has been freed. - - - Closing an OpenSSL connection in an orderly fashion - - - - shows how - to deallocate the context object when it is no longer needed - because no further TLS connections will be established. - - - Closing an OpenSSL connection in an orderly fashion - - -
-
- Implementation TLS Clients With GNUTLS - - This section describes how to implement a TLS client with full - certificate validation (but without certificate revocation - checking). Note that the error handling in is only - exploratory and needs to be replaced before production use. - - - Before setting up TLS connections, a credentials objects has - to be allocated and initialized with the set of trusted root - CAs (). - - - Initializing a GNUTLS credentials structure - - - - After the last TLS connection has been closed, this credentials - object should be freed: - - - - - - During its lifetime, the credentials object can be used to - initialize TLS session objects from multiple threads, provided - that it is not changed. - - - Once the TCP connection has been established, the Nagle - algorithm should be disabled (see ). After that, the - socket can be associated with a new GNUTLS session object. - The previously allocated credentials object provides the set - of root CAs. Then the TLS handshake must be initiated. - This is shown in . - - - Establishing a TLS client connection using GNUTLS - - - - After the handshake has been completed, the server certificate - needs to be verified against the server's hostname (). In - the example, the user-defined - certificate_validity_override function is - called if the verification fails, so that a separate, - user-specific trust store can be checked. This function call - can be omitted if the functionality is not needed. - - - Verifying a server certificate using GNUTLS - - - - An established TLS session can be used for sending and - receiving data, as in . - - - Using a GNUTLS session - - - - In order to shut down a connection in an orderly manner, you - should call the gnutls_bye function. - Finally, the session object can be deallocated using - gnutls_deinit (see ). - - - Closing a GNUTLS session in an orderly fashion - - -
-
- Implementing TLS Clients With OpenJDK - - The examples below use the following cryptographic-related - classes: - - - - - - If compatibility with OpenJDK 6 is required, it is necessary - to use the internal class - sun.security.util.HostnameChecker. (The - public OpenJDK API does not provide any support for dissecting - the subject distinguished name of an X.509 certificate, so a - custom-written DER parser is needed—or we have to use an - internal class, which we do below.) In OpenJDK 7, the - setEndpointIdentificationAlgorithm method - was added to the - javax.net.ssl.SSLParameters class, - providing an official way to implement host name checking. - - - TLS connections are established using an - SSLContext instance. With a properly - configured OpenJDK installation, the - SunJSSE provider uses the system-wide set - of trusted root certificate authorities, so no further - configuration is necessary. For backwards compatibility with - OpenJDK 6, the TLSv1 provider has to - be supported as a fall-back option. This is shown in . - - - Setting up an <literal>SSLContext</literal> for OpenJDK TLS - clients - - - - In addition to the context, a TLS parameter object will be - needed which adjusts the cipher suites and protocols (). Like - the context, these parameters can be reused for multiple TLS - connections. - - - Setting up <literal>SSLParameters</literal> for TLS use - with OpenJDK - - - - As initialized above, the parameter object does not yet - require host name checking. This has to be enabled - separately, and this is only supported by OpenJDK 7 and later: - - - - - - All application protocols can use the - "HTTPS" algorithm. (The algorithms have - minor differences with regard to wildcard handling, which - should not matter in practice.) - - - - shows how to establish the connection. Before the handshake - is initialized, the protocol and cipher configuration has to - be performed, by applying the parameter object - params. (After this point, changes to - params will not affect this TLS socket.) - As mentioned initially, host name checking requires using an - internal API on OpenJDK 6. - - - Establishing a TLS connection with OpenJDK - - - - Starting with OpenJDK 7, the last lines can be omitted, - provided that host name verification has been enabled by - calling the - setEndpointIdentificationAlgorithm method - on the params object (before it was applied - to the socket). - - - The TLS socket can be used as a regular socket, as shown in - . - - - Using a TLS client socket in OpenJDK - - -
- Overriding server certificate validation with OpenJDK 6 - - Overriding certificate validation requires a custom trust - manager. With OpenJDK 6, the trust manager lacks - information about the TLS session, and to which server the - connection is made. Certificate overrides have to be tied - to specific servers (host names). Consequently, different - TrustManager and - SSLContext objects have to be used for - different servers. - - - In the trust manager shown in , - the server certificate is identified by its SHA-256 hash. - - - A customer trust manager for OpenJDK TLS clients - - - - This trust manager has to be passed to the - init method of the - SSLContext object, as show in . - - - Using a custom TLS trust manager with OpenJDK - - - - When certificate overrides are in place, host name - verification should not be performed because there is no - security requirement that the host name in the certificate - matches the host name used to establish the connection (and - it often will not). However, without host name - verification, it is not possible to perform transparent - fallback to certification validation using the system - certificate store. - - - The approach described above works with OpenJDK 6 and later - versions. Starting with OpenJDK 7, it is possible to use a - custom subclass of the - javax.net.ssl.X509ExtendedTrustManager - class. The OpenJDK TLS implementation will call the new - methods, passing along TLS session information. This can be - used to implement certificate overrides as a fallback (if - certificate or host name verification fails), and a trust - manager object can be used for multiple servers because the - server address is available to the trust manager. - -
-
-
- Implementing TLS Clients With NSS - - The following code shows how to implement a simple TLS client - using NSS. These instructions apply to NSS version 3.14 and - later. Versions before 3.14 need different initialization - code. - - - Keep in mind that the error handling needs to be improved - before the code can be used in production. - - - Using NSS needs several header files, as shown in - . - - - Include files for NSS - - - - Initializing the NSS library is shown in . This - initialization procedure overrides global state. We only call - NSS_SetDomesticPolicy if there are no - strong ciphers available, assuming that it has already been - called otherwise. This avoids overriding the process-wide - cipher suite policy unnecessarily. - - - The simplest way to configured the trusted root certificates - involves loading the libnssckbi.so NSS - module with a call to the - SECMOD_LoadUserModule function. The root - certificates are compiled into this module. (The PEM module - for NSS, libnsspem.so, offers a way to - load trusted CA certificates from a file.) - - - Initializing the NSS library - - - - Some of the effects of the initialization can be reverted with - the following function calls: - - - - - - After NSS has been initialized, the TLS connection can be - created (). The - internal PR_ImportTCPSocket function is - used to turn the POSIX file descriptor - sockfd into an NSPR file descriptor. (This - function is de-facto part of the NSS public ABI, so it will - not go away.) Creating the TLS-capable file descriptor - requires a model descriptor, which is - configured with the desired set of protocols. The model - descriptor is not needed anymore after TLS support has been - activated for the existing connection descriptor. - - - The call to SSL_BadCertHook can be - omitted if no mechanism to override certificate verification - is needed. The bad_certificate function - must check both the host name specified for the connection and - the certificate before granting the override. - - - Triggering the actual handshake requires three function calls, - SSL_ResetHandshake, - SSL_SetURL, and - SSL_ForceHandshake. (If - SSL_ResetHandshake is omitted, - SSL_ForceHandshake will succeed, but the - data will not be encrypted.) During the handshake, the - certificate is verified and matched against the host name. - - - Creating a TLS connection with NSS - - - - After the connection has been established, shows how to use - the NSPR descriptor to communicate with the server. - - - Using NSS for sending and receiving data - - - - - shows how to close the connection. - - - Closing NSS client connections - - -
-
- Implementing TLS Clients With Python - - The Python distribution provides a TLS implementation in the - ssl module (actually a wrapper around - OpenSSL). The exported interface is somewhat restricted, so - that the client code shown below does not fully implement the - recommendations in . - - - - Currently, most Python function which accept - https:// URLs or otherwise implement - HTTPS support do not perform certificate validation at all. - (For example, this is true for the httplib - and xmlrpclib modules.) If you use - HTTPS, you should not use the built-in HTTP clients. The - Curl class in the curl - module, as provided by the python-pycurl - package implements proper certificate validation. - - - - The ssl module currently does not perform - host name checking on the server certificate. - shows how to implement certificate matching, using the parsed - certificate returned by getpeercert. - - - Implementing TLS host name checking Python (without - wildcard support) - - - - To turn a regular, connected TCP socket into a TLS-enabled - socket, use the ssl.wrap_socket function. - The function call in - provides additional arguments to override questionable - defaults in OpenSSL and in the Python module. - - - - - ciphers="HIGH:-aNULL:-eNULL:-PSK:RC4-SHA:RC4-MD5" - selects relatively strong cipher suites with - certificate-based authentication. (The call to - check_host_name function provides - additional protection against anonymous cipher suites.) - - - - - ssl_version=ssl.PROTOCOL_TLSv1 disables - SSL 2.0 support. By default, the ssl - module sends an SSL 2.0 client hello, which is rejected by - some servers. Ideally, we would request OpenSSL to - negotiated the most recent TLS version supported by the - server and the client, but the Python module does not - allow this. - - - - - cert_reqs=ssl.CERT_REQUIRED turns on - certificate validation. - - - - - ca_certs='/etc/ssl/certs/ca-bundle.crt' - initializes the certificate store with a set of trusted - root CAs. Unfortunately, it is necessary to hard-code - this path into applications because the default path in - OpenSSL is not available through the Python - ssl module. - - - - - The ssl module (and OpenSSL) perform - certificate validation, but the certificate must be compared - manually against the host name, by calling the - check_host_name defined above. - - - Establishing a TLS client connection with Python - - - - After the connection has been established, the TLS socket can - be used like a regular socket: - - - - - - Closing the TLS socket is straightforward as well: - - - - -
-
-
diff --git a/en-US/Go.xml b/en-US/Go.xml deleted file mode 100644 index 565e727..0000000 --- a/en-US/Go.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - -The Go Programming Language - - This chapter contains language-specific recommendations for Go. - -
- Memory Safety - - Go provides memory safety, but only if the program is not executed - in parallel (that is, GOMAXPROCS is not larger than - 1). The reason is that interface values and - slices consist of multiple words are not updated atomically. - Another thread of execution can observe an inconsistent pairing - between type information and stored value (for interfaces) or - pointer and length (for slices), and such inconsistency can lead - to a memory safety violation. - - - Code which does not run in parallel and does not use the - unsafe package (or other packages which expose - unsafe constructs) is memory-safe. For example, invalid casts and - out-of-range subscripting cause panics at run time. - - - Keep in mind that finalization can introduce parallelism because - finalizers are executed concurrently, potentially interleaved with - the rest of the program. - -
-
- Error Handling - - Only a few common operations (such as pointer dereference, integer - division, array subscripting) trigger exceptions in Go, called - panics. Most interfaces in the standard - library use a separate return value of type - error to signal error. - - - Not checking error return values can lead to incorrect operation - and data loss (especially in the case of writes, using interfaces - such as io.Writer). - - - The correct way to check error return values depends on the - function or method being called. In the majority of cases, the - first step after calling a function should be an error check - against the nil value, handling any encountered - error. See for - details. - - - Regular error handling in Go - - - - However, with io.Reader, - io.ReaderAt and related interfaces, it is - necessary to check for a non-zero number of read bytes first, as - shown in . If this - pattern is not followed, data loss may occur. This is due to the - fact that the io.Reader interface permits - returning both data and an error at the same time. - - - Read error handling in Go - - -
-
- Garbage Collector - - Older Go releases (before Go 1.3) use a conservative garbage - collector without blacklisting. This means that data blobs can - cause retention of unrelated data structures because the data is - conservatively interpreted as pointers. This phenomenon can be - triggered accidentally on 32-bit architectures and is more likely - to occur if the heap grows larger. On 64-bit architectures, it - may be possible to trigger it deliberately—it is unlikely to occur - spontaneously. - -
-
- Marshaling and Unmarshaling - - Several packages in the encoding hierarchy - provide support for serialization and deserialization. The usual - caveats apply (see - ). - - - As an additional precaution, the Unmarshal - and Decode functions should only be used with - fresh values in the interface{} argument. This - is due to the way defaults for missing values are implemented: - During deserialization, missing value do not result in an error, - but the original value is preserved. Using a fresh value (with - suitable default values if necessary) ensures that data from a - previous deserialization operation does not leak into the current - one. This is especially relevant when structs are deserialized. - -
-
diff --git a/en-US/Java-Language.xml b/en-US/Java-Language.xml deleted file mode 100644 index c6eda5b..0000000 --- a/en-US/Java-Language.xml +++ /dev/null @@ -1,291 +0,0 @@ - - -
- The Core Language - - Implementations of the Java programming language provide strong - memory safety, even in the presence of data races in concurrent - code. This prevents a large range of security vulnerabilities - from occurring, unless certain low-level features are used; see - . - - -
- Increasing Robustness when Reading Arrays - - External data formats often include arrays, and the data is - stored as an integer indicating the number of array elements, - followed by this number of elements in the file or protocol data - unit. This length specified can be much larger than what is - actually available in the data source. - - - To avoid allocating extremely large amounts of data, you can - allocate a small array initially and grow it as you read more - data, implementing an exponential growth policy. See the - readBytes(InputStream, int) function in - . - - - Incrementally reading a byte array - - - - When reading data into arrays, hash maps or hash sets, use the - default constructor and do not specify a size hint. You can - simply add the elements to the collection as you read them. - -
- -
- Resource Management - - Unlike C++, Java does not offer destructors which can deallocate - resources in a predictable fashion. All resource management has - to be manual, at the usage site. (Finalizers are generally not - usable for resource management, especially in high-performance - code; see .) - - - The first option is the - try-finally construct, as - shown in . - The code in the finally block should be as short as - possible and should not throw any exceptions. - - - Resource management with a - <literal>try</literal>-<literal>finally</literal> block - - - - Note that the resource allocation happens - outside the try block, - and that there is no null check in the - finally block. (Both are common artifacts - stemming from IDE code templates.) - - - If the resource object is created freshly and implements the - java.lang.AutoCloseable interface, the code - in can be - used instead. The Java compiler will automatically insert the - close() method call in a synthetic - finally block. - - - Resource management using the - <literal>try</literal>-with-resource construct - - - - To be compatible with the try-with-resource - construct, new classes should name the resource deallocation - method close(), and implement the - AutoCloseable interface (the latter breaking - backwards compatibility with Java 6). However, using the - try-with-resource construct with objects that - are not freshly allocated is at best awkward, and an explicit - finally block is usually the better approach. - - - In general, it is best to design the programming interface in - such a way that resource deallocation methods like - close() cannot throw any (checked or - unchecked) exceptions, but this should not be a reason to ignore - any actual error conditions. - -
- -
- Finalizers - - Finalizers can be used a last-resort approach to free resources - which would otherwise leak. Finalization is unpredictable, - costly, and there can be a considerable delay between the last - reference to an object going away and the execution of the - finalizer. Generally, manual resource management is required; - see . - - - Finalizers should be very short and should only deallocate - native or other external resources held directly by the object - being finalized. In general, they must use synchronization: - Finalization necessarily happens on a separate thread because it is - inherently concurrent. There can be multiple finalization - threads, and despite each object being finalized at most once, - the finalizer must not assume that it has exclusive access to - the object being finalized (in the this - pointer). - - - Finalizers should not deallocate resources held by other - objects, especially if those objects have finalizers on their - own. In particular, it is a very bad idea to define a finalizer - just to invoke the resource deallocation method of another object, - or overwrite some pointer fields. - - - Finalizers are not guaranteed to run at all. For instance, the - virtual machine (or the machine underneath) might crash, - preventing their execution. - - - Objects with finalizers are garbage-collected much later than - objects without them, so using finalizers to zero out key - material (to reduce its undecrypted lifetime in memory) may have - the opposite effect, keeping objects around for much longer and - prevent them from being overwritten in the normal course of - program execution. - - - For the same reason, code which allocates objects with - finalizers at a high rate will eventually fail (likely with a - java.lang.OutOfMemoryError exception) because - the virtual machine has finite resources for keeping track of - objects pending finalization. To deal with that, it may be - necessary to recycle objects with finalizers. - - - The remarks in this section apply to finalizers which are - implemented by overriding the finalize() - method, and to custom finalization using reference queues. - -
- -
- Recovering from Exceptions and Errors - - Java exceptions come in three kinds, all ultimately deriving - from java.lang.Throwable: - - - - - Run-time exceptions do not have to be - declared explicitly and can be explicitly thrown from any - code, by calling code which throws them, or by triggering an - error condition at run time, like division by zero, or an - attempt at an out-of-bounds array access. These exceptions - derive from from the - java.lang.RuntimeException class (perhaps - indirectly). - - - - - Checked exceptions have to be declared - explicitly by functions that throw or propagate them. They - are similar to run-time exceptions in other regards, except - that there is no language construct to throw them (except - the throw statement itself). Checked - exceptions are only present at the Java language level and - are only enforced at compile time. At run time, the virtual - machine does not know about them and permits throwing - exceptions from any code. Checked exceptions must derive - (perhaps indirectly) from the - java.lang.Exception class, but not from - java.lang.RuntimeException. - - - - - Errors are exceptions which typically - reflect serious error conditions. They can be thrown at any - point in the program, and do not have to be declared (unlike - checked exceptions). In general, it is not possible to - recover from such errors; more on that below, in . - Error classes derive (perhaps indirectly) from - java.lang.Error, or from - java.lang.Throwable, but not from - java.lang.Exception. - - - - - - The general expection is that run-time errors are avoided by - careful programming (e.g., not dividing by zero). Checked - exception are expected to be caught as they happen (e.g., when - an input file is unexpectedly missing). Errors are impossible - to predict and can happen at any point and reflect that - something went wrong beyond all expectations. - - -
- The Difficulty of Catching Errors - - Errors (that is, exceptions which do not (indirectly) derive - from java.lang.Exception), have the - peculiar property that catching them is problematic. There - are several reasons for this: - - - - - The error reflects a failed consistenty check, for example, - java.lang.AssertionError. - - - - - The error can happen at any point, resulting in - inconsistencies due to half-updated objects. Examples are - java.lang.ThreadDeath, - java.lang.OutOfMemoryError and - java.lang.StackOverflowError. - - - - - The error indicates that virtual machine failed to provide - some semantic guarantees by the Java programming language. - java.lang.ExceptionInInitializerError - is an example—it can leave behind a half-initialized - class. - - - - - In general, if an error is thrown, the virtual machine should - be restarted as soon as possible because it is in an - inconsistent state. Continuing running as before can have - unexpected consequences. However, there are legitimate - reasons for catching errors because not doing so leads to even - greater problems. - - - Code should be written in a way that avoids triggering errors. - See - for an example. - - - It is usually necessary to log errors. Otherwise, no trace of - the problem might be left anywhere, making it very difficult - to diagnose realted failures. Consequently, if you catch - java.lang.Exception to log and suppress all - unexpected exceptions (for example, in a request dispatching - loop), you should consider switching to - java.lang.Throwable instead, to also cover - errors. - - - The other reason mainly applies to such request dispatching - loops: If you do not catch errors, the loop stops looping, - resulting in a denial of service. - - - However, if possible, catching errors should be coupled with a - way to signal the requirement of a virtual machine restart. - -
-
-
- diff --git a/en-US/Java-LowLevel.xml b/en-US/Java-LowLevel.xml deleted file mode 100644 index 18d507f..0000000 --- a/en-US/Java-LowLevel.xml +++ /dev/null @@ -1,157 +0,0 @@ - - -
- Low-level Features of the Virtual Machine - -
- <literal>Reflection and Private Parts</literal> - - The setAccessible(boolean) method of the - java.lang.reflect.AccessibleObject class - allows a program to disable language-defined access rules for - specific constructors, methods, or fields. Once the access - checks are disabled, any code can use the - java.lang.reflect.Constructor, - java.lang.reflect.Method, or - java.lang.reflect.Field object to access the - underlying Java entity, without further permission checks. This - breaks encapsulation and can undermine the stability of the - virtual machine. (In contrast, without using the - setAccessible(boolean) method, this should - not happen because all the language-defined checks still apply.) - - - This feature should be avoided if possible. - -
- -
- Java Native Interface (JNI) - - The Java Native Interface allows calling from Java code - functions specifically written for this purpose, usually in C or - C++. - - - The transition between the Java world and the C world is not - fully type-checked, and the C code can easily break the Java - virtual machine semantics. Therefore, extra care is needed when - using this functionality. - - - To provide a moderate amount of type safety, it is recommended - to recreate the class-specific header file using - javah during the build process, - include it in the implementation, and use the - option. - - - Ideally, the required data is directly passed to static JNI - methods and returned from them, and the code and the C side does - not have to deal with accessing Java fields (or even methods). - - - When using GetPrimitiveArrayCritical or - GetStringCritical, make sure that you only - perform very little processing between the get and release - operations. Do not access the file system or the network, and - not perform locking, because that might introduce blocking. - When processing large strings or arrays, consider splitting the - computation into multiple sub-chunks, so that you do not prevent - the JVM from reaching a safepoint for extended periods of time. - - - If necessary, you can use the Java long type - to store a C pointer in a field of a Java class. On the C side, - when casting between the jlong value and the - pointer on the C side, - - - You should not try to perform pointer arithmetic on the Java - side (that is, you should treat pointer-carrying - long values as opaque). When passing a slice - of an array to the native code, follow the Java convention and - pass it as the base array, the integer offset of the start of - the slice, and the integer length of the slice. On the native - side, check the offset/length combination against the actual - array length, and use the offset to compute the pointer to the - beginning of the array. - - - Array length checking in JNI code - - - - In any case, classes referring to native resources must be - declared final, and must not be serializeable - or cloneable. Initialization and mutation of the state used by - the native side must be controlled carefully. Otherwise, it - might be possible to create an object with inconsistent native - state which results in a crash (or worse) when used (or perhaps - only finalized) later. If you need both Java inheritance and - native resources, you should consider moving the native state to - a separate class, and only keep a reference to objects of that - class. This way, cloning and serialization issues can be - avoided in most cases. - - - If there are native resources associated with an object, the - class should have an explicit resource deallocation method - () and a - finalizer () as a - last resort. The need for finalization means that a minimum - amount of synchronization is needed. Code on the native side - should check that the object is not in a closed/freed state. - - - Many JNI functions create local references. By default, these - persist until the JNI-implemented method returns. If you create - many such references (e.g., in a loop), you may have to free - them using DeleteLocalRef, or start using - PushLocalFrame and - PopLocalFrame. Global references must be - deallocated with DeleteGlobalRef, otherwise - there will be a memory leak, just as with - malloc and free. - - - When throwing exceptions using Throw or - ThrowNew, be aware that these functions - return regularly. You have to return control manually to the - JVM. - - - Technically, the JNIEnv pointer is not - necessarily constant during the lifetime of your JNI module. - Storing it in a global variable is therefore incorrect. - Particularly if you are dealing with callbacks, you may have to - store the pointer in a thread-local variable (defined with - __thread). It is, however, best to avoid the - complexity of calling back into Java code. - - - Keep in mind that C/C++ and Java are different languages, - despite very similar syntax for expressions. The Java memory - model is much more strict than the C or C++ memory models, and - native code needs more synchronization, usually using JVM - facilities or POSIX threads mutexes. Integer overflow in Java - is defined, but in C/C++ it is not (for the - jint and jlong types). - -
- -
- <literal>sun.misc.Unsafe</literal> - - The sun.misc.Unsafe class is unportable and - contains many functions explicitly designed to break Java memory - safety (for performance and debugging). If possible, avoid - using this class. - -
- -
diff --git a/en-US/Java-SecurityManager.xml b/en-US/Java-SecurityManager.xml deleted file mode 100644 index 35fade8..0000000 --- a/en-US/Java-SecurityManager.xml +++ /dev/null @@ -1,292 +0,0 @@ - - -
- Interacting with the Security Manager - - The Java platform is largely implemented in the Java language - itself. Therefore, within the same JVM, code runs which is part - of the Java installation and which is trusted, but there might - also be code which comes from untrusted sources and is restricted - by the Java sandbox (to varying degrees). The security - manager draws a line between fully trusted, partially - trusted and untrusted code. - - - The type safety and accessibility checks provided by the Java - language and JVM would be sufficient to implement a sandbox. - However, only some Java APIs employ such a capabilities-based - approach. (The Java SE library contains many public classes with - public constructors which can break any security policy, such as - java.io.FileOutputStream.) Instead, critical - functionality is protected by stack - inspection: At a security check, the stack is walked - from top (most-nested) to bottom. The security check fails if a - stack frame for a method is encountered whose class lacks the - permission which the security check requires. - - - This simple approach would not allow untrusted code (which lacks - certain permissions) to call into trusted code while the latter - retains trust. Such trust transitions are desirable because they - enable Java as an implementation language for most parts of the - Java platform, including security-relevant code. Therefore, there - is a mechanism to mark certain stack frames as trusted (). - - - In theory, it is possible to run a Java virtual machine with a - security manager that acts very differently from this approach, - but a lot of code expects behavior very close to the platform - default (including many classes which are part of the OpenJDK - implementation). - - -
- Security Manager Compatibility - - A lot of code can run without any additional permissions at all, - with little changes. The following guidelines should help to - increase compatibility with a restrictive security manager. - - - - - When retrieving system properties using - System.getProperty(String) or similar - methods, catch SecurityException - exceptions and treat the property as unset. - - - - - Avoid unnecessary file system or network access. - - - - - Avoid explicit class loading. Access to a suitable class - loader might not be available when executing as untrusted - code. - - - - - If the functionality you are implementing absolutely requires - privileged access and this functionality has to be used from - untrusted code (hopefully in a restricted and secure manner), - see . - -
- -
- Activating the Security Manager - - The usual command to launch a Java application, - java, does not activate the security manager. - Therefore, the virtual machine does not enforce any sandboxing - restrictions, even if explicitly requested by the code (for - example, as described in ). - - - The option activates - the security manager, with the fairly restrictive default - policy. With a very permissive policy, most Java code will run - unchanged. Assuming the policy in - has been saved in a file grant-all.policy, - this policy can be activated using the option - (in - addition to the - option). - - - Most permissve OpenJDK policy file - -grant { - permission java.security.AllPermission; -}; - - - - With this most permissive policy, the security manager is still - active, and explicit requests to drop privileges will be - honored. - -
- -
- Reducing Trust in Code - - - shows how to run a piece code of with reduced privileges. - - - Using the security manager to run code with reduced - privileges - - - - The example above does not add any additional permissions to the - permissions object. If such permissions are - necessary, code like the following (which grants read permission - on all files in the current directory) can be used: - - - - - - - Calls to the - java.security.AccessController.doPrivileged() - methods do not enforce any additional restriction if no - security manager has been set. Except for a few special - exceptions, the restrictions no longer apply if the - doPrivileged() has returned, even to - objects created by the code which ran with reduced privileges. - (This applies to object finalization in particular.) - - - The example code above does not prevent the called code from - calling the - java.security.AccessController.doPrivileged() - methods. This mechanism should be considered an additional - safety net, but it still can be used to prevent unexpected - behavior of trusted code. As long as the executed code is not - dynamic and came with the original application or library, the - sandbox is fairly effective. - - - The context argument in - is extremely important—otherwise, this code would increase - privileges instead of reducing them. - - - - For activating the security manager, see . - Unfortunately, this affects the virtual machine as a whole, so - it is not possible to do this from a library. - -
- -
- Re-gaining Privileges - - Ordinarily, when trusted code is called from untrusted code, it - loses its privileges (because of the untrusted stack frames - visible to stack inspection). The - java.security.AccessController.doPrivileged() - family of methods provides a controlled backdoor from untrusted - to trusted code. - - - - By design, this feature can undermine the Java security model - and the sandbox. It has to be used very carefully. Most - sandbox vulnerabilities can be traced back to its misuse. - - - - In essence, the doPrivileged() methods - cause the stack inspection to end at their call site. Untrusted - code further down the call stack becomes invisible to security - checks. - - - The following operations are common and safe to perform with - elevated privileges. - - - - - Reading custom system properties with fixed names, - especially if the value is not propagated to untrusted code. - (File system paths including installation paths, host names - and user names are sometimes considered private information - and need to be protected.) - - - - - Reading from the file system at fixed paths, either - determined at compile time or by a system property. Again, - leaking the file contents to the caller can be problematic. - - - - - Accessing network resources under a fixed address, name or - URL, derived from a system property or configuration file, - information leaks not withstanding. - - - - - - shows how to request additional privileges. - - - Using the security manager to run code with increased - privileges - - - - Obviously, this only works if the class containing the call to - doPrivileged() is marked trusted (usually - because it is loaded from a trusted class loader). - - - When writing code that runs with elevated privileges, make sure - that you follow the rules below. - - - - - Make the privileged code as small as possible. Perform as - many computations as possible before and after the - privileged code section, even if it means that you have to - define a new class to pass the data around. - - - - - Make sure that you either control the inputs to the - privileged code, or that the inputs are harmless and cannot - affect security properties of the privileged code. - - - - - Data that is returned from or written by the privileged code - must either be restricted (that is, it cannot be accessed by - untrusted code), or must be harmless. Otherwise, privacy - leaks or information disclosures which affect security - properties can be the result. - - - - - If the code calls back into untrusted code at a later stage (or - performs other actions under control from the untrusted caller), - you must obtain the original security context and restore it - before performing the callback, as in . - (In this example, it would be much better to move the callback - invocation out of the privileged code section, of course.) - - - Restoring privileges when invoking callbacks - - -
- -
- diff --git a/en-US/Java.xml b/en-US/Java.xml deleted file mode 100644 index 3ff75c5..0000000 --- a/en-US/Java.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - The Java Programming Language - - - - - - diff --git a/en-US/Python.xml b/en-US/Python.xml deleted file mode 100644 index bb5c73b..0000000 --- a/en-US/Python.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - The Python Programming Language - - Python provides memory safety by default, so low-level security - vulnerabilities are rare and typically needs fixing the Python - interpreter or standard library itself. - - - Other sections with Python-specific advice include: - - - - - - - - - - - - - - - , in - particular - - - - - - - - -
- Dangerous Standard Library Features - - Some areas of the standard library, notably the - ctypes module, do not provide memory safety - guarantees comparable to the rest of Python. If such - functionality is used, the advice in should be followed. - -
-
- Run-time Compilation and Code Generation - - The following Python functions and statements related to code - execution should be avoided: - - - compile - eval - exec - execfile - - - If you need to parse integers or floating point values, use the - int and float - functions instead of eval. Sandboxing - untrusted Python code does not work reliably. - -
-
- Sandboxing - - The rexec Python module cannot safely sandbox - untrusted code and should not be used. The standard CPython - implementation is not suitable for sandboxing. - -
-
diff --git a/en-US/Revision_History.xml b/en-US/Revision_History.xml deleted file mode 100644 index e2dfe12..0000000 --- a/en-US/Revision_History.xml +++ /dev/null @@ -1,96 +0,0 @@ - - -%BOOK_ENTITIES; -]> - - Revision History - - - - 1.3-1 - Mon Oct 13 2014 - - Florian - Weimer - fweimer@redhat.com - - - - Go: Mention default value handling in deserialization - Shell: New chapter - - - - - 1.2-1 - Wed Jul 16 2014 - - Florian - Weimer - fweimer@redhat.com - - - - C: Corrected the strncat example - C: Mention mixed signed/unsigned comparisons - C: Unsigned overflow checking example - C++: operator new[] has been fixed in GCC - C++: Additional material on std::string, iterators - OpenSSL: Mention openssl genrsa entropy issue - Packaging: X.509 key generation - Go, Vala: Add short chapters - Serialization: Notes on fragmentation and reassembly - - - - - 1.1-1 - Tue Aug 27 2013 - - Eric - Christensen - sparks@redhat.com - - - - Add a chapter which covers some Java topics. - Deserialization: Warn about Java's java.beans.XMLDecoder. - C: Correct the advice on array allocation - (bug 995595). - C: Add material on global variables. - - - - - 1.0-1 - Thu May 09 2013 - - Eric - Christensen - sparks@redhat.com - - - - Added more C and C++ examples. - TLS Client NSS: Rely on NSS 3.14 cipher suite defaults. - - - - - 0-1 - Thu Mar 7 2013 - - Eric - Christensen - sparks@redhat.com - - - - Initial publication. - - - - - - diff --git a/en-US/Shell.xml b/en-US/Shell.xml deleted file mode 100644 index b0fef4d..0000000 --- a/en-US/Shell.xml +++ /dev/null @@ -1,454 +0,0 @@ - - - -Shell Programming and <application>bash</application> - - This chapter contains advice about shell programming, specifically - in bash. Most of the advice will apply - to scripts written for other shells because extensions such as - integer or array variables have been implemented there as well, with - comparable syntax. - -
- Consider Alternatives - - Once a shell script is so complex that advice in this chapter - applies, it is time to step back and consider the question: Is - there a more suitable implementation language available? - - - For example, Python with its subprocess module - can be used to write scripts which are almost as concise as shell - scripts when it comes to invoking external programs, and Python - offers richer data structures, with less arcane syntax and more - consistent behavior. - -
-
-Shell Language Features - - The following sections cover subtleties concerning the shell - programming languages. They have been written with the - bash shell in mind, but some of these - features apply to other shells as well. - - - Some of the features described may seem like implementation defects, - but these features have been replicated across multiple independent - implementations, so they now have to be considered part of the shell - programming language. - -
- Parameter Expansion - - The mechanism by which named shell variables and parameters are - expanded is called parameter expansion. The - most basic syntax is - “$variable” or - “${variable}”. - - - In almost all cases, a parameter expansion should be enclosed in - double quotation marks "". - - - -external-program "$arg1" "$arg2" - - - - If the double quotation marks are omitted, the value of the - variable will be split according to the current value of the - IFS variable. This may allow the injection of - additional options which are then processed by - external-program. - - - Parameter expansion can use special syntax for specific features, - such as substituting defaults or performing string or array - operations. These constructs should not be used because they can - trigger arithmetic evaluation, which can result in code execution. - See . - -
-
- Double Expansion - - Double expansion occurs when, during the - expansion of a shell variable, not just the variable is expanded, - replacing it by its value, but the value of - the variable is itself is expanded as well. This can trigger - arbitrary code execution, unless the value of the variable is - verified against a restrictive pattern. - - - The evaluation process is in fact recursive, so a self-referential - expression can cause an out-of-memory condition and a shell crash. - - - Double expansion may seem like as a defect, but it is implemented - by many shells, and has to be considered an integral part of the - shell programming language. However, it does make writing robust - shell scripts difficult. - - - Double expansion can be requested explicitly with the - eval built-in command, or by invoking a - subshell with “bash -c”. These constructs - should not be used. - - - The following sections give examples of places where implicit - double expansion occurs. - -
- Arithmetic Evaluation - - Arithmetic evaluation is a process by which - the shell computes the integer value of an expression specified - as a string. It is highly problematic for two reasons: It - triggers double expansion (see ), and the - language of arithmetic expressions is not self-contained. Some - constructs in arithmetic expressions (notably array subscripts) - provide a trapdoor from the restricted language of arithmetic - expressions to the full shell language, thus paving the way - towards arbitrary code execution. Due to double expansion, - input which is (indirectly) referenced from an arithmetic - expression can trigger execution of arbitrary code, which is - potentially harmful. - - - Arithmetic evaluation is triggered by the follow constructs: - - - - - - The expression in - “$((expression))” - is evaluated. This construct is called arithmetic - expansion. - - - - - “$[expression]” - is a deprecated syntax with the same effect. - - - - - The arguments to the let shell built-in - are evaluated. - - - - - “((expression))” - is an alternative syntax for “let - expression”. - - - - - Conditional expressions surrounded by - “[[]]” can trigger - arithmetic evaluation if certain operators such as - -eq are used. (The - test built-in does not perform arithmetic - evaluation, even with integer operators such as - -eq.) - - - The conditional expression - “[[ $variable =~ regexp ]]” - can be used for input validation, assuming that - regexp is a constant regular - expression. - See . - - - - - Certain parameter expansions, for example - “${variable[expression]}” - (array indexing) or - “${variable:expression}” - (string slicing), trigger arithmetic evaluation of - expression. - - - - - Assignment to array elements using - “array_variable[subscript]=expression” - triggers evaluation of subscript, but - not expression. - - - - - The expressions in the arithmetic for - command, - “for ((expression1; expression2; expression3)); do commands; done” - are evaluated. This does not apply to the regular - for command, - “for variable in list; do commands; done”. - - - - - - Depending on the bash version, the - above list may be incomplete. - - - If faced with a situation where using such shell features - appears necessary, see . - - - - If it is impossible to avoid shell arithmetic on untrusted - inputs, refer to . - -
-
- Type declarations - - bash supports explicit type - declarations for shell variables: - - - - declare -i integer_variable - declare -a array_variable - declare -A assoc_array_variable - - typeset -i integer_variable - typeset -a array_variable - typeset -A assoc_array_variable - - local -i integer_variable - local -a array_variable - local -A assoc_array_variable - - readonly -i integer_variable - readonly -a array_variable - readonly -A assoc_array_variable - - - - Variables can also be declared as arrays by assigning them an - array expression, as in: - - - -array_variable=(1 2 3 4) - - - - Some built-ins (such as mapfile) can - implicitly create array variables. - - - Such type declarations should not be used because assignment to - such variables (independent of the concrete syntax used for the - assignment) triggers arithmetic expansion (and thus double - expansion) of the right-hand side of the assignment operation. - See . - - - Shell scripts which use integer or array variables should be - rewritten in another, more suitable language. Se . - -
-
-
- Other Obscurities - - Obscure shell language features should not be used. Examples are: - - - - - Exported functions (export -f or - declare -f). - - - - - Function names which are not valid variable names, such as - “module::function”. - - - - - The possibility to override built-ins or external commands - with shell functions. - - - - - Changing the value of the IFS variable to - tokenize strings. - - - -
-
-
-Invoking External Commands - - When passing shell variables as single command line arguments, - they should always be surrounded by double quotes. See - . - - - Care is required when passing untrusted values as positional - parameters to external commands. If the value starts with a hyphen - “-”, it may be interpreted by the external - command as an option. Depending on the external program, a - “--” argument stops option processing and treats - all following arguments as positional parameters. (Double quotes - are completely invisible to the command being invoked, so they do - not prevent variable values from being interpreted as options.) - - - Cleaning the environment before invoking child processes is - difficult to implement in script. bash - keeps a hidden list of environment variables which do not correspond - to shell variables, and unsetting them from within a - bash script is not possible. To reset - the environment, a script can re-run itself under the “env - -i” command with an additional parameter which indicates - the environment has been cleared and suppresses a further - self-execution. Alternatively, individual commands can be executed - with “env -i”. - - - - Complete isolation from its original execution environment - (which is required when the script is executed after a trust - transition, e.g., triggered by the SUID mechanism) is impossible - to achieve from within the shell script itself. Instead, the - invoking process has to clear the process environment (except for - few trusted variables) before running the shell script. - - - - Checking for failures in executed external commands is recommended. - If no elaborate error recovery is needed, invoking “set - -e” may be sufficient. This causes the script to stop on - the first failed command. However, failures in pipes - (“command1 | command2”) are only detected for the - last command in the pipe, errors in previous commands are ignored. - This can be changed by invoking “set -o pipefail”. - Due to architectural limitations, only the process that spawned - the entire pipe can check for failures in individual commands; - it is not possible for a process to tell if the process feeding - data (or the process consuming data) exited normally or with - an error. - - - See - for additional details on creating child processes. - -
-
- Temporary Files - - Temporary files should be created with the - mktemp command, and temporary directories with - “mktemp -d”. - - - To clean up temporary files and directories, write a clean-up - shell function and register it as a trap handler, as shown in - . - Using a separate function avoids issues with proper quoting of - variables. - - - Creating and Cleaning up Temporary Files - - -tmpfile="$(mktemp)" - -cleanup () { - rm -f -- "$tmpfile" -} - -trap cleanup 0 - - - -
-
- Performing Input Validation - - In some cases, input validation cannot be avoided. For example, - if arithmetic evaluation is absolutely required, it is imperative - to check that input values are, in fact, integers. See . - - - - shows a construct which can be used to check if a string - “$value” is an integer. This construct is - specific to bash and not portable to - POSIX shells. - - - Input validation in <application>bash</application> - - - - Using case statements for input validation is - also possible and supported by other (POSIX) shells, but the - pattern language is more restrictive, and it can be difficult to - write suitable patterns. - - - The expr external command can give misleading - results (e.g., if the value being checked contains operators - itself) and should not be used. - -
-
- Guarding Shell Scripts Against Changes - - bash only reads a shell script up to - the point it is needed for executed the next command. This means - that if script is overwritten while it is running, execution can - jump to a random part of the script, depending on what is modified - in the script and how the file offsets change as a result. (This - behavior is needed to support self-extracting shell archives whose - script part is followed by a stream of bytes which does not follow - the shell language syntax.) - - - Therefore, long-running scripts should be guarded against - concurrent modification by putting as much of the program logic - into a main function, and invoking the - main function at the end of the script, using - this syntax: - - - -main "$@" ; exit $? - - - - This construct ensures that bash will - stop execution after the main function, instead - of opening the script file and trying to read more commands. - -
-
diff --git a/en-US/Tasks-Cryptography.xml b/en-US/Tasks-Cryptography.xml deleted file mode 100644 index 8843f07..0000000 --- a/en-US/Tasks-Cryptography.xml +++ /dev/null @@ -1,143 +0,0 @@ - - - - Cryptography - -
- Primitives - - Choosing from the following cryptographic primitives is - recommended: - - - RSA with 2048 bit keys and OAEP or PSS - padding - AES-128 in CBC mode - AES-128 in GCM mode - AES-256 in CBC mode - AES-256 in GCM mode - SHA-256 - HMAC-SHA-256 - HMAC-SHA-1 - - - Other cryptographic algorithms can be used if they are required - for interoperability with existing software: - - - RSA with key sizes larger than 1024 - and legacy padding - AES-192 - 3DES (triple DES, with two or three 56 bit keys), - but strongly discouraged - RC4 (but very, very strongly discouraged) - SHA-1 - HMAC-MD5 - - - Important - - These primitives are difficult to use in a secure way. Custom - implementation of security protocols should be avoided. For - protecting confidentiality and integrity of network - transmissions, TLS should be used (). - - - In particular, when using AES in CBC mode, it is necessary to - add integrity checking by other means, preferably using - HMAC-SHA-256 and after encryption (that - is, on the encrypted cipher text). For AES in GCM mode, - correct construction of nonces is absolutely essential. - - - -
- -
- Randomness - - The following facilities can be used to generate unpredictable - and non-repeating values. When these functions are used without - special safeguards, each individual random value should be at - least 12 bytes long. - - - - PK11_GenerateRandom in the NSS library - (usable for high data rates) - - - RAND_bytes in the OpenSSL library - (usable for high data rates) - - - gnutls_rnd in GNUTLS, with - GNUTLS_RND_RANDOM as the first argument - (usable for high data rates) - - - java.security.SecureRandom in Java - (usable for high data rates) - - - os.urandom in Python - - - The getrandom system call since glibc 2.25 - - - The getentropy call since glibc 2.25 - - - Reading from the /dev/urandom - character device - - - - All these functions should be non-blocking, and they should not - wait until physical randomness becomes available. (Some - cryptography providers for Java can cause - java.security.SecureRandom to block, however.) - Those functions which do not obtain all bits directly from - /dev/urandom are suitable for high data - rates because they do not deplete the system-wide entropy pool. - - - Difficult to use API - - Both RAND_bytes and - PK11_GenerateRandom have three-state - return values (with conflicting meanings). Careful error - checking is required. Please review the documentation when - using these functions. - - - - Difficult to use API - - The getrandom system call has three-state - return values, hence requires careful error checking. - - - It was introduced in Linux kernel 3.17, but before glibc 2.25 no API wrappers were - provided. As such one could only use it via the syscall interface - as syscall(SYS_getrandom, (void*)dest, (size_t)size, (unsigned int)0). - For portable code targetting multiple kernel versions one has to check - for the function being available on run-time, and switch to another - facility if the running kernel does not support this call. - - - - Other sources of randomness should be considered predictable. - - - Generating randomness for cryptographic keys in long-term use - may need different steps and is best left to cryptographic - libraries. - -
- -
diff --git a/en-US/Tasks-Descriptors.xml b/en-US/Tasks-Descriptors.xml deleted file mode 100644 index ca4c884..0000000 --- a/en-US/Tasks-Descriptors.xml +++ /dev/null @@ -1,267 +0,0 @@ - - - - File Descriptor Management - - File descriptors underlie all input/output mechanisms offered by - the system. They are used to implementation the FILE - *-based functions found in - <stdio.h>, and all the file and network - communication facilities provided by the Python and Java - environments are eventually implemented in them. - - - File descriptors are small, non-negative integers in userspace, - and are backed on the kernel side with complicated data structures - which can sometimes grow very large. - -
- Closing Descriptors - - If a descriptor is no longer used by a program and is not closed - explicitly, its number cannot be reused (which is problematic in - itself, see ), and - the kernel resources are not freed. Therefore, it is important - to close all descriptors at the earliest point in time - possible, but not earlier. - -
- Error Handling during Descriptor Close - - The close system call is always - successful in the sense that the passed file descriptor is - never valid after the function has been called. However, - close still can return an error, for - example if there was a file system failure. But this error is - not very useful because the absence of an error does not mean - that all caches have been emptied and previous writes have - been made durable. Programs which need such guarantees must - open files with O_SYNC or use - fsync or fdatasync, and - may also have to fsync the directory - containing the file. - -
-
- Closing Descriptors and Race Conditions - - Unlike process IDs, which are recycle only gradually, the - kernel always allocates the lowest unused file descriptor when - a new descriptor is created. This means that in a - multi-threaded program which constantly opens and closes file - descriptors, descriptors are reused very quickly. Unless - descriptor closing and other operations on the same file - descriptor are synchronized (typically, using a mutex), there - will be race conditons and I/O operations will be applied to - the wrong file descriptor. - - - Sometimes, it is necessary to close a file descriptor - concurrently, while another thread might be about to use it in - a system call. In order to support this, a program needs to - create a single special file descriptor, one on which all I/O - operations fail. One way to achieve this is to use - socketpair, close one of the descriptors, - and call shutdown(fd, SHUTRDWR) on the - other. - - - When a descriptor is closed concurrently, the program does not - call close on the descriptor. Instead it - program uses dup2 to replace the - descriptor to be closed with the dummy descriptor created - earlier. This way, the kernel will not reuse the descriptor, - but it will carry out all other steps associated with calling - a descriptor (for instance, if the descriptor refers to a - stream socket, the peer will be notified). - - - This is just a sketch, and many details are missing. - Additional data structures are needed to determine when it is - safe to really close the descriptor, and proper locking is - required for that. - -
-
- Lingering State after Close - - By default, closing a stream socket returns immediately, and - the kernel will try to send the data in the background. This - means that it is impossible to implement accurate accounting - of network-related resource utilization from userspace. - - - The SO_LINGER socket option alters the - behavior of close, so that it will return - only after the lingering data has been processed, either by - sending it to the peer successfully, or by discarding it after - the configured timeout. However, there is no interface which - could perform this operation in the background, so a separate - userspace thread is needed for each close - call, causing scalability issues. - - - Currently, there is no application-level countermeasure which - applies universally. Mitigation is possible with - iptables (the - connlimit match type in particular) and - specialized filtering devices for denial-of-service network - traffic. - - - These problems are not related to the - TIME_WAIT state commonly seen in - netstat output. The kernel - automatically expires such sockets if necessary. - -
-
- -
- Preventing File Descriptor Leaks to Child Processes - - Child processes created with fork share - the initial set of file descriptors with their parent - process. By default, file descriptors are also preserved if - a new process image is created with execve - (or any of the other functions such as system - or posix_spawn). - - - Usually, this behavior is not desirable. There are two ways to - turn it off, that is, to prevent new process images from - inheriting the file descriptors in the parent process: - - - - - Set the close-on-exec flag on all newly created file - descriptors. Traditionally, this flag is controlled by the - FD_CLOEXEC flag, using - F_GETFD and F_SETFD - operations of the fcntl function. - - - However, in a multi-threaded process, there is a race - condition: a subprocess could have been created between the - time the descriptor was created and the - FD_CLOEXEC was set. Therefore, many system - calls which create descriptors (such as - open and openat) - now accept the O_CLOEXEC flag - (SOCK_CLOEXEC for - socket and - socketpair), which cause the - FD_CLOEXEC flag to be set for the file - descriptor in an atomic fashion. In addition, a few new - systems calls were introduced, such as - pipe2 and dup3. - - - The downside of this approach is that every descriptor needs - to receive special treatment at the time of creation, - otherwise it is not completely effective. - - - - - After calling fork, but before creating - a new process image with execve, all - file descriptors which the child process will not need are - closed. - - - Traditionally, this was implemented as a loop over file - descriptors ranging from 3 to - 255 and later 1023. - But this is only an approximation because it is possible to - create file descriptors outside this range easily (see ). - Another approach reads /proc/self/fd - and closes the unexpected descriptors listed there, but this - approach is much slower. - - - - - At present, environments which care about file descriptor - leakage implement the second approach. OpenJDK 6 and 7 - are among them. - -
- -
- Dealing with the <function>select</function> Limit - - By default, a user is allowed to open only 1024 files in a - single process, but the system administrator can easily change - this limit (which is necessary for busy network servers). - However, there is another restriction which is more difficult to - overcome. - - - The select function only supports a - maximum of FD_SETSIZE file descriptors - (that is, the maximum permitted value for a file descriptor - is FD_SETSIZE - 1, usually 1023.) If a - process opens many files, descriptors may exceed such - limits. It is impossible to query such descriptors using - select. - - - If a library which creates many file descriptors is used in - the same process as a library which uses - select, at least one of them needs to - be changed. - Calls to select can be replaced with - calls to poll or another event handling - mechanism. Replacing the select function - is the recommended approach. - - - Alternatively, the library with high descriptor usage can - relocate descriptors above the FD_SETSIZE - limit using the following procedure. - - - - - Create the file descriptor fd as - usual, preferably with the O_CLOEXEC - flag. - - - - - Before doing anything else with the descriptor - fd, invoke: - - - int newfd = fcntl(fd, F_DUPFD_CLOEXEC, (long)FD_SETSIZE); - - - - - Check that newfd result is - non-negative, otherwise close fd and - report an error, and return. - - - - - Close fd and continue to use - newfd. - - - - - The new descriptor has been allocated above the - FD_SETSIZE. Even though this algorithm - is racy in the sense that the FD_SETSIZE - first descriptors could fill up, a very high degree of - physical parallelism is required before this becomes a problem. - -
-
diff --git a/en-US/Tasks-File_System.xml b/en-US/Tasks-File_System.xml deleted file mode 100644 index a68fca2..0000000 --- a/en-US/Tasks-File_System.xml +++ /dev/null @@ -1,339 +0,0 @@ - - - - File System Manipulation - - In this chapter, we discuss general file system manipulation, with - a focus on access files and directories to which an other, - potentially untrusted user has write access. - - - Temporary files are covered in their own chapter, . - -
- Working with Files and Directories Owned by Other Users - - Sometimes, it is necessary to operate on files and directories - owned by other (potentially untrusted) users. For example, a - system administrator could remove the home directory of a user, - or a package manager could update a file in a directory which is - owned by an application-specific user. This differs from - accessing the file system as a specific user; see - . - - - Accessing files across trust boundaries faces several - challenges, particularly if an entire directory tree is being - traversed: - - - - - Another user might add file names to a writable directory at - any time. This can interfere with file creation and the - order of names returned by readdir. - - - - - Merely opening and closing a file can have side effects. - For instance, an automounter can be triggered, or a tape - device rewound. Opening a file on a local file system can - block indefinitely, due to mandatory file locking, unless - the O_NONBLOCK flag is specified. - - - - - Hard links and symbolic links can redirect the effect of - file system operations in unexpected ways. The - O_NOFOLLOW and - AT_SYMLINK_NOFOLLOW variants of system - calls only affected final path name component. - - - - - The structure of a directory tree can change. For example, - the parent directory of what used to be a subdirectory - within the directory tree being processed could suddenly - point outside that directory tree. - - - - - Files should always be created with the - O_CREAT and O_EXCL flags, - so that creating the file will fail if it already exists. This - guards against the unexpected appearance of file names, either - due to creation of a new file, or hard-linking of an existing - file. In multi-threaded programs, rather than manipulating the - umask, create the files with mode 000 if - possible, and adjust it afterwards with - fchmod. - - - To avoid issues related to symbolic links and directory tree - restructuring, the “at” variants of system - calls have to be used (that is, functions like - openat, fchownat, - fchmodat, and - unlinkat, together with - O_NOFOLLOW or - AT_SYMLINK_NOFOLLOW). Path names passed to - these functions must have just a single component (that is, - without a slash). When descending, the descriptors of parent - directories must be kept open. The missing - opendirat function can be emulated with - openat (with an - O_DIRECTORY flag, to avoid opening special - files with side effects), followed by - fdopendir. - - - If the “at” functions are not available, it - is possible to emulate them by changing the current directory. - (Obviously, this only works if the process is not multi-threaded.) - fchdir has to be used to change the current - directory, and the descriptors of the parent directories have to - be kept open, just as with the “at”-based - approach. chdir("...") is unsafe because it - might ascend outside the intended directory tree. - - - This “at” function emulation is currently - required when manipulating extended attributes. In this case, - the lsetxattr function can be used, with a - relative path name consisting of a single component. This also - applies to SELinux contexts and the - lsetfilecon function. - - - Currently, it is not possible to avoid opening special files - and changes to files with hard links if the - directory containing them is owned by an untrusted user. - (Device nodes can be hard-linked, just as regular files.) - fchmodat and fchownat - affect files whose link count is greater than one. But opening - the files, checking that the link count is one with - fstat, and using - fchmod and fchown on - the file descriptor may have unwanted side effects, due to item - 2 above. When creating directories, it is therefore important - to change the ownership and permissions only after it has been - fully created. Until that point, file names are stable, and no - files with unexpected hard links can be introduced. - - - Similarly, when just reading a directory owned by an untrusted - user, it is currently impossible to reliably avoid opening - special files. - - - There is no workaround against the instability of the file list - returned by readdir. Concurrent - modification of the directory can result in a list of files - being returned which never actually existed on disk. - - - Hard links and symbolic links can be safely deleted using - unlinkat without further checks because - deletion only affects the name within the directory tree being - processed. - -
-
- Accessing the File System as a Different User - - This section deals with access to the file system as a specific - user. This is different from accessing files and directories owned by a - different, potentially untrusted user; see . - - - One approach is to spawn a child process which runs under the - target user and group IDs (both effective and real IDs). Note - that this child process can block indefinitely, even when - processing regular files only. For example, a special FUSE file - system could cause the process to hang in uninterruptible sleep - inside a stat system call. - - - An existing process could change its user and group ID using - setfsuid and setfsgid. - (These functions are preferred over seteuid - and setegid because they do not allow the - impersonated user to send signals to the process.) These - functions are not thread safe. In multi-threaded processes, - these operations need to be performed in a single-threaded child - process. Unexpected blocking may occur as well. - - - It is not recommended to try to reimplement the kernel - permission checks in user space because the required checks are - complex. It is also very difficult to avoid race conditions - during path name resolution. - -
-
- File System Limits - - For historical reasons, there are preprocessor constants such as - PATH_MAX, NAME_MAX. - However, on most systems, the length of canonical path names - (absolute path names with all symbolic links resolved, as - returned by realpath or - canonicalize_file_name) can exceed - PATH_MAX bytes, and individual file name - components can be longer than NAME_MAX. This - is also true of the _PC_PATH_MAX and - _PC_NAME_MAX values returned by - pathconf, and the - f_namemax member of struct - statvfs. Therefore, these constants should not be - used. This is also reason why the - readdir_r should never be used (instead, - use readdir). - - - You should not write code in a way that assumes that there is an - upper limit on the number of subdirectories of a directory, the - number of regular files in a directory, or the link count of an - inode. - -
-
- File system features - - Not all file systems support all features. This makes it very - difficult to write general-purpose tools for copying files. For - example, a copy operation intending to preserve file permissions - will generally fail when copying to a FAT file system. - - - - - Some file systems are case-insensitive. Most should be - case-preserving, though. - - - - - Name length limits vary greatly, from eight to thousands of - bytes. Path length limits differ as well. Most systems - impose an upper bound on path names passed to the kernel, - but using relative path names, it is possible to create and - access files whose absolute path name is essentially of - unbounded length. - - - - - Some file systems do not store names as fairly unrestricted - byte sequences, as it has been traditionally the case on GNU - systems. This means that some byte sequences (outside the - POSIX safe character set) are not valid names. Conversely, - names of existing files may not be representable as byte - sequences, and the files are thus inaccessible on GNU - systems. Some file systems perform Unicode canonicalization - on file names. These file systems preserve case, but - reading the name of a just-created file using - readdir might still result in a - different byte sequence. - - - - - Permissions and owners are not universally supported (and - SUID/SGID bits may not be available). For example, FAT file - systems assign ownership based on a mount option, and - generally mark all files as executable. Any attempt to - change permissions would result in an error. - - - - - Non-regular files (device nodes, FIFOs) are not generally - available. - - - - - Only on some file systems, files can have holes, that is, - not all of their contents is backed by disk storage. - - - - - ioctl support (even fairly generic - functionality such as FIEMAP for - discovering physical file layout and holes) is - file-system-specific. - - - - - Not all file systems support extended attributes, ACLs and - SELinux metadata. Size and naming restriction on extended - attributes vary. - - - - - Hard links may not be supported at all (FAT) or only within - the same directory (AFS). Symbolic links may not be - available, either. Reflinks (hard links with copy-on-write - semantics) are still very rare. Recent systems restrict - creation of hard links to users which own the target file or - have read/write access to it, but older systems do not. - - - - - Renaming (or moving) files using rename - can fail (even when stat indicates that - the source and target directories are located on the same - file system). This system call should work if the old and - new paths are located in the same directory, though. - - - - - Locking semantics vary among file systems. This affects - advisory and mandatory locks. For example, some network - file systems do not allow deleting files which are opened by - any process. - - - - - Resolution of time stamps varies from two seconds to - nanoseconds. Not all time stamps are available on all file - systems. File creation time (birth - time) is not exposed over the - stat/fstat - interface, even if stored by the file system. - - - -
-
- Checking Free Space - - The statvfs and - fstatvfs functions allow programs to - examine the number of available blocks and inodes, through the - members f_bfree, f_bavail, - f_ffree, and f_favail of - struct statvfs. Some file systems return - fictional values in the f_ffree and - f_favail fields, so the only reliable way to - discover if the file system still has space for a file is to try - to create it. The f_bfree field should be - reasonably accurate, though. - -
-
- diff --git a/en-US/Tasks-Library_Design.xml b/en-US/Tasks-Library_Design.xml deleted file mode 100644 index e10a6e4..0000000 --- a/en-US/Tasks-Library_Design.xml +++ /dev/null @@ -1,195 +0,0 @@ - - - - Library Design - - Through this section, the term client code - refers to applications and other libraries using the library. - - -
- State Management - - -
- Global State - - Global state should be avoided. - - - If this is impossible, the global state must be protected with - a lock. For C/C++, you can use the - pthread_mutex_lock - and pthread_mutex_unlock - functions without linking against -lpthread - because the system provides stubs for non-threaded processes. - - - For compatibility with fork, these locks - should be acquired and released in helpers registered with - pthread_atfork. This function is not - available without -lpthread, so you need to - use dlsym or a weak symbol to obtain its - address. - - - If you need fork protection for other - reasons, you should store the process ID and compare it to the - value returned by getpid each time you - access the global state. (getpid is not - implemented as a system call and is fast.) If the value - changes, you know that you have to re-create the state object. - (This needs to be combined with locking, of course.) - -
-
- Handles - - Library state should be kept behind a curtain. Client code - should receive only a handle. In C, the handle can be a - pointer to an incomplete struct. In C++, - the handle can be a pointer to an abstract base class, or it - can be hidden using the pointer-to-implementation idiom. - - - The library should provide functions for creating and - destroying handles. (In C++, it is possible to use virtual - destructors for the latter.) Consistency between creation and - destruction of handles is strongly recommended: If the client - code created a handle, it is the responsibility of the client - code to destroy it. (This is not always possible or - convenient, so sometimes, a transfer of ownership has to - happen.) - - - Using handles ensures that it is possible to change the way - the library represents state in a way that is transparent to - client code. This is important to facilitate security updates - and many other code changes. - - - It is not always necessary to protect state behind a handle - with a lock. This depends on the level of thread safety - the library provides. - -
-
- -
- Object Orientation - - Classes should be either designed as base classes, or it should - be impossible to use them as base classes (like - final classes in Java). Classes which are - not designed for inheritance and are used as base classes - nevertheless create potential maintenance hazards because it is - difficult to predict how client code will react when calls to - virtual methods are added, reordered or removed. - - - Virtual member functions can be used as callbacks. See - - for some of the challenges involved. - -
- -
- Callbacks - - Higher-order code is difficult to analyze for humans and - computers alike, so it should be avoided. Often, an - iterator-based interface (a library function which is called - repeatedly by client code and returns a stream of events) leads - to a better design which is easier to document and use. - - - If callbacks are unavoidable, some guidelines for them follow. - - - In modern C++ code, std::function objects - should be used for callbacks. - - - In older C++ code and in C code, all callbacks must have an - additional closure parameter of type void *, - the value of which can be specified by client code. If - possible, the value of the closure parameter should be provided - by client code at the same time a specific callback is - registered (or specified as a function argument). If a single - closure parameter is shared by multiple callbacks, flexibility - is greatly reduced, and conflicts between different pieces of - client code using the same library object could be unresolvable. - In some cases, it makes sense to provide a de-registration - callback which can be used to destroy the closure parameter when - the callback is no longer used. - - - Callbacks can throw exceptions or call - longjmp. If possible, all library objects - should remain in a valid state. (All further operations on them - can fail, but it should be possible to deallocate them without - causing resource leaks.) - - - The presence of callbacks raises the question if functions - provided by the library are reentrant. - Unless a library was designed for such use, bad things will - happen if a callback function uses functions in the same library - (particularly if they are invoked on the same objects and - manipulate the same state). When the callback is invoked, the - library can be in an inconsistent state. Reentrant functions - are more difficult to write than thread-safe functions (by - definition, simple locking would immediately lead to deadlocks). - It is also difficult to decide what to do when destruction of an - object which is currently processing a callback is requested. - -
- -
- Process Attributes - - Several attributes are global and affect all code in the - process, not just the library that manipulates them. - - - - environment variables - (see ) - - - umask - - - user IDs, group IDs and capabilities - - - current working directory - - - signal handlers, signal masks and signal delivery - - - file locks (especially fcntl locks - behave in surprising ways, not just in a multi-threaded - environment) - - - - Library code should avoid manipulating these global process - attributes. It should not rely on environment variables, umask, - the current working directory and signal masks because these - attributes can be inherited from an untrusted source. - - - In addition, there are obvious process-wide aspects such as the - virtual memory layout, the set of open files and dynamic shared - objects, but with the exception of shared objects, these can be - manipulated in a relatively isolated way. - - -
- -
- - diff --git a/en-US/Tasks-Locking.xml b/en-US/Tasks-Locking.xml deleted file mode 100644 index f85e61e..0000000 --- a/en-US/Tasks-Locking.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - diff --git a/en-US/Tasks-Packaging.xml b/en-US/Tasks-Packaging.xml deleted file mode 100644 index 2d61af9..0000000 --- a/en-US/Tasks-Packaging.xml +++ /dev/null @@ -1,183 +0,0 @@ - - - - RPM Packaging - - This chapter deals with security-related concerns around RPM - packaging. It has to be read in conjunction with - distribution-specific packaging guidelines. - -
- Generating X.509 Self-signed Certificates during - Installation - - Some applications need X.509 certificates for authentication - purposes. For example, a single private/public key pair could - be used to define cluster membership, enabling authentication - and encryption of all intra-cluster communication. (Lack of - certification from a CA matters less in such a context.) For - such use, generating the key pair at package installation time - when preparing system images for use in the cluster is - reasonable. For other use cases, it is necessary to generate - the key pair before the service is started for the first time, - see , - and Packaging:Initial Service Setup. - - - - The way the key is generated may not be suitable for key - material of critical value. (openssl - genrsa uses, but does not require, entropy from a - physical source of randomness, among other things.) Such keys - should be stored in a hardware security module if possible, - and generated from random bits reserved for this purpose - derived from a non-deterministic physical source. - - - - In the spec file, we define two RPM variables which contain the - names of the files used to store the private and public key, and - the user name for the service: - - - -# Name of the user owning the file with the private key -%define tlsuser %{name} -# Name of the directory which contains the key and certificate files -%define tlsdir %{_sysconfdir}/%{name} -%define tlskey %{tlsdir}/%{name}.key -%define tlscert %{tlsdir}/%{name}.crt - - - - These variables likely need adjustment based on the needs of the - package. - - - Typically, the file with the private key needs to be owned by - the system user which needs to read it, - %{tlsuser} (not root). In - order to avoid races, if the directory - %{tlsdir} is owned by the services - user, you should use the code in . - The invocation of su with the - argument is necessary in case the - login shell for the user has been disabled. - - - Creating a key pair in a user-owned directory - -%post -if [ $1 -eq 1 ] ; then - if ! test -e %{tlskey} ; then - su -s /bin/bash \ - -c "umask 077 && openssl genrsa -out %{tlskey} 2048 2>/dev/null" \ - %{tlsuser} - fi - if ! test -e %{tlscert} ; then - cn="Automatically generated certificate for the %{tlsuser} service" - req_args="-key %{tlskey} -out %{tlscert} -days 7305 -subj \"/CN=$cn/\"" - su -s /bin/bash \ - -c "openssl req -new -x509 -extensions usr_cert $req_args" \ - %{tlsuser} - fi -fi - -%files -%dir %attr(0755,%{tlsuser},%{tlsuser]) %{tlsdir} -%ghost %attr(0600,%{tlsuser},%{tlsuser}) %config(noreplace) %{tlskey} -%ghost %attr(0644,%{tlsuser},%{tlsuser}) %config(noreplace) %{tlscert} - - - - The files containing the key material are marked as ghost - configuration files. This ensures that they are tracked in the - RPM database as associated with the package, but RPM will not - create them when the package is installed and not verify their - contents (the %ghost), or delete the files - when the package is uninstalled (the - %config(noreplace) part). - - - If the directory - %{tlsdir} is owned by - root, use the code in . - - - Creating a key pair in a <literal>root</literal>-owned directory - -%post -if [ $1 -eq 1 ] ; then - if ! test -e %{tlskey} ; then - (umask 077 && openssl genrsa -out %{tlskey} 2048 2>/dev/null) - chown %{tlsuser} %{tlskey} - fi - if ! test -e %{tlscert} ; then - cn="Automatically generated certificate for the %{tlsuser} service" - openssl req -new -x509 -extensions usr_cert \ - -key %{tlskey} -out %{tlscert} -days 7305 -subj "/CN=$cn/" - fi -fi - -%files -%dir %attr(0755,root,root]) %{tlsdir} -%ghost %attr(0600,%{tlsuser},%{tlsuser}) %config(noreplace) %{tlskey} -%ghost %attr(0644,root,root) %config(noreplace) %{tlscert} - - - - In order for this to work, the package which generates the keys - must require the openssl package. If - the user which owns the key file is generated by a different - package, the package generating the certificate must specify a - Requires(pre): on the package which creates - the user. This ensures that the user account will exist when it - is needed for the su or - chmod invocation. - -
-
- Generating X.509 Self-signed Certificates before Service - Start - - An alternative way to automatically provide an X.509 key pair is - to create it just before the service is started for the first - time. This ensures that installation images which are created - from installed RPM packages receive different key material. - Creating the key pair at package installation time (see ) - would put the key into the image, which may or may not make - sense. - - - The caveats about the way the key is generated in - apply to this procedure as well. - - - - Generating key material before service start may happen very - early during boot, when the kernel randomness pool has not yet - been initialized. Currently, the only way to check for the - initialization is to look for the kernel message - random: nonblocking pool is initialized, or - ensure that the application used for generating the keys - is utilizing the getrandom() system call. - - - In theory, it is also possible to use an application which reads from - /dev/random while generating the key - material (instead of /dev/urandom), but - this can block not just during the boot process, but also much - later at run time, and generally results in a poor user - experience. - - - The requirements for generating such keys is documented at - Packaging:Initial Service Setup. - -
-
diff --git a/en-US/Tasks-Processes.xml b/en-US/Tasks-Processes.xml deleted file mode 100644 index 26eec58..0000000 --- a/en-US/Tasks-Processes.xml +++ /dev/null @@ -1,483 +0,0 @@ - - - - Processes - -
- Creating Safe Processes - - This section describes how to create new child processes in a - safe manner. In addition to the concerns addressed below, there - is the possibility of file descriptor leaks, see . - -
- Obtaining the Program Path and the Command-line - Template - - The name and path to the program being invoked should be - hard-coded or controlled by a static configuration file stored - at a fixed location (at an file system absolute path). The - same applies to the template for generating the command line. - - - The configured program name should be an absolute path. If it - is a relative path, the contents of the PATH - must be obtained in a secure manner (see ). - If the PATH variable is not set or untrusted, - the safe default /bin:/usr/bin must be - used. - - - If too much flexibility is provided here, it may allow - invocation of arbitrary programs without proper authorization. - -
- -
- Bypassing the Shell - - Child processes should be created without involving the system - shell. - - - For C/C++, system should not be used. - The posix_spawn function can be used - instead, or a combination fork and - execve. (In some cases, it may be - preferable to use vfork or the - Linux-specific clone system call instead - of fork.) - - - In Python, the subprocess module bypasses - the shell by default (when the shell - keyword argument is not set to true). - os.system should not be used. - - - The Java class java.lang.ProcessBuilder can be - used to create subprocesses without interference from the - system shell. - - - Portability notice - - On Windows, there is no argument vector, only a single - argument string. Each application is responsible for parsing - this string into an argument vector. There is considerable - variance among the quoting style recognized by applications. - Some of them expand shell wildcards, others do not. Extensive - application-specific testing is required to make this secure. - - - - Note that some common applications (notably - ssh) unconditionally introduce the - use of a shell, even if invoked directly without a shell. It is - difficult to use these applications in a secure manner. In this - case, untrusted data should be supplied by other means. For - example, standard input could be used, instead of the command - line. - -
- -
- Specifying the Process Environment - - Child processes should be created with a minimal set of - environment variables. This is absolutely essential if there - is a trust transition involved, either when the parent process - was created, or during the creation of the child process. - - - In C/C++, the environment should be constructed as an array of - strings and passed as the envp argument to - posix_spawn or execve. - The functions setenv, - unsetenv and putenv - should not be used. They are not thread-safe and suffer from - memory leaks. - - - Python programs need to specify a dict for - the the env argument of the - subprocess.Popen constructor. - The Java class java.lang.ProcessBuilder - provides a environment() method, - which returns a map that can be manipulated. - - - The following list provides guidelines for selecting the set - of environment variables passed to the child process. - - - - - PATH should be initialized to - /bin:/usr/bin. - - - - - USER and HOME can be inhereted - from the parent process environment, or they can be - initialized from the pwent structure - for the user. - - - - The DISPLAY and XAUTHORITY - variables should be passed to the subprocess if it is an X - program. Note that this will typically not work across trust - boundaries because XAUTHORITY refers to a file - with 0600 permissions. - - - - - The location-related environment variables - LANG, LANGUAGE, - LC_ADDRESS, LC_ALL, - LC_COLLATE, LC_CTYPE, - LC_IDENTIFICATION, - LC_MEASUREMENT, LC_MESSAGES, - LC_MONETARY, LC_NAME, - LC_NUMERIC, LC_PAPER, - LC_TELEPHONE and LC_TIME - can be passed to the subprocess if present. - - - - - The called process may need application-specific - environment variables, for example for passing passwords. - (See .) - - - - - All other environment variables should be dropped. Names - for new environment variables should not be accepted from - untrusted sources. - - - -
- -
- Robust Argument List Processing - - When invoking a program, it is sometimes necessary to include - data from untrusted sources. Such data should be checked - against embedded NUL characters because the - system APIs will silently truncate argument strings at the first - NUL character. - - - The following recommendations assume that the program being - invoked uses GNU-style option processing using - getopt_long. This convention is widely - used, but it is just that, and individual programs might - interpret a command line in a different way. - - - If the untrusted data has to go into an option, use the - --option-name=VALUE syntax, placing the - option and its value into the same command line argument. - This avoids any potential confusion if the data starts with - -. - - - For positional arguments, terminate the option list with a - single marker after the last option, and - include the data at the right position. The - marker terminates option processing, and - the data will not be treated as an option even if it starts - with a dash. - -
- -
- Passing Secrets to Subprocesses - - The command line (the name of the program and its argument) of - a running process is traditionally available to all local - users. The called program can overwrite this information, but - only after it has run for a bit of time, during which the - information may have been read by other processes. However, - on Linux, the process environment is restricted to the user - who runs the process. Therefore, if you need a convenient way - to pass a password to a child process, use an environment - variable, and not a command line argument. (See .) - - - Portability notice - - On some UNIX-like systems (notably Solaris), environment - variables can be read by any system user, just like command - lines. - - - - If the environment-based approach cannot be used due to - portability concerns, the data can be passed on standard - input. Some programs (notably gpg) - use special file descriptors whose numbers are specified on - the command line. Temporary files are an option as well, but - they might give digital forensics access to sensitive data - (such as passphrases) because it is difficult to safely delete - them in all cases. - -
-
- -
- Handling Child Process Termination - - When child processes terminate, the parent process is signalled. - A stub of the terminated processes (a - zombie, shown as - <defunct> by - ps) is kept around until the status - information is collected (reaped) by the - parent process. Over the years, several interfaces for this - have been invented: - - - - - The parent process calls wait, - waitpid, waitid, - wait3 or wait4, - without specifying a process ID. This will deliver any - matching process ID. This approach is typically used from - within event loops. - - - - - The parent process calls waitpid, - waitid, or wait4, - with a specific process ID. Only data for the specific - process ID is returned. This is typically used in code - which spawns a single subprocess in a synchronous manner. - - - - - The parent process installs a handler for the - SIGCHLD signal, using - sigaction, and specifies to the - SA_NOCLDWAIT flag. - This approach could be used by event loops as well. - - - - - None of these approaches can be used to wait for child process - terminated in a completely thread-safe manner. The parent - process might execute an event loop in another thread, which - could pick up the termination signal. This means that libraries - typically cannot make free use of child processes (for example, - to run problematic code with reduced privileges in a separate - address space). - - - At the moment, the parent process should explicitly wait for - termination of the child process using - waitpid or waitid, - and hope that the status is not collected by an event loop - first. - -
- -
- <literal>SUID</literal>/<literal>SGID</literal> - processes - - - Programs can be marked in the file system to indicate to the - kernel that a trust transition should happen if the program is - run. The SUID file permission bit indicates - that an executable should run with the effective user ID equal - to the owner of the executable file. Similarly, with the - SGID bit, the effective group ID is set to - the group of the executable file. - - - Linux supports fscaps, which can grant - additional capabilities to a process in a finer-grained manner. - Additional mechanisms can be provided by loadable security - modules. - - - When such a trust transition has happened, the process runs in a - potentially hostile environment. Additional care is necessary - not to rely on any untrusted information. These concerns also - apply to libraries which can be linked into such processes. - - -
- Accessing Environment Variables - - The following steps are required so that a program does not - accidentally pick up untrusted data from environment - variables. - - - - Compile your C/C++ sources with -D_GNU_SOURCE. - The Autoconf macro AC_GNU_SOURCE ensures this. - - - Check for the presence of the secure_getenv - and __secure_getenv function. The Autoconf - directive AC_CHECK_FUNCS([__secure_getenv secure_getenv]) - performs these checks. - - - Arrange for a proper definition of the - secure_getenv function. See . - - - Use secure_getenv instead of - getenv to obtain the value of critical - environment variables. secure_getenv - will pretend the variable has not bee set if the process - environment is not trusted. - - - - Critical environment variables are debugging flags, - configuration file locations, plug-in and log file locations, - and anything else that might be used to bypass security - restrictions or cause a privileged process to behave in an - unexpected way. - - - Either the secure_getenv function or the - __secure_getenv is available from GNU libc. - - - Obtaining a definition for <function>secure_getenv</function> - - - -#ifndef HAVE_SECURE_GETENV -# ifdef HAVE__SECURE_GETENV -# define secure_getenv __secure_getenv -# else -# error neither secure_getenv nor __secure_getenv are available -# endif -#endif -]]> - - -
-
- -
- Daemons - - Background processes providing system services - (daemons) need to decouple themselves from - the controlling terminal and the parent process environment: - - - - Fork. - - - - In the child process, call setsid. The - parent process can simply exit (using - _exit, to avoid running clean-up - actions twice). - - - - - In the child process, fork again. Processing continues in - the child process. Again, the parent process should just - exit. - - - - - Replace the descriptors 0, 1, 2 with a descriptor for - /dev/null. Logging should be - redirected to syslog. - - - - - Older instructions for creating daemon processes recommended a - call to umask(0). This is risky because it - often leads to world-writable files and directories, resulting - in security vulnerabilities such as arbitrary process - termination by untrusted local users, or log file truncation. - If the umask needs setting, a restrictive - value such as 027 or 077 - is recommended. - - - Other aspects of the process environment may have to changed as - well (environment variables, signal handler disposition). - - - It is increasingly common that server processes do not run as - background processes, but as regular foreground process under a - supervising master process (such as - systemd). Server processes should - offer a command line option which disables forking and - replacement of the standard output and standard error streams. - Such an option is also useful for debugging. - -
- -
- Semantics of Command-line Arguments - - - After process creation and option processing, it is up to the - child process to interpret the arguments. Arguments can be - file names, host names, or URLs, and many other things. URLs - can refer to the local network, some server on the Internet, - or to the local file system. Some applications even accept - arbitrary code in arguments (for example, - python with the - option). - - - Similar concerns apply to environment variables, the contents - of the current directory and its subdirectories. - - - - Consequently, careful analysis is required if it is safe to - pass untrusted data to another program. - -
- -
- <function>fork</function> as a Primitive for Parallelism - - A call to fork which is not immediately - followed by a call to execve (perhaps after - rearranging and closing file descriptors) is typically unsafe, - especially from a library which does not control the state of - the entire process. Such use of fork - should be replaced with proper child processes or threads. - -
- -
diff --git a/en-US/Tasks-Serialization.xml b/en-US/Tasks-Serialization.xml deleted file mode 100644 index 7165a07..0000000 --- a/en-US/Tasks-Serialization.xml +++ /dev/null @@ -1,610 +0,0 @@ - - - - Serialization and Deserialization - - Protocol decoders and file format parsers are often the - most-exposed part of an application because they are exposed with - little or no user interaction and before any authentication and - security checks are made. They are also difficult to write - robustly in languages which are not memory-safe. - - -
- Recommendations for Manually-written Decoders - - For C and C++, the advice in applies. In - addition, avoid non-character pointers directly into input - buffers. Pointer misalignment causes crashes on some - architectures. - - - When reading variable-sized objects, do not allocate large - amounts of data solely based on the value of a size field. If - possible, grow the data structure as more data is read from the - source, and stop when no data is available. This helps to avoid - denial-of-service attacks where little amounts of input data - results in enormous memory allocations during decoding. - Alternatively, you can impose reasonable bounds on memory - allocations, but some protocols do not permit this. - -
- -
- Protocol Design - - Binary formats with explicit length fields are more difficult to - parse robustly than those where the length of dynamically-sized - elements is derived from sentinel values. A protocol which does - not use length fields and can be written in printable ASCII - characters simplifies testing and debugging. However, binary - protocols with length fields may be more efficient to parse. - - - In new datagram-oriented protocols, unique numbers such as - sequence numbers or identifiers for fragment reassembly (see - ) - should be at least 64 bits large, and really should not be - smaller than 32 bits in size. Protocols should not permit - fragments with overlapping contents. - -
- -
- Fragmentation - - Some serialization formats use frames or protocol data units - (PDUs) on lower levels which are smaller than the PDUs on higher - levels. With such an architecture, higher-level PDUs may have - to be fragmented into smaller frames during - serialization, and frames may need - reassembly into large PDUs during - deserialization. - - - Serialization formats may use conceptually similar structures - for completely different purposes, for example storing multiple - layers and color channels in a single image file. - - - When fragmenting PDUs, establish a reasonable lower bound for - the size of individual fragments (as large as possible—limits as - low as one or even zero can add substantial overhead). Avoid - fragmentation if at all possible, and try to obtain the maximum - acceptable fragment length from a trusted data source. - - - When implementing reassembly, consider the following aspects. - - - - - Avoid allocating significant amount of resources without - proper authentication. Allocate memory for the unfragmented - PDU as more and more and fragments are encountered, and not - based on the initially advertised unfragmented PDU size, - unless there is a sufficiently low limit on the unfragmented - PDU size, so that over-allocation cannot lead to performance - problems. - - - - - Reassembly queues on top of datagram-oriented transports - should be bounded, both in the combined size of the arrived - partial PDUs waiting for reassembly, and the total number of - partially reassembled fragments. The latter limit helps to - reduce the risk of accidental reassembly of unrelated - fragments, as it can happen with small fragment IDs (see - ). - It also guards to some extent against deliberate injection of fragments, - by guessing fragment IDs. - - - - - Carefully keep track of which bytes in the unfragmented PDU - have been covered by fragments so far. If message - reordering is a concern, the most straightforward data - structure for this is an array of bits, with one bit for - every byte (or other atomic unit) in the unfragmented PDU. - Complete reassembly can be determined by increasing a - counter of set bits in the bit array as the bit array is - updated, taking overlapping fragments into consideration. - - - - - Reject overlapping fragments (that is, multiple fragments - which provide data at the same offset of the PDU being - fragmented), unless the protocol explicitly requires - accepting overlapping fragments. The bit array used for - tracking already arrived bytes can be used for this purpose. - - - - - Check for conflicting values of unfragmented PDU lengths (if - this length information is part of every fragment) and - reject fragments which are inconsistent. - - - - - Validate fragment lengths and offsets of individual - fragments against the unfragmented PDU length (if they are - present). Check that the last byte in the fragment does not - lie after the end of the unfragmented PDU. Avoid integer - overflows in these computations (see ). - - - -
- Fragment IDs - - If the underlying transport is datagram-oriented (so that PDUs - can be reordered, duplicated or be lost, like with UDP), - fragment reassembly needs to take into account endpoint - addresses of the communication channel, and there has to be - some sort of fragment ID which identifies the individual - fragments as part of a larger PDU. In addition, the - fragmentation protocol will typically involve fragment offsets - and fragment lengths, as mentioned above. - - - If the transport may be subject to blind PDU injection (again, - like UDP), the fragment ID must be generated randomly. If the - fragment ID is 64 bit or larger (strongly recommended), it can - be generated in a completely random fashion for most traffic - volumes. If it is less than 64 bits large (so that accidental - collisions can happen if a lot of PDUs are transmitted), the - fragment ID should be incremented sequentially from a starting - value. The starting value should be derived using a HMAC-like - construction from the endpoint addresses, using a long-lived - random key. This construction ensures that despite the - limited range of the ID, accidental collisions are as unlikely - as possible. (This will not work reliable with really short - fragment IDs, such as the 16 bit IDs used by the Internet - Protocol.) - -
-
- -
- Library - Support for Deserialization - - For some languages, generic libraries are available which allow - to serialize and deserialize user-defined objects. The - deserialization part comes in one of two flavors, depending on - the library. The first kind uses type information in the data - stream to control which objects are instantiated. The second - kind uses type definitions supplied by the programmer. The - first one allows arbitrary object instantiation, the second one - generally does not. - - - The following serialization frameworks are in the first category, - are known to be unsafe, and must not be used for untrusted data: - - - - Python's pickle and cPickle - modules, and wrappers such as shelve - - - Perl's Storable package - - - Java serialization (java.io.ObjectInputStream), - even if encoded in other formats (as with - java.beans.XMLDecoder) - - - PHP serialization (unserialize) - - - Most implementations of YAML - - - - When using a type-directed deserialization format where the - types of the deserialized objects are specified by the - programmer, make sure that the objects which can be instantiated - cannot perform any destructive actions in their destructors, - even when the data members have been manipulated. - - - In general, JSON decoders do not suffer from this problem. But - you must not use the eval function to parse - JSON objects in Javascript; even with the regular expression - filter from RFC 4627, there are still information leaks - remaining. JSON-based formats can still turn out risky if they - serve as an encoding form for any if the serialization - frameworks listed above. - - - For serialization in C and C++ projects, the Protocol Buffers serialization - (protobuf) provides type safe automated serialization - by relying on code generation. It is positioned as similar, but simpler and - more efficient to XML serialization. - -
- -
- XML Serialization - - -
- External References - - XML documents can contain external references. They can occur - in various places. - - - - - In the DTD declaration in the header of an XML document: - - - -]]> - - - - - - In a namespace declaration: - - - -]]> - - - - - - In an entity defintion: - - - - -]]> - - - - - - In a notation: - - - -]]> - - - - - - Originally, these external references were intended as unique - identifiers, but by many XML implementations, they are used - for locating the data for the referenced element. This causes - unwanted network traffic, and may disclose file system - contents or otherwise unreachable network resources, so this - functionality should be disabled. - - - Depending on the XML library, external referenced might be - processed not just when parsing XML, but also when generating - it. - -
-
- Entity Expansion - - When external DTD processing is disabled, an internal DTD - subset can still contain entity definitions. Entity - declarations can reference other entities. Some XML libraries - expand entities automatically, and this processing cannot be - switched off in some places (such as attribute values or - content models). Without limits on the entity nesting level, - this expansion results in data which can grow exponentially in - length with size of the input. (If there is a limit on the - nesting level, the growth is still polynomial, unless further - limits are imposed.) - - - Consequently, the processing internal DTD subsets should be - disabled if possible, and only trusted DTDs should be - processed. If a particular XML application does not permit - such restrictions, then application-specific limits are called - for. - -
- -
- XInclude Processing - - XInclude processing can reference file and network resources - and include them into the document, much like external entity - references. When parsing untrusted XML documents, XInclude - processing should be turned off. - - - XInclude processing is also fairly complex and may pull in - support for the XPointer and XPath specifications, - considerably increasing the amount of code required for XML - processing. - -
- -
- Algorithmic Complexity of XML Validation - - DTD-based XML validation uses regular expressions for content - models. The XML specification requires that content models - are deterministic, which means that efficient validation is - possible. However, some implementations do not enforce - determinism, and require exponential (or just polynomial) - amount of space or time for validating some DTD/document - combinations. - - - XML schemas and RELAX NG (via the xsd: - prefix) directly support textual regular expressions which are - not required to be deterministic. - -
-
- Using Expat for XML parsing - - By default, Expat does not try to resolve external IDs, so no - steps are required to block them. However, internal entity - declarations are processed. Installing a callback which stops - parsing as soon as such entities are encountered disables - them, see . - Expat does not perform any validation, so there are no - problems related to that. - - - Disabling XML entity processing with Expat - - - - This handler must be installed when the - XML_Parser object is created (). - - - Creating an Expat XML parser - - - - It is also possible to reject internal DTD subsets altogether, - using a suitable - XML_StartDoctypeDeclHandler handler - installed with XML_SetDoctypeDeclHandler. - -
- -
- Using Qt for XML Parsing - - The XML component of Qt, QtXml, does not resolve external IDs - by default, so it is not required to prevent such resolution. - Internal entities are processed, though. To change that, a - custom QXmlDeclHandler and - QXmlSimpleReader subclasses are needed. It - is not possible to use the - QDomDocument::setContent(const QByteArray - &) convenience methods. - - - - shows an entity handler which always returns errors, causing - parsing to stop when encountering entity declarations. - - - A QtXml entity handler which blocks entity processing - - - - This handler is used in the custom - QXmlReader subclass in . - Some parts of QtXml will call the - setDeclHandler(QXmlDeclHandler *) method. - Consequently, we prevent overriding our custom handler by - providing a definition of this method which does nothing. In - the constructor, we activate namespace processing; this part - may need adjusting. - - - A QtXml XML reader which blocks entity processing - - - - Our NoEntityReader class can be used with - one of the overloaded - QDomDocument::setContent methods. - - shows how the buffer object (of type - QByteArray) is wrapped as a - QXmlInputSource. After calling the - setContent method, you should check the - return value and report any error. - - - Parsing an XML document with QDomDocument, without entity expansion - - -
- -
- Using OpenJDK for XML Parsing and Validation - - OpenJDK contains facilities for DOM-based, SAX-based, and - StAX-based document parsing. Documents can be validated - against DTDs or XML schemas. - - - The approach taken to deal with entity expansion differs from - the general recommendation in . - We enable the the feature flag - javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, - which enforces heuristic restrictions on the number of entity - expansions. Note that this flag alone does not prevent - resolution of external references (system IDs or public IDs), - so it is slightly misnamed. - - - In the following sections, we use helper classes to prevent - external ID resolution. - - - Helper class to prevent DTD external entity resolution in OpenJDK - - - - Helper class to prevent schema resolution in - OpenJDK - - - - - shows the imports used by the examples. - - - Java imports for OpenJDK XML parsing - - -
- DOM-based XML parsing and DTD validation in OpenJDK - - This approach produces a - org.w3c.dom.Document object from an input - stream. - use the data from the java.io.InputStream - instance in the inputStream variable. - - - DOM-based XML parsing in OpenJDK - - - - External entity references are prohibited using the - NoEntityResolver class in - . - Because external DTD references are prohibited, DTD validation - (if enabled) will only happen against the internal DTD subset - embedded in the XML document. - - - To validate the document against an external DTD, use a - javax.xml.transform.Transformer class to - add the DTD reference to the document, and an entity - resolver which whitelists this external reference. - -
- -
- XML Schema Validation in OpenJDK - - - shows how to validate a document against an XML Schema, - using a SAX-based approach. The XML data is read from an - java.io.InputStream in the - inputStream variable. - - - SAX-based validation against an XML schema in - OpenJDK - - - - The NoResourceResolver class is defined - in . - - - If you need to validate a document against an XML schema, - use the code in - to create the document, but do not enable validation at this - point. Then use - - to perform the schema-based validation on the - org.w3c.dom.Document instance - document. - - - Validation of a DOM document against an XML schema in - OpenJDK - - -
-
- Other XML Parsers in OpenJDK - - OpenJDK contains additional XML parsing and processing - facilities. Some of them are insecure. - - - The class java.beans.XMLDecoder acts as a - bridge between the Java object serialization format and XML. - It is close to impossible to securely deserialize Java - objects in this format from untrusted inputs, so its use is - not recommended, as with the Java object serialization - format itself. See . - -
-
-
- -
- Protocol Encoders - - For protocol encoders, you should write bytes to a buffer which - grows as needed, using an exponential sizing policy. Explicit - lengths can be patched in later, once they are known. - Allocating the required number of bytes upfront typically - requires separate code to compute the final size, which must be - kept in sync with the actual encoding step, or vulnerabilities - may result. In multi-threaded code, parts of the object being - deserialized might change, so that the computed size is out of - date. - - - You should avoid copying data directly from a received packet - during encoding, disregarding the format. Propagating malformed - data could enable attacks on other recipients of that data. - - - When using C or C++ and copying whole data structures directly - into the output, make sure that you do not leak information in - padding bytes between fields or at the end of the - struct. - -
- -
- diff --git a/en-US/Tasks-Temporary_Files.xml b/en-US/Tasks-Temporary_Files.xml deleted file mode 100644 index 842cdcb..0000000 --- a/en-US/Tasks-Temporary_Files.xml +++ /dev/null @@ -1,257 +0,0 @@ - - - - Temporary Files - - In this chapter, we describe how to create temporary files and - directories, how to remove them, and how to work with programs - which do not create files in ways that are safe with a shared - directory for temporary files. General file system manipulation - is treated in a separate chapter, . - - - Secure creation of temporary files has four different aspects. - - - - - The location of the directory for temporary files must be - obtained in a secure manner (that is, untrusted environment - variables must be ignored, see ). - - - - - A new file must be created. Reusing an existing file must be - avoided (the /tmp race - condition). This is tricky because traditionally, system-wide - temporary directories shared by all users are used. - - - - - The file must be created in a way that makes it impossible for - other users to open it. - - - - - The descriptor for the temporary file should not leak to - subprocesses. - - - - - All functions mentioned below will take care of these aspects. - - - Traditionally, temporary files are often used to reduce memory - usage of programs. More and more systems use RAM-based file - systems such as tmpfs for storing temporary - files, to increase performance and decrease wear on Flash storage. - As a result, spooling data to temporary files does not result in - any memory savings, and the related complexity can be avoided if - the data is kept in process memory. - - -
- Obtaining the Location of Temporary Directory - - Some functions below need the location of a directory which - stores temporary files. For C/C++ programs, use the following - steps to obtain that directory: - - - - - Use secure_getenv to obtain the value - of the TMPDIR environment variable. If - it is set, convert the path to a fully-resolved absolute - path, using realpath(path, NULL). Check - if the new path refers to a directory and is writeable. In - this case, use it as the temporary directory. - - - - - Fall back to /tmp. - - - - - In Python, you can use the tempfile.tempdir - variable. - - - Java does not support SUID/SGID programs, so you can use the - java.lang.System.getenv(String) method to - obtain the value of the TMPDIR environment - variable, and follow the two steps described above. (Java's - default directory selection does not honor - TMPDIR.) - -
- -
- Named Temporary Files - - The mkostemp function creates a named - temporary file. You should specify the - O_CLOEXEC flag to avoid file descriptor leaks - to subprocesses. (Applications which do not use multiple threads - can also use mkstemp, but libraries should - use mkostemp.) For determining the - directory part of the file name pattern, see . - - - The file is not removed automatically. It is not safe to rename - or delete the file before processing, or transform the name in - any way (for example, by adding a file extension). If you need - multiple temporary files, call mkostemp - multiple times. Do not create additional file names derived - from the name provided by a previous - mkostemp call. However, it is safe to close - the descriptor returned by mkostemp and - reopen the file using the generated name. - - - The Python class tempfile.NamedTemporaryFile - provides similar functionality, except that the file is deleted - automatically by default. Note that you may have to use the - file attribute to obtain the actual file - object because some programming interfaces cannot deal with - file-like objects. The C function mkostemp - is also available as tempfile.mkstemp. - - - In Java, you can use the - java.io.File.createTempFile(String, String, - File) function, using the temporary file location - determined according to . - Do not use java.io.File.deleteOnExit() to - delete temporary files, and do not register a shutdown hook for - each temporary file you create. In both cases, the deletion - hint cannot be removed from the system if you delete the - temporary file prior to termination of the VM, causing a memory - leak. - -
- -
- Temporary Files without Names - - The tmpfile function creates a temporary - file and immediately deletes it, while keeping the file open. - As a result, the file lacks a name and its space is deallocated - as soon as the file descriptor is closed (including the implicit - close when the process terminates). This avoids cluttering the - temporary directory with orphaned files. - - - Alternatively, if the maximum size of the temporary file is - known beforehand, the fmemopen function can - be used to create a FILE * object which is - backed by memory. - - - In Python, unnamed temporary files are provided by the - tempfile.TemporaryFile class, and the - tempfile.SpooledTemporaryFile class provides - a way to avoid creation of small temporary files. - - - Java does not support unnamed temporary files. - -
- -
- Temporary Directories - - The mkdtemp function can be used to create - a temporary directory. (For determining the directory part of - the file name pattern, see .) - The directory is not automatically removed. In Python, this - function is available as tempfile.mkdtemp. - In Java 7, temporary directories can be created using the - java.nio.file.Files.createTempDirectory(Path, String, - FileAttribute...) function. - - - When creating files in the temporary directory, use - automatically generated names, e.g., derived from a sequential - counter. Files with externally provided names could be picked - up in unexpected contexts, and crafted names could actually - point outside of the tempoary directory (due to - directory traversal). - - - Removing a directory tree in a completely safe manner is - complicated. Unless there are overriding performance concerns, - the rm program should be used, with - the and options. - -
- -
- Compensating for Unsafe File Creation - - There are two ways to make a function or program which excepts a - file name safe for use with temporary files. See - , - for details on subprocess creation. - - - - - Create a temporary directory and place the file there. If - possible, run the program in a subprocess which uses the - temporary directory as its current directory, with a - restricted environment. - Use generated names for all files in that temporary - directory. (See .) - - - - - Create the temporary file and pass the generated file name - to the function or program. This only works if the function - or program can cope with a zero-length existing file. It is - safe only under additional assumptions: - - - - - The function or program must not create additional files - whose name is derived from the specified file name or - are otherwise predictable. - - - - - The function or program must not delete the file before - processing it. - - - - - It must not access any existing files in the same - directory. - - - - - It is often difficult to check whether these additional - assumptions are matched, therefore this approach is not - recommended. - - - -
-
diff --git a/en-US/Vala.xml b/en-US/Vala.xml deleted file mode 100644 index 3dea943..0000000 --- a/en-US/Vala.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - -The Vala Programming Language - - Vala is a programming language mainly targeted at GNOME developers. - - - Its syntax is inspired by C# (and thus, indirectly, by Java). But - unlike C# and Java, Vala does not attempt to provide memory safety: - Vala is compiled to C, and the C code is compiled with GCC using - typical compiler flags. Basic operations like integer arithmetic - are directly mapped to C constructs. As a results, the - recommendations in apply. - - - In particular, the following Vala language constructs can result in - undefined behavior at run time: - - - - - Integer arithmetic, as described in . - - - - - Pointer arithmetic, string subscripting and the - substring method on strings (the - string class in the - glib-2.0 package) are not range-checked. It - is the responsibility of the calling code to ensure that the - arguments being passed are valid. This applies even to cases - (like substring) where the implementation - would have range information to check the validity of indexes. - See . - - - - - Similarly, Vala only performs garbage collection (through - reference counting) for GObject values. For - plain C pointers (such as strings), the programmer has to ensure - that storage is deallocated once it is no longer needed (to - avoid memory leaks), and that storage is not being deallocated - while it is still being used (see ). - - - - diff --git a/en-US/Web_Applications.xml.txt b/en-US/Web_Applications.xml.txt deleted file mode 100644 index e1f270a..0000000 --- a/en-US/Web_Applications.xml.txt +++ /dev/null @@ -1,2118 +0,0 @@ - - - - Web Applications - How to protect your web application against some of the more common format of attacks. - -
- Cross site scripting - Cross Site Scripting (XSS) vulnerabilities are often used a foothold for more sophisticated vectors and it is why they need to be taken seriously. Generally speaking there are two forms of XSS attacks, reflected and persisted. - -
- Reflected XSS attack - A reflected XSS attack occurs when an attacker can directly manipulate a HTTP request parameter to inject malicious Javascript code into the rendered page. The attacker tricks a victim to click on the specially crafted link to execute malicious script. - Consider a simple servlet that greets a user via a HTTP request parameter: - - protected void doGet(...){ - response.getWriter().printf("Welcome %s", request.getParameter('name')); - } - - - An attacker could in theory create a link that contains Javascript that will be executed in the victims browser like so: - -http://example.com/?name=<script>alert(1)</script> - -
-
- Persisted XSS attack - This variation of the XSS attack uses the ability of a registered user to be able to store content in the web applications database. The attacker saves the malicious script to the database via a web form with the knowledge that it will be embedded in a rendered page at a later time when viewed by a victim. This scenario is most common in sites that allow users to post comments or rate products without taking the appropriate security precautions. -
-
-
- Defending against XSS attacks - - -
- Escaping user controlled content - The most effective mechanism for preventing XSS attacks is to ensure that any user controlled content is safely escaped. Most modern web frameworks have mechanisms to do this which are automatically enabled. There should be limited reasons to stray outside of this practice for all user controlled input. - The Seam framework escapes content by default unless explicitly told not to. - - -Will be escaped -<h:outputText value="#{param.name}"> - -Won't be escaped (DON'T DO THIS!) -<h:outputText value="#{param.name}" escape=false> - - - Similarly Flask templates will escape content by default unless explicitly told not to. - - -This will be escaped -{{ user_controlled_input }} - -Unless you do this -{{ user_controlled_input | safe }} - - To escape HTML content directly within a Flask request handler you need only import escape. - - -from flask import g, request, flash, abort, escape - -@app.route('/say_hello') -def say_hello(): - return "<p>Hi %s</p>" % (escape(request.args.get('name'))) - - - You can also do this directly in Java code using Apache commons - -import static org.apache.commons.lang.StringEscapeUtils.escapeHtml; - -void doGet(...){ - response.getWriter().printf("<p>Hello, %s</p>", escapeHtml(request.getParameter("name"))); -} - - - - You should *NOT* try to implement your own escaping mechanisms or blacklists when a better, security tested alternative is available. - - - Some caveats around how to escape content correctly and safely will be covered in more details in the <_output_escaping_and_encoding,output escaping and encoding>> section. - -
- Monitoring and validating HTTP parameters - Tampering with HTTP parameters can be a good indication that your site is being probed for weaknesses. It is a good idea to validate user HTTP parameters against a whitelist of trusted input characters that omit anything that may be used to construct malicious input. - -def say_hello(): - user_input = request.args.get('name') - whitelist = re.compile('^\w+$') - if not whitelist.match(user_input): - return abort(400) - - return "Hello %s" % escape(user_input) - -
-
-
- Leveraging browser security features - Most modern browsers have added capabilities to thwart these types of attacks. However to take advantage of them some effort is required by the web application developer. -
- X-XSS-Protection - The first of these measures is a simple header that should be supplied with each HTTP response from the server. It ensures that a XSS filter is enabled in some older browsers (IE8 and IE9). The filter mechanism in these browsers is disabled by default. Other browsers will ignore this header. - -// You can manually add this header to each request using -// a custom filter and enabling it in your web.xml -public void doFilter(...){ - request.addHeader("X-XSS-Protection", "1; mode=block;"); - ... -} - - -# (flask) -@app.after_request -def xss_protection(rsp): - rsp.headers['X-XSS-Protection'] = '1; mode=block;' - -
-
- Content Security Policy (CSP) - The trouble with XSS from a browser's perspective is that is difficult to distinguish between a script that's intended to be part of a web application and a script that has been injected by an attacker. Content Security Policy (CSP) is a standard that allows application developers to specify whitelists of trusted sources for their content. - There are however some caveats to using this feature. In-lined content is considered harmful so all content must be loadable from an external source. This means that you cannot embed scripts and styles within HTML content. - -<!-- - You can no longer use inline content when working with CSP. - This is an example of things that will no longer work. ---> -<html> - <head> - <title>Example</title> - <!-- - All styles need to be loaded from an explicit source - rather than being embedded in a page. - --> - <style> - #foo { - padding-top: 2em; - margin-left: 1.5em; - }; - </style> - </head> - <body - <div id="foo"> - <h1>Example</h1> - <p> - This is an example of the kind of things that you can no longer do. - You can't invoke <a id='say_hello' href="javascript:sayHello()">javascript via links</a> - anymore. - </p> - <p id="bad_style" style="color:red"> - Inline styles are also prevented. - </p> - </div> - - <!-- - All scripts need to be loaded from an explicit source rather - than being embedded in a page. - --> - <script> - function sayHello(){ - alert("Hello world"); - } - </script> - </body> -</html> - - Instead you should load content from an explicit source. For example the previous code snippet may be rewritten as follows. - -/* hello.css */ -#foo { - padding-top: 2em; - margin-left: 1.5em; -} - -#bad_style { - color: red; -} - - -// hello.js -function sayHello(){ - alert("Hello world"); -} - -document.addEventListner('DOMContentLoaded', function(){ - document.getElementById('say_hello').addEventListener('click', sayHello); -}); - - -<html> - <head> - <link rel="stylesheet" type="text/css" href="hello.css"> - </head> - <body> - <div id="foo"> - <h1>Example</h1> - <p> - In this example the scripts and styles are loaded from - an external source. The onclick event handler of <a id='say_hello' href="#">this link</a> - is handled by the external javascript source file. This can be used with - CSP. - </p> - <p id="bad_style"> - Similarly the style of this paragrah is managed by the external CSS source. This - approach can also be used with CSP. - </p> - </div> - <script type="text/javascript" src="hello.js"></script> - </body> -</html> - - The content security policy can be set using the following headers: - -[options="header"] -|=== -| Header | Browsers - -| Content-Security-Policy -| Chrome 25+, Firefox 23+ - -| X-Content-Security-Policy -| Firefox 4+, IE 10+ (partial) - -| X-Webkit-CSP -| Chrome 14+, Safari 6+ - -|=== - -When specifying the header you can create a fine grained policy using a combination -of the following directives: - -[options="header"] -|=== -| Directive | Description - -| default-src -| The default policy for loading all content such as images, scripts, stylesheets, -fonts etc. This can be used when a simple broad policy will apply for all content -within the web application. - -| script-src -| Allows you to set policy around valid sources for Javascript content. - -| object-src -| Defines valid sources of plugins such as <object>, <embed>, and <applet>. - -| style-src -| Allows you to set policy around valid sources for stylesheets. - -| img-src -| Allows you to set policy around valid sources of images. - -| media-src -| Allows you to set policy around valid sources of HTML5 content like -<audio> and <video>. - -| frame-src -| Allows you to set policy around valid sources for loading frames. - -| font-src -| Allows you to set policy around valid sources for loading fonts. - -| connect-src -| Allows you to put restrictions on AJAX requests, websockets and -event source. - -| sandbox -| The sandbox feature allows further preventative restrictions to be -placed on the browser context. When specified it will have to most restrictive -environment enabled by default, and can disable sandboxing for specific -features that are required by the site. - -*allow-top-navigation*: If not specified along with the sandbox directive auxiliary browsing contexts will be disabled. Using target, window.open() or showModalDiaglog() will be blocked by the browser. - -*allow-same-origin*: If not specified along with the sandbox directive forces the content into a unique origin. Preventing it from accessing other content from the same origin. It also means that scripts will not be able to access document.cookie or local storage. - -*allow-forms*: If not specified along with the sandbox directive form submission will be blocked at the browser. - -*allow-scripts*: If not specified with the sandbox directive then no scripts will be executed by the browser. - -| report-uri -| CSP failures can be reported back to the application server. This directive allows you to -specify the URI to send the CSP report to. - - -|=== - -Most of these directives need to be applied to a source to be enforced by the browser. -The exceptions being the sandbox and report-uri directives which have their own special -purposes. For ther other directives you may enforce your whitelist by selective usage -of the following sources. - -[options="headers"] -|=== -| Source | Description - -| * -| Wildcard will allow anything to be loaded for this directive. - -| `none' -| Prevents loading the content from anywhere. - -| `self' -| Restricts the content from being loaded from the same origin (host, scheme and port). - -| data -| Allows content to be loaded via the data scheme. For example a base64 encoded img. - -| hostname.example.com or *.example.com -| Allows content to be loaded from the specified hostname. - -| https://cdn.example.com -| An explicit URI to load content from. - -|=== - - -Creating a policy requires knowing where your web assets are coming from and restricting -external sources as much as possible. Most web applications will be able to get away with -disabling media, embedded content and frames entirely. The best way to retrofit a policy -is to start in a restrictive mode, run your test suite and examine any reported CSP failures. -The following code snippet demonstrates how you might create a policy for browsers -supporting CSP. - - -[source,java] ----- - - // Policy explicitly disables all content then selectively enables - // features required by most modern sites. - String policy = "default-src 'none';"; - - // Enable 'self' for commonly directives. - String[] directives = { - "script-src", - "connect-src", - "img-src", - "style-src" - }; - - for (String directive : directives){ - policy += String.format(" %s 'self';", directive); - } - - // Add appropriate header for browser - String userAgent = request.getHeader("user-agent"); - Pattern chrome = Pattern.compile(" Chrome/([0-9]+)"); - Matcher browser = null; - - if ((browser = chrome.matcher(userAgent)).find()){ - int version = Integer.parseInt(browser.group(1)); - if (version >= 25){ - response.addHeader("Content-Security-Policy", policy); - } else if (version < 25 ## version > 14){ - response.addHeader("X-Webkit-CSP", policy); - } else { - log.debug("CSP not supported by : " + userAgent); - } - } - - // ... etc. - - ----- - -
-
- Summary - Using the CSP in conjunction with the aforementioned mitigation strategies is a really good defense in depth approach to reduce the likelihood of XSS attacks. The great thing is that it requires very little effort by web developers to get a substantial gain in security and therefore it is something that should be considered as a high priority for those looking to boost the security of their applications. -TIP -Validate user input against a whitelist -Escape user controlled input -Monitor the use of HTTP parameters for signs of attacks. -Use CSP to limit the trusted sources of scripts in your web application. - -
-
-
-
- Session Hijacking - -
- Overview - A session hijacking attack is when an attacker manages to steal an existing -users session token and impersonate them when talking to the server. -Session Hijacking is one possible use of a XSS attack, although sessions may -be hijacked by other means. For instance, an attacker may construct a link that -pre-emptively sets a users session identifier to a known value which the user -then authenticates. Other attacks only require you to be logged into the -same network as the attacker and they can simply sniff the network traffic -to access your session token. - - As a result it is essential to ensure all authenticated network traffic is -performed over a secure channel via TLS. Session tokens must be also transmitted -in a secure manner. -
-
- Defending against Session Hijacking - -
- Use non-deterministic session identifiers - Predictable session identifiers also be used in a session hijacking attack. An attacker -only has to guess a valid session identifier to impersonate a different user. Most -web frameworks already include a vetted session cookie implementation. It is not -recommended that you concoct your own session identification mechanism. It is however -recommended that you verify that the session identifier is suitably random. A useful tool for doing this is called Stompy. -Stompy is a command line entropy verifier for session cookies and XSRF tokens. - - -
-
- Set the HTTP Only flag - A good protective measure against session hijacking via XSS is to use -a session cookie that cannot be accessed by client side Javascript. This -is achieved by setting the HTTP only flag on the cookie. - - For most web containers you can specify the following option in your web.xml file. - -[source,xml] ----- -... - - <session-config> - <cookie-config> - <http-only>true</http-only> - </cookie-config> - </session-config> - -... ----- - -Of course the +HttpOnly+ flag can be set programmatically when -creating the cookie too. - - -[source,java] ----- - response.addHeader("Set-Cookie", "foo=bar; HttpOnly;"); ----- - -
-
- Set the Secure Flag - Setting the HttpOnly flag will prevent the session cookie from -being accessed via client side Javascript, but it doesn't protect the -token being transmitted over an insecure channel. Setting the +Secure+ -flag on the session cookie will tell the browser not to transmit the -cookie over an insecure channel. - -Again, this can be done via the web containers web.xml file. - - -[source, xml] ----- -... - - <session-config> - <cookie-config> - <http-only>true</http-only> - <secure>true</secure> - </cookie-config> - </session-config> -... - ----- - -Or programatically. - -[source,java] ----- - response.addHeader("Set-Cookie", "foo=bar; HttpOnly; Secure;"); ----- - -
-
- Strict transport security (HSTS) - Taking this a step further, you should ensure that all authenticated -network traffic is sent via a TLS connection. Enabling HTTP Strict Transport -Security informs compliant browsers to only interact with the web service -via a secure HTTPS connection. This protection mechanism is most effective -in preventing TLS stripping attacks and helps prevent hijacking by -ensuring a secure connection is always used with the server. - - To enable HSTS you need only add a Strict-Transport-Security header to -client responses with a +max-age+ value in seconds. The +max-age+ -attribute indicates to the browser how long it should honour the HTST -transport request. - - -[source,java] ----- - ... - response.addHeader("Strict-Transport-Security", "max-age=86400; includeSubdomains"); - ... ----- - -
-
-
- Summary - Using a combination of all these measures will help prevent the incidence of -session hijacking on your site. - TIP -*DON'T* Use deterministic session identifiers -*DON'T* Send a session identifier via a HTTP parameter or in the URI -*DON'T* Allow client side Javascript to have access to the session token. -*DON'T* Send session tokens over an insecure channel -*DON'T* Allow authenticated content to travel via HTTP - -
-
-
- Click Jacking - -
- Overview - Click Jacking is when an attacker conceals the true nature of a site using -techniques as cursor spoofing or iframe overlays to trick a user into -clicking on a malicious link to perform unintended actions. -
-
- Content Security Policy - The <<_content_security_policy_csp, XSS section>> introduced -content security policy, and defining a tight CSP can also -help mitigate this class of attack. W3C currently has -a link:https://www.w3.org/TR/UISafety/[working draft] -of how CSP may be futher used to mitigate user interface redressing. -
-
- X-Frame-Options - It is common for this class of attack to use iframes to obscure the -actual nature of the site. The +X-Frame-Options+ header was introduced -by Microsoft in IE8. It allows web application developers to prevent frame -based UI redressing. All modern browsers now support this option so it -is worth turning on. - -There are three configuration options for this header. -[options="headers"] -|=== -| Option | Description - -| DENY -| The page cannot be displayed in a frame, regardless of the site attempting to do so. - -| SAMEORIGIN -| The page can only be displayed in a frame on the same origin as the -page itself. - -| ALLOW-FROM uri -| The page can only be displayed in a frame on the specified origin. -|=== - -[source, java] ----- - -// prevent all frames -response.addHeader("X-Frame-Options", "DENY"); - -// allow frames from same origin -response.addHeader("X-Frame-Options", "SAMEORIGIN"); - -// allow frames from specific uri -response.addHeader("X-Frame-Options", "ALLOW-FROM http://example.com"); - ----- - - -=== Confirmation - -It may sound simple but to protect against click jacking another -approach is to use +window.confirm()+ to notify the user of -the action they are about to perform. This is because it creates -a popup that cannot be framed and hidden by the attacker. - -=== Summary - -Click Jacking can be serious and cause carnage to users of your site. It is worth -taking some basic precautions when creating your site. - -[TIP] -==== -* Set the X-Frame-Options header to +DENY+ unless frames are needed for the site. -* Request user confirmation before attempting irreversible actions. -==== - - -== Cross site request forgery (CSRF/XSRF) - -=== Overview - -A Cross site request forgery (CSRF) attack leverages an authenticated -users existing session to issue commands on their behalf. This attack -generally involves some aspect of social engineering to get a user to click -on a malicious link on a third party site or email. The link is usually -specially crafted to execute business logic on a site for which the user -already has an authenticated session for. - -=== CSRF Token - -It is common for most web frameworks to include mechanism that creates a -unique CSRF token for each request. The CSRF attack is thwarted by this -mechanism as the attacker cannot spoof the random value. - - -Starting from Seam 2.2.1 you can add a CSRF token to user forms as follows. - -[source, html] ----- -<h:form> - <s:token/> - ... -</h:form> - ----- - -Python Flask-WTF forms have CSRF token protection enabled by default. You need -only remember to include the hidden tags in your form template. This will -include the random _csrf_token. - -[source, html] ----- -<form method="POST" action="/transfer"> - {{ form.hidden_tag() }} - <!-- Define the rest of form fields goes here --> - <button type="submit">Transfer funds</button> -</form> - ----- - -[IMPORTANT] -==== -The CSRF token must be sufficiently random and non deterministic. This can -be confirmed by tools like Stompy. Again you should *NOT* try and implement -your own CSRF mechanism. - -==== - - -=== Referrer Header Checks - -It is also difficult for an attacker to spoof the referrer header that -is sent by the browser in each request. It is therefore pertinent to -enable referrer checks within your web framework. These checks should -ensure that the request originated from the same origin as the website -executing the business logic. - -This technique can be effective but is not fool proof. Browsers and -proxies can be configured to strip the referrer header for privacy -reasons. It is therefore recommended to use this in conjunction with -CSRF tokens to counter this class of attack. - -If your framework does not include referrer checks you can add them -by comparing the schema, hostname and port of the web application -against the supplied referrer header. - -[source, python] ----- -# TODO (This is completely untested) -from functools import wraps -from urlparse import urlparse -from flask import request, abort, render_template, redirect -from forms import TransferForm -from app import app - -# Referrer check decorator. Checks the referrer -# against the configured SERVER_NAME for the webapp. -def referrer_check(f) - @wraps(f) - def decorated(*args, **kwargs): - url = urlparse(request.referrer) - if url.netloc and not(url.netloc == app.config['SERVER_NAME']): - return abort(400) - return decorated - -@referrer_check -@app.route('/transfer', methods=[GET, POST]) -def transfer_funds(): - form = TransferForm() - if form.validate_on_submit(): - # process form - pass - return redirect('/') - - # Render form to user - return render_template("transfer.html", form=form) - ----- - - -=== Summary - -CSRF attacks are common place but can be prevented by deploying a secure -random CSRF token on a per-request or per-session basis. When used in -conjunction with referrer header checks it is difficult for an attack -of this class to be successful. - -[TIP] -==== -* Enable a CSRF token for business logic. -* Ensure the CSRF token is non deterministic. -* Enable referrer header checks in your web framework. - -==== - -== Remote code execution - -=== Overview - -Remote code execution is usually the ultimate goal -of most attacks. In 1996 when the infamous _Smashing the -stack for fun and for profit_ article hit Phrack magazine -this was achieved via buffer overruns and remote injection -of shell code. However more modern garbage collected languages -aren't exempt from this category of attacks. There as still -many ways in which remote code can find its way into the -execution context of the application and cause unexpected -behaviours. This section covers some of the common -flaws in applications that can lead to remote code or command -execution. - -=== Unsafe use of Serialization - -Serialization in both the Java and Python language can lead -to malicious code execution. Technologies such as Java -RMI rely on serialization so care needs to be taken when defining -and deserializing objects that could've been exploited by a remote -attacker. - -==== When it comes to serialization consider practicing abstinence - -Generally speaking it is better to avoid serialization altogether and -fall back to a safer transport medium such as JSON to send messages -between services. JSON does not contain any features that would allow -an attacker to overwrite object code, and must be explicitly unpacked -to instantiate a remote object.. - -==== Control the serialization process - -If serialization is an absolute must then there are several things that -you need to consider when developing your class. - - * Mark sensitive fields as transient - * Use serialPersistentFields to restrict serialized state - * Implement readObject, writeObject, and readObjectNoData methods with - the following signatures: - - private void writeObject(java.io.ObjectOutputStream out) throws IOException; - - private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException; - - private void readObjectNoData() throws ObjectStreamException; - - * Selectively deserialize each field using readField rather than readObject - from the ObjectInputStream. - * Ensure that the class is declared as final or has a private constructor that - performs a security check with the security manager. - * Reduce privileges when deserializing objects from untrusted source - * Do not use public static nonfinal variables - * Always generate a unique serialization id for classes. - * Don't serialize instances of inner classes - -Even after taking these precautions it is still dangerous to -deserialize data that could be received from an external and -untrusted source. - - -=== Abuse of JSP Expression Language (EL) - -The Java Expression Language provides a mechanism to dynamically access -Bean methods in the current scope and request context. Unfortunately -this capability can be abused if untrusted user input is not correctly -validated. - -A simple example of this attack would be to bypass HttpOnly flag of a -session cookie by injecting the EL expression +${cookie["JSESSIONID"].value}+. - -[source,html] ----- -<!-- - Consider what happens when any of these values are supplied -for the parameter without server side validation. - http://example.com/?foo=${cookie["JSESSIONID"].value - or - http://example.com/?foo=${pageContext.request.getSession().setAttribute("admin", ture)} ---> - -... -<h:outputText value="${param.foo}" /> -... - ----- - -To check for instances of EL injection vulnerabilities in your application -you should try a sending a token value for each request parameter that you -can check for in the resulting pages. For example you may send +${"IF_WE_FIND_THIS_VALUE_BAD_THINGS_COULD_HAPPEN"}+. If a generic error message or exception is thrown -then chances are the field may also be vulnerable to injection also. - -A simple way to protect against EL injection is to properly sanitize -user controlled input. You should restrict all parameters using a -whitelist that does not include the characters '$#{}'. A defense in depth -approach will also restrict the capabilities of the the EL interpreter using -a Java security manager policy. - -.TODO - - Run this by SRT. - -=== Remote command execution - -Command injection occurs when user controlled input is passed -into a operating system command execution content or shell with -proper sanitization. - -==== Python command injection gotchas - -Python's subprocess module is somewhat impervious to command -injection however there are some use cases where unvalidated -user input could lead to a - -===== Injection is possible when shell=True - -Creating a subprocess in Python and setting the -shell setting to True can expose the application -to command injection attacks. If the application -does not escape or validate user input against a -secure whitelist of values an attacker may execute -multiple commands. For example. - -[source, python] ----- -def local_command_injection(cmd): - pipe = subprocess.PIPE - proc = subprocess.Popen([cmd], shell=True, stdin=pipe, stdout=pipe, stderr=pipe, close_fds=True) - proc.wait() - err = proc.stderr.read() - if err: - print(err) - else: - print(proc.stdout.read()) - - -# A contrived usage which constructs the command string without -# validating user input. -user_input = ";cat /etc/passwd" -vulnerable_command = "ls %s" % user_input -local_command_injection(vulnerable_command) - ----- - -Where possible constructing a subprocess using shell=True -should be avoided. If it must be used then caution -must be taken to escape user controlled content. - -.TODO - - Safe example - - -===== Injection is possible for commands run over ssh - -Similarly, care needs to be taken when constructing command -strings that would be executed on remote machines. The -following code snippet demonstrates how user controlled input -could easily be executed using the Parmiko SSH library. - -[source, python] ----- -def remote_command_injection(host, port, cmd): - user = getpass.getuser() - passwd = getpass.getpass('Enter password for %s: ' % user) - client = paramiko.SSHClient() - client.load_system_host_keys() - client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) - client.connect(host, username=user, password=passwd, port=port) - stdin, stdout, stderr = client.exec_command(cmd) - for line in stdout: - print '... ' + line.strip('\n') - - client.close() - -# A contrived usage which constructs the command string without -# validating user input. -user_input = ";cat /etc/passwd" -vulnerable_command = "ls %s" % user_input -remote_command_injection(vulnerable_command) - ----- - -To protect against this scenario it is necessary to either -escape user input using shlex.escape and/or use a whitelist -of allowed characters to restrict the user input. - -.TODO - - Safe example - - -==== Java command injection gotchas - -Java is at risk of command injection also. Again it comes back to -correctly sanitizing user input, and using a safe API where possible. -So instead of invoking something like +Runtime.getRuntime().exec(cmd + userArguments)+ -it would be better to use +ProcessBuilder+ to construct the command. -However all input that comes from an untrusted source should be validated -against a whitelist of safe characters that will not allow shell -escaping. - - -==== Explicit mapping of command arguments - -To further reduce the likelihood of command injection attacks you can -restrict command line arguments to a predefined subset of values that -the user may select by an enumerated value. This prevents passing -user controlled information directly to the command string. - -=== Summary - -It is difficult to construct applications that execute external commands -on the operating system. However if care is taken to limited the attack -surface and frequency of these types of calls then it is possible to -do it safely. - -The same care must be taken when leveraging serialization and expression language -features of Java. Whilst using these language features can make program development -easier, it security implications associated with these capabilities also needs -some consideration. - -[TIP] -==== -* Choose a safe serialization mechanism such as JSON. -* Avoid using shell=True for Python subprocess -* Sanitize user input against a safe subset of characters that cannot be used -to have a side effect. -* Restrict the external commands that can be executed by the application. -* Favour libraries and SDK's over external command execution. - -==== - - -== File system attacks - -=== Overview - -When accessing and manipulating file system objects there are several factors -that need to be considered. Python and Java are both cross platform environments and -the discretionary access controls provided by operating systems alone do not -always provide adequate protection against certain classes of attacks. - -Typically an attacker will exploit unrestricted file system access within an -application, inadequate file system permissions or time of check time of use (TOCTOU) -flaws within the application. All of these attacks can be mitigated by restricting -the scope of file system access and creating files in a way that reduces the -chances of race conditions occurring. - -=== Defeating path traversal - -A path traversal attack is when an attacker supplies input that is used -directly to access a file on the file system. The input usually attempts -to break out of the applications working directory and access a file elsewhere -on the file system. - -[source, java] ----- -// Contrived example of how user input may be used to -// access unintended system files. - -File getFile(String filename) throws IOException { - return new File(userInput); -} - -// oops -String userInput = "../../../../../../../../etc/passwd"; -File f = getFile(userInput); - ----- - -There are a couple of ways that this can be prevented. The first -explicitly restricts file access to a known safe directory, the other -is to only allow users to access files indirectly by using a enumerated -type to reference a particular known safe file. - -==== Limiting file system access to specific safe directory - -The key to preventing attackers from accessing external system files is -to limit access to the file system to a known safe directory. To do this -when the file name is directly supplied by user controlled input you *must* -process the file path in its canonical form. This means resolving all -directory switching and environment variables to get the absolute path -of the path string. You then should ensure that the absolute path -resides in the subset of paths that have the safe directory as the root. - - -Java provides the method +getCanonicalPath+ which will safely resolve -the absolute path based on the supplied input. This can then be used -to determine if the file resides within a safe directory. - -[source, java] ----- - -// This solution is suitable for the Java 1.6 and under. If you are -// using the Java 1.7 SDK you should consider the java.nio.file.Path -// methods to resolve paths, and startsWith options. - -boolean isSafeFilePath(String safeDir, String path) throws IOException { - return new File(path).getCanonicalPath().startsWith(safeDir); -} - -File getFile(path){ - if (isSafeFilePath("/var/www", userControlledInput)){ - return new File(userControlledInput); - } - throw IOException("Attempted path traversal"); -} - ----- - -A similar feat can be achieved using Python. In this example you have -the option of resolving symbolic links to ensure that they cannot be -used to escape the supplied base directory. - -[source,python] ----- -import os - -def is_safe_path(basedir, path, follow_symlinks=True): - - # resolves symbolic links - if follow_symlinks: - return os.path.realpath(path).startswith(basedir) - - return os.path.abspath(path).startswith(basedir) - ----- - - -==== Indirect file system object mapping - -Another approach to restricting file system access to maintain an -indirect mapping between a unique identifier and a file path that -exists on the operating system. This prevents users supplying -malicious input to access unintended files. - -[source,python] ----- - -localfiles = { - "01" : "/var/www/img/001.png", - "02" : "/var/www/img/002.png", - "03" : "/var/www/img/003.png", -} - -# Will raise an error if an invalid key is used. -def get_file(file_id): - return open(localfiles[file_id]) - ----- - -=== Safely creating temporary files and directories. - -On most systems the temporary directory provides a shared location that -can be used to create temporary files that can be purged periodically -or on system restart. This is beneficial for applications performing -some operation that may or may not succeed and to prevent leaving -dangling files all over the file system. - -However there is also the problem that this is infact a shared area. -This means that an attacker may premptively or actively exploit a -race condition to substitue a file for their own. Resulting in -the injection of untrusted content in your application, or reading or -writing of a file with escalated priviledges. - -TOCTOU attacks exist because programmers continually create files -in a shared directory with a predictable path and / or insufficient -priviledges. Both the Java(1.7) and Python programming environments provide -a API that will create a temporary file or directory in a secure manner. - - -[source, java] ----- -// Unfortunately prior to Java 1.7 there was no standard way to create a file -// with exlcusive write access and set the default permissions. Therefore even -// using +File.createTempFile+ to create a file with a random file name -// it does not ensure that the file was created exclusively -// with restrictive permissions and cannot be trusted. -// -// Java 7 contains features within the java.nio to securely create a -// temporary file atomically and set the permissions at the same time. - -import java.nio.file.FileSystems; - -// Securely creating a temporary file in Java 1.7 -import java.nio.file.Files; - -// Restrict read / write to current user only. -Set<PosixFilePermssions> perms = PosixFilePermissions.fromString("rw-------") - -String prefix = null; // use default -String suffix = null; // use default - -// Create a temporary file -Path file = Files.createTempFile(prefix, suffix, PosixFilePermissions.asFileAttributes(perms)); - -// Create a temporary directory -Path dir = Files.createTempDirectory(prefix, PosixFilePermissions.asFileAttributes(perms)); - ----- - -The Python solution is a little bit less verbose. - -[source, python] ----- -import tempfile - -# Securely creating a temporary file in Python -file = tempfile.mkstemp() - -# Securely creating a temporary directory in Python -dir = tempfile.mkdtemp() - ----- - -Whilst both these mechanisms are safe it is worth mentioning that -temporary file usage should also used sparingly where possible. - - -== XML attacks - -=== Overview - -XML is used extensively in Java EE, unfortunately it has serveral weak points -from a security perspective. Not all of these are faults of the programmer, some -of these are flaws in XML's design. - -=== Importance of schema validation - -XML like many topics covered previously in this document is also susceptable to -injection attacks. It is also prone to attacks focused on algorithmic exhautation -and denial of service. Both of these problems originate from problems in parsing -the XML content. - -There are generally two camps when it comes to XML parsers. -The first is a stream parser that interprets the XML code on the fly whilst maintaining -state around nesting tags and attributes. This event driven approach typically feeds -nodes to callback functions to yield values from the XML content. Without schema -validation this approach is susceptible to XML injection attacks. If an attacker -is able to inject a node into the document structure values can be overwritten -as the SAX parser will process the document on the fly. - -[source, xml] ----- - -<account> - <username>fred</username> - <roles> - <role>staff</role> - </roles> - - <!-- Consider what would happend if the - following user controlled input is supplied for nickname. - </nickname><roles><role>admin</role></roles><nickname>freddie - --> - <nickname> - {{ user_controlled_input }} - </nickname> -</account> - ----- - -The alternative approach is to make a full parse of the XML document and use a -document object model to represent the entire document. Without validation -and other checks this approach can be vulnerable to resource exhaustation -attacks. The XML document may have been maliciously contructed to exhaust the -stack limit or system memory to cause a denial of service of a remote -service. - -By validating the XML document against a known good DTD or schema, as well -as placing some common sense limits on the XML document size being processed -these types of attacks can be circumvented. - - - -[source, java] ----- - -SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); -Schema schema = schemaFactory.newSchema(new File("schema.xsd")); - -try { - schema.newValidator().validate(xmlContent); - // XML is in format defined by schema.xsd - -} catch (SAXException e){ - // XML is invalid. Do not try to process it any further. -} - - ----- - - -=== Defending XML entity attacks - -==== Malicious entity expansion - - -XML is susceptable to a denial of service attack through entity expansion. -The following is an example of the infamous billion laughs attack where it -uses entity recursion to expand a small XML document to a huge size. - - -[source, xml] ----- -<!-- billion lolz attack --> -<?xml version="1.0"?> -<!DOCTYPE lolz [ -<!ENTITY lol "lol"> -<!ELEMENT lolz (#PCDATA)> -<!ENTITY lol1 "&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;"> -<!ENTITY lol2 "&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;"> -<!ENTITY lol3 "&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;"> -<!ENTITY lol4 "&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;"> -<!ENTITY lol5 "&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;"> -<!ENTITY lol6 "&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;"> -<!ENTITY lol7 "&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;"> -<!ENTITY lol8 "&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;"> -<!ENTITY lol9 "&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;"> -]> -<lolz>&lol9;</lolz> ----- - -To protect against entity expansion in JAXP 1.3 you will need to turn on -the secure processing feature to set a limit for the DOM and SAX parsers. - - entityExpansionLimit = 64,000; - elementAttributeLimit = 10,000; - -However you will need to enable this feature explicitly: - -[source,java] ----- - SAXParserFactory spf = SAXParserFactory.newInstance(); - spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); ----- - -In JAXP 1.4 the secure processing feature is turned on by default. -You can also set these limits using system properties. For example -if you wanted to apply something more restrictive across the board -you could do start your process with the flag +-DentityExpansionLimit=10+ -or explicitly set it in your application: - -[source,java] ----- -System.setProperty("entityExpansionLimit", "10"); - ----- - - -==== Unauthorized file access through external entities - -Another way in which a XML entity tag can be abused is by accessing -local or remote content. - -[source,xml] ----- - -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE foo [ - <!ELEMENT foo ANY > - <!ENTITY xxe SYSTEM "file:///etc/passwd" >]> - <foo>&xxe;</foo> ----- - - -To prevent this class of attack you should use your own custom -resolver. - -[source, java] ----- - -public class RestrictedEntityResolver implements EntityResolver { - - private static final String EXTERNAL_ENTITY_DIR = "/usr/share/example/xml"; - - public InputSource resolveEntity(String publicId, String systemId) - throws SAXException, IOException { - - // Example restricting external entities to safe directory - String resolvedPath = new File(systemId).canonicalPath(); - if (resolvedPath.startsWith(EXTERNAL_ENTITY_DIR)){ - return new InputSource(resolvedPath); - } - - // Return empty InputSource which will cause malformed url exception - return new InputSource(); - - } -} - - -// The resolver can then be used with an XML reader to -// limit access to external entities. -SAXParser parser = spf.newSAXParser(); -XMLReader reader = parser.getXMLReader(); -reader.setEntityResolver(new RestrictedEntityResolver()); -reader.parse(new InputSource(input)); - ----- - - - -=== Detecting XML deserialization attacks - -.TODO - - http://blog.diniscruz.com/2013/08/using-xmldecoder-to-execute-server-side.html - - - -== Redirection attacks - -=== Overview - -It is common to redirect a user after form submission. However in -some cases developers achieve this by using a URL parameter that -could be manipulated by an attacker. An attacker may manipulate the -redirection URL to trick a victim into entering their username -and password to a fake login dialog. - -=== Validating redirects - -An example of how an attacker may exploit URL redirects: - https://www.example.com/login.php?next=http://attacker.com/phonylogin.php - -To counter this type of attack redirects need to be validated before -redirecting the user to an external site. Essentially -you should confirm that the redirection will take the user -to another page within your site. - -[source, java] ----- -static String safeRedirect(URI baseUrl, String target){ - - try { - - URI redirect = URI.create(target).normalize(); - - // Relative redirect - if (! redirect.isAbsolute()){ - return new URI(baseUrl.getScheme(), - baseUrl.getUserInfo(), - baseUrl.getHost(), - baseUrl.getPort(), - redirect.getPath(), - redirect.getQuery(), - redirect.getFragment()).normalize().toString(); - } - - // Assert that normalized URI hostname, port and scheme match - if (baseUrl.getHost().equals(redirect.getHost()) - ## baseUrl.getPort() == redirect.getPort() - ## baseUrl.getScheme().equals(redirect.getScheme())){ - - return redirect.toString(); - } - - } catch (Exception e){ - } - - // or Redirect to default base URL - return baseUrl.toString(); -} - - -String redirect = safeRedirect(URI.create("https://example.com"), request.getParameter("next")); -response.sendRedirect(redirect); - ----- - -=== Summary - -[TIP] -==== -* Validate all redirects performed by your web application -* Warn the user when redirecting them to a site outside the hosted web application. -==== - - -== SQL injection - -=== Overview - -SQL injection is a well known vulnerability that may be exploited when a programmer -does not safely construct a database query from user supplied data. This problem is -well known within industry yet it still has high incidence. - -A classic SQL injection may occur when concatenating or interpolating user input -when construction a query string as follows: - -[source, java] ----- - -// User controlled -String username = "admin' OR '1' ='1"; -String password = ""; - -boolean login(String username, String password){ - - // Constructing query string - String sql = "SELECT * FROM user where username='" - + username + "' and password='" + password + "'"; - - ResultSet rs = db.createStatement().executeQuery(sql); - return rs.next() != null; - -} - ----- - -To prevent this type of attack you should always use parameterised queries -and validate user input against a whitelist of safe characters. You should -*NEVER* construct a SQL query using concatenation or interpolation. - -=== Use JBDC Prepared statements - -When accessing a SQL database using JDBC it is essential that you use parameterized -queries. This prevents injection attacks as all parameters are safely escaped when -a value is set for them. A parameterized query means that placeholders are used -when declaring the initial SQL statement, these placeholders are then substituted -for a typesafe variable at runtime. - -[source, java] ----- -PreparedStatement findAllEmployeesByFirstName = null; - -try { - - // ? is the parameter that will be substituted - String queryString = "SELECT * FROM Employee WHERE firstName = ?"; - findAllEmployeesByFirstName = conn.prepareStatement(queryString); - - // The value for the parameter is explicitly set - findAllEmployeesByFirstName.set(1, userControlledInput); - - ResultSet rs = findAllEmployeesByFirstName.executeQuery(); - // Process results ... - -} catch (SQLException e){ - System.err.println(e.toString()); -} finally { - if (findAllEmployeesByFirstName != null){ - findAllEmployeesByFirstName.close(); - } -} - ----- - -Using a prepared statement in this way prevents injection as each parameter -is escaped when constructing the query string. It also provides an element -of type safety to ensure that supplied parameters are of the correct type. - - -=== Use JPA named queries - -The Java Persistence API provides a similar mechanism for creating parameterized -queries. The best practice is to use named queries to restrict the way in which -the database may be accessed. It also prevents dynamic construction of query strings. - -[source,java] ----- -// Parameter :firstname will be safely escaped in this query. -@Entity -@NamedQuery( - name="findAllEmployeesByFirstName", - queryString="SELECT OBJECT(emp) FROM Employee emp WHERE emp.firstName = :firstname" -) -public final class Employee implements Serializable { -... -} - -Query queryEmployeesByFirstName = em.createNamedQuery("findAllEmployeesByFirstName"); -queryEmployeesByFirstName.setParameter("firstname", userInput); -Collection employees = queryEmployeesByFirstName.getResultList(); - ----- - -In a similar fashion to JDBC parameterized queries using named parameters will -prevent SQL injection and is the preferred approach over dynamically generating -queries by concatenating user input. - - -=== Stored Procedures -.TODO - - Decide if I want to keep /add this.. - -=== Summary - -SQL injection can be easily avoided by using safer libraries and frameworks to -access the database. All user input should be properly sanitized before constructing -SQL statements from it. - - -[TIP] -==== - * Beware string concatenation and interpolation - * Use prepared statements in JDBC - * Hibernate and JPA - * Stored procedures - * Use SQLAlchemy in Python - -==== -== Session management - -=== Overview - -Attackers commonly attempt to exploit the improper use and protection of -session identifiers. Deploying and using sessions correctly is therefore -essential to securing your web application. - -=== Session Fixation - -Session fixation occurs when an attacker supplies an valid session identifier -to a user and tricks them into authenticating that session when they login. -To prevent this class of attack you need to ensure that a new session identifier -is generated for each logon. Any supplied session identifier should be discarded. - -=== Session Lifecycle - -The lifetime of sessions needs to be tightly managed. A session should have an -expiry and idle timeout. Ensure that your +web.xml+ sets a +session-timeout+ for -Java EE applications. It is also vital to invalidate a session when a user logs out. -Ensure that +session.invalidate()+ is called in all places where the user can -logout of the application. - -=== Insecure session identifiers - -A session identifier must be non-deterministic, bound to client -properties, and provide non-repudiation. If the session identifier -does not possess these qualities it may be subject to a number of -attack vectors. - -If for example an web application uses an incremental number to -maintain state for each client then it is trivial for an attacker -to simply guess the correct session identifier to impersonate -a user. You should always use the session management mechanism provided by -your application container rather than using your own implementation. - -If you are using client side sessions then should be digitally -signed on the server to ensure that a malicious attacker cannot -tamper with session information in a request. This is not a common -approach in the JavaEE applications however it is common in Python. -An additional technique is to bind a session to client properties -such as the user agent. This can be useful in detecting anomalies -in the middle of an established session and acting accordingly however -it is more of an obstacle for an attack not a prevention mechanism. - - -=== Insecure transmission of session data - -This has already been touched on in the <<_session_hijacking, session hijacking>> -section. To reiterate the main points: - - * Session data should *ALWAYS* be transmitted over a secure channel. - * Session data should *NEVER* be passed in the URL as a HTTP parameter. - * Session data should not be accessible via client side scripts. - -=== Summary - -Most web containers if up to date should have a pretty solid session management -capabilities built in so it is essential that they are deployed and utilized -correctly. - -[TIP] -==== -- Ensure your session identifier is sufficiently random -- Ensure session data cannot be tampered with on the client side. -- Ensure session tokens are only sent over a secure - -==== - - -== Input validation - -=== Overview - -The majority of attacks covered in this guide can be traced back to the -unsafe processing and use of user input. This section intends to focus on the -merits of having a strong input validation ethos in your web application -development projects. Applications need to set stringent guidelines that -dictate on what terms data may cross a trust boundary and become part of -the application state. - -=== Whitelists and Blacklists - -A blacklist can be used to filter input by trying to filter out or reject -input that contains banned characters. This may be implemented as a -regular expression or just a list of banned character sequences. - -[source,java] ----- - -// NOTE: A case is intentionally missed in this list -private static final PATH_BLACKLIST = "^.*[./].*$"; - -String input = "../../../../../../../../etc/passwd"; -if (input.matches(PATH_BLACKLIST)){ - // ERROR reject input - throw new InvalidInputException(input); -} - -// Do something with input ----- - -The trouble with blacklists as is demonstrated in the code snippet above -is that the list may miss a corner case that allows a protected code path -to still be executed. (The blacklist in the example above does not include -a path separator character for the Windows platform). A much safer approach -is to flip the usage to define what constitutes safe input and reject everything -else. For instance if you are expecting a value for a phone number you might -restrict input to 10 digits. - -[source,java] ----- - private static final PHONE_NUMBER_WHITELIST = "^\d{10}$+"; - if (input.matches(PHONE_NUMBER_WHITELIST)){ - // Valid input continue processing - return; - } - - // All other cases are rejcted as invalid - throw new InputInputException(input); - ----- - -=== Form validation - -==== Seam validation framework - -http://docs.jboss.org/seam/latest/reference/html/validation.html - -=== GWT validation - -http://www.gwtproject.org/doc/latest/DevGuideValidation.html - -==== Python WTForms - -The wtforms module comes with several default validators that can -be used to ensure that invalid form data is rejected. - -[options="headers"] -|=== -| Validator | Description - -| Required -| Ensures that data has been provided for this form field. - -| Email -| Ensures the form field is a valid email address. - -| EqualTo -| Ensures that the value of this form field equals the value supplied -for another form field. This is useful for confirmation fields. - -| IPAddress -| Ensures that the form field is a valid IP address (either ipv4 or ipv6). - -| Length -| Limits the input for the field to a specific length range. - -| MacAddress -| Expects the form field to contain a valid mac address. - -| NumberRange -| Expects the form field contain a value within a specific number range. - -| Regexp -| Allows you to specify a regular expression. Useful for specifying -a whitelist to validate user information. - -| URL -| Expects a valid URL in the form field. - -| UUID -| Expects a valid UUID to be specifiied in the form field. - -| AnyOf -| Expects the form field to contain a value matchin any of a values -in the supplied list. - -| NoneOf -| Expects that the form field won't match any value in the supplied list -of values. - -|=== - -When defining a form using wtforms you should always ensure that the -validation rules mirror the restrictions that are in place for the -database. For example a MySQL schema requires hard limits on VARCHAR -columns, so the corresponding form field should use the +Length+ validator -to enforce that limitation. - -Custom validation is also possible with wtforms. This can be achieved by -implementing a +validate_x+ method in your form class where +x+ is the -name of a form field to validate. You can also implement inline checks. - -[source, python] ----- - -# A custom validator that checks password strength -def password_strength_check(form, field): - """ password must contain of uppercase, lowercase, digit and symbol """ - return \ - any((sym in string.ascii_uppercase) for c in field.data) and - any((sym in string.ascii_lowercase) for c in field.data) and - any((sym in string.digits) for c in field.data) and - any((sym in """!@#$%^#*()-_+={}[]\|;:'"/?.>,<`~""".split()) for c in field) - - -# Form definition for user registration. -class RegisterForm(RedirectForm): - - # Name field has validators to restrict length, and restricted to - # have only characters that are valid for a persons name. - name = TextField('Name', - [ - Required(), - Regexp(whitelists.IDENTITY_WHITELIST), - Length(min=3, max=constants.MAX_NAME_LENGTH) - ]) - - # Using default email validator along with length restrictions. - email = TextField('Email address', - [ - Required(), - Email(), - Length(max=constants.MAX_EMAIL_LENGTH) - ]) - - # Password field has a restricted minimum length - # and also uses a custom validator (password_strength_check) - # to check the password complexity. - password = PasswordField('Password', - [ - Required(), - Length(min=constants.MIN_PASSWORD_LENGTH, max=constants.MAX_PASSWORD_LENGTH), - password_strength_check - ]) - - # Confirmation validator is used to make sure - # password entered matches. - confirm = PasswordField('Repeat Password', - [ - Required(), - EqualTo('password', message="Passwords must match") - ]) - ----- - - -=== Database validation - -==== Input validation with Hibernate - - * Database Java - Hibernate validation - -==== Input validation with SQLAlchemy - -Input validation can also be enforced at the database layer -of your application. SQLAlchemy includes a validates decorator -that can be used in your ORM definition. - -[source, python] ----- - -from sqlalchemy.orm import validates -... - -class User(Base): - id = Column(Integer, primary_key=True) - email = Column(String) - #... - - # Custom email validation for the supplied field. - @validates('email') - def validate_email(self, key, address): - assert '@' in address - return address - - ----- - -=== Validating data exchange formats - -==== JSON schema validation - -JSON is a dominant format for interacting with RESTful API's. An effort to introduce -a standard form of schema validation link:http://json-schema.org/examples.html[is underway]. - -The link:https://github.com/Julian/jsonschema[jsonschema] module -implements full support of Draft3 and Draft4 of the standard. -It can be used to enforce type safety and input validation -and is recommended for defining and checking API entrypoints -for any RESTful web services. - -[options="header"] -|=== -| Validator | Description | Works on - -|multipleOf -|Expects a number which is a multiple of the -supplied constraint. - -+jsonschema.validate(32, {"multipleOf", 2})+ - -| +number+ - -|maximum and exclusiveMaximum -|Sets a maximum value for a number field. -+jsonschema.validate(101, {"maximum", 100})+ -| +number+ - -|minimum and exclusiveMinimum -|Sets a minimum value required for a number field. -+jsonschema.validate(0, { "minimum", 21})+ -| +number+ - -|maxLength -|Checks that the supplied string is at most N characters -long. +jsonschema.validate("The F word", {"maxLength": 4}) -| +string+ - -|minLength -|Checks that the supplied string is at least N characters -long. +jsonschema.validate("foo", {"minLength" : 6 })+ -| +string+ - -|pattern -|Validate using a regular expression in ECMA 262 format. -+jsonschema.validate("aardvark", {"pattern" : "^aa.*$" })+ -| +string+ - -|additionalItems and items -| The +items+ validator allows you to apply validation rules -over an entire array. This may be to ensure that each item -is of a specific type or only a subset of values. The additionalItems -allows the array to contain supplementary values to be included -at the end of the array. - -This would fail validation as it contains an additional -entry over the defined schema. - -+jsonschema.validate([1, 2, "This is a string"], { - "items" : [ - { "type" : "number" }, - { "type" : "number" } - ] - })+ - -To allow additional data at the end of the -array you need to specify +additionalData = True+. - -| +array+ - -|maxItems -|Sets a hard limit on the maximum number of items that can be -supplied. -+jsonschema.validate([1, 2, 3], { "maxItems" : 3 })+ -| +array+ - -|minItems -|Sets a hard limit on the minumum number of items that can be -supplied. -+jsonschema.validate([1, 2, 3], { "minItems" : 1 })+ -| +array+ - -|uniqueItems -|True of false value to indicate that all items in the array must -be unique. -+jsonschema.validate([1, 2, 2], { "uniqueItems" : true }) -| +array+ - -|maxProperties -|Validates that an object has at most N properties. -+jsonschema.validate({'name' : 'bob', 'age' : 21 }, { "maxProperties" : 2 })+ -| +object+ - -|minProperties -|Validates that an object has at least N properties. -+jsonschema.validate({'name' : 'bob', 'age' : 21 }, { "minProperties" : 2 })+ -| +object+ - -|required -|Dictates which properties an object must possess. Should be specified as -a list of objects. - -+jsonschema.validate({ 'firstname' : 'bob', 'lastname' : 'marley' }, { 'required' : ['firstname', 'lastname']})+ -|+object+ - -|additionalProperties, properties and patternProperties -| Checks an object for the supplied properties. A property name -may be matched by a pattern or explicitly. The additionalProperties -attribute can restrict or allow additional properties to exist within -the object. -| - - -|dependencies -| -| - -|enum -| -| - -|type -|Defines the basic types that instances can take. -* object -* array -* string -* number -* boolean -* null -* any -+jsonschema.validate("foo", { "type" : "string" })+ -| +any+ - -|allOf -|Provides a list of schema's that a value must adhere to. -It is a way to separate schema's into separate definitions -and use all of them to validate a value. -+jsonschema.validate("foo", { - "allOf" : [ - { "title" : "first schema", "type" : "string"}, - { "title": "second schema", "minLength" : 3 } - ]})+ -| +any+ - -|anyOf -|Requires that at least one of the provided schema's apply -to the value being validated. -+jsonschema.validate("foo", { - "anyOf" : [ - { "title" : "first schema", "type" : "string"}, - { "title": "second schema", "minLength" : 5 } - ]})+ -| +any+ - - -|oneOf -|Requires that *EXACTLY* one of the provided schema's -apply to the value being validated. - -+jsonschema.validate("foo", { - "oneOf" : [ - { "title": "[on]", "properties": { "status" : {"enum" : [True]} }}, - { "title": "[off]", "properties": { "status" : {"enum" : [False]} }} - ]})+ -|+any+ - - -|not -|Negates the validation result of the supplied schema. -+jsonschema.validate(1, { "not" : { "type" : "number" } })+ -|+any+ - - -|format -| There are several useful built-in format verification -attributes that can be applied to a value. These include: -* date-time -* email -* hostname -* ipv4 -* ipv6 -* uri - -+jsonschema.validate("user@example.com", {"format", "email"})+ -| +string+ - - -|=== - -Bringing all of this together allows you to safely define -a the constraints and expectations around your API usage. -When the schema is defined it dramatically reduces the -complexity associated with validating an inbound request. - -[source, python] ----- -def validate_person(data): - - # Could externally define and document - # expected request format for each API call - Person = { - "properties": { - "firstname" : { - "type" : "string", - "minLength" : 2, - "pattern" : "^[A-Za-z]+$" - }, - "lastname" : { - "type" : "string", - "minLength : 2, - "pattern" : "^[A-Za-z]+$" - }, - "age" : { - "type" : "number", - "minimum" : 0, - "maximum" : 150, - }, - additionProperties : False - } - } - return jsonschema.validate(data, Person) - - -@app.route("/person", methods=["POST"]) -def create_person(): - - if not request.json: - return abort(400) - - try: - validate_person(request.json) - id = save_person(request.json) - return jsonify(status="success", id=id) - - except Exception as e: - return jsonify(status="error", message=str(e)), 400 - ----- - - - -==== XML schema validation - -The <<_importance_of_schema_validation,importance of XML schema validation>> -has already been touched on in this guide. To summarize you should explicitly -validate XML input against a xsd to ensure it is a valid document. - - -=== Summary - -Input validation should be considered a high priority activity -when developing web applications. Having strict constraints on the -type of input that can cross a trust boundary will help prevent -applications being exploited by attackers. - -You should try to identify your applications attack surface and -ensure that all input that comes from an external source is correctly -validated before allowing your application to interact with it. - -[TIP] -==== -* Validate all fields when processing user forms -* Ensure the database constraints are protected by input validation -* Validate all input at API boundaries -* Use whitelists to define what input is valid and reject everything else. -==== - - -== Output escaping and encoding - - * Safely escaping and encoding - -== Authentication and Authorization - - * JAAS - * JBoss declarative security - * Federated authentication - * LDAP authentication - * Kerberos authentication - -== Deployment issues - - * Incorrectly configured TLS and keystores - * Deploying using known vulnerable artifacts - * Beward the risks of embedded dependencies -=== - - -=== Environment Hardening - -A good defensive strategy for command or code injection is to -reduce the attack surface and limit exposure of the application -as much as possible. - - * Linux containers and SELinux - * Java security policy - -=== Summary - -.TODO - - Insert summary here. - - -== Verifying application correctness - - * OWASP application verification standard. - -== Supporting libraries # tools - - * OWASP ESAPI - * OWASP AntiSammy - * OWASP CSRF Guard Project - * Picketbox - * Apache Santuario - * Apache Shiro - * Bouncy Castle - * Checker framework (@Tainted) - * Google Guava Libraries - - Using and avoiding null - - Preconditions - - Immutable Collections - * Java Simplified Encryption - jasypt - * Coverity security library - https://github.com/coverity/coverity-security-library - * Coverty scanner - * Findbugs - * Web application firewall - * - - - - diff --git a/en-US/images/icon.svg b/en-US/images/icon.svg deleted file mode 100644 index c471a60..0000000 --- a/en-US/images/icon.svg +++ /dev/null @@ -1,3936 +0,0 @@ - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - id="path2858" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/en-US/schemas.xml b/en-US/schemas.xml deleted file mode 100644 index 28b4476..0000000 --- a/en-US/schemas.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/publican.cfg b/publican.cfg deleted file mode 100644 index 10f699a..0000000 --- a/publican.cfg +++ /dev/null @@ -1,10 +0,0 @@ -xml_lang: en-US -brand: fedora -chunk_section_depth: 3 -#product: Defensive_Coding -#mainfile: Defensive_Coding -#docname: Defensive_Coding -web_version_label: UNUSED -version: 1 -#git_branch: eng-docs-rhel-6 -doc_url: https://gitlab.com/redhat-sectech/defensive-coding-guide diff --git a/schemas.xml b/schemas.xml deleted file mode 100644 index 7d50b63..0000000 --- a/schemas.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - -