markt       2004/05/22 13:43:35

  Modified:    .        tomcat.nsi
  Log:
  Fix bug 15798. Install fails if '&' appears in admin user name or password.
  Ported from TC4.
  
  Revision  Changes    Path
  1.45      +25 -2     jakarta-tomcat-5/tomcat.nsi
  
  Index: tomcat.nsi
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-5/tomcat.nsi,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- tomcat.nsi        25 Apr 2004 12:35:55 -0000      1.44
  +++ tomcat.nsi        22 May 2004 20:43:35 -0000      1.45
  @@ -22,6 +22,8 @@
     VIProductVersion @[EMAIL PROTECTED]
   
   !include "MUI.nsh"
  +!include "StrFunc.nsh"
  +${StrRep}
   
   ;--------------------------------
   ;Configuration
  @@ -426,9 +428,19 @@
     IfSilent 0 +2
     StrCpy $R5 ''
   
  -  IfSilent +2 0
  +  IfSilent Silent 0
  +
  +  ; Escape XML
  +  Push $R1
  +  Call xmlEscape
  +  Pop $R1
  +  Push $R2
  +  Call xmlEscape
  +  Pop $R2
  +  
     StrCpy $R5 '<user name="$R1" password="$R2" roles="admin,manager" />'
   
  +Silent:
     DetailPrint 'HTTP/1.1 Connector configured on port "$R0"'
     DetailPrint 'Admin user added: "$R1"'
   
  @@ -450,6 +462,7 @@
     DetailPrint "server.xml written"
   
     ; Build final tomcat-users.xml
  +  
     Delete "$INSTDIR\conf\tomcat-users.xml"
     FileOpen $R9 "$INSTDIR\conf\tomcat-users.xml" w
   
  @@ -465,6 +478,16 @@
   
     RMDir /r "$TEMP\confinstall"
   
  +FunctionEnd
  +
  +
  +Function xmlEscape
  +  Pop $0
  +  ${StrRep} $0 $0 "&" "&amp;"
  +  ${StrRep} $0 $0 "$\"" "&quot;"
  +  ${StrRep} $0 $0 "<" "&lt;"
  +  ${StrRep} $0 $0 ">" "&gt;"
  +  Push $0
   FunctionEnd
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to