Adjusted paramhandling to accept parameters with empty values (which is legal) v8.20
authorArt Cancro <ajc@uncensored.citadel.org>
Wed, 14 Aug 2013 14:43:11 +0000 (10:43 -0400)
committerArt Cancro <ajc@uncensored.citadel.org>
Wed, 14 Aug 2013 14:43:11 +0000 (10:43 -0400)
webcit/calendar.h
webcit/dav.h
webcit/messages.h
webcit/paramhandling.c
webcit/paramhandling.h
webcit/preferences.h
webcit/roomops.h
webcit/subst.h
webcit/tcp_sockets.h
webcit/utils.h
webcit/webserver.h

index a5571a0e49c98dff0e7afef05a606356d83965d2..ee1f8bc6a061a0f7ddcfe196eb810470c364bf9e 100644 (file)
@@ -1,19 +1,13 @@
 /*
- * Copyright (c) 1996-2012 by the citadel.org team
+ * Copyright (c) 1996-2013 by the citadel.org team
  *
  * This program is open source software.  You can redistribute it and/or
  * modify it under the terms of the GNU General Public License, version 3.
- * 
- * 
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
- * 
- * 
- * 
  */
 
 #ifndef __CALENDAR_H__
index a2963f0fb7b30dfa158d98083f89d76e34cbca33..3426c81cde61d30dfc652a4d0eac5a04b70c40d6 100644 (file)
@@ -1,6 +1,18 @@
 /*
- * Data passed back and forth between dav_get() and its
- * callback functions called by the MIME parser
+ * Copyright (c) 1996-2013 by the citadel.org team
+ *
+ * This program is open source software.  You can redistribute it and/or
+ * modify it under the terms of the GNU General Public License, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+
+/*
+ * Data passed back and forth between dav_get() and its callback functions called by the MIME parser
  */
 struct epdata {
        char desired_content_type_1[128];
index 050117b0e2dd7df7a136eab2ff68045188d67537..0738e947e39ff3ba1e80f4641c792853a52c6a96 100644 (file)
@@ -1,3 +1,15 @@
+/*
+ * Copyright (c) 1996-2013 by the citadel.org team
+ *
+ * This program is open source software.  You can redistribute it and/or
+ * modify it under the terms of the GNU General Public License, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
 extern CtxType CTX_MAILSUM;
 extern CtxType CTX_MIME_ATACH;
 extern HashList *MsgHeaderHandler;
index a317ad39daff72f72d330d5652071913ed978c7d..f7d1a325d21fd85b83c02b83449628411b2814ec 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * parse urlparts and post data
  *
- * Copyright (c) 1996-2012 by the citadel.org team
+ * Copyright (c) 1996-2013 by the citadel.org team
  *
  * This program is open source software.  You can redistribute it and/or
  * modify it under the terms of the GNU General Public License, version 3.
 #include "webcit.h"
 #include "webserver.h"
 
+/* uncomment to see all parameters sent to the server by the browser. */
+/* #define DEBUG_URLSTRINGS */
+
+
 void free_url(void *U)
 {
        urlcontent *u = (urlcontent*) U;
@@ -27,19 +31,21 @@ void free_url(void *U)
  */
 void ParseURLParams(StrBuf *url)
 {
-       const char *aptr, *bptr, *eptr, *up;
-       int len, keylen;
-       urlcontent *u;
+       const char *aptr, *bptr, *eptr, *up = NULL;
+       int len, keylen = 0;
+       urlcontent *u = NULL;
        wcsession *WCC = WC;
 
-       if (WCC->Hdr->urlstrings == NULL)
+       if (WCC->Hdr->urlstrings == NULL) {
                WCC->Hdr->urlstrings = NewHash(1, NULL);
+       }
        eptr = ChrPtr(url) + StrLength(url);
        up = ChrPtr(url);
        while ((up < eptr) && (!IsEmptyStr(up))) {
                aptr = up;
-               while ((aptr < eptr) && (*aptr != '\0') && (*aptr != '='))
+               while ((aptr < eptr) && (*aptr != '\0') && (*aptr != '=')) {
                        aptr++;
+               }
                if (*aptr != '=') {
                        return;
                }
@@ -50,16 +56,17 @@ void ParseURLParams(StrBuf *url)
                        bptr++;
                }
                keylen = aptr - up - 1; /* -1 -> '=' */
-               if(keylen >= sizeof(u->url_key)) {
-                       syslog(LOG_WARNING, "invalid url_key from %s", ChrPtr(WCC->Hdr->HR.browser_host));
-                       return;
+               if (keylen > sizeof(u->url_key)) {
+                       syslog(LOG_WARNING, "%s:%d: invalid url_key of size %d in string size %d",
+                               __FILE__, __LINE__, keylen, sizeof(u->url_key)
+                       );
                }
 
                u = (urlcontent *) malloc(sizeof(urlcontent));
                memcpy(u->url_key, up, keylen);
                u->url_key[keylen] = '\0';
                if (keylen < 0) {
-                       syslog(LOG_WARNING, "invalid url_key from %s", ChrPtr(WCC->Hdr->HR.browser_host));
+                       syslog(LOG_WARNING, "%s:%d: invalid url_key of size %d", __FILE__, __LINE__, keylen);
                        free(u);
                        return;
                }
@@ -357,7 +364,7 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp,
                WCC->upload_filename = NewStrBufPlain(filename, -1);
                safestrncpy(WCC->upload_content_type, cbtype, sizeof(WC->upload_content_type));
 #ifdef DEBUG_URLSTRINGS
-               syslog(LOG_DEBUG, "File: <%s> len: [%ld]", filename, length);
+               syslog(LOG_DEBUG, "File: <%s> len: [%ld]", filename, (long int)length);
 #endif
                
        }
@@ -367,10 +374,9 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp,
 void PutBstr(const char *key, long keylen, StrBuf *Value)
 {
        urlcontent *u;
-       wcsession *WCC = WC;
 
        if(keylen >= sizeof(u->url_key)) {
-               syslog(LOG_WARNING, "invalid url_key from %s", ChrPtr(WCC->Hdr->HR.browser_host));
+               syslog(LOG_WARNING, "%s:%d: invalid url_key of size %ld", __FILE__, __LINE__, keylen);
                FreeStrBuf(&Value);
                return;
        }
index 87b0b1cec65ae1ff103aab804497f26930f7666d..4aaddea71cff0df7ea5a631a3415e7e43c87fd17 100644 (file)
@@ -1,3 +1,15 @@
+/*
+ * Copyright (c) 1996-2013 by the citadel.org team
+ *
+ * This program is open source software.  You can redistribute it and/or
+ * modify it under the terms of the GNU General Public License, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
 /* URL / Mime Post parsing -> paramhandling.c */
 void upload_handler(char *name, char *filename, char *partnum, char *disp,
                    void *content, char *cbtype, char *cbcharset,
index 7a3c04300ec5923da5abdf6eb6c40b59da870add..7a30a7bbde56a33d5aee5088b0775594ebc881ef 100644 (file)
@@ -1,3 +1,15 @@
+/*
+ * Copyright (c) 1996-2013 by the citadel.org team
+ *
+ * This program is open source software.  You can redistribute it and/or
+ * modify it under the terms of the GNU General Public License, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
 
 typedef enum _ePrefType{
        PRF_UNSET = 0,
index 7d9cd89e3792281e9e51ac22bb9796fa76a276cd..fd1f60e4ae62686a1bf9606569bc96722cf73097 100644 (file)
@@ -1,8 +1,20 @@
+/*
+ * Copyright (c) 1996-2013 by the citadel.org team
+ *
+ * This program is open source software.  You can redistribute it and/or
+ * modify it under the terms of the GNU General Public License, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
 
 #define VIRTUAL_MY_FLOOR -1
 
 /*
- * \brief This struct holds a list of rooms for \\\<G\\\>oto operations.
+ * This struct holds a list of rooms for "Goto" operations.
  */
 struct march {
        struct march *next;       /* pointer to next in linked list */
@@ -11,9 +23,8 @@ struct march {
        int march_order;          /* sequence in which we are to visit this room */
 };
 
-/* *
- * \brief      This struct holds a list of rooms for client display.
- *             It is a binary tree.
+/*
+ * This struct holds a list of rooms for client display. It is a binary tree.
  */
 struct roomlisting {
        struct roomlisting *lnext;      /* pointer to 'left' tree node */
@@ -35,8 +46,8 @@ typedef struct _floor {
        long AlphaN;
 } Floor;
 
-/**
- * \brief  Data structure for roomlist-to-folderlist conversion 
+/*
+ * Data structure for roomlist-to-folderlist conversion 
  */
 struct __ofolder {
        int floor;      /* which floor is it on */
@@ -51,8 +62,8 @@ struct __ofolder {
 
 
 
-/**
- * \brief  Data structure for roomlist-to-folderlist conversion 
+/*
+ * Data structure for roomlist-to-folderlist conversion 
  */
 typedef struct _folder {
        /* Data citserver tells us about the room */
@@ -108,7 +119,7 @@ typedef struct _folder {
        int BumpUsers; /* if SETR set to 1 to make all users who knew this room to forget about it. */
 
        HashList *IgnetCfgs[maxRoomNetCfg + 1];
-}folder;
+} folder;
 
 HashList *GetFloorListHash(StrBuf *Target, WCTemplputParams *TP);
 void vDeleteFolder(void *vFolder);
index 30c3a6b66ff743379595473b03c1c7ae81ea891e..bd6f8318d97d1d0202c8a93de535c546a64bb3a6 100644 (file)
@@ -1,5 +1,15 @@
-/**
- * @defgroup subst Template processing functions
+/*
+ * Copyright (c) 1996-2013 by the citadel.org team
+ *
+ * This program is open source software.  You can redistribute it and/or
+ * modify it under the terms of the GNU General Public License, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * subst template processing functions
  */
 
 extern HashList *Conditionals;
index a8bfb20ca3e266fa4d42e5b2d16c3590a1f18486..8528539bf9ef04d32036f20716b9049b736862a9 100644 (file)
@@ -1,26 +1,36 @@
+/*
+ * Copyright (c) 1996-2013 by the citadel.org team
+ *
+ * This program is open source software.  You can redistribute it and/or
+ * modify it under the terms of the GNU General Public License, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
 int uds_connectsock(char *);
 int tcp_connectsock(char *, char *);
 int serv_getln(char *strbuf, int bufsize);
 int StrBuf_ServGetln(StrBuf *buf);
 
-/**
- * @defgroup CoreSrv Core Server Functionality
+/*
+ * parse & check the server reply 
+ *
+ * Line                the line containing the server reply
+ * FullState   if you need more than just the major number, this is returns it. Ignored if NULL.
+ * PutImportantMessage if you want to forward the text part of the server reply to the user, specify 1; 
+ *             the result will be put into the 'Important Message' framework.
+ * MajorOK     in case of which major number not to put the ImportantMessage? 0 for all.
+ *
+ * returns the most significant digit of the server status
  */
 
-/**
- * @ingroup CoreSrv
- * @brief parse & check the server reply 
- * @param Line the line containing the server reply
- * @param FullState if you need more than just the major number, this is returns it. Ignored if NULL.
- * @param PutImportantMessage if you want to forward the text part of the server reply to the user, specify 1; 
- *    the result will be put into the 'Important Message' framework.
- * @param MajorOK in case of which major number not to put the ImportantMessage? 0 for all.
- * @return the most significant digit of the server status
- */
 int GetServerStatusMsg(StrBuf *Line, long* FullState, int PutImportantMessage, int MajorOK);
-/**
- * @ingroup CoreSrv
- * @brief to migrate old calls.... 
+
+/*
+ * to migrate old calls.... 
  */
 #define GetServerStatus(a, b) GetServerStatusMsg(a, b, 0, 0)
 
index 57cf13b9f5e8848c840507ceccd6f62d07908bc2..7c322492b351f434a635928ed2b0d615af701491 100644 (file)
@@ -1,3 +1,15 @@
+/*
+ * Copyright (c) 1996-2013 by the citadel.org team
+ *
+ * This program is open source software.  You can redistribute it and/or
+ * modify it under the terms of the GNU General Public License, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
 void StrEscPuts(const StrBuf *strbuf);
 void StrEscputs1(const StrBuf *strbuf, int nbsp, int nolinebreaks);
 
index 51926cbf58b13d5b7354db54d5a6d0a1b1459891..dc142d0d1a08e7a7887efbb0cbb078e7e8e570a1 100644 (file)
@@ -1,3 +1,15 @@
+/*
+ * Copyright (c) 1996-2013 by the citadel.org team
+ *
+ * This program is open source software.  You can redistribute it and/or
+ * modify it under the terms of the GNU General Public License, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
 
 extern char *static_dirs[PATH_MAX];          /**< Web representation */
 extern int ndirs;