summaryrefslogtreecommitdiff
path: root/recipes/boa/boa-0.94.13/debian-patch.diff
blob: 6ce71c0046c65af133b2157cf9ba68f05eb35a93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
diff -urN boa-0.94.13.orig/src/boa.c boa-0.94.13/src/boa.c
--- boa-0.94.13.orig/src/boa.c	2002-07-23 17:50:29.000000000 +0200
+++ boa-0.94.13/src/boa.c	2004-09-01 20:00:36.000000000 +0200
@@ -208,10 +208,11 @@
         struct passwd *passwdbuf;
         passwdbuf = getpwuid(server_uid);
         if (passwdbuf == NULL) {
-            DIE("getpwuid");
-        }
+            WARN("getpwuid - will not initgroups");
+        } else {
         if (initgroups(passwdbuf->pw_name, passwdbuf->pw_gid) == -1) {
-            DIE("initgroups");
+				WARN("initgroups");
+			}
         }
         if (setgid(server_gid) == -1) {
             DIE("setgid");
diff -urN boa-0.94.13.orig/src/boa.h boa-0.94.13/src/boa.h
--- boa-0.94.13.orig/src/boa.h	2002-07-26 05:03:44.000000000 +0200
+++ boa-0.94.13/src/boa.h	2004-09-01 20:00:36.000000000 +0200
@@ -149,8 +149,9 @@
 void clean_pathname(char *pathname);
 char *get_commonlog_time(void);
 void rfc822_time_buf(char *buf, time_t s);
-char *simple_itoa(unsigned int i);
+char *simple_itoa(long long int i);
 int boa_atoi(char *s);
+long long int boa_atoll(char *s);
 char *escape_string(char *inp, char *buf);
 int month2int(char *month);
 int modified_since(time_t * mtime, char *if_modified_since);
diff -urN boa-0.94.13.orig/src/boa_grammar.y boa-0.94.13/src/boa_grammar.y
--- boa-0.94.13.orig/src/boa_grammar.y	1999-10-12 16:49:07.000000000 +0200
+++ boa-0.94.13/src/boa_grammar.y	2004-09-01 20:00:36.000000000 +0200
@@ -20,7 +20,7 @@
  *
  */
 
-/* $Id: boa_grammar.y,v 1.14 1999/10/12 14:49:07 jon Exp $*/
+/* $Id: boa_grammar.y,v 1.14 1999/10/12 14:49:07 jon Exp $ */
 
 #include <string.h>
 #include <stdio.h>
diff -urN boa-0.94.13.orig/src/compat.h boa-0.94.13/src/compat.h
--- boa-0.94.13.orig/src/compat.h	2002-06-06 07:02:28.000000000 +0200
+++ boa-0.94.13/src/compat.h	2004-09-01 20:00:36.000000000 +0200
@@ -117,7 +117,7 @@
 #endif
 
 #ifdef HAVE_TM_GMTOFF
-#define TIMEZONE_OFFSET(foo) foo##->tm_gmtoff
+#define TIMEZONE_OFFSET(foo) foo->tm_gmtoff
 #else
 #define TIMEZONE_OFFSET(foo) timezone
 #endif
diff -urN boa-0.94.13.orig/src/get.c boa-0.94.13/src/get.c
--- boa-0.94.13.orig/src/get.c	2002-07-26 05:05:59.000000000 +0200
+++ boa-0.94.13/src/get.c	2004-09-01 20:00:36.000000000 +0200
@@ -43,7 +43,7 @@
     struct stat statbuf;
     volatile int bytes;
 
-    data_fd = open(req->pathname, O_RDONLY);
+    data_fd = open(req->pathname, O_RDONLY | O_LARGEFILE);
     saved_errno = errno; /* might not get used */
 
 #ifdef GUNZIP
@@ -58,7 +58,7 @@
         memcpy(gzip_pathname, req->pathname, len);
         memcpy(gzip_pathname + len, ".gz", 3);
         gzip_pathname[len + 3] = '\0';
-        data_fd = open(gzip_pathname, O_RDONLY);
+        data_fd = open(gzip_pathname, O_RDONLY | O_LARGEFILE);
         if (data_fd != -1) {
             close(data_fd);
 
@@ -313,7 +313,7 @@
            sprintf(pathname_with_index, "%s%s", req->pathname, directory_index);
          */
 
-        data_fd = open(pathname_with_index, O_RDONLY);
+        data_fd = open(pathname_with_index, O_RDONLY | O_LARGEFILE);
 
         if (data_fd != -1) {    /* user's index file */
             strcpy(req->request_uri, directory_index); /* for mimetype */
@@ -334,7 +334,7 @@
          * try index.html.gz
          */
         strcat(pathname_with_index, ".gz");
-        data_fd = open(pathname_with_index, O_RDONLY);
+        data_fd = open(pathname_with_index, O_RDONLY | O_LARGEFILE);
         if (data_fd != -1) {    /* user's index file */
             close(data_fd);
 
@@ -399,9 +399,9 @@
     time_t real_dir_mtime;
 
     real_dir_mtime = statbuf->st_mtime;
-    sprintf(pathname_with_index, "%s/dir.%d.%ld",
+    sprintf(pathname_with_index, "%s/dir.%d.%lld",
             cachedir, (int) statbuf->st_dev, statbuf->st_ino);
-    data_fd = open(pathname_with_index, O_RDONLY);
+    data_fd = open(pathname_with_index, O_RDONLY | O_LARGEFILE);
 
     if (data_fd != -1) {        /* index cache */
 
@@ -417,7 +417,7 @@
     if (index_directory(req, pathname_with_index) == -1)
         return -1;
 
-    data_fd = open(pathname_with_index, O_RDONLY); /* Last chance */
+    data_fd = open(pathname_with_index, O_RDONLY | O_LARGEFILE); /* Last chance */
     if (data_fd != -1) {
         strcpy(req->request_uri, directory_index); /* for mimetype */
         fstat(data_fd, statbuf);
diff -urN boa-0.94.13.orig/src/globals.h boa-0.94.13/src/globals.h
--- boa-0.94.13.orig/src/globals.h	2002-07-24 05:03:59.000000000 +0200
+++ boa-0.94.13/src/globals.h	2004-09-01 20:00:36.000000000 +0200
@@ -54,8 +54,8 @@
     int kacount;                /* keepalive count */
 
     int data_fd;                /* fd of data */
-    unsigned long filesize;     /* filesize */
-    unsigned long filepos;      /* position in file */
+    unsigned long long filesize;     /* filesize */
+    unsigned long long filepos;      /* position in file */
     char *data_mem;             /* mmapped/malloced char array */
     int method;                 /* M_GET, M_POST, etc. */
 
diff -urN boa-0.94.13.orig/src/index_dir.c boa-0.94.13/src/index_dir.c
--- boa-0.94.13.orig/src/index_dir.c	2002-01-30 04:41:45.000000000 +0100
+++ boa-0.94.13/src/index_dir.c	2004-09-01 20:00:36.000000000 +0200
@@ -240,10 +240,10 @@
         printf("<tr>"
                "<td width=\"40%%\"><a href=\"%s/\">%s/</a></td>"
                "<td align=right>%s</td>"
-               "<td align=right>%ld bytes</td>"
+               "<td align=right>%lld bytes</td>"
                "</tr>\n",
                http_filename, html_filename,
-               ctime(&statbuf.st_mtime), (long) statbuf.st_size);
+               ctime(&statbuf.st_mtime), (long long) statbuf.st_size);
     }
 
     printf
@@ -281,19 +281,19 @@
                    "<td width=\"40%%\"><a href=\"%s\">%s</a> "
                    "<a href=\"%s.gz\">(.gz)</a></td>"
                    "<td align=right>%s</td>"
-                   "<td align=right>%ld bytes</td>"
+                   "<td align=right>%lld bytes</td>"
                    "</tr>\n",
                    http_filename, html_filename, http_filename,
-                   ctime(&statbuf.st_mtime), (long) statbuf.st_size);
+                   ctime(&statbuf.st_mtime), (long long) statbuf.st_size);
         } else {
 #endif
             printf("<tr>"
                    "<td width=\"40%%\"><a href=\"%s\">%s</a></td>"
                    "<td align=right>%s</td>"
-                   "<td align=right>%ld bytes</td>"
+                   "<td align=right>%lld bytes</td>"
                    "</tr>\n",
                    http_filename, html_filename,
-                   ctime(&statbuf.st_mtime), (long) statbuf.st_size);
+                   ctime(&statbuf.st_mtime), (long long) statbuf.st_size);
 #ifdef GUNZIP
         }
 #endif
diff -urN boa-0.94.13.orig/src/log.c boa-0.94.13/src/log.c
--- boa-0.94.13.orig/src/log.c	2002-07-26 05:04:48.000000000 +0200
+++ boa-0.94.13/src/log.c	2004-09-01 20:00:36.000000000 +0200
@@ -142,7 +142,7 @@
     if (access_log) {
         if (virtualhost)
             fprintf(access_log, "%s ", req->local_ip_addr);
-        fprintf(access_log, "%s - - %s\"%s\" %d %ld \"%s\" \"%s\"\n",
+        fprintf(access_log, "%s - - %s\"%s\" %d %lld \"%s\" \"%s\"\n",
                 req->remote_ip_addr,
                 get_commonlog_time(),
                 req->logline,
diff -urN boa-0.94.13.orig/src/mmap_cache.c boa-0.94.13/src/mmap_cache.c
--- boa-0.94.13.orig/src/mmap_cache.c	2002-03-24 23:35:34.000000000 +0100
+++ boa-0.94.13/src/mmap_cache.c	2004-09-01 20:00:36.000000000 +0200
@@ -104,7 +104,7 @@
     int data_fd;
     struct stat statbuf;
     struct mmap_entry *e;
-    data_fd = open(fname, O_RDONLY);
+    data_fd = open(fname, O_RDONLY | O_LARGEFILE);
     if (data_fd == -1) {
         perror(fname);
         return NULL;
diff -urN boa-0.94.13.orig/src/read.c boa-0.94.13/src/read.c
--- boa-0.94.13.orig/src/read.c	2002-03-18 02:53:48.000000000 +0100
+++ boa-0.94.13/src/read.c	2004-09-01 20:00:36.000000000 +0200
@@ -157,7 +157,7 @@
                 if (req->content_length) {
                     int content_length;
 
-                    content_length = boa_atoi(req->content_length);
+                    content_length = boa_atoll(req->content_length);
                     /* Is a content-length of 0 legal? */
                     if (content_length <= 0) {
                         log_error_time();
diff -urN boa-0.94.13.orig/src/util.c boa-0.94.13/src/util.c
--- boa-0.94.13.orig/src/util.c	2002-07-08 01:22:18.000000000 +0200
+++ boa-0.94.13/src/util.c	2004-09-01 20:00:36.000000000 +0200
@@ -386,7 +386,7 @@
     memcpy(p, day_tab + t->tm_wday * 4, 4);
 }
 
-char *simple_itoa(unsigned int i)
+char *simple_itoa(long long int i)
 {
     /* 21 digits plus null terminator, good for 64-bit or smaller ints
      * for bigger ints, use a bigger buffer!
@@ -427,6 +427,24 @@
     return retval;
 }
 
+/* I don't "do" negative conversions
+ * Therefore, -1 indicates error
+ */
+
+long long int boa_atoll(char *s)
+{
+    long long int retval;
+
+    if (!isdigit(*s))
+        return -1;
+
+    retval = atoll(s);
+    if (retval < 0)
+        return -1;
+
+    return retval;
+}
+
 int create_temporary_file(short want_unlink, char *storage, int size)
 {
     static char boa_tempfile[MAX_PATH_LENGTH + 1];