View Issue Details

IDProjectCategoryView StatusLast Update
0000487Apache 2.x Bugpublic2020-08-24 03:13
ReporterDB1 Assigned Topsmedley  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
PlatformT23OSECSOS Version2.20
Product Versionv2.2.0 
Summary0000487: 2.2.20 Authentication is broken - all rejected as mismatch
DescriptionAuth BASIC is broken - all are rejected as a mismatch. Reverting to 2.2.17 with *no* other changes and all is well.
TagsNo tags attached.
Attached Files
apr-1.4.5.diff (77,082 bytes)   
Only in apr-1.4.5: .libs
Only in apr-1.4.5: .make.dirs
Only in apr-1.4.5: 71
Only in apr-1.4.5: apr-1-config
Only in apr-1.4.5: apr-config.out
Only in apr-1.4.5: apr.exp
Only in apr-1.4.5: apr.pc
Only in apr-1.4.5/atomic/unix: builtins.lo
Only in apr-1.4.5/atomic/unix: builtins.o
Only in apr-1.4.5/atomic/unix: ia32.lo
Only in apr-1.4.5/atomic/unix: ia32.o
Only in apr-1.4.5/atomic/unix: mutex.lo
Only in apr-1.4.5/atomic/unix: mutex.o
Only in apr-1.4.5/atomic/unix: ppc.lo
Only in apr-1.4.5/atomic/unix: ppc.o
Only in apr-1.4.5/atomic/unix: s390.lo
Only in apr-1.4.5/atomic/unix: s390.o
Only in apr-1.4.5/atomic/unix: solaris.lo
Only in apr-1.4.5/atomic/unix: solaris.o
diff -ur apr-1.4.5-o/build/aplibtool.c apr-1.4.5/build/aplibtool.c
--- apr-1.4.5-o/build/aplibtool.c	2011-02-18 21:57:04.000000000 +1030
+++ apr-1.4.5/build/aplibtool.c	2011-09-11 19:03:34.000000000 +0930
@@ -36,7 +36,7 @@
 #  define CC         "gcc"
 #  define GEN_EXPORTS "emxexp"
 #  define DEF2IMPLIB_CMD "emximp"
-#  define SHARE_SW   "-Zdll -Zmtd"
+#  define SHARE_SW   "-Zdll -Zmap -Zmtd"
 #  define USE_OMF true
 #  define TRUNCATE_DLL_NAME
 #  define DYNAMIC_LIB_EXT "dll"
@@ -45,7 +45,7 @@
 #  if USE_OMF
      /* OMF is the native format under OS/2 */
 #    define STATIC_LIB_EXT "lib"
-#    define OBJECT_EXT     "obj"
+#    define OBJECT_EXT     "o"
 #    define LIBRARIAN      "emxomfar"
 #  else
      /* but the alternative, a.out, can fork() which is sometimes necessary */
@@ -358,7 +358,6 @@
           newarg = truncate_dll_name(newarg);
         }
 #endif
-
         cmd_data->arglist[cmd_data->num_args++] = newarg;
         cmd_data->output_name = newarg;
         return true;
Only in apr-1.4.5/build: aplibtool.exe
Only in apr-1.4.5/build: apr_rules.mk
Only in apr-1.4.5/build: apr_rules.out
Only in apr-1.4.5/build/pkg: pkginfo
Only in apr-1.4.5: build.cmd
Only in apr-1.4.5: build.log
Only in apr-1.4.5: conf.cmd
Only in apr-1.4.5: config.log
Only in apr-1.4.5: config.nice
Only in apr-1.4.5: config.status
Only in apr-1.4.5: configure.lineno
Only in apr-1.4.5: configure.log
Only in apr-1.4.5: data
diff -ur apr-1.4.5-o/dso/os2/dso.c apr-1.4.5/dso/os2/dso.c
--- apr-1.4.5-o/dso/os2/dso.c	2006-08-03 20:25:30.000000000 +0930
+++ apr-1.4.5/dso/os2/dso.c	2011-06-25 18:35:50.000000000 +0930
@@ -50,13 +50,23 @@
     (*res_handle)->load_error = APR_SUCCESS;
     (*res_handle)->failed_module = NULL;
 
-    if ((rc = DosLoadModule(failed_module, sizeof(failed_module), path, &handle)) != 0) {
+    rc = DosLoadModule(failed_module, sizeof(failed_module), path, &handle);
+
+   if ((rc != 0)&&(rc!=87)) {
         (*res_handle)->load_error = APR_FROM_OS_ERROR(rc);
         (*res_handle)->failed_module = apr_pstrdup(ctx, failed_module);
         return APR_FROM_OS_ERROR(rc);
     }
 
+   if (rc==87){
+        int rc2;
+        HMODULE handle2;
+        rc2=DosQueryModuleHandle(path,&handle2);
+        (*res_handle)->handle  = handle2;
+        }
+   if (rc==0) 
     (*res_handle)->handle  = handle;
+
     apr_pool_cleanup_register(ctx, *res_handle, dso_cleanup, apr_pool_cleanup_null);
     return APR_SUCCESS;
 }
@@ -80,7 +90,16 @@
     if (symname == NULL || ressym == NULL)
         return APR_ESYMNOTFOUND;
 
-    if ((rc = DosQueryProcAddr(handle->handle, 0, symname, &func)) != 0) {
+#if defined(__INNOTEK_LIBC__)
+    void *retval;
+    char *symbol = (char*)malloc(sizeof(char)*(strlen(symname)+2));
+    sprintf(symbol, "_%s", symname);
+    rc = DosQueryProcAddr(handle->handle, 0, symbol, &func);
+    free(symbol);
+#else
+    rc = DosQueryProcAddr(handle->handle, 0, symname, &func);
+#endif
+    if (rc != 0) {
         handle->load_error = APR_FROM_OS_ERROR(rc);
         return handle->load_error;
     }
Only in apr-1.4.5/dso/os2: dso.lo
Only in apr-1.4.5/dso/os2: dso.o
Only in apr-1.4.5: export_vars.c
Only in apr-1.4.5: exports.c
Only in apr-1.4.5/file_io/os2: buffer.lo
Only in apr-1.4.5/file_io/os2: buffer.o
Only in apr-1.4.5/file_io/os2: copy.lo
Only in apr-1.4.5/file_io/os2: copy.o
Only in apr-1.4.5/file_io/os2: dir_make_recurse.lo
Only in apr-1.4.5/file_io/os2: dir_make_recurse.o
diff -ur apr-1.4.5-o/file_io/os2/dir.c apr-1.4.5/file_io/os2/dir.c
--- apr-1.4.5-o/file_io/os2/dir.c	2006-08-03 20:25:30.000000000 +0930
+++ apr-1.4.5/file_io/os2/dir.c	2011-06-25 18:35:50.000000000 +0930
@@ -21,6 +21,16 @@
 #include "apr_portable.h"
 #include <string.h>
 
+#if ( defined(__INNOTEK_LIBCxx__) || defined(__WATCOMC__) )
+/* Paul - I didn't see F_OK defined in io.h so I add this incase - asking Bird
+ * says in fcntl.h or unistd.h
+ */
+#ifndef F_OK
+#define F_OK  0
+#endif
+#include <io.h>
+#endif
+
 static apr_status_t dir_cleanup(void *thedir)
 {
     apr_dir_t *dir = thedir;
@@ -46,6 +56,14 @@
     thedir->validentry = FALSE;
     *new = thedir;
     apr_pool_cleanup_register(pool, thedir, dir_cleanup, apr_pool_cleanup_null);
+    /* In testdir, a call to a non-existent directory and the expected return is
+     * APR_ENOENT. I am adding a quick access( ), which is supported by new gcc and
+     * Open Watcom. If the dir doesn' exist we bug-out with the correct error.
+     */
+#if ( defined(__INNOTEK_LIBC__) || defined(__WATCOMC__) )
+    if(access(dirname, F_OK) != 0) return APR_ENOENT;
+#endif
+
     return APR_SUCCESS;
 }
 
Only in apr-1.4.5/file_io/os2: dir.lo
Only in apr-1.4.5/file_io/os2: dir.o
Only in apr-1.4.5/file_io/os2: fileacc.lo
Only in apr-1.4.5/file_io/os2: fileacc.o
Only in apr-1.4.5/file_io/os2: filedup.lo
Only in apr-1.4.5/file_io/os2: filedup.o
Only in apr-1.4.5/file_io/os2: filepath_util.lo
Only in apr-1.4.5/file_io/os2: filepath_util.o
Only in apr-1.4.5/file_io/os2: filepath.lo
Only in apr-1.4.5/file_io/os2: filepath.o
diff -ur apr-1.4.5-o/file_io/os2/filestat.c apr-1.4.5/file_io/os2/filestat.c
--- apr-1.4.5-o/file_io/os2/filestat.c	2006-08-03 20:25:30.000000000 +0930
+++ apr-1.4.5/file_io/os2/filestat.c	2011-06-25 18:35:50.000000000 +0930
@@ -84,7 +84,123 @@
     return APR_FROM_OS_ERROR(rc);
 }
 
+#ifdef __KLIBC__
+static apr_filetype_e filetype_from_mode(mode_t mode)
+{
+    apr_filetype_e type;
+
+    switch (mode & S_IFMT) {
+    case S_IFREG:
+        type = APR_REG;  break;
+    case S_IFDIR:
+        type = APR_DIR;  break;
+    case S_IFLNK:
+        type = APR_LNK;  break;
+    case S_IFCHR:
+        type = APR_CHR;  break;
+    case S_IFBLK:
+        type = APR_BLK;  break;
+#if defined(S_IFFIFO)
+    case S_IFFIFO:
+        type = APR_PIPE; break;
+#endif
+#if !defined(BEOS) && defined(S_IFSOCK)
+    case S_IFSOCK:
+        type = APR_SOCK; break;
+#endif
+
+    default:
+	/* Work around missing S_IFxxx values above
+         * for Linux et al.
+         */
+#if !defined(S_IFFIFO) && defined(S_ISFIFO)
+    	if (S_ISFIFO(mode)) {
+            type = APR_PIPE;
+	} else
+#endif
+#if !defined(BEOS) && !defined(S_IFSOCK) && defined(S_ISSOCK)
+    	if (S_ISSOCK(mode)) {
+            type = APR_SOCK;
+	} else
+#endif
+        type = APR_UNKFILE;
+    }
+    return type;
+}
+
+static void fill_out_finfo(apr_finfo_t *finfo, struct_stat *info,
+                           apr_int32_t wanted)
+{ 
+    finfo->valid = APR_FINFO_MIN | APR_FINFO_IDENT | APR_FINFO_NLINK
+                 | APR_FINFO_OWNER | APR_FINFO_PROT;
+    finfo->protection = apr_unix_mode2perms(info->st_mode);
+    finfo->filetype = filetype_from_mode(info->st_mode);
+    finfo->user = info->st_uid;
+    finfo->group = info->st_gid;
+    finfo->size = info->st_size;
+    finfo->inode = info->st_ino;
+    finfo->device = info->st_dev;
+    finfo->nlink = info->st_nlink;
+    apr_time_ansi_put(&finfo->atime, info->st_atime);
+#ifdef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
+    finfo->atime += info->st_atim.tv_nsec / APR_TIME_C(1000);
+#elif defined(HAVE_STRUCT_STAT_ST_ATIMENSEC)
+    finfo->atime += info->st_atimensec / APR_TIME_C(1000);
+#elif defined(HAVE_STRUCT_STAT_ST_ATIME_N)
+    finfo->ctime += info->st_atime_n / APR_TIME_C(1000);
+#endif
+
+    apr_time_ansi_put(&finfo->mtime, info->st_mtime);
+#ifdef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
+    finfo->mtime += info->st_mtim.tv_nsec / APR_TIME_C(1000);
+#elif defined(HAVE_STRUCT_STAT_ST_MTIMENSEC)
+    finfo->mtime += info->st_mtimensec / APR_TIME_C(1000);
+#elif defined(HAVE_STRUCT_STAT_ST_MTIME_N)
+    finfo->ctime += info->st_mtime_n / APR_TIME_C(1000);
+#endif
+
+    apr_time_ansi_put(&finfo->ctime, info->st_ctime);
+#ifdef HAVE_STRUCT_STAT_ST_CTIM_TV_NSEC
+    finfo->ctime += info->st_ctim.tv_nsec / APR_TIME_C(1000);
+#elif defined(HAVE_STRUCT_STAT_ST_CTIMENSEC)
+    finfo->ctime += info->st_ctimensec / APR_TIME_C(1000);
+#elif defined(HAVE_STRUCT_STAT_ST_CTIME_N)
+    finfo->ctime += info->st_ctime_n / APR_TIME_C(1000);
+#endif
+
+#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
+#ifdef DEV_BSIZE
+    finfo->csize = (apr_off_t)info->st_blocks * (apr_off_t)DEV_BSIZE;
+#else
+    finfo->csize = (apr_off_t)info->st_blocks * (apr_off_t)512;
+#endif
+    finfo->valid |= APR_FINFO_CSIZE;
+#endif
+}
+
+apr_status_t apr_file_info_get_locked(apr_finfo_t *finfo, apr_int32_t wanted,
+                                      apr_file_t *thefile)
+{
 
+    struct_stat info;
+
+    if (thefile->buffered) {
+        apr_status_t rv = apr_file_flush_locked(thefile);
+        if (rv != APR_SUCCESS)
+            return rv;
+    }
+
+    if (fstat(thefile->filedes, &info) == 0) {
+        finfo->pool = thefile->pool;
+        finfo->fname = thefile->fname;
+        fill_out_finfo(finfo, &info, wanted);
+        return (wanted & ~finfo->valid) ? APR_INCOMPLETE : APR_SUCCESS;
+    }
+    else {
+        return errno;
+    }
+}
+#endif
 
 APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo, apr_int32_t wanted, 
                                    apr_file_t *thefile)
@@ -172,7 +288,12 @@
         return APR_FROM_OS_ERROR(rc);
     }
 
