From 262111689f19e362100236a37bcd3c7eed6fd769 Mon Sep 17 00:00:00 2001 From: Michael Meckelein Date: Fri, 31 Aug 2007 12:47:35 +0000 Subject: patches and docu update for 1.19.3 --- msg.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'msg.c') diff --git a/msg.c b/msg.c index 30fe7d4e..be3c48ae 100644 --- a/msg.c +++ b/msg.c @@ -1606,6 +1606,45 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, } } + /* Take care of spurious characters to make the property safe + * for a path definition + */ + if(pTpe->data.field.options.bSecPathDrop || pTpe->data.field.options.bSecPathReplace) { + if(pTpe->data.field.options.bSecPathDrop) { + char *pSrc = pRes; + char *pDst = pRes; + while(*pSrc) { + if(*pSrc != '/') + *pDst++ = *pSrc; + pSrc++; + } + *pDst = '\0'; + } else { + char *pB = pRes; + while(*pB) { + if(*pB == '/') + *pB = '_'; + pB++; + } + } + + if(*pRes == '.' && (*(pRes + 1) == '\0' || (*(pRes + 1) == '.' && *(pRes + 2) == '\0'))) + *pRes = '_'; + + if(*pRes == '\0') { + if(*pbMustBeFreed == 1) + free(pRes); + pRes = malloc(2); + if(pRes == NULL) { + *pbMustBeFreed = 0; + return "**OUT OF MEMORY ALLOCATING pBuf**"; + } + *pRes = '_'; + *(pRes + 1) = '\0'; + *pbMustBeFreed = 1; + } + } + /* Now drop last LF if present (pls note that this must not be done * if bEscapeCC was set! */ -- cgit v1.2.3