~ubuntu-branches/ubuntu/feisty/apache2/feisty

« back to all changes in this revision

Viewing changes to debian/patches/to-review/013_path_iconv

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Barth
  • Date: 2006-12-09 21:05:45 UTC
  • mfrom: (0.6.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061209210545-h70s0xaqc2v8vqr2
Tags: 2.2.3-3.2
* Non-maintainer upload.
* 043_ajp_connection_reuse: Patch from upstream Bugzilla, fixing a critical
  issue with regard to connection reuse in mod_proxy_ajp.
  Closes: #396265

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
4
 
@@ -1639,6 +1639,7 @@
5
 
     for (x = 0; x < n; x++) {
6
 
         char *anchor, *t, *t2;
7
 
         int nwidth;
8
 
+       int i;
9
 
 
10
 
         apr_pool_clear(scratch);
11
 
 
12
 
@@ -1688,16 +1689,21 @@
13
 
                           ap_escape_html(scratch, t2), "</a>", NULL);
14
 
             }
15
 
             else {
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;
23
 
-                  t2 = name_scratch;
24
 
-                  nwidth = name_width;
25
 
-                }
26
 
+               nwidth = strlen(t2);
27
 
+               if (nwidth > name_width) {
28
 
+                   memcpy(name_scratch, t2, name_width - 2);
29
 
+                   i = name_width - 3;
30
 
+                   while (i > 0) {
31
 
+                       if ( (name_scratch[i] & 0xC0) != 0x80) break;
32
 
+                       i--;
33
 
+                   }
34
 
+                   name_scratch[i] = '.';
35
 
+                   name_scratch[i + 1] = '.';
36
 
+                   name_scratch[i + 2] = '>';
37
 
+                   name_scratch[i + 3] = 0;
38
 
+                   t2 = name_scratch;
39
 
+                   nwidth = name_width;
40
 
+               }
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 @@
45
 
             }
46
 
             nwidth = strlen(t2);
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);
54
 
+               i = name_width - 3;
55
 
+               while (i > 0) {
56
 
+                   if ( (name_scratch[i] & 0xC0) != 0x80) break;
57
 
+                   i--;
58
 
+                       
59
 
+               }
60
 
+                name_scratch[i] = '.';
61
 
+               name_scratch[i + 1] = '.';
62
 
+                name_scratch[i + 2] = '>';
63
 
+                name_scratch[i + 3] = 0;
64
 
                 t2 = name_scratch;
65
 
                 nwidth = name_width;
66
 
             }
67
 
@@ -1967,7 +1979,7 @@
68
 
         return HTTP_FORBIDDEN;
69
 
     }
70
 
 
71
 
-#if APR_HAS_UNICODE_FS
72
 
+#if APR_HAS_UNICODE_FS || 1
73
 
     ap_set_content_type(r, "text/html;charset=utf-8");
74
 
 #else
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
79
 
@@ -15,7 +15,8 @@
80
 
        pipe.lo \
81
 
        readwrite.lo \
82
 
        seek.lo \
83
 
-       mktemp.lo
84
 
+       mktemp.lo \
85
 
+       path_iconv.lo
86
 
 
87
 
 # bring in rules.mk for standard functionality
88
 
 @INCLUDE_RULES@
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
92
 
@@ -62,6 +62,8 @@
93
 
 #include <limits.h>
94
 
 #endif
95
 
 
96
 
+#include "path_iconv.h"
97
 
+
98
 
 static apr_status_t dir_cleanup(void *thedir)
99
 
 {
100
 
     apr_dir_t *dir = thedir;
101
 
@@ -109,6 +111,9 @@
102
 
 apr_status_t apr_dir_open(apr_dir_t **new, const char *dirname, 
103
 
                           apr_pool_t *pool)
104
 
 {
105
 
+    char dirname_fs[APR_PATH_MAX];
106
 
+    apr_status_t rv;
107
 
+
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);
115
 
116
 
+    rv = apr_iconv_proc2fs(dirname, dirname_fs);
117
 
+    if (rv != APR_SUCCESS)
118
 
+       return rv;
119
 
 
120
 
     (*new) = (apr_dir_t *)apr_palloc(pool, sizeof(apr_dir_t));
121
 
 
122
 
     (*new)->pool = pool;
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);
127
 
 
128
 
     if ((*new)->dirstruct == NULL) {
129
 
@@ -171,7 +180,8 @@
130
 
 apr_status_t apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted,
131
 
                           apr_dir_t *thedir)