+#ifndef __INNOTEK_LIBC__
     return (wanted & ~finfo->valid) ? APR_INCOMPLETE : APR_SUCCESS;
+#else
+    return APR_SUCCESS;
+#endif
+
 }
 
 
Only in apr-1.4.5/file_io/os2: filestat.lo
Only in apr-1.4.5/file_io/os2: filestat.o
Only in apr-1.4.5/file_io/os2: filesys.lo
Only in apr-1.4.5/file_io/os2: filesys.o
Only in apr-1.4.5/file_io/os2: flock.lo
Only in apr-1.4.5/file_io/os2: flock.o
Only in apr-1.4.5/file_io/os2: fullrw.lo
Only in apr-1.4.5/file_io/os2: fullrw.o
diff -ur apr-1.4.5-o/file_io/os2/maperrorcode.c apr-1.4.5/file_io/os2/maperrorcode.c
--- apr-1.4.5-o/file_io/os2/maperrorcode.c	2006-08-03 20:25:30.000000000 +0930
+++ apr-1.4.5/file_io/os2/maperrorcode.c	2011-06-25 18:35:50.000000000 +0930
@@ -18,8 +18,8 @@
 #include "apr_arch_file_io.h"
 #include "apr_file_io.h"
 #include <errno.h>
-#include <string.h>
 #include "apr_errno.h"
+#include <string.h>
 
 static int errormap[][2] = {
     { NO_ERROR,                   APR_SUCCESS      },
@@ -37,7 +37,7 @@
     { ERROR_NEGATIVE_SEEK,        APR_ESPIPE       },
     { ERROR_NO_SIGNAL_SENT,       ESRCH            },
     { ERROR_NO_DATA,              APR_EAGAIN       },
-    { SOCEINTR,                 EINTR           },
+    { SOCEINTR,         	EINTR           },
     { SOCEWOULDBLOCK,           EWOULDBLOCK     },
     { SOCEINPROGRESS,           EINPROGRESS     },
     { SOCEALREADY,              EALREADY        },
@@ -81,15 +81,13 @@
 
     if (err < APR_OS_START_SYSERR)
         return err;
-
     err -= APR_OS_START_SYSERR;
-
     for (index=0; index<MAPSIZE && errormap[index][0] != err; index++);
     
     if (index<MAPSIZE)
         rv = errormap[index][1];
     else
-        fprintf(stderr, "apr_canonical_error: Unknown OS/2 error code %d\n", err );
+        fprintf(stderr, "apr_canonical_error: Unknown OS/2 error code %d\n",err);
         
     return rv;
 }
Only in apr-1.4.5/file_io/os2: maperrorcode.lo
Only in apr-1.4.5/file_io/os2: maperrorcode.o
Only in apr-1.4.5/file_io/os2: mktemp.lo
Only in apr-1.4.5/file_io/os2: mktemp.o
diff -ur apr-1.4.5-o/file_io/os2/open.c apr-1.4.5/file_io/os2/open.c
--- apr-1.4.5-o/file_io/os2/open.c	2010-03-02 10:59:02.000000000 +1030
+++ apr-1.4.5/file_io/os2/open.c	2011-06-25 18:57:00.000000000 +0930
@@ -28,6 +28,59 @@
     return apr_file_close(file);
 }
 
+#ifdef __INNOTEK_LIBC__
+static apr_status_t file_cleanup(apr_file_t *file)
+{
+    apr_status_t rv = APR_SUCCESS;
+
+    if (close(file->filedes) == 0) {
+        file->filedes = -1;
+        if (file->flags & APR_DELONCLOSE) {
+            unlink(file->fname);
+        }
+#if APR_HAS_THREADS
+        if (file->mutex) {
+            rv = apr_thread_mutex_destroy(file->mutex);
+        }
+#endif
+    }
+    else {
+        /* Are there any error conditions other than EINTR or EBADF? */
+        rv = errno;
+    }
+#ifndef WAITIO_USES_POLL
+    if (file->pollset != NULL) {
+        int pollset_rv = apr_pollset_destroy(file->pollset);
+        /* If the file close failed, return its error value,
+         * not apr_pollset_destroy()'s.
+         */
+        if (rv == APR_SUCCESS) {
+            rv = pollset_rv;
+        }
+    }
+#endif /* !WAITIO_USES_POLL */
+    return rv;
+}
+
+apr_status_t apr_unix_file_cleanup(void *thefile)
+{
+    apr_file_t *file = thefile;
+    apr_status_t flush_rv = APR_SUCCESS, rv = APR_SUCCESS;
+
+    if (file->buffered) {
+        flush_rv = apr_file_flush(file);
+    }
+
+    rv = file_cleanup(file);
+
+    return rv != APR_SUCCESS ? rv : flush_rv;
+}
+
+apr_status_t apr_unix_child_file_cleanup(void *thefile)
+{
+    return file_cleanup(thefile);
+}
+#endif
 
 
 APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, const char *fname, apr_int32_t flag,  apr_fileperms_t perm, apr_pool_t *pool)
@@ -36,6 +89,9 @@
     int mflags = OPEN_FLAGS_FAIL_ON_ERROR|OPEN_SHARE_DENYNONE|OPEN_FLAGS_NOINHERIT;
     int rv;
     ULONG action;
+    ULONG    CurMaxFH      = 0;          /* Current count of handles         */
+    LONG     ReqCount      = 0;          /* Number to adjust file handles    */
+
     apr_file_t *dafile = (apr_file_t *)apr_palloc(pool, sizeof(apr_file_t));
 
     dafile->pool = pool;
@@ -86,6 +142,14 @@
     
     rv = DosOpen(fname, &(dafile->filedes), &action, 0, 0, oflags, mflags, NULL);
     
+    if (rv == ERROR_TOO_MANY_OPEN_FILES) {
+	rv = DosSetRelMaxFH(&ReqCount,     /* Using 0 here will return the       */
+                      &CurMaxFH);    /* current number of file handles     */
+	rv = DosSetRelMaxFH(10L,&CurMaxFH);     /* Change handle maximum */
+
+	rv = DosOpen(fname, &(dafile->filedes), &action, 0, 0, oflags, mflags, NULL);
+    }    
+
     if (rv == 0 && (flag & APR_FOPEN_APPEND)) {
         ULONG newptr;
         rv = DosSetFilePtr(dafile->filedes, 0, FILE_END, &newptr );
@@ -105,6 +169,7 @@
     dafile->direction = 0;
     dafile->pipe = FALSE;
 
+
     if (!(flag & APR_FOPEN_NOCLEANUP)) {
         apr_pool_cleanup_register(dafile->pool, dafile, apr_file_cleanup, apr_file_cleanup);
     }
@@ -275,11 +340,9 @@
     ULONG state;
 
     rv = DosQueryFHState(thefile->filedes, &state);
-
     if (rv == 0 && (state & OPEN_FLAGS_NOINHERIT) != 0) {
         rv = DosSetFHState(thefile->filedes, state & ~OPEN_FLAGS_NOINHERIT);
     }
-
     return APR_FROM_OS_ERROR(rv);
 }
 
@@ -291,10 +354,14 @@
     ULONG state;
 
     rv = DosQueryFHState(thefile->filedes, &state);
-
     if (rv == 0 && (state & OPEN_FLAGS_NOINHERIT) == 0) {
-        rv = DosSetFHState(thefile->filedes, state | OPEN_FLAGS_NOINHERIT);
+/*        rv = DosSetFHState(thefile->filedes, state | OPEN_FLAGS_NOINHERIT);*/
     }
-
     return APR_FROM_OS_ERROR(rv);
 }
+
+APR_DECLARE(apr_status_t) apr_file_link(const char *from_path, 
+                                          const char *to_path)
+{
+    return APR_ENOTIMPL;;
+}
Only in apr-1.4.5/file_io/os2: open.c.orig
Only in apr-1.4.5/file_io/os2: open.c.rej
Only in apr-1.4.5/file_io/os2: open.lo
Only in apr-1.4.5/file_io/os2: open.o
diff -ur apr-1.4.5-o/file_io/os2/pipe.c apr-1.4.5/file_io/os2/pipe.c
--- apr-1.4.5-o/file_io/os2/pipe.c	2007-10-15 00:04:42.000000000 +1030
+++ apr-1.4.5/file_io/os2/pipe.c	2011-06-25 18:50:30.000000000 +0930
@@ -30,6 +30,8 @@
     ULONG rc, action;
     static int id = 0;
     char pipename[50];
+    ULONG    CurMaxFH      = 0;          /* Current count of handles         */
+    LONG     ReqCount      = 0;          /* Number to adjust file handles    */
 
     sprintf(pipename, "/pipe/%d.%d", getpid(), id++);
     rc = DosCreateNPipe(pipename, filedes, NP_ACCESS_INBOUND, NP_NOWAIT|1, 4096, 4096, 0);
@@ -48,6 +50,17 @@
                   OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW,
                   OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYREADWRITE,
                   NULL);
+    if (rc == ERROR_TOO_MANY_OPEN_FILES) {
+	rc = DosSetRelMaxFH(&ReqCount,     /* Using 0 here will return the       */
+                      &CurMaxFH);    /* current number of file handles     */
+	rc = DosSetRelMaxFH(10L,&CurMaxFH);     /* Change handle maximum */
+
+	rc = DosOpen (pipename, filedes+1, &action, 0, FILE_NORMAL,
+                  OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW,
+                  OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYREADWRITE,
+                  NULL);
+
+    }    
 
     if (rc) {
         DosClose(filedes[0]);
@@ -143,23 +156,24 @@
 
 APR_DECLARE(apr_status_t) apr_file_pipe_timeout_set(apr_file_t *thepipe, apr_interval_time_t timeout)
 {
+    int rc = 0;
+
     if (thepipe->pipe == 1) {
         thepipe->timeout = timeout;
 
-        if (thepipe->timeout >= 0) {
-            if (thepipe->blocking != BLK_OFF) {
+        if ((thepipe->timeout >= 0) && (thepipe->blocking != BLK_OFF) ) {
                 thepipe->blocking = BLK_OFF;
-                return APR_FROM_OS_ERROR(DosSetNPHState(thepipe->filedes, NP_NOWAIT));
-            }
+            rc = DosSetNPHState(thepipe->filedes, NP_NOWAIT);
         }
-        else if (thepipe->timeout == -1) {
-            if (thepipe->blocking != BLK_ON) {
+        else if ( (thepipe->timeout == -1) && (thepipe->blocking != BLK_ON) ) {
                 thepipe->blocking = BLK_ON;
-                return APR_FROM_OS_ERROR(DosSetNPHState(thepipe->filedes, NP_WAIT));
-            }
-        }
+            rc = DosSetNPHState(thepipe->filedes, NP_WAIT);
     }
-    return APR_EINVAL;
+
+        return APR_FROM_OS_ERROR(rc);
+
+    } else return APR_EINVAL;
+
 }
 
 
Only in apr-1.4.5/file_io/os2: pipe.lo
Only in apr-1.4.5/file_io/os2: pipe.o
diff -ur apr-1.4.5-o/file_io/os2/readwrite.c apr-1.4.5/file_io/os2/readwrite.c
--- apr-1.4.5-o/file_io/os2/readwrite.c	2011-02-18 21:57:04.000000000 +1030
+++ apr-1.4.5/file_io/os2/readwrite.c	2011-06-26 07:38:36.000000000 +0930
@@ -34,6 +34,16 @@
         return APR_EBADF;
     }
 
+    /* unix code was checking for nbytes <= 0 and returning
+     * APR_SUCCESS for test_readzero - now we are up to speed
+     * but... nbytes is an unsigned int so why the hell are they
+     * checking for < 0 ??? Linux elite
+     */
+    if (*nbytes == 0) {
+        *nbytes = 0;
+        return APR_SUCCESS;
+    }
+
     if (thefile->buffered) {
         char *pos = (char *)buf;
         ULONG blocksize;
@@ -149,10 +159,10 @@
         }
 
         while (rc == 0 && size > 0) {
-            if (thefile->bufpos == thefile->bufsize) /* write buffer is full */
+            if (thefile->bufpos == thefile->bufsize){ /* write buffer is full */
                 /* XXX bug; - rc is double-transformed os->apr below */
                 rc = apr_file_flush(thefile);
-
+		}
             blocksize = size > thefile->bufsize - thefile->bufpos ? thefile->bufsize - thefile->bufpos : size;
             memcpy(thefile->buffer + thefile->bufpos, pos, blocksize);
             thefile->bufpos += blocksize;
@@ -172,7 +182,7 @@
                 rc = DosSetFilePtr(thefile->filedes, 0, FILE_END, &newpos);
 
                 if (rc == 0) {
-                    rc = DosWrite(thefile->filedes, buf, *nbytes, &byteswritten);
+                    rc = DosWrite(thefile->filedes, (PVOID)buf, *nbytes, &byteswritten);
                 }
 
                 DosSetFileLocks(thefile->filedes, &all, NULL, -1, 0);
@@ -197,6 +207,7 @@
 
 APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile, const struct iovec *vec, apr_size_t nvec, apr_size_t *nbytes)
 {
+#ifndef __KLIBC__xx
     int bytes;
 
     if (thefile->buffered) {
@@ -214,6 +225,42 @@
         *nbytes = bytes;
         return APR_SUCCESS;
     }
+#else
+    apr_status_t rv;
+    int bytes;
+
+    if (thefile->buffered) {
+        file_lock(thefile);
+
+        rv = apr_file_flush_locked(thefile);
+        if (rv != APR_SUCCESS) {
+            file_unlock(thefile);
+            return rv;
+        }
+        if (thefile->direction == 0) {
+            /* Position file pointer for writing at the offset we are
+             * logically reading from
+             */
+            apr_int64_t offset = thefile->filePtr - thefile->dataRead +
+                                 thefile->bufpos;
+            if (offset != thefile->filePtr)
+                lseek(thefile->filedes, offset, SEEK_SET);
+            thefile->bufpos = thefile->dataRead = 0;
+        }
+
+        file_unlock(thefile);
+    }
+
+    if ((bytes = writev(thefile->filedes, vec, nvec)) < 0) {
+        *nbytes = 0;
+        rv = errno;
+    }
+    else {
+        *nbytes = bytes;
+        rv = APR_SUCCESS;
+    }
+    return rv;
+#endif
 }
 #endif
 
@@ -248,6 +295,7 @@
 
 APR_DECLARE(apr_status_t) apr_file_getc(char *ch, apr_file_t *thefile)
 {
+#if 1
     ULONG rc;
     apr_size_t bytesread;
 
@@ -268,19 +316,52 @@
     }
     
     return APR_SUCCESS;
+#else
+    apr_size_t nbytes = 1;
+
+    return apr_file_read(thefile, ch, &nbytes);
+
+#endif
 }
 
 
 
 APR_DECLARE(apr_status_t) apr_file_puts(const char *str, apr_file_t *thefile)
 {
+#if 1
     apr_size_t len;
 
     len = strlen(str);
     return apr_file_write(thefile, str, &len); 
+#else
+    return apr_file_write_full(thefile, str, strlen(str), NULL);
+#endif
 }
 
 
