[pubcookie-dev] CVS update: fox; webiso/pubcookie/src index.cgi.c,1.182,1.183

fox at washington.edu fox at washington.edu
Wed May 30 10:03:22 PDT 2007


Update of /usr/local/cvsroot/webiso/pubcookie/src
 In directory webiso-cvs.cac.washington.edu:/var/tmp/cvs-serv11514/webiso/pubcookie/src
 
 Modified Files:
 	index.cgi.c 
 Log Message:
 
 
 Fixing post_data handling of args and values on the redirect back to
 the app in GET method.
 
 



Index: webiso/pubcookie/src/index.cgi.c
diff -u webiso/pubcookie/src/index.cgi.c:1.182 webiso/pubcookie/src/index.cgi.c:1.183
--- webiso/pubcookie/src/index.cgi.c:1.182	Wed Feb  7 14:49:22 2007
+++ webiso/pubcookie/src/index.cgi.c	Wed May 30 10:03:20 2007
@@ -18,7 +18,7 @@
 /** @file index.cgi.c
  * Login server CGI
  *
- * $Id: index.cgi.c,v 1.182 2007/02/07 22:49:22 willey Exp $
+ * $Id: index.cgi.c,v 1.183 2007/05/30 17:03:20 fox Exp $
  */
 
 #ifdef WITH_FCGI
@@ -1091,7 +1091,7 @@
     char *out;
     char *ptr;
 
-    if (!(out = malloc (strlen (in) * 5 + 1))) {
+    if (!(out = malloc (strlen (in) * 6 + 1))) {
         abend (p, "out of memory");
     }
 
@@ -1125,6 +1125,20 @@
             *(++ptr) = 't';
             *(++ptr) = ';';
             break;
+        case '\n':
+            *ptr = '&';
+            *(++ptr) = '#';
+            *(++ptr) = '1';
+            *(++ptr) = '0';
+            *(++ptr) = ';';
+            break;
+        case '\r':
+            *ptr = '&';
+            *(++ptr) = '#';
+            *(++ptr) = '1';
+            *(++ptr) = '3';
+            *(++ptr) = ';';
+            break;
         default:
             *ptr = *in;
             break;
@@ -2751,7 +2765,6 @@
     int limitations_mentioned = 0;
     char *submit_value = NULL;
     cgiFormEntry *cur;
-    cgiFormEntry *next;
     char *redirect_final_trunc = NULL;
     char version[PBC_VER_LEN];
 
@@ -2933,40 +2946,17 @@
 
         cur = cgiFormEntryFirst;
         while (cur) {
-            /* in the perl version we had to make sure we were getting */
-            /* rid of this header line                                 */
-            /*        cur->attr =~ s%^\s*HTTP/1.1 100 Continue\s*%%mi;   */
-
-            /* if there is a " in the value string we have to put */
-            /* in a TEXTAREA object that will be visible          */
-            if (strstr (cur->value, "\"") ||
-                strstr (cur->value, "\r") || strstr (cur->value, "\n")) {
-                if (!limitations_mentioned) {
-                    print_html (p,
-                                "Certain limitations require that this be shown, please ignore it<BR>\n");
-                    limitations_mentioned++;
-                }
-                print_html (p,
-                            "<textarea cols=\"0\" rows=\"0\" name=\"%s\">\n",
-                            cur->attr);
-                print_html (p, "%s</textarea>",
-                            string_encode (p, cur->value));
-                print_html (p, "<P>\n");
+
+            /* we don't want to overwrite other people's submits */
+            if (!strcmp (cur->attr, "submit")) {
+                submit_value = string_encode (p, cur->value);
             } else {
-                /* we don't want to cover other people's submits */
-                if (!strcmp (cur->attr, "submit")) {
-                    submit_value = string_encode (p, cur->value);
-                } else {
-                    print_html (p, "<input type=\"hidden\" ");
-                    print_html (p, "name=\"%s\" value=\"%s\">\n",
-                                cur->attr, cur->value);
-                }
+                print_html (p, "<input type=\"hidden\" ");
+                print_html (p, "name=\"%s\" value=\"%s\">\n",
+                            string_encode(p, cur->attr), string_encode(p, cur->value));
             }
-
-            /* move onto the next attr/value pair */
-            next = cur->next;
-            cur = next;
-        }                       /* while cur */
+            cur = cur->next;
+        }
 
 
         print_html (p, "</td></tr>\n");
@@ -2977,7 +2967,7 @@
         print_html (p, "%s\n", PBC_POST_NO_JS_TEXT);
         print_html (p, "</td></tr></table>\n");
 
-        /* put submit at the bottom so it looks better and */
+        /* put submit at the bottom so it looks better */
         if (submit_value)
             print_html (p,
                         "<input type=\"submit\" name=\"submit\" value=\'%s\'>\n",



end of message


More information about the pubcookie-dev mailing list