summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSumit Bose <sbose@nb.localdomain>2008-10-09 12:20:09 +0200
committerSumit Bose <sbose@nb.localdomain>2008-10-09 12:20:09 +0200
commit3fdccfc21786437f93623a6bb62d1a9e80a5c2b3 (patch)
treed723b881254b31925497ec1d2f4513429900707c
parent94fec89320e4420fddad4c934876352c3452f97c (diff)
downloadipa_policy-3fdccfc21786437f93623a6bb62d1a9e80a5c2b3.tar.gz
ipa_policy-3fdccfc21786437f93623a6bb62d1a9e80a5c2b3.tar.xz
ipa_policy-3fdccfc21786437f93623a6bb62d1a9e80a5c2b3.zip
finished sudoers.xslt
-rw-r--r--sudoers/sudoers.xslt172
1 files changed, 157 insertions, 15 deletions
diff --git a/sudoers/sudoers.xslt b/sudoers/sudoers.xslt
index f33fc10..f767335 100644
--- a/sudoers/sudoers.xslt
+++ b/sudoers/sudoers.xslt
@@ -32,14 +32,12 @@
</xsl:template>
<xsl:template match="sudoers:sudoers">
-
<xsl:variable name="name">
<xsl:apply-templates select="sudoers:subject">
</xsl:apply-templates>
</xsl:variable>
- <xsl:apply-templates>
- <!-- <xsl:apply-templates select="sudoers:command"> -->
+ <xsl:apply-templates select="sudoers:command|sudoers:option">
<xsl:with-param name="name" select="$name"/>
</xsl:apply-templates>
</xsl:template>
@@ -54,7 +52,143 @@
</xsl:template>
<xsl:template match="sudoers:option">
- <xsl:text># found an option &#xA;&#xA;</xsl:text>
+ <xsl:param name="name"/>
+ <xsl:text>Default</xsl:text>
+ <xsl:choose>
+ <xsl:when test="$name = 'ALL'">
+ <xsl:text> </xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>:</xsl:text>
+ <xsl:value-of select="$name"/>
+ <xsl:text> </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:for-each select="*">
+ <xsl:choose>
+ <!-- boolean options -->
+ <xsl:when test="name()='always_set_home' or
+ name()='authenticate' or
+ name()='env_editor' or
+ name()='env_reset' or
+ name()='fqdn' or
+ name()='ignore_dot' or
+ name()='ignore_local_sudoers' or
+ name()='insults' or
+ name()='log_host' or
+ name()='log_year' or
+ name()='long_otp_prompt' or
+ name()='mail_always' or
+ name()='mail_badpass' or
+ name()='mail_no_host' or
+ name()='mail_no_perms' or
+ name()='mail_no_user' or
+ name()='noexec' or
+ name()='path_info' or
+ name()='passprompt_override' or
+ name()='preserve_groups' or
+ name()='requiretty' or
+ name()='root_sudo' or
+ name()='rootpw' or
+ name()='runaspw' or
+ name()='set_home' or
+ name()='set_logname' or
+ name()='setenv' or
+ name()='shell_noargs' or
+ name()='stay_setuid' or
+ name()='targetpw' or
+ name()='tty_tickets'
+ ">
+ <xsl:if test=". = 'off'">
+ <xsl:text>!</xsl:text>
+ </xsl:if>
+ <xsl:value-of select="name()"/>
+ </xsl:when>
+
+ <!-- integer option -->
+ <xsl:when test="name()='passwd_tries'" >
+ <xsl:value-of select="name()"/>
+ <xsl:text>=</xsl:text>
+ <xsl:value-of select="."/>
+ </xsl:when>
+
+ <!-- integer/booleans option, we handle them like integers -->
+ <xsl:when test="name()='loglinelen' or
+ name()='passwd_timeout' or
+ name()='timestamp_timeout' or
+ name()='umask'
+ ">
+ <xsl:value-of select="name()"/>
+ <xsl:text>=</xsl:text>
+ <xsl:value-of select="."/>
+ </xsl:when>
+
+ <!-- string options -->
+ <xsl:when test="name()='badpass_message' or
+ name()='editor' or
+ name()='mailsub' or
+ name()='noexec_file' or
+ name()='passprompt' or
+ name()='role' or
+ name()='runas_default' or
+ name()='syslog_badpri' or
+ name()='syslog_goodpri' or
+ name()='timestampdir' or
+ name()='timestampowner' or
+ name()='type'
+ ">
+ <xsl:value-of select="name()"/>
+ <xsl:text>="</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>"</xsl:text>
+ </xsl:when>
+ <!-- string/boolean options -->
+ <xsl:when test="name()='exempt_group' or
+ name()='lecture' or
+ name()='lecture_file' or
+ name()='listpw' or
+ name()='logfile' or
+ name()='mailerflags' or
+ name()='mailerpath' or
+ name()='mailto' or
+ name()='syslog' or
+ name()='verifypw'
+ ">
+ <xsl:choose>
+ <xsl:when test=".='off'">
+ <xsl:text>!</xsl:text>
+ <xsl:value-of select="name()"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="name()"/>
+ <xsl:text>="</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>"</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+
+ <!-- list/boolean options -->
+ <xsl:when test="name()='env_check' or
+ name()='env_delete' or
+ name()='env_keep'
+ ">
+ <xsl:choose>
+ <xsl:when test=".='off'">
+ <xsl:text>!</xsl:text>
+ <xsl:value-of select="name()"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="name()"/>
+ <xsl:text>="</xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>"</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ <xsl:text>&#xA;</xsl:text>
</xsl:template>
<xsl:template match="sudoers:command">
@@ -68,15 +202,16 @@
</xsl:variable>
<xsl:value-of select="$name"/>
- <xsl:text>=</xsl:text>
+ <xsl:text> ALL = </xsl:text>
<xsl:if test="$runas != ''">
<xsl:text>(</xsl:text>
<xsl:value-of select="$runas"/>
- <xsl:text>)</xsl:text>
+ <xsl:text>) </xsl:text>
+ </xsl:if>
+ <xsl:if test="$tag != ''">
+ <xsl:value-of select="$tag"/>
+ <xsl:text> </xsl:text>
</xsl:if>
- <xsl:text> </xsl:text>
- <xsl:value-of select="$tag"/>
- <xsl:text> </xsl:text>
<xsl:value-of select="$command"/>
<xsl:text>&#xA;</xsl:text>
</xsl:template>
@@ -86,14 +221,21 @@
<xsl:param name="type"/>
<xsl:choose>
- <xsl:when test="$type = 'netgroup'">
- <xsl:text>+</xsl:text>
- </xsl:when>
- <xsl:when test="$type = 'posixGroup'">
- <xsl:text>%</xsl:text>
+ <xsl:when test="$type = 'ALL'">
+ <xsl:text>ALL</xsl:text>
</xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$type = 'netgroup'">
+ <xsl:text>+</xsl:text>
+ </xsl:when>
+ <xsl:when test="$type = 'posixGroup'">
+ <xsl:text>%</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:value-of select="$name"/>
+ </xsl:otherwise>
</xsl:choose>
- <xsl:value-of select="$name"/>
</xsl:template>
<xsl:template name="format_tag">