+#ifdef __KLIBC__
+apr_status_t apr_file_flush_locked(apr_file_t *thefile)
+{
+    apr_status_t rv = APR_SUCCESS;
+
+    if (thefile->direction == 1 && thefile->bufpos) {
+        apr_ssize_t written;
+
+        do {
+            written = write(thefile->filedes, thefile->buffer, thefile->bufpos);
+        } while (written == -1 && errno == EINTR);
+        if (written == -1) {
+            rv = errno;
+        } else {
+            thefile->filePtr += written;
+            thefile->bufpos = 0;
+        }
+    }
+
+    return rv;
+}
+#endif
+
 APR_DECLARE(apr_status_t) apr_file_flush(apr_file_t *thefile)
 {
     if (thefile->buffered) {
@@ -349,6 +430,58 @@
 }
 
 
+/* Pull from unix code to start a sync up */
+#if (defined(__INNOTEK_LIBC__) || defined(__WATCOMC__) )
+ 
+struct apr_file_printf_data {
+    apr_vformatter_buff_t vbuff;
+    apr_file_t *fptr;
+    char *buf;
+};
+
+static int file_printf_flush(apr_vformatter_buff_t *buff)
+{
+    struct apr_file_printf_data *data = (struct apr_file_printf_data *)buff;
+
+    if (apr_file_write_full(data->fptr, data->buf,
+                            data->vbuff.curpos - data->buf, NULL)) {
+        return -1;
+    }
+
+    data->vbuff.curpos = data->buf;
+    return 0;
+}
+
+
+APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr,
+                                        const char *format, ...)
+{
+    struct apr_file_printf_data data;
+    va_list ap;
+    int count;
+
+    /* don't really need a HUGE_STRING_LEN anymore */
+    data.buf = malloc(HUGE_STRING_LEN);
+    if (data.buf == NULL) {
+        return -1;
+    }
+    data.vbuff.curpos = data.buf;
+    data.vbuff.endpos = data.buf + HUGE_STRING_LEN;
+    data.fptr = fptr;
+    va_start(ap, format);
+    count = apr_vformatter(file_printf_flush,
+                           (apr_vformatter_buff_t *)&data, format, ap);
+    /* apr_vformatter does not call flush for the last bits */
+    if (count >= 0) file_printf_flush((apr_vformatter_buff_t *)&data);
+
+    va_end(ap);
+
+    free(data.buf);
+
+    return count;
+}
+
+#else
 
 APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr, 
                                         const char *format, ...)
@@ -369,7 +502,7 @@
     free(buf);
     return (cc == APR_SUCCESS) ? len : -1;
 }
-
+#endif
 
 
 apr_status_t apr_file_check_read(apr_file_t *fd)
Only in apr-1.4.5/file_io/os2: readwrite.c.orig
Only in apr-1.4.5/file_io/os2: readwrite.c.rej
Only in apr-1.4.5/file_io/os2: readwrite.lo
Only in apr-1.4.5/file_io/os2: readwrite.o
diff -ur apr-1.4.5-o/file_io/os2/seek.c apr-1.4.5/file_io/os2/seek.c
--- apr-1.4.5-o/file_io/os2/seek.c	2006-08-03 20:25:30.000000000 +0930
+++ apr-1.4.5/file_io/os2/seek.c	2011-06-25 19:26:54.000000000 +0930
@@ -55,6 +55,7 @@
 
 APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, apr_seek_where_t where, apr_off_t *offset)
 {
+#ifndef __KLIBC__
     if (!thefile->isopen) {
         return APR_EBADF;
     }
@@ -100,6 +101,51 @@
 
         return APR_FROM_OS_ERROR(DosSetFilePtr(thefile->filedes, *offset, where, (ULONG *)offset));
     }
+#else
+    apr_off_t rv;
+
+    thefile->eof_hit = 0;
+
+    if (thefile->buffered) {
+        int rc = EINVAL;
+        apr_finfo_t finfo;
+
+        file_lock(thefile);
+
+        switch (where) {
+        case APR_SET:
+            rc = setptr(thefile, *offset);
+            break;
+
+        case APR_CUR:
+            rc = setptr(thefile, thefile->filePtr - thefile->dataRead + thefile->bufpos + *offset);
+            break;
+
+        case APR_END:
+            rc = apr_file_info_get_locked(&finfo, APR_FINFO_SIZE, thefile);
+            if (rc == APR_SUCCESS)
+                rc = setptr(thefile, finfo.size + *offset);
+            break;
+        }
+
+        *offset = thefile->filePtr - thefile->dataRead + thefile->bufpos;
+
+        file_unlock(thefile);
+
+        return rc;
+    }
+    else {
+        rv = lseek(thefile->filedes, *offset, where);
+        if (rv == -1) {
+            *offset = -1;
+            return errno;
+        }
+        else {
+            *offset = rv;
+            return APR_SUCCESS;
+        }
+    }
+#endif
 }
 
 
Only in apr-1.4.5/file_io/os2: seek.lo
Only in apr-1.4.5/file_io/os2: seek.o
Only in apr-1.4.5/file_io/os2: tempdir.lo
Only in apr-1.4.5/file_io/os2: tempdir.o
diff -ur apr-1.4.5-o/file_io/unix/fileacc.c apr-1.4.5/file_io/unix/fileacc.c
--- apr-1.4.5-o/file_io/unix/fileacc.c	2006-08-03 20:25:30.000000000 +0930
+++ apr-1.4.5/file_io/unix/fileacc.c	2011-06-25 18:35:50.000000000 +0930
@@ -31,7 +31,7 @@
     return f->flags;
 }
 
-#if !defined(OS2) && !defined(WIN32)
+#if (!defined(OS2) && !defined(WIN32)) || defined (__KLIBC__)
 mode_t apr_unix_perms2mode(apr_fileperms_t perms)
 {
     mode_t mode = 0;
diff -ur apr-1.4.5-o/file_io/unix/mktemp.c apr-1.4.5/file_io/unix/mktemp.c
--- apr-1.4.5-o/file_io/unix/mktemp.c	2010-03-02 10:59:02.000000000 +1030
+++ apr-1.4.5/file_io/unix/mktemp.c	2011-06-25 18:35:50.000000000 +0930
@@ -81,7 +81,9 @@
 #include <fcntl.h>
 #endif
 #include <stdio.h>
+#ifndef __INNOTEK_LIBC__
 #include <stdlib.h>
+#endif
 #include <string.h>
 #include <ctype.h>
 #ifdef HAVE_TIME_H
@@ -189,6 +191,11 @@
 #else
     fd = mkstemp(template);
 #endif
+
+#ifdef __INNOTEK_LIBC__
+          setmode(fd, O_BINARY);
+#endif 
+
     
     if (fd == -1) {
         return errno;
diff -ur apr-1.4.5-o/include/apr_errno.h apr-1.4.5/include/apr_errno.h
--- apr-1.4.5-o/include/apr_errno.h	2009-12-02 11:40:06.000000000 +1030
+++ apr-1.4.5/include/apr_errno.h	2011-06-25 18:35:50.000000000 +0930
@@ -837,7 +837,7 @@
 
 #define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
 #define APR_TO_OS_ERROR(e)   (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
-
+#define apr_get_os_error()    (errno)
 #define INCL_DOSERRORS
 #define INCL_DOS
 
@@ -918,7 +918,7 @@
                 || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED)
 #define APR_STATUS_IS_ENAMETOOLONG(s)   ((s) == APR_ENAMETOOLONG \
                 || (s) == APR_OS_START_SYSERR + ERROR_FILENAME_EXCED_RANGE \
-                || (s) == APR_OS_START_SYSERR + SOCENAMETOOLONG)
+                || (s) == APR_OS_START_SYSERR + SOCENAMETOOLONG  || (s) == SOCENAMETOOLONG)
 #define APR_STATUS_IS_ENOENT(s)         ((s) == APR_ENOENT \
                 || (s) == APR_OS_START_SYSERR + ERROR_FILE_NOT_FOUND \
                 || (s) == APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \
diff -ur apr-1.4.5-o/include/apr_network_io.h apr-1.4.5/include/apr_network_io.h
--- apr-1.4.5-o/include/apr_network_io.h	2010-01-06 22:06:50.000000000 +1030
+++ apr-1.4.5/include/apr_network_io.h	2011-06-25 18:35:50.000000000 +0930
@@ -21,6 +21,11 @@
  * @brief APR Network library
  */
 
+#ifdef __KLIBC__
+/* we don't want to include nerror.h from types.h - define this so it doesn't get included */
+#define _NERROR_H_ 1
+#endif
+
 #include "apr.h"
 #include "apr_pools.h"
 #include "apr_file_io.h"
@@ -783,7 +788,7 @@
  * Unset a socket from being inherited by child processes.
  */
 APR_DECLARE_INHERIT_UNSET(socket);
-
+#ifndef __INNOTEK_LIBC__
 /**
  * @defgroup apr_mcast IP Multicast
  * @{
@@ -845,6 +850,7 @@
 APR_DECLARE(apr_status_t) apr_mcast_interface(apr_socket_t *sock,
                                               apr_sockaddr_t *iface);
 
+#endif
 /** @} */
 
 /** @} */
diff -ur apr-1.4.5-o/include/apr_poll.h apr-1.4.5/include/apr_poll.h
--- apr-1.4.5-o/include/apr_poll.h	2011-04-29 22:21:20.000000000 +0930
+++ apr-1.4.5/include/apr_poll.h	2011-06-25 18:35:50.000000000 +0930
@@ -273,8 +273,9 @@
  * @remark If the pollset was not created with APR_POLLSET_WAKEABLE the
  *         return value is APR_EINIT.
  */
+#ifndef __OS2__
 APR_DECLARE(apr_status_t) apr_pollset_wakeup(apr_pollset_t *pollset);
-
+#endif
 /**
  * Poll the descriptors in the poll structure
  * @param aprset The poll structure we will be using. 
@@ -301,14 +302,16 @@
  * Return a printable representation of the pollset method.
  * @param pollset The pollset to use
  */
+#ifndef __OS2__
 APR_DECLARE(const char *) apr_pollset_method_name(apr_pollset_t *pollset);
-
+#endif
 /**
  * Return a printable representation of the default pollset method
  * (APR_POLLSET_DEFAULT).
  */
+#ifndef __OS2__
 APR_DECLARE(const char *) apr_poll_method_defname(void);
-
+#endif
 /** Opaque structure used for pollset API */
 typedef struct apr_pollcb_t apr_pollcb_t;
 
@@ -340,12 +343,13 @@
  * @remark Pollcb is only supported on some platforms; the apr_pollcb_create_ex()
  * call will fail with APR_ENOTIMPL on platforms where it is not supported.
  */
+#ifndef __OS2__
 APR_DECLARE(apr_status_t) apr_pollcb_create_ex(apr_pollcb_t **pollcb,
                                                apr_uint32_t size,
                                                apr_pool_t *p,
                                                apr_uint32_t flags,
                                                apr_pollset_method_e method);
-
+#endif
 /**
  * Add a socket or file descriptor to a pollcb
  * @param pollcb The pollcb to which to add the descriptor
Only in apr-1.4.5/include: apr_poll.h.orig
Only in apr-1.4.5/include: apr.h
diff -ur apr-1.4.5-o/include/apr.h.in apr-1.4.5/include/apr.h.in
--- apr-1.4.5-o/include/apr.h.in	2011-04-12 05:16:46.000000000 +0930
+++ apr-1.4.5/include/apr.h.in	2011-06-25 18:35:50.000000000 +0930
@@ -185,6 +185,7 @@
 #ifdef OS2
 #define INCL_DOS
 #define INCL_DOSERRORS
+#define INCL_EXAPIS
 #include <os2.h>
 #endif
 
Only in apr-1.4.5/include: apr.h.in.orig
diff -ur apr-1.4.5-o/include/arch/os2/apr_arch_file_io.h apr-1.4.5/include/arch/os2/apr_arch_file_io.h
--- apr-1.4.5-o/include/arch/os2/apr_arch_file_io.h	2011-02-18 21:57:04.000000000 +1030
+++ apr-1.4.5/include/arch/os2/apr_arch_file_io.h	2011-06-25 18:56:36.000000000 +0930
@@ -25,11 +25,17 @@
 #include "apr_errno.h"
 #include "apr_poll.h"
 
+#ifdef __KLIBC__
+#include <sys/stat.h>
+#endif
+
 /* We have an implementation of mkstemp but it's not very multi-threading 
  * friendly & is part of the POSIX emulation rather than native so don't
  * use it.
  */
+#ifndef __INNOTEK_LIBC__
 #undef HAVE_MKSTEMP
+#endif
 
 #define APR_FILE_DEFAULT_BUFSIZE 4096
 #define APR_FILE_BUFSIZE APR_FILE_DEFAULT_BUFSIZE
@@ -46,7 +52,13 @@
     int pipe;
     HEV pipeSem;
     enum { BLK_UNKNOWN, BLK_OFF, BLK_ON } blocking;
