1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-23 09:10:43 +00:00

- Fix handling of & sign, it need to be escaped for XML storage

PR:		ports/85240
Submitted by:	Maurice Castro <maurice@sphinx.clari.net.au>
Approved by:	maintainer timeout (anders, 17 days)

- While here, fix runtime crash on 64bit platforms by explicitly declaring
  getenv() (via including <stdlib.h> header)
This commit is contained in:
Pav Lucistnik 2005-10-08 21:32:20 +00:00
parent f07b80a7e4
commit ff2b67ac7d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=144607
3 changed files with 55 additions and 1 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= pwman
PORTVERSION= 0.3.2
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= security
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
@ -19,11 +19,15 @@ LIB_DEPENDS= xml2.5:${PORTSDIR}/textproc/libxml2
RUN_DEPENDS= gpg:${PORTSDIR}/security/gnupg
GNU_CONFIGURE= yes
USE_REINPLACE= yes
MAN1= pwman.1
DOCS= AUTHORS COPYING ChangeLog README TODO
post-patch:
@${REINPLACE_CMD} -e 's|/usr/bin/gpg|${LOCALBASE}/bin/gpg|g' ${WRKSRC}/src/misc.c
.if !defined(NOPORTDOCS)
post-install:
@${INSTALL} -d -m 0755 ${DOCSDIR}

View File

@ -0,0 +1,40 @@
--- src/pwlist.c.old 2005-03-09 16:07:07.000000000 +0000
+++ src/pwlist.c 2005-03-09 16:06:37.000000000 +0000
@@ -272,13 +272,32 @@
write_password_node(xmlNodePtr root, Pw* pw)
{
xmlNodePtr node;
+ xmlChar *escaped;
+
+ // Take the inbound strings. Treat as an xmlChar, and escape
+ // Need to free the result of escape every time
node = xmlNewChild(root, NULL, (xmlChar*)"PwItem", NULL);
- xmlNewChild(node, NULL, (xmlChar*)"name", (xmlChar*)pw->name);
- xmlNewChild(node, NULL, (xmlChar*)"host", (xmlChar*)pw->host);
- xmlNewChild(node, NULL, (xmlChar*)"user", (xmlChar*)pw->user);
- xmlNewChild(node, NULL, (xmlChar*)"passwd", (xmlChar*)pw->passwd);
- xmlNewChild(node, NULL, (xmlChar*)"launch", (xmlChar*)pw->launch);
+
+ escaped = xmlEncodeSpecialChars(root, (xmlChar*)pw->name);
+ xmlNewChild(node, NULL, (xmlChar*)"name", escaped);
+ xmlFree(escaped);
+
+ escaped = xmlEncodeSpecialChars(root, (xmlChar*)pw->host);
+ xmlNewChild(node, NULL, (xmlChar*)"host", escaped);
+ xmlFree(escaped);
+
+ escaped = xmlEncodeSpecialChars(root, (xmlChar*)pw->user);
+ xmlNewChild(node, NULL, (xmlChar*)"user", escaped);
+ xmlFree(escaped);
+
+ escaped = xmlEncodeSpecialChars(root, (xmlChar*)pw->passwd);
+ xmlNewChild(node, NULL, (xmlChar*)"passwd", escaped);
+ xmlFree(escaped);
+
+ escaped = xmlEncodeSpecialChars(root, (xmlChar*)pw->launch);
+ xmlNewChild(node, NULL, (xmlChar*)"launch", escaped);
+ xmlFree(escaped);
}
int

View File

@ -0,0 +1,10 @@
--- src/pwman.h.orig Mon Oct 14 18:10:36 2002
+++ src/pwman.h Sat Oct 8 23:21:23 2005
@@ -26,6 +26,7 @@
#include <string.h>
#include <config.h>
#include <time.h>
+#include <stdlib.h>
#include <stdarg.h>
#define CONF_FILE ".pwmanrc"