132
 
 {
133
 
-    apr_status_t ret = 0;
134
 
+    apr_status_t ret = 0, rv;
135
 
+    char procname[APR_PATH_MAX];
136
 
 #ifdef DIRENT_TYPE
137
 
     apr_filetype_e type;
138
 
 #endif
139
 
@@ -213,6 +223,10 @@
140
 
     }
141
 
 #endif
142
 
 
143
 
+    rv = apr_iconv_fs2proc(thedir->entry->d_name, procname);
144
 
+    if (rv != APR_SUCCESS)
145
 
+       return rv;
146
 
+
147
 
     /* No valid bit flag to test here - do we want one? */
148
 
     finfo->fname = NULL;
149
 
 
150
 
@@ -243,7 +257,7 @@
151
 
         off = strlen(fspec);
152
 
         if ((fspec[off - 1] != '/') && (off + 1 < sizeof(fspec)))
153
 
             fspec[off++] = '/';
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 */
158
 
         finfo->fname = NULL;
159
 
@@ -272,7 +286,7 @@
160
 
 #endif
161
 
     }
162
 
 
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;
166
 
 
167
 
     if (wanted)
168
 
@@ -291,8 +305,13 @@
169
 
                           apr_pool_t *pool)
170
 
 {
171
 
     mode_t mode = apr_unix_perms2mode(perm);
172
 
+    char fsname[APR_PATH_MAX];
173
 
+    apr_status_t rv = apr_iconv_proc2fs(path, fsname);
174
 
 
175
 
-    if (mkdir(path, mode) == 0) {
176
 
+    if (rv != APR_SUCCESS)
177
 
+       return rv;
178
 
+
179
 
+    if (mkdir(fsname, mode) == 0) {
180
 
         return APR_SUCCESS;
181
 
     }
182
 
     else {
183
 
@@ -325,7 +344,13 @@
184
 
 
185
 
 apr_status_t apr_dir_remove(const char *path, apr_pool_t *pool)
186
 
 {
187
 
-    if (rmdir(path) == 0) {
188
 
+    char fsname[APR_PATH_MAX];
189
 
+    apr_status_t rv = apr_iconv_proc2fs(path, fsname);
190
 
+
191
 
+    if (rv != APR_SUCCESS)
192
 
+       return rv;
193
 
+
194
 
+    if (rmdir(fsname) == 0) {
195
 
         return APR_SUCCESS;
196
 
     }
197
 
     else {
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
201
 
@@ -70,20 +70,28 @@
202
 
 #include <dirent.h>
203
 
 #endif
204
 
 
205
 
+#include "path_iconv.h"
206
 
+
207
 
 /* Any OS that requires/refuses trailing slashes should be dealt with here.
208
 
  */
209
 
 APR_DECLARE(apr_status_t) apr_filepath_get(char **defpath, apr_int32_t flags,
210
 
                                            apr_pool_t *p)
211
 
 {
212
 
-    char path[APR_PATH_MAX];
213
 
+    char fspath[APR_PATH_MAX], procpath[APR_PATH_MAX];
214
 
+    apr_status_t rv;
215
 
 
216
 
-    if (!getcwd(path, sizeof(path))) {
217
 
+    if (!getcwd(fspath, sizeof(fspath))) {
218
 
         if (errno == ERANGE)
219
 
             return APR_ENAMETOOLONG;
220
 
         else
221
 
             return errno;
222
 
     }
223
 
-    *defpath = apr_pstrdup(p, path);
224
 
+
225
 
+    rv = apr_iconv_fs2proc(fspath, procpath);
226
 
+    if (rv != APR_SUCCESS)
227
 
+       return rv;
228
 
+
229
 
+    *defpath = apr_pstrdup(p, procpath);
230
 
 
231
 
     return APR_SUCCESS;
232
 
 }
233
 
@@ -93,7 +101,13 @@
234
 
  */
235
 
 APR_DECLARE(apr_status_t) apr_filepath_set(const char *path, apr_pool_t *p)
236
 
 {
237
 
-    if (chdir(path) != 0)
238
 
+    char fspath[APR_PATH_MAX];
239
 
+    apr_status_t rv = apr_iconv_proc2fs(path, fspath);
240
 
+
241
 
+    if (rv != APR_SUCCESS)
242
 
+       return rv;
243
 
+
244
 
+    if (chdir(fspath) != 0)
245
 
         return errno;
246
 
 
247
 
     return APR_SUCCESS;
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
251
 
@@ -58,6 +58,8 @@
252
 
 #include "apr_strings.h"
253
 
 #include "apr_errno.h"
254
 
 
255
 
+#include "path_iconv.h"
256
 
+
257
 
 static apr_filetype_e filetype_from_mode(mode_t mode)
258
 
 {
259
 
     apr_filetype_e type;
260
 
@@ -148,12 +150,17 @@
261
 
     }
262
 
 }
263
 
 
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)
267
 
 {
268
 
+    char fsname[APR_PATH_MAX];
269
 
+    apr_status_t rv = apr_iconv_proc2fs(procname, fsname);
270
 
     mode_t mode = apr_unix_perms2mode(perms);
271
 
 
272
 
-    if (chmod(fname, mode) == -1)
273
 
+    if (rv != APR_SUCCESS)
274
 
+       return rv;
275
 
+
276
 
+    if (chmod(fsname, mode) == -1)
277
 
         return errno;
278
 
     return APR_SUCCESS;
279
 
 }
280
 
@@ -209,20 +216,25 @@
281
 
 }
282
 
 
283
 
 APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, 
284
 
-                                   const char *fname, 
285
 
+                                   const char *procname, 
286
 
                                    apr_int32_t wanted, apr_pool_t *pool)
287
 
 {
288
 
     struct stat info;
289
 
     int srv;
290
 
+    char fsname[APR_PATH_MAX];
291
 
+    apr_status_t rv = apr_iconv_proc2fs(procname, fsname);
292
 
+
293
 
+    if (rv != APR_SUCCESS)
294
 
+       return rv;
295
 
 
296
 
     if (wanted & APR_FINFO_LINK)
297
 
-        srv = lstat(fname, &info);
298
 
+        srv = lstat(fsname, &info);
299
 
     else
300
 
-        srv = stat(fname, &info);
301
 
+        srv = stat(fsname, &info);
302
 
 
303
 
     if (srv == 0) {
304
 
         finfo->pool = pool;
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
313
 
@@ -64,10 +64,13 @@
314
 
 #include "fsio.h"
315
 
 #endif
316
 
 
317
 
+#include "path_iconv.h"
318
 
+
319
 
 apr_status_t apr_unix_file_cleanup(void *thefile)
320
 
 {
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];
325
 
 
326
 
     if (file->buffered) {
327
 
         flush_rv = apr_file_flush(file);
328
 
@@ -75,7 +78,10 @@
329
 
     if (close(file->filedes) == 0) {
330
 
         file->filedes = -1;
331
 
         if (file->flags & APR_DELONCLOSE) {
332
 
-            unlink(file->fname);
333
 
+           rv2 = apr_iconv_proc2fs(file->fname, fsname);
334
 
+           if (rv2 != APR_SUCCESS)
335
 
+               return rv2;
336
 
+            unlink(fsname);
337
 
         }
338
 
 #if APR_HAS_THREADS
339
 
         if (file->thlock) {
340
 
@@ -91,7 +97,7 @@
341
 
 }
342
 
 
343
 
 APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, 
344
 
-                                        const char *fname, 
345
 
+                                        const char *procname, 
346
 
                                         apr_int32_t flag, 
347
 
                                         apr_fileperms_t perm, 
348
 
                                         apr_pool_t *pool)
349
 
@@ -100,8 +106,12 @@
350
 
     int oflags = 0;
351
 
 #if APR_HAS_THREADS
352
 
     apr_thread_mutex_t *thlock;
353
 
-    apr_status_t rv;
354
 
 #endif
355
 
+    char fsname[APR_PATH_MAX];
356
 
+    apr_status_t rv = apr_iconv_proc2fs(procname, fsname);
357
 
+
358
 
+    if (rv != APR_SUCCESS)
359
 
+       return rv;
360
 
 
361
 
     if ((flag & APR_READ) && (flag & APR_WRITE)) {
362
 
         oflags = O_RDWR;
363
 
@@ -149,10 +159,10 @@
364
 
 #endif
365
 
 
366
 
     if (perm == APR_OS_DEFAULT) {
367
 
-        fd = open(fname, oflags, 0666);
368
 
+        fd = open(fsname, oflags, 0666);
369
 
     }
370
 
     else {
371
 
-        fd = open(fname, oflags, apr_unix_perms2mode(perm));
372
 
+        fd = open(fsname, oflags, apr_unix_perms2mode(perm));
373
 
     } 
374
 
     if (fd < 0) {
375
 
        return errno;
376
 
@@ -163,7 +173,7 @@
377
 
     (*new)->flags = flag;
378
 
     (*new)->filedes = fd;
379
 
 
380
 
-    (*new)->fname = apr_pstrdup(pool, fname);
381
 
+    (*new)->fname = apr_pstrdup(pool, procname);
382
 
 
383
 
     (*new)->blocking = BLK_ON;
384
 
     (*new)->buffered = (flag & APR_BUFFERED) > 0;
385
 
@@ -204,7 +214,12 @@
386
 
 
387
 
 APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *pool)
388
 
 {
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)
393
 
+       return rv;
394
 
+
395
 
+    if (unlink(fsname) == 0) {
396
 
         return APR_SUCCESS;
397
 
     }
398
 
     else {
399
 
@@ -216,7 +231,18 @@
400
 
                                           const char *to_path,
401
 
                                           apr_pool_t *p)
402
 
 {
403
 
-    if (rename(from_path, to_path) != 0) {
404
 
+    char from_path_fs[APR_PATH_MAX], to_path_fs[APR_PATH_MAX];
405
 
+    apr_status_t rv;
406
 
+
407
 
+    rv = apr_iconv_proc2fs(from_path, from_path_fs);
408
 
+    if (rv != APR_SUCCESS)
409
 
+       return rv;
410
 
+
411
 
+    rv = apr_iconv_proc2fs(to_path, to_path_fs);
412
 
+    if (rv != APR_SUCCESS)
413
 
+       return rv;
414
 
+
415
 
+    if (rename(from_path_fs, to_path_fs) != 0) {
416
 
         return errno;
417
 
     }
418
 
     return APR_SUCCESS;
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
422
 
@@ -0,0 +1,148 @@
423
 
+/* ====================================================================
424
 
+ * The Apache Software License, Version 1.1
425
 
+ *
426
 
+ * Copyright (c) 2002 The Apache Software Foundation.  All rights
427
 
+ * reserved.
428
 
+ *
429
 
+ * Redistribution and use in source and binary forms, with or without
430
 
+ * modification, are permitted provided that the following conditions
431
 
+ * are met:
432
 
+ *
433
 
+ * 1. Redistributions of source code must retain the above copyright
434
 
+ *    notice, this list of conditions and the following disclaimer.
435
 
+ *
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
439
 
+ *    distribution.
440
 
+ *
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.
447
 
+ *
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.
452
 
+ *
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.
456
 
+ *
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
468
 
+ * SUCH DAMAGE.
469
 
+ * ====================================================================
470
 
+ *
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/>.
475
 
+ */
476
 
+
477
 
+#include "apr_file_io.h"
478
 
+#include "apr_file_info.h"
479
 
+#include <iconv.h>
480
 
+#include <string.h>
481
 
+#include <stdlib.h>
482
 
+#include "apr_strings.h"
483
 
+#include "path_iconv.h"
484
 
+
485
 
+static char *FS_ENCODING = (char *)-1;
486
 
+
487
 
+/*
488
 
+ * convert a processing encoding to the filesystem encoding
489
 
+ */
490
 
+APR_DECLARE(apr_status_t) apr_iconv_proc2fs(const char *procname,
491
 
+                                           char *fsname)
492
 
+{
493
 
+    static iconv_t cd_proc2fs = NULL;
494
 
+    char *procname_v = (char *)procname;
495
 
+    size_t fssize = APR_PATH_MAX, procsize;
496
 
+
497
 
+    if (procname == NULL || fsname == NULL)
498
 
+       return APR_EGENERAL;
499
 
+
500
 
+    if (FS_ENCODING == (char *)-1)
501
 
+       FS_ENCODING = getenv("APACHE_FS_ENCODING");
502
 
+
503
 
+    if (FS_ENCODING == NULL) {
504
 
+       apr_cpystrn(fsname, procname, APR_PATH_MAX);
505
 
+       return APR_SUCCESS;
506
 
+    }
507
 
+
508
 
+    procsize = strlen(procname) + 1;
509
 
+
510
 
+    if (cd_proc2fs == NULL) {
511
 
+       cd_proc2fs = iconv_open(FS_ENCODING, PROC_ENCODING);
512
 
+       if (cd_proc2fs == (iconv_t)-1) {
513
 
+           return errno;
514
 
+       }
515
 
+    }
516
 
+
517
 
+#if 1
518
 
+    if (iconv(cd_proc2fs, NULL, NULL, NULL, NULL) < 0)
519
 
+       return errno;
520
 
+#endif
521
 
+
522
 
+    if (iconv(cd_proc2fs, &procname_v, &procsize, &fsname, &fssize) < 0)
523
 
+       return errno;
524
 
+
525
 
+    return APR_SUCCESS;
526
 
+}
527
 
+
528
 
+
529
 
+/*
530
 
+ * initialize iconv descripters
531
 
+ */
532
 
+APR_DECLARE(apr_status_t) apr_iconv_fs2proc(const char *fsname,
533
 
+                                           char *procname)
534
 
+{
535
 
+    static iconv_t cd_fs2proc = NULL;
536
 
+    char *fsname_v = (char *)fsname;
537
 
+    size_t procsize = APR_PATH_MAX, fssize;
538
 
+
539
 
+    if (fsname == NULL || procname == NULL)
540
 
+       return APR_EGENERAL;
541
 
+
542
 
+    if (FS_ENCODING == (char *)-1)
543
 
+       FS_ENCODING = getenv("APACHE_FS_ENCODING");
544
 
+
545
 
+    if (FS_ENCODING == NULL) {
546
 
+       apr_cpystrn(procname, fsname, APR_PATH_MAX);
547
 
+       return APR_SUCCESS;
548
 
+    }
549
 
+
550
 
+    fssize = strlen(fsname) + 1;
551
 
+
552
 
+    if (cd_fs2proc == NULL) {
553
 
+       cd_fs2proc = iconv_open(PROC_ENCODING, FS_ENCODING);
554
 
+       if (cd_fs2proc == (iconv_t)-1) {
555
 
+           return errno;
556
 
+       }
557
 
+    }
558
 
+
559
 
+#if 1
560
 
+    if (iconv(cd_fs2proc, NULL, NULL, NULL, NULL) < 0)
561
 
+       return errno;
562
 
+#endif
563
 
+
564
 
+    if (iconv(cd_fs2proc, &fsname_v, &fssize, &procname, &procsize) < 0)
565
 
+       return errno;
566
 
+
567
 
+    return APR_SUCCESS;
568
 
+}
569
 
+
570
 
+
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
574
 
@@ -0,0 +1,74 @@
575
 
+/* ====================================================================
576
 
+ * The Apache Software License, Version 1.1
577
 
+ *
578
 
+ * Copyright (c) 2002 The Apache Software Foundation.  All rights
579
 
+ * reserved.
580
 
+ *
581
 
+ * Redistribution and use in source and binary forms, with or without
582
 
+ * modification, are permitted provided that the following conditions
583
 
+ * are met:
584
 
+ *
585
 
+ * 1. Redistributions of source code must retain the above copyright
586
 
+ *    notice, this list of conditions and the following disclaimer.
587
 
+ *
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
591
 
+ *    distribution.
592
 
+ *
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.
599
 
+ *
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.
604
 
+ *
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.
608
 
+ *
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
620
 
+ * SUCH DAMAGE.
621
 
+ * ====================================================================
622
 
+ *
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/>.
627
 
+ */
628
 
+
629
 
+#ifndef PATH_ICONV_H
630
 
+#define PATH_ICONV_H
631
 
+
632
 
+
633
 
+#define PROC_ENCODING "UTF-8"
634
 
+
635
 
+
636
 
+/*
637
 
+ * convert a processing encoding to the filesystem encoding
638
 
+ */
639
 
+APR_DECLARE(apr_status_t) apr_iconv_proc2fs(const char *procname,
640
 
+                                           char *fsname);
641
 
+
642
 
+/*
643
 
+ * initialize iconv descripters
644
 
+ */
645
 
+APR_DECLARE(apr_status_t) apr_iconv_fs2proc(const char *fsname,
646
 
+                                           char *procname);
647
 
+
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
652
 
@@ -58,6 +58,8 @@
653
 
 
654
 
 #include "apr_arch_inherit.h"
655
 
 
656
 
+#include "path_iconv.h"
657
 
+
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 @@
662
 
     return APR_SUCCESS;
663
 
 }
664
 
 
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)
668
 
 {
669
 
+    char fsname[APR_PATH_MAX];
670
 
+    apr_status_t rv = apr_iconv_proc2fs(procname, fsname);
671
 
     mode_t mode = apr_unix_perms2mode(perm);
672
 
 
673
 
-    if (mkfifo(filename, mode) == -1) {
674
 
+    if (rv != APR_SUCCESS)
675
 
+       return rv;
676
 
+
677
 
+    if (mkfifo(fsname, mode) == -1) {
678
 
         return errno;
679
 
     }
680
 
     return APR_SUCCESS;