-
+#ifdef __KLIBC__
+    int ungetchar;    /* Last char provided by an unget op. (-1 = no char)*/
+#endif
+#ifndef WAITIO_USES_POLL
+    /* if there is a timeout set, then this pollset is used */
+    apr_pollset_t *pollset;
+#endif
     /* Stuff for buffered mode */
     char *buffer;
     apr_size_t bufsize;        /* Read/Write position in buffer             */
@@ -66,6 +78,26 @@
     int validentry;
 };
 
+#ifdef __INNOTEK_LIBC__
+apr_status_t apr_unix_file_cleanup(void *);
+apr_status_t apr_unix_child_file_cleanup(void *);
+#if APR_HAS_THREADS
+#define file_lock(f)   do { \
+                           if ((f)->mutex) \
+                               apr_thread_mutex_lock((f)->mutex); \
+                       } while (0)
+#define file_unlock(f) do { \
+                           if ((f)->mutex) \
+                               apr_thread_mutex_unlock((f)->mutex); \
+                       } while (0)
+#else
+#define file_lock(f)   do {} while (0)
+#define file_unlock(f) do {} while (0)
+#endif
+typedef struct stat struct_stat;
+#endif
+
+
 apr_status_t apr_file_cleanup(void *);
 apr_status_t apr_os2_time_to_apr_time(apr_time_t *result, FDATE os2date, 
                                       FTIME os2time);
@@ -81,6 +113,10 @@
 apr_status_t filepath_drive_get(char **rootpath, char drive, 
                                 apr_int32_t flags, apr_pool_t *p);
 apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p);
-
+#ifdef __KLIBC__
+apr_status_t apr_file_flush_locked(apr_file_t *thefile);
+apr_status_t apr_file_info_get_locked(apr_finfo_t *finfo, apr_int32_t wanted,
+                                      apr_file_t *thefile);
+#endif
 #endif  /* ! FILE_IO_H */
 
Only in apr-1.4.5/include/arch/os2: apr_arch_file_io.h.orig
Only in apr-1.4.5/include/arch/os2: apr_arch_file_io.h.rej
diff -ur apr-1.4.5-o/include/arch/os2/apr_arch_networkio.h apr-1.4.5/include/arch/os2/apr_arch_networkio.h
--- apr-1.4.5-o/include/arch/os2/apr_arch_networkio.h	2006-08-03 20:25:30.000000000 +0930
+++ apr-1.4.5/include/arch/os2/apr_arch_networkio.h	2011-06-25 18:35:50.000000000 +0930
@@ -20,7 +20,11 @@
 #include "apr_private.h"
 #include "apr_network_io.h"
 #include "apr_general.h"
+#ifdef TCPV40HDRS
 #include "apr_arch_os2calls.h"
+#else
+#include <sys/socket.h>
+#endif
 #include "apr_poll.h"
 
 #if APR_HAVE_NETDB_H
Only in apr-1.4.5/include/arch/unix: apr_private.h
Only in apr-1.4.5: lfstests
Only in apr-1.4.5: libapr-1.la
diff -ur apr-1.4.5-o/locks/os2/proc_mutex.c apr-1.4.5/locks/os2/proc_mutex.c
--- apr-1.4.5-o/locks/os2/proc_mutex.c	2011-02-18 21:57:04.000000000 +1030
+++ apr-1.4.5/locks/os2/proc_mutex.c	2011-06-25 18:35:50.000000000 +0930
@@ -80,9 +80,11 @@
     ULONG rc;
     char *semname;
 
+#if 0
     if (mech != APR_LOCK_DEFAULT) {
         return APR_ENOTIMPL;
     }
+#endif
 
     new = (apr_proc_mutex_t *)apr_palloc(pool, sizeof(apr_proc_mutex_t));
     new->pool       = pool;
@@ -115,6 +117,13 @@
     new->owner      = 0;
     new->lock_count = 0;
 
+#ifdef __INNOTEK_LIBC__
+    if (!fname) {
+        /* Reinitializing unnamed mutexes is a noop in the Unix code. */
+        return APR_SUCCESS;
+    }
+#endif
+
     semname = fixed_name(fname, pool);
     rc = DosOpenMutexSem(semname, &(new->hMutex));
     *mutex = new;
Only in apr-1.4.5/locks/os2: proc_mutex.lo
Only in apr-1.4.5/locks/os2: proc_mutex.o
Only in apr-1.4.5/locks/os2: thread_cond.lo
Only in apr-1.4.5/locks/os2: thread_cond.o
Only in apr-1.4.5/locks/os2: thread_mutex.lo
Only in apr-1.4.5/locks/os2: thread_mutex.o
diff -ur apr-1.4.5-o/locks/os2/thread_rwlock.c apr-1.4.5/locks/os2/thread_rwlock.c
--- apr-1.4.5-o/locks/os2/thread_rwlock.c	2006-08-03 20:25:30.000000000 +0930
+++ apr-1.4.5/locks/os2/thread_rwlock.c	2011-06-25 18:35:50.000000000 +0930
@@ -118,6 +118,7 @@
 
         if (rc)
             DosReleaseMutexSem(rwlock->write_lock);
+
     }
 
     return APR_FROM_OS_ERROR(rc);
Only in apr-1.4.5/locks/os2: thread_rwlock.lo
Only in apr-1.4.5/locks/os2: thread_rwlock.o
Only in apr-1.4.5/memory/unix: apr_pools.lo
Only in apr-1.4.5/memory/unix: apr_pools.o
Only in apr-1.4.5/misc/unix: charset.lo
Only in apr-1.4.5/misc/unix: charset.o
Only in apr-1.4.5/misc/unix: env.lo
Only in apr-1.4.5/misc/unix: env.o
diff -ur apr-1.4.5-o/misc/unix/errorcodes.c apr-1.4.5/misc/unix/errorcodes.c
--- apr-1.4.5-o/misc/unix/errorcodes.c	2011-03-22 03:34:16.000000000 +1030
+++ apr-1.4.5/misc/unix/errorcodes.c	2011-06-25 18:35:50.000000000 +0930
@@ -138,9 +138,8 @@
 }
 
 
-#ifdef OS2
+#if defined(OS2) 
 #include <ctype.h>
-
 int apr_canonical_error(apr_status_t err);
 
 static char *apr_os_strerror(char* buf, apr_size_t bufsize, int err)
Only in apr-1.4.5/misc/unix: errorcodes.lo
Only in apr-1.4.5/misc/unix: errorcodes.o
Only in apr-1.4.5/misc/unix: getopt.lo
Only in apr-1.4.5/misc/unix: getopt.o
Only in apr-1.4.5/misc/unix: otherchild.lo
Only in apr-1.4.5/misc/unix: otherchild.o
diff -ur apr-1.4.5-o/misc/unix/rand.c apr-1.4.5/misc/unix/rand.c
--- apr-1.4.5-o/misc/unix/rand.c	2007-07-04 19:31:04.000000000 +0930
+++ apr-1.4.5/misc/unix/rand.c	2011-06-25 18:35:50.000000000 +0930
@@ -122,7 +122,7 @@
     
     close(fd);
 #elif defined(OS2)
-    static UCHAR randbyte();
+    UCHAR randbyte();
     unsigned int idx;
 
     for (idx=0; idx<length; idx++)
Only in apr-1.4.5/misc/unix: rand.lo
Only in apr-1.4.5/misc/unix: rand.o
diff -ur apr-1.4.5-o/misc/unix/randbyte_os2.inc apr-1.4.5/misc/unix/randbyte_os2.inc
--- apr-1.4.5-o/misc/unix/randbyte_os2.inc	2006-08-03 20:25:30.000000000 +0930
+++ apr-1.4.5/misc/unix/randbyte_os2.inc	2011-06-25 18:35:50.000000000 +0930
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+#ifndef __KLIBC__ /* KLIBC has a random() function - use it */
 /* The high resolution timer API provides access to the hardware timer 
  * running at around 1.1MHz. The amount this changes in a time slice is
  * varies randomly due to system events, hardware interrupts etc
@@ -62,8 +63,10 @@
  * which is why it's run-time linked.
  */
 
+#ifndef __INNOTEK_LIBC__
 static APIRET APIENTRY(*DosPerfSysCall) (ULONG ulCommand, ULONG ulParm1,
                                          ULONG ulParm2, ULONG ulParm3) = NULL;
+#endif
 static HMODULE hDoscalls = 0;
 #define   CMD_KI_RDCNT    (0x63)
 
@@ -85,6 +88,7 @@
     CPUUTIL util;
     int c;
 
+#ifndef __INNOTEK_LIBC__
     if (hDoscalls == 0) {
         char failed_module[20];
         ULONG rc;
@@ -111,13 +115,28 @@
             DosPerfSysCall = NULL;
         }
     }
-
+#endif
     return byte;
 }
 
 
 
-static UCHAR randbyte()
+UCHAR randbyte()
 {
     return randbyte_hrtimer() ^ randbyte_sysinfo() ^ randbyte_perf();
 }
+#else /* __KLIBC__ */
+UCHAR randbyte()
+{
+    int c;
+    UCHAR byte;
+    ULONG ulrandom;
+    ulrandom = random();
+     
+    for (c = 0; c < sizeof(ulrandom); c++) {
+        byte ^= ((UCHAR *)&ulrandom)[c];
+    }
+
+    return byte;
+}
+#endif
Only in apr-1.4.5/misc/unix: start.lo
Only in apr-1.4.5/misc/unix: start.o
Only in apr-1.4.5/misc/unix: version.lo
Only in apr-1.4.5/misc/unix: version.o
Only in apr-1.4.5/mmap/unix: common.lo
Only in apr-1.4.5/mmap/unix: common.o
Only in apr-1.4.5/mmap/unix: mmap.lo
Only in apr-1.4.5/mmap/unix: mmap.o
Only in apr-1.4.5: Makefile
Only in apr-1.4.5/network_io/os2: inet_ntop.lo
Only in apr-1.4.5/network_io/os2: inet_ntop.o
Only in apr-1.4.5/network_io/os2: inet_pton.lo
Only in apr-1.4.5/network_io/os2: inet_pton.o
diff -ur apr-1.4.5-o/network_io/os2/os2calls.c apr-1.4.5/network_io/os2/os2calls.c
--- apr-1.4.5-o/network_io/os2/os2calls.c	2006-08-03 20:25:30.000000000 +0930
+++ apr-1.4.5/network_io/os2/os2calls.c	2011-06-25 18:35:50.000000000 +0930
@@ -42,6 +42,7 @@
 int (*apr_os2_sendto)(int, const char *, int, int, const struct sockaddr *, int);
 int (*apr_os2_recvfrom)(int, char *, int, int, struct sockaddr *, int *);
 
+#ifdef TCPV40HDRS
 static HMODULE hSO32DLL;
 
 static int os2_fn_link()
@@ -120,9 +121,86 @@
     DosExitCritSec();
     return APR_SUCCESS;
 }
+#else
+static HMODULE hTCPIPDLL;
 
+static int os2_fn_link()
+{
+    DosEnterCritSec(); /* Stop two threads doing this at the same time */
+
+    if (apr_os2_socket == os2_socket_init) {
+        ULONG rc;
+        char errorstr[200];
+
+        rc = DosLoadModule(errorstr, sizeof(errorstr), "TCPIPDLL", &hTCPIPDLL);
+
+        if (rc)
+            return APR_OS2_STATUS(rc);
+
+        rc = DosQueryProcAddr(hTCPIPDLL, 0, "SOCKET", &apr_os2_socket);
+
+        if (!rc)
+            rc = DosQueryProcAddr(hTCPIPDLL, 0, "SELECT", &apr_os2_select);
 
+        if (!rc)
+            rc = DosQueryProcAddr(hTCPIPDLL, 0, "SOCK_ERRNO", &apr_os2_sock_errno);
+
+        if (!rc)
+            rc = DosQueryProcAddr(hTCPIPDLL, 0, "ACCEPT", &apr_os2_accept);
+
+        if (!rc)
+            rc = DosQueryProcAddr(hTCPIPDLL, 0, "BIND", &apr_os2_bind);
+
+        if (!rc)
+            rc = DosQueryProcAddr(hTCPIPDLL, 0, "CONNECT", &apr_os2_connect);
 
+        if (!rc)
+            rc = DosQueryProcAddr(hTCPIPDLL, 0, "GETPEERNAME", &apr_os2_getpeername);
+
+        if (!rc)
+            rc = DosQueryProcAddr(hTCPIPDLL, 0, "GETSOCKNAME", &apr_os2_getsockname);
+
+        if (!rc)
+            rc = DosQueryProcAddr(hTCPIPDLL, 0, "GETSOCKOPT", &apr_os2_getsockopt);
+
+        if (!rc)
+            rc = DosQueryProcAddr(hTCPIPDLL, 0, "IOCTL", &apr_os2_ioctl);
+
+        if (!rc)
+            rc = DosQueryProcAddr(hTCPIPDLL, 0, "LISTEN", &apr_os2_listen);
+
+        if (!rc)
+            rc = DosQueryProcAddr(hTCPIPDLL, 0, "RECV", &apr_os2_recv);
+
+        if (!rc)
+            rc = DosQueryProcAddr(hTCPIPDLL, 0, "SEND", &apr_os2_send);
+
+        if (!rc)
+            rc = DosQueryProcAddr(hTCPIPDLL, 0, "SETSOCKOPT", &apr_os2_setsockopt);
+
+        if (!rc)
+            rc = DosQueryProcAddr(hTCPIPDLL, 0, "SHUTDOWN", &apr_os2_shutdown);
+
+        if (!rc)
+            rc = DosQueryProcAddr(hTCPIPDLL, 0, "SOCLOSE", &apr_os2_soclose);
+
+        if (!rc)
+            rc = DosQueryProcAddr(hTCPIPDLL, 0, "WRITEV", &apr_os2_writev);
+
+        if (!rc)
+            rc = DosQueryProcAddr(hTCPIPDLL, 0, "SENDTO", &apr_os2_sendto);
+
+        if (!rc)
+            rc = DosQueryProcAddr(hTCPIPDLL, 0, "RECVFROM", &apr_os2_recvfrom);
+
+        if (rc)
+            return APR_OS2_STATUS(rc);
+    }
+
+    DosExitCritSec();
+    return APR_SUCCESS;
+}
+#endif
 static int os2_socket_init(int domain, int type, int protocol)
 {
     int rc = os2_fn_link();
@@ -130,3 +208,4 @@
         return apr_os2_socket(domain, type, protocol);
     return rc;
 }
