1
diff -urN build-tree.orig/apache2/modules/generators/mod_autoindex.c build-tree/apache2/modules/generators/mod_autoindex.c
2
--- build-tree.orig/apache2/modules/generators/mod_autoindex.c 2003-03-08 05:43:49.000000000 +0900
3
+++ build-tree/apache2/modules/generators/mod_autoindex.c 2003-04-11 00:12:37.000000000 +0900
5
for (x = 0; x < n; x++) {
10
apr_pool_clear(scratch);
12
@@ -1688,16 +1689,21 @@
13
ap_escape_html(scratch, t2), "</a>", NULL);
16
- nwidth = strlen(t2);
17
- if (nwidth > name_width) {
18
- memcpy(name_scratch, t2, name_width - 3);
19
- name_scratch[name_width - 3] = '.';
20
- name_scratch[name_width - 2] = '.';
21
- name_scratch[name_width - 1] = '>';
22
- name_scratch[name_width] = 0;
24
- nwidth = name_width;
26
+ nwidth = strlen(t2);
27
+ if (nwidth > name_width) {
28
+ memcpy(name_scratch, t2, name_width - 2);
31
+ if ( (name_scratch[i] & 0xC0) != 0x80) break;
34
+ name_scratch[i] = '.';
35
+ name_scratch[i + 1] = '.';
36
+ name_scratch[i + 2] = '>';
37
+ name_scratch[i + 3] = 0;
39
+ nwidth = name_width;
41
ap_rvputs(r, "<td><a href=\"", anchor, "\">",
42
ap_escape_html(scratch, t2),
43
"</a>", pad_scratch + nwidth, NULL);
44
@@ -1771,11 +1777,17 @@
47
if (nwidth > name_width) {
48
- memcpy(name_scratch, t2, name_width - 3);
49
- name_scratch[name_width - 3] = '.';
50
- name_scratch[name_width - 2] = '.';
51
- name_scratch[name_width - 1] = '>';
52
- name_scratch[name_width] = 0;
53
+ memcpy(name_scratch, t2, name_width - 2);
56
+ if ( (name_scratch[i] & 0xC0) != 0x80) break;
60
+ name_scratch[i] = '.';
61
+ name_scratch[i + 1] = '.';
62
+ name_scratch[i + 2] = '>';
63
+ name_scratch[i + 3] = 0;
68
return HTTP_FORBIDDEN;
71
-#if APR_HAS_UNICODE_FS
72
+#if APR_HAS_UNICODE_FS || 1
73
ap_set_content_type(r, "text/html;charset=utf-8");
75
ap_set_content_type(r, "text/html");
76
diff -urN build-tree.orig/apache2/srclib/apr/file_io/unix/Makefile.in build-tree/apache2/srclib/apr/file_io/unix/Makefile.in
77
--- build-tree.orig/apache2/srclib/apr/file_io/unix/Makefile.in 2003-02-13 05:20:56.000000000 +0900
78
+++ build-tree/apache2/srclib/apr/file_io/unix/Makefile.in 2003-04-11 00:11:56.000000000 +0900
87
# bring in rules.mk for standard functionality
89
diff -urN build-tree.orig/apache2/srclib/apr/file_io/unix/dir.c build-tree/apache2/srclib/apr/file_io/unix/dir.c
90
--- build-tree.orig/apache2/srclib/apr/file_io/unix/dir.c 2003-01-07 09:52:52.000000000 +0900
91
+++ build-tree/apache2/srclib/apr/file_io/unix/dir.c 2003-04-11 00:11:56.000000000 +0900
96
+#include "path_iconv.h"
98
static apr_status_t dir_cleanup(void *thedir)
100
apr_dir_t *dir = thedir;
102
apr_status_t apr_dir_open(apr_dir_t **new, const char *dirname,
105
+ char dirname_fs[APR_PATH_MAX];
108
/* On some platforms (e.g., Linux+GNU libc), d_name[] in struct
109
* dirent is declared with enough storage for the name. On other
110
* platforms (e.g., Solaris 8 for Intel), d_name is declared as a
111
@@ -117,12 +122,16 @@
112
apr_size_t dirent_size =
113
(sizeof((*new)->entry->d_name) > 1 ?
114
sizeof(struct dirent) : sizeof (struct dirent) + 255);
116
+ rv = apr_iconv_proc2fs(dirname, dirname_fs);
117
+ if (rv != APR_SUCCESS)
120
(*new) = (apr_dir_t *)apr_palloc(pool, sizeof(apr_dir_t));
123
(*new)->dirname = apr_pstrdup(pool, dirname);
124
- (*new)->dirstruct = opendir(dirname);
125
+ (*new)->dirstruct = opendir(dirname_fs);
126
(*new)->entry = apr_pcalloc(pool, dirent_size);
128
if ((*new)->dirstruct == NULL) {
130
apr_status_t apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted,
133
- apr_status_t ret = 0;
134
+ apr_status_t ret = 0, rv;
135
+ char procname[APR_PATH_MAX];
143
+ rv = apr_iconv_fs2proc(thedir->entry->d_name, procname);
144
+ if (rv != APR_SUCCESS)
147
/* No valid bit flag to test here - do we want one? */
152
if ((fspec[off - 1] != '/') && (off + 1 < sizeof(fspec)))
154
- apr_cpystrn(fspec + off, thedir->entry->d_name, sizeof(fspec) - off);
155
+ apr_cpystrn(fspec + off, procname, sizeof(fspec) - off);
156
ret = apr_lstat(finfo, fspec, wanted, thedir->pool);
157
/* We passed a stack name that will disappear */
163
- finfo->name = apr_pstrdup(thedir->pool, thedir->entry->d_name);
164
+ finfo->name = apr_pstrndup(thedir->pool, procname, NAME_MAX);
165
finfo->valid |= APR_FINFO_NAME;
171
mode_t mode = apr_unix_perms2mode(perm);
172
+ char fsname[APR_PATH_MAX];
173
+ apr_status_t rv = apr_iconv_proc2fs(path, fsname);
175
- if (mkdir(path, mode) == 0) {
176
+ if (rv != APR_SUCCESS)
179
+ if (mkdir(fsname, mode) == 0) {
185
apr_status_t apr_dir_remove(const char *path, apr_pool_t *pool)
187
- if (rmdir(path) == 0) {
188
+ char fsname[APR_PATH_MAX];
189
+ apr_status_t rv = apr_iconv_proc2fs(path, fsname);
191
+ if (rv != APR_SUCCESS)
194
+ if (rmdir(fsname) == 0) {
198
diff -urN build-tree.orig/apache2/srclib/apr/file_io/unix/filepath.c build-tree/apache2/srclib/apr/file_io/unix/filepath.c
199
--- build-tree.orig/apache2/srclib/apr/file_io/unix/filepath.c 2003-02-17 06:59:08.000000000 +0900
200
+++ build-tree/apache2/srclib/apr/file_io/unix/filepath.c 2003-04-11 00:11:57.000000000 +0900
205
+#include "path_iconv.h"
207
/* Any OS that requires/refuses trailing slashes should be dealt with here.
209
APR_DECLARE(apr_status_t) apr_filepath_get(char **defpath, apr_int32_t flags,
212
- char path[APR_PATH_MAX];
213
+ char fspath[APR_PATH_MAX], procpath[APR_PATH_MAX];
216
- if (!getcwd(path, sizeof(path))) {
217
+ if (!getcwd(fspath, sizeof(fspath))) {
219
return APR_ENAMETOOLONG;
223
- *defpath = apr_pstrdup(p, path);
225
+ rv = apr_iconv_fs2proc(fspath, procpath);
226
+ if (rv != APR_SUCCESS)
229
+ *defpath = apr_pstrdup(p, procpath);
235
APR_DECLARE(apr_status_t) apr_filepath_set(const char *path, apr_pool_t *p)
237
- if (chdir(path) != 0)
238
+ char fspath[APR_PATH_MAX];
239
+ apr_status_t rv = apr_iconv_proc2fs(path, fspath);
241
+ if (rv != APR_SUCCESS)
244
+ if (chdir(fspath) != 0)
248
diff -urN build-tree.orig/apache2/srclib/apr/file_io/unix/filestat.c build-tree/apache2/srclib/apr/file_io/unix/filestat.c
249
--- build-tree.orig/apache2/srclib/apr/file_io/unix/filestat.c 2003-03-06 18:21:24.000000000 +0900
250
+++ build-tree/apache2/srclib/apr/file_io/unix/filestat.c 2003-04-11 00:11:57.000000000 +0900
252
#include "apr_strings.h"
253
#include "apr_errno.h"
255
+#include "path_iconv.h"
257
static apr_filetype_e filetype_from_mode(mode_t mode)
260
@@ -148,12 +150,17 @@
264
-APR_DECLARE(apr_status_t) apr_file_perms_set(const char *fname,
265
+APR_DECLARE(apr_status_t) apr_file_perms_set(const char *procname,
266
apr_fileperms_t perms)
268
+ char fsname[APR_PATH_MAX];
269
+ apr_status_t rv = apr_iconv_proc2fs(procname, fsname);
270
mode_t mode = apr_unix_perms2mode(perms);
272
- if (chmod(fname, mode) == -1)
273
+ if (rv != APR_SUCCESS)
276
+ if (chmod(fsname, mode) == -1)
280
@@ -209,20 +216,25 @@
283
APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo,
285
+ const char *procname,
286
apr_int32_t wanted, apr_pool_t *pool)
290
+ char fsname[APR_PATH_MAX];
291
+ apr_status_t rv = apr_iconv_proc2fs(procname, fsname);
293
+ if (rv != APR_SUCCESS)
296
if (wanted & APR_FINFO_LINK)
297
- srv = lstat(fname, &info);
298
+ srv = lstat(fsname, &info);
300
- srv = stat(fname, &info);
301
+ srv = stat(fsname, &info);
305
- finfo->fname = fname;
306
+ finfo->fname = procname;
307
fill_out_finfo(finfo, &info, wanted);
308
if (wanted & APR_FINFO_LINK)
309
wanted &= ~APR_FINFO_LINK;
310
diff -urN build-tree.orig/apache2/srclib/apr/file_io/unix/open.c build-tree/apache2/srclib/apr/file_io/unix/open.c
311
--- build-tree.orig/apache2/srclib/apr/file_io/unix/open.c 2003-03-19 12:45:42.000000000 +0900
312
+++ build-tree/apache2/srclib/apr/file_io/unix/open.c 2003-04-11 00:14:05.000000000 +0900
317
+#include "path_iconv.h"
319
apr_status_t apr_unix_file_cleanup(void *thefile)
321
apr_file_t *file = thefile;
322
- apr_status_t flush_rv = APR_SUCCESS, rv = APR_SUCCESS;
323
+ apr_status_t flush_rv = APR_SUCCESS, rv = APR_SUCCESS, rv2 = APR_SUCCESS;
324
+ char fsname[APR_PATH_MAX];
326
if (file->buffered) {
327
flush_rv = apr_file_flush(file);
329
if (close(file->filedes) == 0) {
331
if (file->flags & APR_DELONCLOSE) {
332
- unlink(file->fname);
333
+ rv2 = apr_iconv_proc2fs(file->fname, fsname);
334
+ if (rv2 != APR_SUCCESS)
343
APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new,
345
+ const char *procname,
347
apr_fileperms_t perm,
352
apr_thread_mutex_t *thlock;
355
+ char fsname[APR_PATH_MAX];
356
+ apr_status_t rv = apr_iconv_proc2fs(procname, fsname);
358
+ if (rv != APR_SUCCESS)
361
if ((flag & APR_READ) && (flag & APR_WRITE)) {
363
@@ -149,10 +159,10 @@
366
if (perm == APR_OS_DEFAULT) {
367
- fd = open(fname, oflags, 0666);
368
+ fd = open(fsname, oflags, 0666);
371
- fd = open(fname, oflags, apr_unix_perms2mode(perm));
372
+ fd = open(fsname, oflags, apr_unix_perms2mode(perm));
377
(*new)->flags = flag;
378
(*new)->filedes = fd;
380
- (*new)->fname = apr_pstrdup(pool, fname);
381
+ (*new)->fname = apr_pstrdup(pool, procname);
383
(*new)->blocking = BLK_ON;
384
(*new)->buffered = (flag & APR_BUFFERED) > 0;
387
APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *pool)
389
- if (unlink(path) == 0) {
390
+ char fsname[APR_PATH_MAX];
391
+ apr_status_t rv = apr_iconv_proc2fs(path, fsname);
392
+ if (rv != APR_SUCCESS)
395
+ if (unlink(fsname) == 0) {
403
- if (rename(from_path, to_path) != 0) {
404
+ char from_path_fs[APR_PATH_MAX], to_path_fs[APR_PATH_MAX];
407
+ rv = apr_iconv_proc2fs(from_path, from_path_fs);
408
+ if (rv != APR_SUCCESS)
411
+ rv = apr_iconv_proc2fs(to_path, to_path_fs);
412
+ if (rv != APR_SUCCESS)
415
+ if (rename(from_path_fs, to_path_fs) != 0) {
419
diff -urN build-tree.orig/apache2/srclib/apr/file_io/unix/path_iconv.c build-tree/apache2/srclib/apr/file_io/unix/path_iconv.c
420
--- build-tree.orig/apache2/srclib/apr/file_io/unix/path_iconv.c 1970-01-01 09:00:00.000000000 +0900
421
+++ build-tree/apache2/srclib/apr/file_io/unix/path_iconv.c 2003-04-11 00:11:57.000000000 +0900
423
+/* ====================================================================
424
+ * The Apache Software License, Version 1.1
426
+ * Copyright (c) 2002 The Apache Software Foundation. All rights
429
+ * Redistribution and use in source and binary forms, with or without
430
+ * modification, are permitted provided that the following conditions
433
+ * 1. Redistributions of source code must retain the above copyright
434
+ * notice, this list of conditions and the following disclaimer.
436
+ * 2. Redistributions in binary form must reproduce the above copyright
437
+ * notice, this list of conditions and the following disclaimer in
438
+ * the documentation and/or other materials provided with the
441
+ * 3. The end-user documentation included with the redistribution,
442
+ * if any, must include the following acknowledgment:
443
+ * "This product includes software developed by the
444
+ * Apache Software Foundation (http://www.apache.org/)."
445
+ * Alternately, this acknowledgment may appear in the software itself,
446
+ * if and wherever such third-party acknowledgments normally appear.
448
+ * 4. The names "Apache" and "Apache Software Foundation" must
449
+ * not be used to endorse or promote products derived from this
450
+ * software without prior written permission. For written
451
+ * permission, please contact apache@apache.org.
453
+ * 5. Products derived from this software may not be called "Apache",
454
+ * nor may "Apache" appear in their name, without prior written
455
+ * permission of the Apache Software Foundation.
457
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
458
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
459
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
460
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
461
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
462
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
463
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
464
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
465
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
466
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
467
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
469
+ * ====================================================================
471
+ * This software consists of voluntary contributions made by many
472
+ * individuals on behalf of the Apache Software Foundation. For more
473
+ * information on the Apache Software Foundation, please see
474
+ * <http://www.apache.org/>.
477
+#include "apr_file_io.h"
478
+#include "apr_file_info.h"
482
+#include "apr_strings.h"
483
+#include "path_iconv.h"
485
+static char *FS_ENCODING = (char *)-1;
488
+ * convert a processing encoding to the filesystem encoding
490
+APR_DECLARE(apr_status_t) apr_iconv_proc2fs(const char *procname,
493
+ static iconv_t cd_proc2fs = NULL;
494
+ char *procname_v = (char *)procname;
495
+ size_t fssize = APR_PATH_MAX, procsize;
497
+ if (procname == NULL || fsname == NULL)
498
+ return APR_EGENERAL;
500
+ if (FS_ENCODING == (char *)-1)
501
+ FS_ENCODING = getenv("APACHE_FS_ENCODING");
503
+ if (FS_ENCODING == NULL) {
504
+ apr_cpystrn(fsname, procname, APR_PATH_MAX);
505
+ return APR_SUCCESS;
508
+ procsize = strlen(procname) + 1;
510
+ if (cd_proc2fs == NULL) {
511
+ cd_proc2fs = iconv_open(FS_ENCODING, PROC_ENCODING);
512
+ if (cd_proc2fs == (iconv_t)-1) {
518
+ if (iconv(cd_proc2fs, NULL, NULL, NULL, NULL) < 0)
522
+ if (iconv(cd_proc2fs, &procname_v, &procsize, &fsname, &fssize) < 0)
525
+ return APR_SUCCESS;
530
+ * initialize iconv descripters
532
+APR_DECLARE(apr_status_t) apr_iconv_fs2proc(const char *fsname,
535
+ static iconv_t cd_fs2proc = NULL;
536
+ char *fsname_v = (char *)fsname;
537
+ size_t procsize = APR_PATH_MAX, fssize;
539
+ if (fsname == NULL || procname == NULL)
540
+ return APR_EGENERAL;
542
+ if (FS_ENCODING == (char *)-1)
543
+ FS_ENCODING = getenv("APACHE_FS_ENCODING");
545
+ if (FS_ENCODING == NULL) {
546
+ apr_cpystrn(procname, fsname, APR_PATH_MAX);
547
+ return APR_SUCCESS;
550
+ fssize = strlen(fsname) + 1;
552
+ if (cd_fs2proc == NULL) {
553
+ cd_fs2proc = iconv_open(PROC_ENCODING, FS_ENCODING);
554
+ if (cd_fs2proc == (iconv_t)-1) {
560
+ if (iconv(cd_fs2proc, NULL, NULL, NULL, NULL) < 0)
564
+ if (iconv(cd_fs2proc, &fsname_v, &fssize, &procname, &procsize) < 0)
567
+ return APR_SUCCESS;
571
diff -urN build-tree.orig/apache2/srclib/apr/file_io/unix/path_iconv.h build-tree/apache2/srclib/apr/file_io/unix/path_iconv.h
572
--- build-tree.orig/apache2/srclib/apr/file_io/unix/path_iconv.h 1970-01-01 09:00:00.000000000 +0900
573
+++ build-tree/apache2/srclib/apr/file_io/unix/path_iconv.h 2003-04-11 00:11:57.000000000 +0900
575
+/* ====================================================================
576
+ * The Apache Software License, Version 1.1
578
+ * Copyright (c) 2002 The Apache Software Foundation. All rights
581
+ * Redistribution and use in source and binary forms, with or without
582
+ * modification, are permitted provided that the following conditions
585
+ * 1. Redistributions of source code must retain the above copyright
586
+ * notice, this list of conditions and the following disclaimer.
588
+ * 2. Redistributions in binary form must reproduce the above copyright
589
+ * notice, this list of conditions and the following disclaimer in
590
+ * the documentation and/or other materials provided with the
593
+ * 3. The end-user documentation included with the redistribution,
594
+ * if any, must include the following acknowledgment:
595
+ * "This product includes software developed by the
596
+ * Apache Software Foundation (http://www.apache.org/)."
597
+ * Alternately, this acknowledgment may appear in the software itself,
598
+ * if and wherever such third-party acknowledgments normally appear.
600
+ * 4. The names "Apache" and "Apache Software Foundation" must
601
+ * not be used to endorse or promote products derived from this
602
+ * software without prior written permission. For written
603
+ * permission, please contact apache@apache.org.
605
+ * 5. Products derived from this software may not be called "Apache",
606
+ * nor may "Apache" appear in their name, without prior written
607
+ * permission of the Apache Software Foundation.
609
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
610
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
611
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
612
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
613
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
614
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
615
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
616
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
617
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
618
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
619
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
621
+ * ====================================================================
623
+ * This software consists of voluntary contributions made by many
624
+ * individuals on behalf of the Apache Software Foundation. For more
625
+ * information on the Apache Software Foundation, please see
626
+ * <http://www.apache.org/>.
629
+#ifndef PATH_ICONV_H
630
+#define PATH_ICONV_H
633
+#define PROC_ENCODING "UTF-8"
637
+ * convert a processing encoding to the filesystem encoding
639
+APR_DECLARE(apr_status_t) apr_iconv_proc2fs(const char *procname,
643
+ * initialize iconv descripters
645
+APR_DECLARE(apr_status_t) apr_iconv_fs2proc(const char *fsname,
648
+#endif /* PATH_ICONV_H */
649
diff -urN build-tree.orig/apache2/srclib/apr/file_io/unix/pipe.c build-tree/apache2/srclib/apr/file_io/unix/pipe.c
650
--- build-tree.orig/apache2/srclib/apr/file_io/unix/pipe.c 2003-03-19 14:32:04.000000000 +0900
651
+++ build-tree/apache2/srclib/apr/file_io/unix/pipe.c 2003-04-11 00:11:57.000000000 +0900
654
#include "apr_arch_inherit.h"
656
+#include "path_iconv.h"
658
/* Figure out how to get pipe block/nonblock on BeOS...
659
* Basically, BONE7 changed things again so that ioctl didn't work,
660
* but now fcntl does, hence we need to do this extra checking.
661
@@ -235,12 +237,17 @@
665
-APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *filename,
666
+APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *procname,
667
apr_fileperms_t perm, apr_pool_t *pool)
669
+ char fsname[APR_PATH_MAX];
670
+ apr_status_t rv = apr_iconv_proc2fs(procname, fsname);
671
mode_t mode = apr_unix_perms2mode(perm);
673
- if (mkfifo(filename, mode) == -1) {
674
+ if (rv != APR_SUCCESS)
677
+ if (mkfifo(fsname, mode) == -1) {