source: BLFS/xsl/process-replaceable.xsl@ 83cfe91

trunk
Last change on this file since 83cfe91 was 816fa9f5, checked in by Pierre Labastie <pierre.labastie@…>, 14 months ago

Fix automatic user password in mit-kerberos

There are two problems:

  • "mypw" is in a dictionary of forbidden passwords
  • "-pw" cannot be after the login name when running "addprinc"

change automatic password to "lupw"
change order of replacement of "loginname"

  • Property mode set to 100644
File size: 7.0 KB
RevLine 
[96d7e44]1<?xml version="1.0" encoding="ISO-8859-1"?>
2
3<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 version="1.0">
5
6<!--===================================================================-->
7 <!-- Localization in the form ll_CC.charmap@modifier (to be used in
8 bash shell startup scripts). ll, CC, and charmap must be present:
9 no way to use "C" or "POSIX". -->
10 <xsl:param name="language" select="'en_US.UTF-8'"/>
11
12 <!-- Break it in pieces -->
13 <xsl:variable name="lang-ll">
14 <xsl:copy-of select="substring-before($language,'_')"/>
15 </xsl:variable>
16 <xsl:variable name="lang-CC">
17 <xsl:copy-of
18 select="substring-before(substring-after($language,'_'),'.')"/>
19 </xsl:variable>
20 <xsl:variable name="lang-charmap">
21 <xsl:choose>
22 <xsl:when test="contains($language,'@')">
23 <xsl:copy-of
24 select="substring-before(substring-after($language,'.'),'@')"/>
25 </xsl:when>
26 <xsl:otherwise>
27 <xsl:copy-of select="substring-after($language,'.')"/>
28 </xsl:otherwise>
29 </xsl:choose>
30 </xsl:variable>
31 <xsl:variable name="lang-modifier">
32 <xsl:choose>
33 <xsl:when test="contains($language,'@')">
34 <xsl:copy-of select="concat('@',substring-after($language,'@'))"/>
35 </xsl:when>
36 <xsl:otherwise>
37 <xsl:copy-of select="''"/>
38 </xsl:otherwise>
39 </xsl:choose>
40 </xsl:variable>
41<!-- end of language variables -->
42
43<!--===================================================================-->
44<!-- to be used at places where we need the domain- or host- name -->
45 <xsl:param name="fqdn" select="'belgarath.example.org'"/>
46
47<!-- make various useful variables -->
48 <xsl:variable name="hostname" select="substring-before($fqdn,'.')"/>
49 <xsl:variable name="domainname" select="substring-after($fqdn,'.')"/>
50 <xsl:variable name="DOMAINNAME" select="translate($domainname,
51 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
52<!-- end of host/domain name variables -->
53
[30732c6a]54<!--===================================================================-->
55<!-- keyboard layout for the gdm page (as of BLFS 9.0) -->
56 <xsl:param name="xkblayout" select="'us'"/>
57
[96d7e44]58<!--===================================================================-->
59<!-- the main template: to be adjusted depending on the book -->
60 <xsl:template match="replaceable">
61 <xsl:choose>
62<!-- When adding a user to a group, the book uses "username" in a replaceable
63 tag. Replace by the user name only if not running as root -->
64 <xsl:when test="contains(string(),'username') and $sudo='y'">
65 <xsl:text>$USER</xsl:text>
66 </xsl:when>
67<!-- The next three entries are for gpm. I guess those settings are OK
68 for a laptop or desktop. -->
69 <xsl:when test="contains(string(),'yourprotocol')">
70 <xsl:text>imps2</xsl:text>
71 </xsl:when>
72 <xsl:when test="contains(string(),'yourdevice')">
73 <xsl:text>/dev/input/mice</xsl:text>
74 </xsl:when>
75 <xsl:when test="contains(string(),'additional options')"/>
76<!-- the book has four fields for language. The language param is
77 broken into four pieces above. We use the results here. -->
78 <xsl:when test="contains(string(),'&lt;ll&gt;')">
79 <xsl:copy-of select="$lang-ll"/>
80 </xsl:when>
81 <xsl:when test="contains(string(),'&lt;CC&gt;')">
82 <xsl:copy-of select="$lang-CC"/>
83 </xsl:when>
84 <xsl:when test="contains(string(),'&lt;charmap&gt;')">
85 <xsl:copy-of select="$lang-charmap"/>
86 </xsl:when>
87 <xsl:when test="contains(string(),'@modifier')">
88 <xsl:copy-of select="$lang-modifier"/>
89 </xsl:when>
[30732c6a]90<!-- keyboard layout for X/waylang (only GDM as of BLFS-9.0) -->
91 <xsl:when test="contains(string(),'layout')">
92 <xsl:copy-of select="$xkblayout"/>
93 </xsl:when>
[96d7e44]94<!-- At several places, the number of jobs is given as "N" in a replaceable
95 tag. We either detect "N" alone or &lt;N&gt; Replace N with 4. -->
96 <xsl:when test="contains(string(),'&lt;N&gt;') or string()='N'">
97 <xsl:text>4</xsl:text>
98 </xsl:when>
99<!-- Mercurial config file uses user_name. Replace only if non root.
100 Add a bogus mail field. That works for the proposed tests anyway. -->
101 <xsl:when test="contains(string(),'user_name') and $sudo='y'">
102 <xsl:text>$USER ${USER}@mail.bogus</xsl:text>
103 </xsl:when>
104<!-- Use the config for Gtk+3 as is -->
[38dd3c3]105 <xsl:when test="ancestor::sect1[@id='gtk3' or @id='gtk4']">
[96d7e44]106 <xsl:copy-of select="string()"/>
107 </xsl:when>
108<!-- Give 1Gb to fop. Hopefully, nobody has less RAM nowadays. -->
109 <xsl:when test="contains(string(),'RAM_Installed')">
110 <xsl:text>1024</xsl:text>
111 </xsl:when>
112<!-- for MIT-Kerberos config file -->
113 <xsl:when test="string()='&lt;EXAMPLE.ORG&gt;'">
114 <xsl:copy-of select="$DOMAINNAME"/>
[b39f283]115 <xsl:if test="contains(preceding-sibling::text()[1],'kdb5_util')">
116 <xsl:text> -P rtpw </xsl:text>
117 </xsl:if>
[96d7e44]118 </xsl:when>
119 <xsl:when test="string()='&lt;example.org&gt;'">
120 <xsl:copy-of select="$domainname"/>
121 </xsl:when>
122 <xsl:when test="string()='&lt;belgarath.example.org&gt;'">
123 <xsl:copy-of select="$fqdn"/>
124 </xsl:when>
125<!-- in this case, even root can be used -->
126 <xsl:when test="string()='&lt;loginname&gt;'">
[b39f283]127 <xsl:if test="contains(preceding-sibling::text()[1],'-policy')">
[816fa9f5]128 <xsl:text>-pw lupw </xsl:text>
[b39f283]129 </xsl:if>
[816fa9f5]130 <xsl:text>$USER</xsl:text>
[b39f283]131 <xsl:if test="contains(preceding-sibling::text()[1],'kinit')">
132 <xsl:text> &lt;&lt; PASS_EOF
[816fa9f5]133lupw
[b39f283]134PASS_EOF
135</xsl:text>
136 </xsl:if>
[96d7e44]137 </xsl:when>
[45f82b13]138<!-- for xorg environment. Note that libreoffice too uses &lt;PREFIX&gt; -->
139 <xsl:when test="string()='&lt;PREFIX&gt;' and
140 ancestor::sect1[@id='xorg-env']">
141 <xsl:text>/usr</xsl:text>
142 </xsl:when>
[1c22535]143<!-- for libreoffice. Note that xorg environment too uses &lt;PREFIX&gt; -->
144 <xsl:when test="string()='&lt;PREFIX&gt;' and
145 ancestor::sect1[@id='libreoffice']">
146 <xsl:text>/opt/</xsl:text>
147 <xsl:value-of select="ancestor::sect1/@xreflabel"/>
148 </xsl:when>
149<!-- for abiword -->
150 <xsl:when test="string()='&lt;lang&gt;'">
151 <xsl:choose>
152 <xsl:when test="starts-with($language,'en_US')">
153 <!-- normal.awt for en_US is already there, copy
154 the one for en_GB (could be any other) -->
155 <xsl:text>en_GB</xsl:text>
156 </xsl:when>
157 <xsl:otherwise>
158 <!-- in general, there are normal.awt-ll_CC files-->
159 <xsl:copy-of select="$lang-ll"/>
160 <xsl:text>_</xsl:text>
161 <xsl:copy-of select="$lang-CC"/>
162 </xsl:otherwise>
163 </xsl:choose>
164 </xsl:when>
[96d7e44]165 <xsl:otherwise>
166 <xsl:text>**EDITME</xsl:text>
167 <xsl:apply-templates/>
168 <xsl:text>EDITME**</xsl:text>
169 </xsl:otherwise>
170 </xsl:choose>
171 </xsl:template>
172
173 <xsl:template match="replaceable" mode="root">
174 <xsl:apply-templates select="."/>
175 </xsl:template>
176
177</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.