+
Only in apr-1.4.5/network_io/os2: os2calls.lo
Only in apr-1.4.5/network_io/os2: os2calls.o
diff -ur apr-1.4.5-o/network_io/os2/sendrecv_udp.c apr-1.4.5/network_io/os2/sendrecv_udp.c
--- apr-1.4.5-o/network_io/os2/sendrecv_udp.c	2006-08-03 20:25:30.000000000 +0930
+++ apr-1.4.5/network_io/os2/sendrecv_udp.c	2011-06-25 18:35:50.000000000 +0930
@@ -94,6 +94,10 @@
         (*len) = 0;
         return APR_FROM_OS_ERROR(serrno);
     }
+#ifdef __KLIBC__
+    apr_sockaddr_vars_set(from, from->sa.sin.sin_family, 
+                          ntohs(from->sa.sin.sin_port));
+#endif
 
     (*len) = rv;
 
Only in apr-1.4.5/network_io/os2: sendrecv_udp.lo
Only in apr-1.4.5/network_io/os2: sendrecv_udp.o
diff -ur apr-1.4.5-o/network_io/os2/sendrecv.c apr-1.4.5/network_io/os2/sendrecv.c
--- apr-1.4.5-o/network_io/os2/sendrecv.c	2006-08-03 20:25:30.000000000 +0930
+++ apr-1.4.5/network_io/os2/sendrecv.c	2011-06-25 18:35:50.000000000 +0930
@@ -27,9 +27,11 @@
     apr_ssize_t rv;
     int fds, err = 0;
 
+#ifndef __INNOTEK_LIBC__
     if (*len > 65536) {
         *len = 65536;
     }
+#endif 
 
     do {
         if (!sock->nonblock || err == SOCEWOULDBLOCK) {
@@ -114,11 +116,17 @@
     int fds, err = 0;
     int nv_tosend, total = 0;
 
+#ifndef __INNOTEK_LIBC__
     /* Make sure writev() only gets fed 64k at a time */
     for ( nv_tosend = 0; nv_tosend < nvec && total + vec[nv_tosend].iov_len < 65536; nv_tosend++ ) {
         total += vec[nv_tosend].iov_len;
     }
-
+#else
+    /* workaround for writev() not required with libc */
+    for ( nv_tosend = 0; nv_tosend < nvec; nv_tosend++ ) {
+        total += vec[nv_tosend].iov_len;
+    }
+#endif
     tmpvec = alloca(sizeof(struct iovec) * nv_tosend);
     memcpy(tmpvec, vec, sizeof(struct iovec) * nv_tosend);
 
Only in apr-1.4.5/network_io/os2: sendrecv.lo
Only in apr-1.4.5/network_io/os2: sendrecv.o
Only in apr-1.4.5/network_io/os2: sockaddr.lo
Only in apr-1.4.5/network_io/os2: sockaddr.o
Only in apr-1.4.5/network_io/os2: socket_util.lo
Only in apr-1.4.5/network_io/os2: socket_util.o
diff -ur apr-1.4.5-o/network_io/os2/sockets.c apr-1.4.5/network_io/os2/sockets.c
--- apr-1.4.5-o/network_io/os2/sockets.c	2006-11-29 07:54:40.000000000 +1030
+++ apr-1.4.5/network_io/os2/sockets.c	2011-06-25 18:35:50.000000000 +0930
@@ -30,6 +30,10 @@
 #include <netdb.h>
 #include "apr_arch_os2calls.h"
 
+#ifdef __KLIBC__x
+static char generic_inaddr_any[16] = {0}; /* big enough for IPv4 or IPv6 */
+#endif
+
 static apr_status_t socket_cleanup(void *sock)
 {
     apr_socket_t *thesocket = sock;
@@ -38,6 +42,9 @@
         return APR_EINVALSOCK;
     }
 
+    /* Add this shutdown call. */
+    shutdown (thesocket->socketdes, 2);
+
     if (soclose(thesocket->socketdes) == 0) {
         thesocket->socketdes = -1;
         return APR_SUCCESS;
@@ -177,15 +184,60 @@
         return APR_OS2_STATUS(sock_errno());
     }
 
+#ifndef __KLIBC__x
     *(*new)->local_addr = *sock->local_addr;
     (*new)->local_addr->pool = connection_context;
     (*new)->remote_addr->port = ntohs((*new)->remote_addr->sa.sin.sin_port);
+#else
+    (*new)->remote_addr_unknown = 0;
 
+    *(*new)->local_addr = *sock->local_addr;
+
+    /* The above assignment just overwrote the pool entry. Setting the local_addr 
+       pool for the accepted socket back to what it should be.  Otherwise all 
+       allocations for this socket will come from a server pool that is not
+       freed until the process goes down.*/
+    (*new)->local_addr->pool = connection_context;
+#endif
     /* fix up any pointers which are no longer valid */
     if (sock->local_addr->sa.sin.sin_family == AF_INET) {
         (*new)->local_addr->ipaddr_ptr = &(*new)->local_addr->sa.sin.sin_addr;
     }
 
+#ifdef __KLIBC__x
+    (*new)->remote_addr->port = ntohs((*new)->remote_addr->sa.sin.sin_port);
+    if (sock->local_port_unknown) {
+        /* not likely for a listening socket, but theoretically possible :) */
+        (*new)->local_port_unknown = 1;
+    }
+
+#if APR_TCP_NODELAY_INHERITED
+    if (apr_is_option_set(sock, APR_TCP_NODELAY) == 1) {
+        apr_set_option(*new, APR_TCP_NODELAY, 1);
+    }
+#endif /* TCP_NODELAY_INHERITED */
+#if APR_O_NONBLOCK_INHERITED
+    if (apr_is_option_set(sock, APR_SO_NONBLOCK) == 1) {
+        apr_set_option(*new, APR_SO_NONBLOCK, 1);
+    }
+#endif /* APR_O_NONBLOCK_INHERITED */
+
+    if (sock->local_interface_unknown ||
+        !memcmp(sock->local_addr->ipaddr_ptr,
+                generic_inaddr_any,
+                sock->local_addr->ipaddr_len)) {
+        /* If the interface address inside the listening socket's local_addr wasn't 
+         * up-to-date, we don't know local interface of the connected socket either.
+         *
+         * If the listening socket was not bound to a specific interface, we
+         * don't know the local_addr of the connected socket.
+         */
+        (*new)->local_interface_unknown = 1;
+    }
+
+    (*new)->inherit = 0;
+
+#endif
     apr_pool_cleanup_register((*new)->pool, (void *)(*new), 
                         socket_cleanup, apr_pool_cleanup_null);
     return APR_SUCCESS;
@@ -194,6 +246,7 @@
 APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock,
                                              apr_sockaddr_t *sa)
 {
+#ifndef __KLIBC__x
     if ((connect(sock->socketdes, (struct sockaddr *)&sa->sa.sin, 
                  sa->salen) < 0) &&
         (sock_errno() != SOCEINPROGRESS)) {
@@ -206,6 +259,68 @@
         sock->remote_addr = sa;
         return APR_SUCCESS;
     }
+#else
+    int rc;        
+
+    do {
+        rc = connect(sock->socketdes,
+                     (const struct sockaddr *)&sa->sa.sin,
+                     sa->salen);
+    } while (rc == -1 && errno == EINTR);
+
+    /* we can see EINPROGRESS the first time connect is called on a non-blocking
+     * socket; if called again, we can see EALREADY
+     */
+    if ((rc == -1) && (errno == EINPROGRESS || errno == EALREADY)
+                   && (sock->timeout > 0)) {
+        rc = apr_wait_for_io_or_timeout(NULL, sock, 0);
+        if (rc != APR_SUCCESS) {
+            return rc;
+        }
+
+#ifdef SO_ERROR
+        {
+            int error;
+            apr_socklen_t len = sizeof(error);
+            if ((rc = getsockopt(sock->socketdes, SOL_SOCKET, SO_ERROR, 
+                                 (char *)&error, &len)) < 0) {
+                return errno;
+            }
+            if (error) {
+                return error;
+            }
+        }
+#endif /* SO_ERROR */
+    }
+
+    if (rc == -1 && errno != EISCONN) {
+        return errno;
+    }
+
+    if (memcmp(sa->ipaddr_ptr, generic_inaddr_any, sa->ipaddr_len)) {
+        /* A real remote address was passed in.  If the unspecified
+         * address was used, the actual remote addr will have to be
+         * determined using getpeername() if required. */
+        /* ### this should probably be a structure copy + fixup as per
+         * _accept()'s handling of local_addr */
+        sock->remote_addr = sa;
+        sock->remote_addr_unknown = 0;
+    }
+
+    if (sock->local_addr->port == 0) {
+        /* connect() got us an ephemeral port */
+        sock->local_port_unknown = 1;
+    }
+    if (!memcmp(sock->local_addr->ipaddr_ptr,
+                generic_inaddr_any,
+                sock->local_addr->ipaddr_len)) {
+        /* not bound to specific local interface; connect() had to assign
+         * one for the socket
+         */
+        sock->local_interface_unknown = 1;
+    }
+    return APR_SUCCESS;
+#endif
 }
 
 APR_DECLARE(apr_status_t) apr_socket_type_get(apr_socket_t *sock, int *type)
@@ -311,7 +426,24 @@
 
 APR_POOL_IMPLEMENT_ACCESSOR(socket);
 
+#ifndef __KLIBC__
 APR_IMPLEMENT_INHERIT_SET(socket, inherit, pool, socket_cleanup)
 
 APR_IMPLEMENT_INHERIT_UNSET(socket, inherit, pool, socket_cleanup)
+#else
+/* Sockets cannot be inherited through the standard sockets
+ * inheritence.  WSADuplicateSocket must be used.
+ * This is not trivial to implement.
+ */
+
+APR_DECLARE(apr_status_t) apr_socket_inherit_set(apr_socket_t *socket)    
+{    
+    return APR_ENOTIMPL;
+}    
+
+APR_DECLARE(apr_status_t) apr_socket_inherit_unset(apr_socket_t *socket)    
+{    
+    return APR_ENOTIMPL;
+}    
+#endif
 
Only in apr-1.4.5/network_io/os2: sockets.lo
Only in apr-1.4.5/network_io/os2: sockets.o
diff -ur apr-1.4.5-o/network_io/os2/sockopt.c apr-1.4.5/network_io/os2/sockopt.c
--- apr-1.4.5-o/network_io/os2/sockopt.c	2006-08-03 20:25:30.000000000 +0930
+++ apr-1.4.5/network_io/os2/sockopt.c	2011-06-25 18:35:50.000000000 +0930
@@ -24,7 +24,9 @@
 #include <sys/socket.h>
 #include <netinet/tcp.h>
 #include <netinet/in.h>
+#ifndef __INNOTEK_LIBC__
 #include <unistd.h>
+#endif
 #include <netdb.h>
 #include <sys/so_ioctl.h>
 
@@ -102,10 +104,51 @@
 APR_DECLARE(apr_status_t) apr_socket_opt_get(apr_socket_t *sock, 
                                              apr_int32_t opt, apr_int32_t *on)
 {
-    switch(opt) {
-    default:
-        return APR_EINVAL;
+    int optval = 0;
+    int optlen = sizeof(optval);
+
+    struct linger  li;
+//    struct timeval ti;
+
+    if (opt & APR_SO_DEBUG) {
+        if (getsockopt(sock->socketdes, SOL_SOCKET, SO_DEBUG, &optval, &optlen) == -1) {
+            return APR_OS2_STATUS(sock_errno());
+        } else *on = (optval > 0);
+    }
+    if (opt & APR_SO_KEEPALIVE) {
+        if (getsockopt(sock->socketdes, SOL_SOCKET, SO_KEEPALIVE, &optval, &optlen) == -1) {
+            return APR_OS2_STATUS(sock_errno());
+        } else *on = (optval > 0);
+    }
+    if (opt & APR_SO_LINGER) {
+        if (getsockopt(sock->socketdes, SOL_SOCKET, SO_LINGER, &li, (int *)sizeof(struct linger)) == -1) {
+            return APR_OS2_STATUS(sock_errno());
+        } else *on = (li.l_onoff > 0);
+    }
+    if (opt & APR_SO_REUSEADDR) {
+        if (getsockopt(sock->socketdes, SOL_SOCKET, SO_REUSEADDR, &optval, &optlen) == -1) {
+            return APR_OS2_STATUS(sock_errno());
+        } else *on = (optval > 0);
+    }
+    if (opt & APR_SO_SNDBUF) {
+        if (getsockopt(sock->socketdes, SOL_SOCKET, SO_SNDBUF, &on, &optlen) == -1) {
+            return APR_OS2_STATUS(sock_errno());
+        }
+    }
+    if (opt & APR_SO_RCVBUF) {
+        if (getsockopt(sock->socketdes, SOL_SOCKET, SO_RCVBUF, &on, &optlen) == -1) {
+            return APR_OS2_STATUS(sock_errno());
+        }
+    }
+    /* have to base this on receive timeout ??? */
+    if (opt & APR_SO_NONBLOCK) {
+        return APR_ENOTIMPL;
+    }
+    /* Windows only ? */
+    if (opt & APR_SO_DISCONNECTED) {
+        return APR_ENOTIMPL;
     }
+
     return APR_SUCCESS;
 }
 
Only in apr-1.4.5/network_io/os2: sockopt.lo
Only in apr-1.4.5/network_io/os2: sockopt.o
Only in apr-1.4.5/passwd: apr_getpass.lo
Only in apr-1.4.5/passwd: apr_getpass.o
Only in apr-1.4.5: patch.log
diff -ur apr-1.4.5-o/poll/os2/poll.c apr-1.4.5/poll/os2/poll.c
--- apr-1.4.5-o/poll/os2/poll.c	2006-08-03 20:25:30.000000000 +0930
+++ apr-1.4.5/poll/os2/poll.c	2011-06-26 07:59:00.000000000 +0930
@@ -103,3 +103,41 @@
 
     return APR_SUCCESS;
 }
+
+APR_DECLARE(apr_status_t) apr_pollcb_create_ex(apr_pollcb_t **ret_pollcb,
+                                               apr_uint32_t size,
+                                               apr_pool_t *p,
+                                               apr_uint32_t flags,
+                                               apr_pollset_method_e method)
+{
+    return APR_ENOTIMPL;
+}
+
+APR_DECLARE(apr_status_t) apr_pollcb_create(apr_pollcb_t **pollcb,
+                                            apr_uint32_t size,
+                                            apr_pool_t *p,
+                                            apr_uint32_t flags)
+{
+    return APR_ENOTIMPL;
+}
+
+APR_DECLARE(apr_status_t) apr_pollcb_add(apr_pollcb_t *pollcb,
+                                         apr_pollfd_t *descriptor)
+{
+    return APR_ENOTIMPL;
+}
+
+APR_DECLARE(apr_status_t) apr_pollcb_remove(apr_pollcb_t *pollcb,
+                                            apr_pollfd_t *descriptor)
+{
+    return APR_ENOTIMPL;
+}
+
+
+APR_DECLARE(apr_status_t) apr_pollcb_poll(apr_pollcb_t *pollcb,
+                                          apr_interval_time_t timeout,
+                                          apr_pollcb_cb_t func,
+                                          void *baton)
+{
+    return APR_ENOTIMPL;
+}
Only in apr-1.4.5/poll/os2: poll.lo
Only in apr-1.4.5/poll/os2: poll.o
Only in apr-1.4.5/poll/os2: pollset.lo
Only in apr-1.4.5/poll/os2: pollset.o
Only in apr-1.4.5/random/unix: apr_random.lo
Only in apr-1.4.5/random/unix: apr_random.o
Only in apr-1.4.5/random/unix: sha2_glue.lo
Only in apr-1.4.5/random/unix: sha2_glue.o
Only in apr-1.4.5/random/unix: sha2.lo
Only in apr-1.4.5/random/unix: sha2.o
diff -ur apr-1.4.5-o/shmem/os2/shm.c apr-1.4.5/shmem/os2/shm.c
--- apr-1.4.5-o/shmem/os2/shm.c	2006-08-03 20:25:30.000000000 +0930
+++ apr-1.4.5/shmem/os2/shm.c	2011-06-25 18:35:50.000000000 +0930
@@ -46,7 +46,12 @@
         flags |= OBJ_GETTABLE;
     }
 
-    rc = DosAllocSharedMem(&(newm->memblock), name, reqsize, flags);
+    /* First try to allocate shared memory in HMA */
+    rc = DosAllocSharedMem(&(newm->memblock), name, reqsize, flags | OBJ_ANY);
+
+    if (rc) {
+        rc = DosAllocSharedMem(&(newm->memblock), name, reqsize, flags);
+    }
 
     if (rc) {
         return APR_OS2_STATUS(rc);
@@ -58,7 +63,15 @@
 
 APR_DECLARE(apr_status_t) apr_shm_destroy(apr_shm_t *m)
 {
-    DosFreeMem(m->memblock);
+    int rc;
+
+    rc = DosFreeMem(m->memblock);
+
+    // MKG: added might not be good
+    if (rc) {
+        return APR_OS2_STATUS(rc);
+    }
+
     return APR_SUCCESS;
 }
 
@@ -78,9 +91,16 @@
     ULONG flags = PAG_READ|PAG_WRITE;
 
     newm->pool = pool;
+
+    //MKG: should be able to get unnamed memory ????
+    if (filename) {
+
     name = apr_pstrcat(pool, "\\SHAREMEM\\", filename, NULL);
 
     rc = DosGetNamedSharedMem(&(newm->memblock), name, flags);
+    } else {
+        rc = DosGetSharedMem(&(newm->memblock), flags);
+    }
 
     if (rc) {
         return APR_FROM_OS_ERROR(rc);
Only in apr-1.4.5/shmem/os2: shm.lo
Only in apr-1.4.5/shmem/os2: shm.o
Only in apr-1.4.5/strings: apr_cpystrn.lo
Only in apr-1.4.5/strings: apr_cpystrn.o
Only in apr-1.4.5/strings: apr_fnmatch.lo
Only in apr-1.4.5/strings: apr_fnmatch.o
Only in apr-1.4.5/strings: apr_snprintf.lo
Only in apr-1.4.5/strings: apr_snprintf.o
Only in apr-1.4.5/strings: apr_strings.lo
Only in apr-1.4.5/strings: apr_strings.o
Only in apr-1.4.5/strings: apr_strnatcmp.lo
Only in apr-1.4.5/strings: apr_strnatcmp.o
Only in apr-1.4.5/strings: apr_strtok.lo
Only in apr-1.4.5/strings: apr_strtok.o
Only in apr-1.4.5/support/unix: waitio.lo
Only in apr-1.4.5/support/unix: waitio.o
Only in apr-1.4.5/tables: apr_hash.lo
Only in apr-1.4.5/tables: apr_hash.o
Only in apr-1.4.5/tables: apr_tables.lo
Only in apr-1.4.5/tables: apr_tables.o
Only in apr-1.4.5/test: .libs
Only in apr-1.4.5/test: abts.lo
Only in apr-1.4.5/test: abts.o
Only in apr-1.4.5/test: build.log
Only in apr-1.4.5/test/data: testbigfprintf.dat
Only in apr-1.4.5/test/data: testdup2.file
Only in apr-1.4.5/test/data: testdup2.readwrite.file
Only in apr-1.4.5/test/data: testflush.dat
Only in apr-1.4.5/test/data: testputs.txt
Only in apr-1.4.5/test/data: testwritev_full.txt
Only in apr-1.4.5/test/data: testwritev.txt
Only in apr-1.4.5/test/data: testxthread.dat
Only in apr-1.4.5/test: echod.exe
Only in apr-1.4.5/test: echod.lo
Only in apr-1.4.5/test: echod.map
Only in apr-1.4.5/test: echod.o
Only in apr-1.4.5/test: globalmutexchild.exe
Only in apr-1.4.5/test: globalmutexchild.lo
Only in apr-1.4.5/test: globalmutexchild.map
Only in apr-1.4.5/test: globalmutexchild.o
Only in apr-1.4.5/test/internal: Makefile
Only in apr-1.4.5/test: lfstests
Only in apr-1.4.5/test: libmod_test.la
Only in apr-1.4.5/test: log
Only in apr-1.4.5/test: mod_test.la
Only in apr-1.4.5/test: mod_test.lo
Only in apr-1.4.5/test: mod_test.o
Only in apr-1.4.5/test: Makefile
Only in apr-1.4.5/test: occhild.exe
Only in apr-1.4.5/test: occhild.lo
Only in apr-1.4.5/test: occhild.map
Only in apr-1.4.5/test: occhild.o
diff -ur apr-1.4.5-o/test/proc_child.c apr-1.4.5/test/proc_child.c
--- apr-1.4.5-o/test/proc_child.c	2007-10-15 05:54:12.000000000 +1030
+++ apr-1.4.5/test/proc_child.c	2011-06-25 18:35:50.000000000 +0930
@@ -7,11 +7,17 @@
 #include <io.h>
 #endif
 #include <stdlib.h>
+#ifdef __INNOTEK_LIBC__
+#include <fcntl.h>
+#endif
 
 int main(void)
 {
     char buf[256];
     int bytes;
+#if defined(__WATCOMC__)||defined(__INNOTEK_LIBC__)
+    setmode(STDIN_FILENO, O_BINARY);
+#endif
     
     bytes = (int)read(STDIN_FILENO, buf, 256);
     if (bytes > 0)
Only in apr-1.4.5/test: proc_child.exe
Only in apr-1.4.5/test: proc_child.lo
Only in apr-1.4.5/test: proc_child.map
Only in apr-1.4.5/test: proc_child.o
Only in apr-1.4.5/test: readchild.exe
Only in apr-1.4.5/test: readchild.lo
Only in apr-1.4.5/test: readchild.map
Only in apr-1.4.5/test: readchild.o
Only in apr-1.4.5/test: results.txt
Only in apr-1.4.5/test: sendfile.exe
Only in apr-1.4.5/test: sendfile.lo
Only in apr-1.4.5/test: sendfile.map
Only in apr-1.4.5/test: sendfile.o
Only in apr-1.4.5/test: sockchild.exe
Only in apr-1.4.5/test: sockchild.lo
Only in apr-1.4.5/test: sockchild.map
Only in apr-1.4.5/test: sockchild.o
Only in apr-1.4.5/test: sockperf.exe
Only in apr-1.4.5/test: sockperf.lo
Only in apr-1.4.5/test: sockperf.map
Only in apr-1.4.5/test: sockperf.o
Only in apr-1.4.5/test: testall.exe
Only in apr-1.4.5/test: testall.map
Only in apr-1.4.5/test: testargs.lo
Only in apr-1.4.5/test: testargs.o
Only in apr-1.4.5/test: testatomic.lo
Only in apr-1.4.5/test: testatomic.o
diff -ur apr-1.4.5-o/test/testcond.c apr-1.4.5/test/testcond.c
--- apr-1.4.5-o/test/testcond.c	2007-11-18 11:05:56.000000000 +1030
+++ apr-1.4.5/test/testcond.c	2011-06-25 19:36:02.000000000 +0930
@@ -652,9 +652,10 @@
 #endif
     suite = ADD_SUITE(suite)
 
-#if !APR_HAS_THREADS
+#if !APR_HAS_THREADS 
     abts_run_test(suite, threads_not_impl, NULL);
 #else
+#ifndef __OS2__
     abts_run_test(suite, lost_signal, NULL);
     abts_run_test(suite, dynamic_binding, NULL);
     abts_run_test(suite, broadcast_threads, NULL);
@@ -665,6 +666,7 @@
     abts_run_test(suite, pipe_producer_consumer, NULL);
     abts_run_test(suite, ping_pong, NULL);
 #endif
+#endif
 
     return suite;
 }
Only in apr-1.4.5/test: testcond.lo
Only in apr-1.4.5/test: testcond.o
Only in apr-1.4.5/test: testdir.lo
Only in apr-1.4.5/test: testdir.o
Only in apr-1.4.5/test: testdso.lo
Only in apr-1.4.5/test: testdso.o
Only in apr-1.4.5/test: testdup.lo
Only in apr-1.4.5/test: testdup.o
Only in apr-1.4.5/test: testenv.lo
Only in apr-1.4.5/test: testenv.o
Only in apr-1.4.5/test: testfile.c.orig
Only in apr-1.4.5/test: testfile.c.rej
Only in apr-1.4.5/test: testfile.lo
Only in apr-1.4.5/test: testfile.o
Only in apr-1.4.5/test: testfilecopy.lo
Only in apr-1.4.5/test: testfilecopy.o
diff -ur apr-1.4.5-o/test/testfileinfo.c apr-1.4.5/test/testfileinfo.c
--- apr-1.4.5-o/test/testfileinfo.c	2010-03-08 01:36:46.000000000 +1030
+++ apr-1.4.5/test/testfileinfo.c	2011-06-25 18:35:50.000000000 +0930
@@ -256,7 +256,9 @@
     abts_run_test(suite, test_stat, NULL);
     abts_run_test(suite, test_stat_eq_finfo, NULL);
     abts_run_test(suite, test_buffered_write_size, NULL);
+#ifndef OS2
     abts_run_test(suite, test_mtime_set, NULL);
+#endif
 
     return suite;
 }
Only in apr-1.4.5/test: testfileinfo.lo
Only in apr-1.4.5/test: testfileinfo.o
Only in apr-1.4.5/test: testflock.lo
Only in apr-1.4.5/test: testflock.o
Only in apr-1.4.5/test: testfmt.lo
Only in apr-1.4.5/test: testfmt.o
Only in apr-1.4.5/test: testfnmatch.lo
Only in apr-1.4.5/test: testfnmatch.o
Only in apr-1.4.5/test: testglobalmutex.lo
Only in apr-1.4.5/test: testglobalmutex.o
Only in apr-1.4.5/test: testhash.lo
Only in apr-1.4.5/test: testhash.o
Only in apr-1.4.5/test: testipsub.lo
Only in apr-1.4.5/test: testipsub.o
Only in apr-1.4.5/test: testlfs.lo
Only in apr-1.4.5/test: testlfs.o
diff -ur apr-1.4.5-o/test/testlock.c apr-1.4.5/test/testlock.c
--- apr-1.4.5-o/test/testlock.c	2007-03-01 21:00:24.000000000 +1030
+++ apr-1.4.5/test/testlock.c	2011-06-25 18:35:50.000000000 +0930
@@ -213,6 +213,7 @@
     apr_thread_rwlock_destroy(rwlock);
 }
 
+
 static void test_cond(abts_case *tc, void *data)
 {
     apr_thread_t *p1, *p2, *p3, *p4, *c1;
@@ -324,9 +325,11 @@
 #else
     abts_run_test(suite, test_thread_mutex, NULL);
     abts_run_test(suite, test_thread_rwlock, NULL);
+#ifndef OS2 /* apr_thread_cond_* not implements on os2 */
     abts_run_test(suite, test_cond, NULL);
     abts_run_test(suite, test_timeoutcond, NULL);
 #endif
+#endif
 
     return suite;
 }
Only in apr-1.4.5/test: testlock.lo
Only in apr-1.4.5/test: testlock.o
Only in apr-1.4.5/test: testlockperf.exe
Only in apr-1.4.5/test: testlockperf.lo
Only in apr-1.4.5/test: testlockperf.map
Only in apr-1.4.5/test: testlockperf.o
Only in apr-1.4.5/test: testmmap.lo
Only in apr-1.4.5/test: testmmap.o
Only in apr-1.4.5/test: testmutexscope.exe
Only in apr-1.4.5/test: testmutexscope.lo
Only in apr-1.4.5/test: testmutexscope.map
Only in apr-1.4.5/test: testmutexscope.o
diff -ur apr-1.4.5-o/test/testnames.c apr-1.4.5/test/testnames.c
--- apr-1.4.5-o/test/testnames.c	2011-05-04 03:54:50.000000000 +0930
+++ apr-1.4.5/test/testnames.c	2011-06-25 18:35:50.000000000 +0930
@@ -31,6 +31,8 @@
 #define ABS_ROOT "C:/"
 #elif defined(NETWARE)
 #define ABS_ROOT "SYS:/"
+#elif defined(__OS2__)
+#define ABS_ROOT "C:/"
 #else
 #define ABS_ROOT "/"
 #endif
@@ -146,7 +148,6 @@
     rv = apr_filepath_merge(&dstpath, "foo/bar", "../baz", 
                             APR_FILEPATH_NOTRELATIVE, p);
     apr_strerror(rv, errmsg, sizeof(errmsg));
-
     ABTS_PTR_EQUAL(tc, NULL, dstpath);
     ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_ERELATIVE(rv));
     ABTS_STR_EQUAL(tc, "The given path is relative", errmsg);
@@ -161,7 +162,6 @@
     rv = apr_filepath_merge(&dstpath, ABS_ROOT"foo/bar", "../baz", 
                             APR_FILEPATH_NOTABSOLUTE, p);
     apr_strerror(rv, errmsg, sizeof(errmsg));
-
     ABTS_PTR_EQUAL(tc, NULL, dstpath);
     ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_EABSOLUTE(rv));
     ABTS_STR_EQUAL(tc, "The given path is absolute", errmsg);
Only in apr-1.4.5/test: testnames.c.orig
Only in apr-1.4.5/test: testnames.lo
Only in apr-1.4.5/test: testnames.o
Only in apr-1.4.5/test: testoc.lo
Only in apr-1.4.5/test: testoc.o
Only in apr-1.4.5/test: testpath.lo
Only in apr-1.4.5/test: testpath.o
Only in apr-1.4.5/test: testpipe.lo
Only in apr-1.4.5/test: testpipe.o
Only in apr-1.4.5/test: testpoll.lo
Only in apr-1.4.5/test: testpoll.o
Only in apr-1.4.5/test: testpools.lo
Only in apr-1.4.5/test: testpools.o
Only in apr-1.4.5/test: testproc.lo
Only in apr-1.4.5/test: testproc.o
diff -ur apr-1.4.5-o/test/testprocmutex.c apr-1.4.5/test/testprocmutex.c
--- apr-1.4.5-o/test/testprocmutex.c	2006-08-03 20:25:30.000000000 +0930
+++ apr-1.4.5/test/testprocmutex.c	2011-06-26 16:51:56.000000000 +0930
@@ -115,6 +115,7 @@
     int n;
  
     rv = apr_proc_mutex_create(&proc_lock, lockname, mech, p);
+
     APR_ASSERT_SUCCESS(tc, "create the mutex", rv);
     if (rv != APR_SUCCESS)
         return;
@@ -122,8 +123,10 @@
     for (n = 0; n < CHILDREN; n++)
         make_child(tc, 0, &child[n], p);
 
+
     for (n = 0; n < CHILDREN; n++)
         await_child(tc, child[n]);
+
     
     ABTS_ASSERT(tc, "Locks don't appear to work", *x == MAX_COUNTER);
 
Only in apr-1.4.5/test: testprocmutex.lo
Only in apr-1.4.5/test: testprocmutex.o
Only in apr-1.4.5/test: testrand.lo
Only in apr-1.4.5/test: testrand.o
diff -ur apr-1.4.5-o/test/testshm.c apr-1.4.5/test/testshm.c
--- apr-1.4.5-o/test/testshm.c	2011-03-22 03:34:16.000000000 +1030
+++ apr-1.4.5/test/testshm.c	2011-06-26 08:06:26.000000000 +0930
@@ -126,7 +126,6 @@
 
     boxes = apr_shm_baseaddr_get(shm);
     ABTS_PTR_NOTNULL(tc, boxes);
-
     rv = apr_proc_fork(&proc, p);
     if (rv == APR_INCHILD) { /* child */
         int num = msgwait(5, 0, N_BOXES);
diff -ur apr-1.4.5-o/test/testshm.h apr-1.4.5/test/testshm.h
--- apr-1.4.5-o/test/testshm.h	2006-08-03 20:25:30.000000000 +0930
+++ apr-1.4.5/test/testshm.h	2011-06-25 18:35:50.000000000 +0930
@@ -24,8 +24,14 @@
 mbox *boxes;
 
 #define N_BOXES 10
+#ifndef __OS2__
 #define SHARED_SIZE (apr_size_t)(N_BOXES * sizeof(mbox))
 #define SHARED_FILENAME "data/apr.testshm.shm"
+#else
+#define SHARED_SIZE (apr_size_t)(N_BOXES * 4096)
+#define SHARED_FILENAME "data\\apr.testshm.shm"
+#endif
+
 #define N_MESSAGES 100
 #define MSG "Sending a message"
 
Only in apr-1.4.5/test: testshm.lo
Only in apr-1.4.5/test: testshm.o
Only in apr-1.4.5/test: testshmconsumer.exe
Only in apr-1.4.5/test: testshmconsumer.lo
Only in apr-1.4.5/test: testshmconsumer.map
Only in apr-1.4.5/test: testshmconsumer.o
Only in apr-1.4.5/test: testshmproducer.exe
Only in apr-1.4.5/test: testshmproducer.lo
Only in apr-1.4.5/test: testshmproducer.map
Only in apr-1.4.5/test: testshmproducer.o
Only in apr-1.4.5/test: testsleep.lo
Only in apr-1.4.5/test: testsleep.o
Only in apr-1.4.5/test: testsock.lo
Only in apr-1.4.5/test: testsock.o
Only in apr-1.4.5/test: testsockets.lo
Only in apr-1.4.5/test: testsockets.o
diff -ur apr-1.4.5-o/test/testsockopt.c apr-1.4.5/test/testsockopt.c
--- apr-1.4.5-o/test/testsockopt.c	2006-08-03 20:25:30.000000000 +0930
+++ apr-1.4.5/test/testsockopt.c	2011-06-25 18:35:50.000000000 +0930
@@ -38,7 +38,6 @@
 
     rv = apr_socket_opt_set(sock, APR_SO_KEEPALIVE, 1);
     ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
-
     rv = apr_socket_opt_get(sock, APR_SO_KEEPALIVE, &ck);
     ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
     ABTS_INT_EQUAL(tc, 1, ck);
Only in apr-1.4.5/test: testsockopt.lo
Only in apr-1.4.5/test: testsockopt.o
Only in apr-1.4.5/test: teststr.lo
Only in apr-1.4.5/test: teststr.o
Only in apr-1.4.5/test: teststrnatcmp.lo
Only in apr-1.4.5/test: teststrnatcmp.o
Only in apr-1.4.5/test: testtable.lo
Only in apr-1.4.5/test: testtable.o
Only in apr-1.4.5/test: testtemp.lo
Only in apr-1.4.5/test: testtemp.o
Only in apr-1.4.5/test: testthread.lo
Only in apr-1.4.5/test: testthread.o
Only in apr-1.4.5/test: testtime.lo
Only in apr-1.4.5/test: testtime.o
Only in apr-1.4.5/test: testud.lo
Only in apr-1.4.5/test: testud.o
Only in apr-1.4.5/test: testuser.lo
Only in apr-1.4.5/test: testuser.o
Only in apr-1.4.5/test: testutil.lo
Only in apr-1.4.5/test: testutil.o
Only in apr-1.4.5/test: testvsn.lo
Only in apr-1.4.5/test: testvsn.o
Only in apr-1.4.5/test: tryread.exe
Only in apr-1.4.5/test: tryread.lo
Only in apr-1.4.5/test: tryread.map
Only in apr-1.4.5/test: tryread.o
diff -ur apr-1.4.5-o/threadproc/os2/proc.c apr-1.4.5/threadproc/os2/proc.c
--- apr-1.4.5-o/threadproc/os2/proc.c	2009-06-11 21:08:10.000000000 +0930
+++ apr-1.4.5/threadproc/os2/proc.c	2011-06-26 16:51:26.000000000 +0930
@@ -41,8 +41,12 @@
 
 APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new, apr_pool_t *pool)
 {
+#if 0
     (*new) = (apr_procattr_t *)apr_palloc(pool, 
               sizeof(apr_procattr_t));
+#else
+    (*new) = (apr_procattr_t *)apr_pcalloc(pool, sizeof(apr_procattr_t));
+#endif
 
     if ((*new) == NULL) {
         return APR_ENOMEM;
@@ -106,7 +110,6 @@
     }
     else if (err == APR_NO_FILE)
         attr->child_err = &no_file;
-
     return APR_SUCCESS;
 }
 
@@ -537,6 +540,7 @@
         DosExitCritSec();
 
     return status;
+
 }
 
 
@@ -587,7 +591,6 @@
             break;
         }
     }
-
     if (exitcode) {
         *exitcode = result;
     }
@@ -632,14 +635,68 @@
     ULONG rc;
     PID pid;
     rc = DosWaitChild(DCWA_PROCESS, waithow == APR_WAIT ? DCWW_WAIT : DCWW_NOWAIT, &codes, &pid, proc->pid);
-
     if (rc == 0) {
         proces_result_codes(codes, exitcode, exitwhy);
         return APR_CHILD_DONE;
     } else if (rc == ERROR_CHILD_NOT_COMPLETE) {
         return APR_CHILD_NOTDONE;
-    }
+    } 
+
+    if (rc==128){
+      pid_t pstatus;
+      int waitpid_options = WUNTRACED;
+      int exit_int;
+      int ignore;
+      apr_exit_why_e ignorewhy;
+
+      if (exitcode == NULL) {
+          exitcode = &ignore;
+      }
+
+      if (exitwhy == NULL) {
+          exitwhy = &ignorewhy;
+      }
+
+      if (waithow != APR_WAIT) {
+          waitpid_options |= WNOHANG;
+      }
+
+      do {
+          pstatus = waitpid(proc->pid, &exit_int, waitpid_options);
+      } while (pstatus < 0 && errno == EINTR);
+
+      if (pstatus > 0) {
+          proc->pid = pstatus;
+
+          if (WIFEXITED(exit_int)) {
+              *exitwhy = APR_PROC_EXIT;
+              *exitcode = WEXITSTATUS(exit_int);
+          }
+          else if (WIFSIGNALED(exit_int)) {
+              *exitwhy = APR_PROC_SIGNAL;
+
+#ifdef WCOREDUMP
+              if (WCOREDUMP(exit_int)) {
+                  *exitwhy |= APR_PROC_SIGNAL_CORE;
+              }
+#endif
+
+              *exitcode = WTERMSIG(exit_int);
+          }
+          else {
+              /* unexpected condition */
+              return APR_EGENERAL;
+          }
+
+          return APR_CHILD_DONE;
+      }
+      else if (pstatus == 0) {
+          return APR_CHILD_NOTDONE;
+      }
+
+      return errno;
 
+    }
     return APR_OS2_STATUS(rc);
 } 
 
@@ -662,3 +719,11 @@
 {
     return APR_ENOTIMPL;
 }
+
+APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr,
+                                                 apr_int32_t what,
+                                                 struct rlimit *limit)
+{
+    return APR_ENOTIMPL;
+}
+
Only in apr-1.4.5/threadproc/os2: proc.lo
Only in apr-1.4.5/threadproc/os2: proc.o
Only in apr-1.4.5/threadproc/os2: signals.lo
Only in apr-1.4.5/threadproc/os2: signals.o
Only in apr-1.4.5/threadproc/os2: thread.lo
Only in apr-1.4.5/threadproc/os2: thread.o
Only in apr-1.4.5/threadproc/os2: threadpriv.lo
Only in apr-1.4.5/threadproc/os2: threadpriv.o
diff -ur apr-1.4.5-o/threadproc/unix/signals.c apr-1.4.5/threadproc/unix/signals.c
--- apr-1.4.5-o/threadproc/unix/signals.c	2008-02-01 19:26:54.000000000 +1030
+++ apr-1.4.5/threadproc/unix/signals.c	2011-06-25 18:35:50.000000000 +0930
@@ -44,7 +44,6 @@
                                                      XCPT_SIGNAL_BREAK));
     }
 #endif /* OS2 */
-
     if (kill(proc->pid, signum) == -1) {
         return errno;
     }
@@ -416,7 +415,7 @@
     sigfillset(&sig_mask);
     remove_sync_sigs(&sig_mask);
 
-#if defined(SIGPROCMASK_SETS_THREAD_MASK) || ! APR_HAS_THREADS
+#if defined(SIGPROCMASK_SETS_THREAD_MASK) || ! APR_HAS_THREADS || defined(OS2)
     if ((rv = sigprocmask(SIG_SETMASK, &sig_mask, NULL)) != 0) {
         rv = errno;
     }
@@ -442,7 +441,7 @@
 
     sigaddset(&sig_mask, signum);
 
-#if defined(SIGPROCMASK_SETS_THREAD_MASK) || ! APR_HAS_THREADS
+#if defined(SIGPROCMASK_SETS_THREAD_MASK) || ! APR_HAS_THREADS || defined(OS2)
     if ((rv = sigprocmask(SIG_BLOCK, &sig_mask, NULL)) != 0) {
         rv = errno;
     }
@@ -469,7 +468,7 @@
 
     sigaddset(&sig_mask, signum);
 
-#if defined(SIGPROCMASK_SETS_THREAD_MASK) || ! APR_HAS_THREADS
+#if defined(SIGPROCMASK_SETS_THREAD_MASK) || ! APR_HAS_THREADS || defined(OS2)
     if ((rv = sigprocmask(SIG_UNBLOCK, &sig_mask, NULL)) != 0) {
         rv = errno;
     }
Only in apr-1.4.5/time/unix: time.lo
Only in apr-1.4.5/time/unix: time.o
Only in apr-1.4.5/time/unix: timestr.lo
Only in apr-1.4.5/time/unix: timestr.o
Only in apr-1.4.5/user/unix: groupinfo.lo
Only in apr-1.4.5/user/unix: groupinfo.o
diff -ur apr-1.4.5-o/user/unix/userinfo.c apr-1.4.5/user/unix/userinfo.c
--- apr-1.4.5-o/user/unix/userinfo.c	2006-08-03 20:25:30.000000000 +0930
+++ apr-1.4.5/user/unix/userinfo.c	2011-06-25 18:35:50.000000000 +0930
@@ -77,7 +77,7 @@
     if ((rv = getpwnam_safe(username, &pw, pwbuf)) != APR_SUCCESS)
         return rv;
 
-#ifdef OS2
+#if (defined(OS2)&&!defined(__INNOTEK_LIBC__))
     /* Need to manually add user name for OS/2 */
     *dirname = apr_pstrcat(p, pw.pw_dir, pw.pw_name, NULL);
 #else
Only in apr-1.4.5/user/unix: userinfo.lo
Only in apr-1.4.5/user/unix: userinfo.o
apr-1.4.5.diff (77,082 bytes)   

Activities

psmedley

2011-09-21 09:41

administrator   ~0001980

I'd suggest that you are correct in that the following is the cause of this:
*) htpasswd: Change the default algorithm for htpasswd to MD5 on all
     platforms. Crypt with its 8 character limit is not useful anymore;
     improve out of disk space handling (PR 30877); print a warning if
     a password is truncated by crypt. [Stefan Fritsch]

LewisR

2011-09-21 15:52

developer   ~0001981

I concur.

Proposed workaround (assuming original clear text passwords are known): regenerate password file(s) using new (2.2.18+) htpasswd.exe.

My concern is bumping into something like https://issues.apache.org/bugzilla/show_bug.cgi?id=49437 , and whether increasing stack size may be necessary to accommodate the larger hashes.

I'm also puzzled as to why I haven't seen this reported on other platforms. I haven't tried testing a pre-2.2.18 password file against 2.2.18+ on Linux. In my case, however, my workaround mentioned above will do the trick, as I only have a few virtuals using basic auth, and I have records of the passwords.

Steven Levine

2011-09-22 21:23

manager   ~0001982

A quick look at the htpasswd code says that that something has changed the results of the crypt algorithm. This really has nothing to do with the change to md5 as the default. The authentication code is supposed to be backwards compatible.

To see this, run the 2.2.17 htpasswd and the 2.2.21 htpasswd as

  htpasswd -n -d username

and you will see the the generated hashes differ.

Looking at the httpd changeset 1094184, it's not obvious how this might have caused the change. Note that crypt() appears to be supplied by libc.

DB1

2011-09-23 06:49

reporter   ~0001983

Last edited: 2011-09-23 07:01

Comparing the results of running htpasswd is not a correct test. I just ran it on my server and the generated password is not the same as in the password file. The password file was generated many moons ago - It looks like there is some sort of salt in there that gives a different encryption per version of the code but previous ones can be unscrambled.

Later - a Crypt password generated by 2.2.21 works in 2.2.17 but not the other way around.

Steven Levine

2011-09-24 02:27

manager   ~0001984

There is no such thing as unscrambling a hash generated by crypt. The encryption is a one-way cipher.

Are you sure you did not let the 2.2.21 htpasswd generate an md5 hash? These will work just fine with 2.2.17.

Steven Levine

2011-09-24 03:29

manager   ~0001985

It turns out that comparing versions of htpasswd is not valid because it appears that the httpd developers changed the salt in the 2.2.20 and newer htpasswd. However, this should not matter because the hash contains the salt as the 1st two characters.

IAC, using perl's crypt to verify the hashes, it appears that there is something wrong with the htpasswd generation of hashes for usernames of 8 characters or more in both the 2.2.17 and 2.2.21 versions of htpasswd. I need to experiment a bit more with different username and password lengths to see exactly when the bustage occurs.

LewisR

2011-09-24 03:40

developer   ~0001986

I would bet that Dave meant that previous ones can be *matched*, not unscrambled.

Indeed, MD5 hashes seem to work on the earlier builds, but Dave has mentioned that he has *all* Crypt on his setup, and lots of them. My workaround (which I just did this afternoon, i.e., creating new hashes - and I used MD5) is not practical for him.

I also tried replacing the auth modules in 2.2.20 with the ones from 2.2.15, but while httpd started up without complaint, I was not able to get earlier Crypt hashes to work, so I must have missed some other dependency. This might (assuming the files will run with the newer Apache builds) be a better workaround until this issue can be better addressed. It shouldn't be that one must forego a security upgrade due to being unable to accept Crypt hashes.

Steve, per your note 0001982, and from what I've (just now) read concerning htpasswd and Crypt vs MD5, MD5 encryption is via files modified for Apache, while crypt() is suplied by the OS (in this case, libc). However, there is still something different between the two htpasswd executables when generating Crypt hashes.

I get varying results with 2.2.15's htpasswd using Crypt; no two hashes appear to be the same; however, using 2.2.20, all seem to be consistent.

2.2.15 (password listed in cleartext here, for clarity):

htpasswd.exe -dn Fred
New password: ethel
Re-type new password: ethel
Fred:p6/G8mAH8QFww


htpasswd.exe -dn Fred
New password: ethel
Re-type new password: ethel
Fred:QvH8axT4GDeWU

2.2.20:

htpasswd.exe -dn Fred
New password: ethel
Re-type new password: ethel
Fred:CDymmOj8aFqpk


htpasswd.exe -dn Fred
New password: ethel
Re-type new password: ethel
Fred:CDymmOj8aFqpk

This is consistent with what Dave mentioned, that these (pre-2.2.18) seemingly different hashes still equate to the same hash when compared. However, the newer build always generates the same hash.

Steven Levine

2011-09-24 03:54

manager   ~0001987

That older versions htpasswd generated different hash (or more correctly digest) for different runs is old, but not incorrect. As I mentioned in my previous note the digest contains the salt as the first two characters, so to verify if given digest, you can use perl as follows

perl -e "printf \"%%s\n\", crypt('steve53', 'EpLqxh7997vzY')"

The output should match the input and it does for usernames of less than 8 characters. You might want to read the Perl manual's write up on crypt. It has a good discussion of crypt is used in practice.

LewisR

2011-09-24 03:59

developer   ~0001988

Sorry; I missed your note 0001985...

FWIW, I get *no* Crypt passwords to work under 2.2.20, even when generated *by* 2.2.20's htpasswd.exe, and whether they are less than or greater than 8 characters. MD5 works consistently.

I thought Crypt was working after regenerating the passwords, but I was too hasty in that statement. On my server, I switched them all to MD5, anyway, so I didn't run a complete test. I just did now, on my local setup.

LewisR

2011-09-24 04:24

developer   ~0001989

Thanks for the reminder about perl (and the reference). *None* of my 2.2.20-generated Crypts verify, regardless of length.

Steven Levine

2011-09-24 06:46

manager   ~0001990

This is starting to act like an uninitialized variable of some sort. I put together the attached c.pl and used it to validate individual entries and entire passwd files.

What I did was use

  htpasswd -b -d passwd username password

to generate new digests and regenerate existing digests. I though I was seeing a pattern as to which combos failed and which did not. Suddenly, for no obvious reason all the versions of httpd started to generate good digests in the sense that the Perl script did not report errors.

Also, I am still getting validation errors from the Perl script for passwords that I know are good. Very strange.

DB1

2011-09-24 07:12

reporter   ~0001991

Last edited: 2011-09-24 08:26

Lewis is correct, what I meant was that 2.2.20 will reject passwords generated with earlier versions but accept its own. 2.2.17 will accept passwords from both. Mind you I was only testing with a password of two characters.

This looks more and more like an initialised variable as Steve suggests.

Oops uninitialised :-)

DB1

2011-09-24 08:43

reporter   ~0001992

Steve, surely there is a logic error with your script. How can it take a password file and check the hashes? The file is username/"encrypted password" not password/"encrypted password" - Did not twig at first but the only three I had that verified were where the password was the same as the username.

Also in single check mode the test after the 'else' should be
if ($s =~ /:/) {

c.pl ethel:CDymmOj8aFqpk

$_ is undefined in the else

DB1

2011-09-24 11:53

reporter   ~0001993

2.2.17 also generates the same CRYPT digest every time. Checking passwords I know, it seems that certainly after August 2010 the same salt was always used. Guessing it changes each release.

Steven Levine

2011-09-24 14:58

manager   ~0001994

Dave, the version of the script I uploaded was not finished for single check mode. Must have been too late at night. The replacement c2.pl should fix this along with other nits.

I'm not sure what you by the statement that the file contains lines of the form username/"encrypted password". htpasswd uses a colon to separate the fields.

IAC, the more I test, the less I understand what's going on. At the moment, all versions of htpasswd are generating digests that the script says are OK.

Steven Levine

2011-09-24 16:31

manager   ~0001995

The c.pl and c2.pl are brain farts. The idea is OK, but one really needs to use the correct input data. I'll have a replacement scripts later today. Paul, please delete the uploads. I don't have the rights to do this. Thanks.

psmedley

2011-09-24 22:19

administrator   ~0001996

Will try do some investigation this week, lots to do before we go to Bali on 9th October, so things are kinda busy :/

DB1

2011-09-25 08:28

reporter   ~0001997

Steven, I know the separator - it was just quick typing and in my book standard representation of user & password pairs. What I meant to convey is that there is nothing in a generated password file that will allow you to check the encryption as, for obvious reasons, there is no plain text version of the password.

Looking briefly over the Apache code (As per Apache site - I don't have Paul's mods.) it would seem to rely heavily on rand() - is there not a problem with that in the current libc? htpassword seems to do little more than your script WRT generating the digest but I have been unable so far to track down where the supplied password is actually checked by the server. I have found the error message - but that is not a lot of help. :-) Given that there appears to be no other reports of problems it must be our (OS/2) problem somewhere.

psmedley

2011-09-25 09:32

administrator   ~0002001

Note there is a diff of 2.2.20 at https://sourceforge.net/projects/ecsports/files/Apache2%20Web%20Server/

Steven Levine

2011-09-25 16:22

manager   ~0002005

I've reworked my scripts and pretty well convinced myself there is not problem with any of the htpasswd versions. Any digest they generate can be validated by Perl's crypt.

If I am reading the code correctly, the authentication is done by apr_password_validate() in apr-util\crypto\apr_md5.c which invokes libc's crypt_r().

My best guess at the moment is that somehow the plaintext password or the salt is not getting passed to crypt_r. However, none of this code appears that have changed in a long time.

The apr-util trunk does have a change related to how the crypt_mutex is handled if the apr is built without pthreds support on OS/2, but this should not be relevant to the failure we are seeing.

Steven Levine

2011-09-25 16:37

manager   ~0002006

Paul, are you building with with apr 1.4.5? This is what the httpd source distro supplies. Could you upload diffs for apr and apr-util? The 1.4.2 apr diff no longer applies cleanly. ISTR that in the past there were no diffs to apr-util. Has this changed.

psmedley

2011-10-01 23:36

administrator   ~0002012

Sorry, I had a busy week at work and forgot to answer this...

Yes I'm using apr 1.4.5 - will try and upload the diff's Monday afternoon when we get home from a weekend away...

psmedley

2011-12-26 23:49

administrator   ~0002078

There are changes to crypto/apr-md5.c in apr-util 1.4.1 - will rebuild apache2 with this now

psmedley

2011-12-27 04:23

administrator   ~0002080

Fixed in 2011-12-27 build of Apache2, downloadable from http://os2ports.smedley.info/index.php?page=apache2

Issue History

Date Modified Username Field Change
2011-09-18 11:42 DB1 New Issue
2011-09-21 09:41 psmedley Note Added: 0001980
2011-09-21 15:52 LewisR Note Added: 0001981
2011-09-22 21:23 Steven Levine Note Added: 0001982
2011-09-23 06:49 DB1 Note Added: 0001983
2011-09-23 07:01 DB1 Note Edited: 0001983
2011-09-24 02:27 Steven Levine Note Added: 0001984
2011-09-24 03:29 Steven Levine Note Added: 0001985
2011-09-24 03:40 LewisR Note Added: 0001986
2011-09-24 03:54 Steven Levine Note Added: 0001987
2011-09-24 03:59 LewisR Note Added: 0001988
2011-09-24 04:24 LewisR Note Added: 0001989
2011-09-24 06:36 Steven Levine File Added: c.pl
2011-09-24 06:46 Steven Levine Note Added: 0001990
2011-09-24 07:12 DB1 Note Added: 0001991
2011-09-24 08:26 DB1 Note Edited: 0001991
2011-09-24 08:43 DB1 Note Added: 0001992
2011-09-24 11:53 DB1 Note Added: 0001993
2011-09-24 14:45 Steven Levine File Added: c2.pl
2011-09-24 14:58 Steven Levine Note Added: 0001994
2011-09-24 16:31 Steven Levine Note Added: 0001995
2011-09-24 22:18 psmedley File Deleted: c.pl
2011-09-24 22:18 psmedley File Deleted: c2.pl
2011-09-24 22:19 psmedley Note Added: 0001996
2011-09-25 08:28 DB1 Note Added: 0001997
2011-09-25 09:32 psmedley Note Added: 0002001
2011-09-25 16:22 Steven Levine Note Added: 0002005
2011-09-25 16:37 Steven Levine Note Added: 0002006
2011-10-01 23:36 psmedley Note Added: 0002012
2011-10-03 06:19 psmedley File Added: apr-1.4.5.diff
2011-12-26 23:49 psmedley Note Added: 0002078
2011-12-27 04:23 psmedley Note Added: 0002080
2011-12-27 04:23 psmedley Status new => resolved
2011-12-27 04:23 psmedley Resolution open => fixed
2011-12-27 04:23 psmedley Assigned To => psmedley
2020-08-24 03:13 psmedley Status resolved => closed