From 4d94ea705a2e69a6d226a6ffec20e2289e0da18e Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Tue, 28 Apr 2026 20:56:03 +0200 Subject: [PATCH] Apply patch: ncpfs-hg-commit-431.patch --- .../ncpfs-2.2.6-r6/ncpfs-hg-commit-431.patch | 2957 +++++++++++++++++ contrib/pam/pam_ncp_auth.c | 10 +- contrib/php/libtool | 8 +- contrib/php/php_auth_nds.c | 2 +- contrib/tcl-utils/chgpwd.c | 3 +- contrib/tcl-utils/ncplist.c | 9 +- contrib/tcl-utils/ncplisttrees.c | 2 +- contrib/tcl-utils/ncpreadprop.c | 6 +- contrib/tcl-utils/ncpreadprops.c | 6 +- contrib/tcl-utils/ncpvrest.c | 3 +- contrib/tcl-utils/ncpwhoami.c | 2 +- contrib/tcl-utils/vlist.c | 2 +- contrib/testing/chgpwd.c | 2 +- contrib/testing/cmpattr.c | 2 +- contrib/testing/dirlist2.c | 5 +- contrib/testing/dssearch.c | 2 +- contrib/testing/dsstream.c | 2 +- contrib/testing/effright.c | 2 +- contrib/testing/large.c | 3 +- contrib/testing/mkattr.c | 2 +- contrib/testing/mkclass.c | 2 +- contrib/testing/mkfile.c | 4 +- contrib/testing/mkobj.c | 2 +- contrib/testing/modclass.c | 2 +- contrib/testing/modobj.c | 2 +- contrib/testing/mvobj.c | 2 +- contrib/testing/nwdsgethost.c | 2 +- contrib/testing/nwdsgetstat.c | 2 +- contrib/testing/nwdslist.c | 2 +- contrib/testing/nwdspartjoin.c | 2 +- contrib/testing/nwdspartlist.c | 2 +- contrib/testing/nwdspartrm.c | 2 +- contrib/testing/nwdspartsplit.c | 2 +- contrib/testing/nwdsresetstat.c | 2 +- contrib/testing/nwgettime.c | 2 +- contrib/testing/partroot.c | 2 +- contrib/testing/pp/bcastmd.c | 2 +- contrib/testing/pp/getsynt.c | 2 +- contrib/testing/pp/nwc_next_object.c | 2 +- contrib/testing/pp/nwgetconnlist.c | 4 +- contrib/testing/pp/nwwhoami.c | 2 +- contrib/testing/pp/open_conn_by_name.c | 2 +- contrib/testing/pp/readsdef.c | 2 +- contrib/testing/pp/readsynt.c | 2 +- contrib/testing/pp/return_block_of_tree.c | 2 +- contrib/testing/pp/scantree.c | 2 +- contrib/testing/pp/scanvolr.c | 2 +- contrib/testing/pp/semaphor.c | 7 +- contrib/testing/pp/volres.c | 2 +- contrib/testing/readaddr.c | 2 +- contrib/testing/readadef.c | 2 +- contrib/testing/readattr.c | 2 +- contrib/testing/readcc.c | 2 +- contrib/testing/readcls.c | 2 +- contrib/testing/readsynt.c | 2 +- contrib/testing/renobj.c | 2 +- contrib/testing/replops.c | 2 +- contrib/testing/resint.c | 2 +- contrib/testing/resolve.c | 2 +- contrib/testing/rmattr.c | 2 +- contrib/testing/rmclass.c | 2 +- contrib/testing/rmobj.c | 2 +- contrib/testing/schsync.c | 2 +- contrib/testing/setkeys.c | 2 +- contrib/testing/timeinfo.c | 2 +- contrib/testing/verpwd.c | 2 +- contrib/tests/dsfilter.c | 2 +- contrib/tests/putfilte.c | 4 +- include/ncp/kernel/ncp_fs.h | 12 +- include/ncp/ncp.h | 2 +- include/ncp/ncplib.h | 54 +- include/ncp/nwnet.h.in | 2 +- lib/ds/dsgetstat.c | 2 +- lib/ds/dsstream.c | 2 +- lib/ds/partops.c | 6 +- lib/ds/search.c | 2 +- lib/ds/setkeys.c | 16 +- lib/filemgmt.c | 52 +- lib/fs/filelock.c | 12 +- lib/ncplib.c | 104 +- lib/ncplib_i.h | 18 +- lib/ncpsign.c | 6 +- lib/ndscrypt.c | 47 +- lib/ndscrypt.h | 22 +- lib/ndslib.c | 99 +- lib/nwcrypt.c | 84 +- lib/nwnet.c | 10 +- lib/o_ndslib.c | 3 +- sutil/ncpm_common.h | 6 +- sutil/ncpmount.h | 8 +- util/ncopy.c | 9 +- util/nwbpvalues.c | 22 +- util/nwpasswd.c | 14 +- util/nwpjmv.c | 34 +- util/nwsalvage.c | 1 + util/pserver.c | 43 +- 96 files changed, 3398 insertions(+), 431 deletions(-) create mode 100644 .patches/ncpfs-2.2.6-r6/ncpfs-hg-commit-431.patch diff --git a/.patches/ncpfs-2.2.6-r6/ncpfs-hg-commit-431.patch b/.patches/ncpfs-2.2.6-r6/ncpfs-hg-commit-431.patch new file mode 100644 index 0000000..7998d87 --- /dev/null +++ b/.patches/ncpfs-2.2.6-r6/ncpfs-hg-commit-431.patch @@ -0,0 +1,2957 @@ +changeset: 431:06020cf028e1 +user: Petr Vandrovec +date: Sat Jun 11 19:59:00 2005 +0000 +files: BitKeeper/etc/ignore contrib/pam/pam_ncp_auth.c contrib/php/libtool contrib/php/php_auth_nds.c contrib/tcl-utils/chgpwd.c contrib/tcl-utils/ncplist.c contrib/tcl-utils/ncplisttrees.c contrib/tcl-utils/ncpreadprop.c contrib/tcl-utils/ncpreadprops.c contrib/tcl-utils/ncpvrest.c contrib/tcl-utils/ncpwhoami.c contrib/tcl-utils/vlist.c contrib/testing/chgpwd.c contrib/testing/cmpattr.c contrib/testing/dirlist2.c contrib/testing/dssearch.c contrib/testing/dsstream.c contrib/testing/effright.c contrib/testing/large.c contrib/testing/mkattr.c contrib/testing/mkclass.c contrib/testing/mkfile.c contrib/testing/mkobj.c contrib/testing/modclass.c contrib/testing/modobj.c contrib/testing/mvobj.c contrib/testing/nwdsgethost.c contrib/testing/nwdsgetstat.c contrib/testing/nwdslist.c contrib/testing/nwdspartjoin.c contrib/testing/nwdspartlist.c contrib/testing/nwdspartrm.c contrib/testing/nwdspartsplit.c contrib/testing/nwdsresetstat.c contrib/testing/nwgettime.c contrib/testing/partroot.c contrib/testing/pp/bcastmd.c contrib/testing/pp/getsynt.c contrib/testing/pp/nwc_next_object.c contrib/testing/pp/nwgetconnlist.c contrib/testing/pp/nwwhoami.c contrib/testing/pp/open_conn_by_name.c contrib/testing/pp/readsdef.c contrib/testing/pp/readsynt.c contrib/testing/pp/return_block_of_tree.c contrib/testing/pp/scantree.c contrib/testing/pp/scanvolr.c contrib/testing/pp/semaphor.c contrib/testing/pp/volres.c contrib/testing/readaddr.c contrib/testing/readadef.c contrib/testing/readattr.c contrib/testing/readcc.c contrib/testing/readcls.c contrib/testing/readsynt.c contrib/testing/renobj.c contrib/testing/replops.c contrib/testing/resint.c contrib/testing/resolve.c contrib/testing/rmattr.c contrib/testing/rmclass.c contrib/testing/rmobj.c contrib/testing/schsync.c contrib/testing/setkeys.c contrib/testing/timeinfo.c contrib/testing/verpwd.c contrib/tests/dsfilter.c contrib/tests/putfilte.c include/ncp/kernel/ncp_fs.h include/ncp/ncp.h include/ncp/ncplib.h include/ncp/nwnet.h.in lib/ds/dsgetstat.c lib/ds/dsstream.c lib/ds/partops.c lib/ds/search.c lib/ds/setkeys.c lib/filemgmt.c lib/fs/filelock.c lib/ncplib.c lib/ncplib_i.h lib/ncpsign.c lib/ndscrypt.c lib/ndscrypt.h lib/ndslib.c lib/nwcrypt.c lib/nwnet.c lib/o_ndslib.c sutil/ncpm_common.h sutil/ncpmount.h util/ncopy.c util/nwbpvalues.c util/nwpasswd.c util/nwpjmv.c util/nwsalvage.c util/pserver.c +description: +Fix signed/unsigned pointer problems pointed out by gcc-4.0. + + +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/pam/pam_ncp_auth.c +--- a/contrib/pam/pam_ncp_auth.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/pam/pam_ncp_auth.c Sat Jun 11 19:59:00 2005 +0000 +@@ -902,7 +902,7 @@ nw_ctx_search(const char *user_cn, NWCON + NWDSContextHandle context; + NWDSCCODE ccode; + nuint32 iterationHandle; +- nint32 countObjectsSearched; ++ nuint32 countObjectsSearched; + nuint32 objCntr; + nuint32 objCount; + char objectName[MAX_DN_CHARS + 1]; +@@ -1472,7 +1472,7 @@ nw_retrieve_bindery_user_info(struct nw_ + if (ui->qflag & QF_DEBUG) + syslog(LOG_NOTICE, "%s:got a full name %s for %s\n ", me, p.value, userName); + +- v = strdup(p.value); ++ v = strdup((char*)p.value); + if (!v) { + syslog(LOG_WARNING, "%s:Not enough memory for strdup()\n", me); + return ENOMEM; +@@ -1490,13 +1490,13 @@ nw_retrieve_bindery_user_info(struct nw_ + err = ncp_read_property_value(conn, NCP_BINDERY_USER, userName, 1, "HOME_DIRECTORY", &p); + if (!err && p.value[0]) { + char *v1; +- char *mark = strchr(p.value, ':'); ++ char *mark = strchr((char*)p.value, ':'); + if (mark && *(mark + 1)) { + if (ui->qflag & QF_DEBUG) + syslog(LOG_NOTICE, "%s:got a home directory %s for %s\n ", me, p.value, userName); + + *mark = 0; +- v = strdup(p.value); ++ v = strdup((char*)p.value); + if (!v) { + syslog(LOG_WARNING, "%s:Not enough memory for strdup()\n", me); + return ENOMEM; +@@ -1793,7 +1793,7 @@ nds_group_name(UNUSED(NWDSContextHandle + syslog(LOG_WARNING, "Not enough memory for strdup()\n"); + return ENOMEM; + } +- f = objname; ++ f = (const unsigned char*)objname; + for (; (c = *f++) != 0; *buff++ = c) { + if (c >= 'a' && c <= 'z') + continue; +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/php/libtool +--- a/contrib/php/libtool Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/php/libtool Sat Jun 11 19:59:00 2005 +0000 +@@ -76,10 +76,10 @@ AR_FLAGS="cru" + AR_FLAGS="cru" + + # A C compiler. +-LTCC="gcc" ++LTCC="gcc-4.0" + + # A language-specific compiler. +-CC="gcc" ++CC="gcc-4.0" + + # Is the compiler the GNU C compiler? + with_gcc=yes +@@ -316,7 +316,7 @@ link_all_deplibs=unknown + link_all_deplibs=unknown + + # Compile-time system search path for libraries +-sys_lib_search_path_spec=" /usr/lib/gcc-lib/i486-linux/3.3.6/ /usr/lib/gcc/i486-linux/3.3.6/ /usr/lib/gcc-lib/i486-linux/3.3.6/../../../../i486-linux/lib/i486-linux/3.3.6/ /usr/lib/gcc-lib/i486-linux/3.3.6/../../../../i486-linux/lib/ /usr/lib/gcc-lib/i486-linux/3.3.6/../../../i486-linux/3.3.6/ /usr/lib/gcc-lib/i486-linux/3.3.6/../../../ /lib/i486-linux/3.3.6/ /lib/ /usr/lib/i486-linux/3.3.6/ /usr/lib/" ++sys_lib_search_path_spec=" /usr/lib/gcc/i486-linux/4.0.1/ /usr/lib/gcc/i486-linux/4.0.1/ /usr/lib/gcc/i486-linux/4.0.1/../../../../i486-linux/lib/i486-linux/4.0.1/ /usr/lib/gcc/i486-linux/4.0.1/../../../../i486-linux/lib/ /usr/lib/gcc/i486-linux/4.0.1/../../../i486-linux/4.0.1/ /usr/lib/gcc/i486-linux/4.0.1/../../../ /lib/i486-linux/4.0.1/ /lib/ /usr/lib/i486-linux/4.0.1/ /usr/lib/" + + # Run-time system search path for libraries + sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib +@@ -6740,7 +6740,7 @@ AR_FLAGS="cru" + AR_FLAGS="cru" + + # A C compiler. +-LTCC="gcc" ++LTCC="gcc-4.0" + + # A language-specific compiler. + CC="g++" +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/php/php_auth_nds.c +--- a/contrib/php/php_auth_nds.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/php/php_auth_nds.c Sat Jun 11 19:59:00 2005 +0000 +@@ -388,7 +388,7 @@ static NWDSCCODE nw_ctx_search( + + NWDSCCODE ccode; + nuint32 iterationHandle = NO_MORE_ITERATIONS; +- nint32 countObjectsSearched; ++ nuint32 countObjectsSearched; + nuint32 objCntr; + nuint32 objCount; + char objectName[MAX_DN_CHARS+1]; +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/tcl-utils/chgpwd.c +--- a/contrib/tcl-utils/chgpwd.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/tcl-utils/chgpwd.c Sat Jun 11 19:59:00 2005 +0000 +@@ -62,6 +62,7 @@ typedef u_int32_t Time_T; + + #include + #include ++#include + #include + #include + +@@ -254,7 +255,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/tcl-utils/ncplist.c +--- a/contrib/tcl-utils/ncplist.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/tcl-utils/ncplist.c Sat Jun 11 19:59:00 2005 +0000 +@@ -85,6 +85,7 @@ typedef u_int32_t Time_T; + #include + #include + #include ++#include + #include + #include + +@@ -151,7 +152,7 @@ int main(int argc, char *argv[]) { + nuint32 ih = NO_MORE_ITERATIONS; + Buf_T* buf; + size_t size = DEFAULT_MESSAGE_LEN; +- size_t cnt; ++ size_t ccnt; + + char treeName [MAX_TREE_NAME_CHARS +1]=""; + char serverName [MAX_SCHEMA_NAME_CHARS+1]=""; +@@ -263,7 +264,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +@@ -345,7 +346,7 @@ int main(int argc, char *argv[]) { + case 0:dserr = NWDSList(ctx, objectname, &ih, buf); break; + case 1:dserr = NWDSListContainers(ctx, objectname, &ih, buf); break; + case 2:dserr = NWDSListByClassAndName(ctx, objectname, classname, subjectname, &ih, buf); break; +- case 3:dserr = NWDSGetCountByClassAndName(ctx, objectname, classname, subjectname, &cnt); break; ++ case 3:dserr = NWDSGetCountByClassAndName(ctx, objectname, classname, subjectname, &ccnt); break; + case 4:dserr = NWDSExtSyncList(ctx, objectname, + classname, subjectname, &ih, &ts, + 0, buf); +@@ -413,7 +414,7 @@ int main(int argc, char *argv[]) { + #endif + } else { + if (!quiet) +- printf("%u objects found\n", cnt); ++ printf("%u objects found\n", ccnt); + } + } while ((dserr == 0) && (ih != NO_MORE_ITERATIONS)); + NWCCCloseConn(conn); +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/tcl-utils/ncplisttrees.c +--- a/contrib/tcl-utils/ncplisttrees.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/tcl-utils/ncplisttrees.c Sat Jun 11 19:59:00 2005 +0000 +@@ -204,7 +204,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/tcl-utils/ncpreadprop.c +--- a/contrib/tcl-utils/ncpreadprop.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/tcl-utils/ncpreadprop.c Sat Jun 11 19:59:00 2005 +0000 +@@ -72,7 +72,7 @@ + + static char *progname; + +-static void ++static void __attribute__((noreturn)) + usage(void) + { + fprintf(stderr, _("usage: %s [options] \n"), progname); +@@ -197,7 +197,7 @@ static int doPrintOut (NWDSContextHandle + } + break; + case SYN_PO_ADDRESS:{ +- const NWDSChar** pa = (const NWDSChar**)name; ++ const NWDSChar*const* pa = (const NWDSChar*const*)name; + printf("%s:%s:%s:%s:%s:%s\n",pa[0],pa[1],pa[2],pa[3],pa[4],pa[5]); + } + break; +@@ -442,7 +442,7 @@ main(int argc, char *argv[]) + + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/tcl-utils/ncpreadprops.c +--- a/contrib/tcl-utils/ncpreadprops.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/tcl-utils/ncpreadprops.c Sat Jun 11 19:59:00 2005 +0000 +@@ -67,7 +67,7 @@ Ppollet:0 CN=FCPC2_APPS home\ppollet:1 2 + + static char *progname; + +-static void ++static void __attribute__((noreturn)) + usage(void) + { + fprintf(stderr, _("usage: %s [options] \n"), progname); +@@ -191,7 +191,7 @@ static int doPrintOut (NWDSContextHandle + } + break; + case SYN_PO_ADDRESS:{ +- const NWDSChar** pa = (const NWDSChar**)name; ++ const NWDSChar*const* pa = (const NWDSChar*const*)name; + printf("%s%c%s%c%s%c%s%c%s%c%s",pa[0],sep,pa[1],sep,pa[2],sep,pa[3],sep,pa[4],sep,pa[5]); + } + break; +@@ -479,7 +479,7 @@ main(int argc, char *argv[]) + + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/tcl-utils/ncpvrest.c +--- a/contrib/tcl-utils/ncpvrest.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/tcl-utils/ncpvrest.c Sat Jun 11 19:59:00 2005 +0000 +@@ -37,6 +37,7 @@ + + #include + #include ++#include + #include + #include + +@@ -148,7 +149,7 @@ int main(int argc, char *argv[]) { + + { + +- int optv=-1; ++ NWVOL_NUM optv; + nuint32 nwuid,rest,inUse; + struct ncp_volume_info target; + +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/tcl-utils/ncpwhoami.c +--- a/contrib/tcl-utils/ncpwhoami.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/tcl-utils/ncpwhoami.c Sat Jun 11 19:59:00 2005 +0000 +@@ -78,7 +78,7 @@ static const char * gUserFields=NULL; + static const char * gUserFields=NULL; + + +-static void ++static void __attribute__((noreturn)) + usage(void) + { + fprintf(stderr, _("failed. usage: %s [-options] \n"), progname); +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/tcl-utils/vlist.c +--- a/contrib/tcl-utils/vlist.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/tcl-utils/vlist.c Sat Jun 11 19:59:00 2005 +0000 +@@ -46,7 +46,7 @@ + + static char *progname; + +-static void ++static void __attribute__((noreturn)) + usage(void) + { + fprintf(stderr, _("failed. usage: %s [options] servername\n"), progname); +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/chgpwd.c +--- a/contrib/testing/chgpwd.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/chgpwd.c Sat Jun 11 19:59:00 2005 +0000 +@@ -200,7 +200,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/cmpattr.c +--- a/contrib/testing/cmpattr.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/cmpattr.c Sat Jun 11 19:59:00 2005 +0000 +@@ -186,7 +186,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/dirlist2.c +--- a/contrib/testing/dirlist2.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/dirlist2.c Sat Jun 11 19:59:00 2005 +0000 +@@ -30,7 +30,6 @@ + #define MAKE_NCPLIB + #include + #include +-#include "../../lib/ncplib_i.h" + + #include + #include +@@ -41,6 +40,8 @@ + + #include "private/libintl.h" + #define _(X) gettext(X) ++ ++#include "../../lib/ncplib_i.h" + + static char *progname; + +@@ -70,7 +71,7 @@ int main(int argc, char *argv[]) { + unsigned int searchattr = SA_ALL; + u_int32_t destns = NW_NS_DOS; + int searchmode = 0; +- const char* sstr = "\xFF*"; ++ const unsigned char* sstr = (const unsigned char*)"\xFF*"; + size_t sslen = 2; + + setlocale(LC_ALL, ""); +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/dssearch.c +--- a/contrib/testing/dssearch.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/dssearch.c Sat Jun 11 19:59:00 2005 +0000 +@@ -554,7 +554,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/dsstream.c +--- a/contrib/testing/dsstream.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/dsstream.c Sat Jun 11 19:59:00 2005 +0000 +@@ -188,7 +188,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/effright.c +--- a/contrib/testing/effright.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/effright.c Sat Jun 11 19:59:00 2005 +0000 +@@ -175,7 +175,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/large.c +--- a/contrib/testing/large.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/large.c Sat Jun 11 19:59:00 2005 +0000 +@@ -244,7 +244,8 @@ int main(int argc, char *argv[]) { + memset(&iii, 0xCC, sizeof(iii)); + + dserr = ncp_ns_open_create_entry(conn, destns, searchattr, NCP_DIRSTYLE_DIRBASE, +- 0, 0, volume, strlen(s) + 2, -1, dowrite ? OC_MODE_CREATE | OC_MODE_TRUNCATE | OC_MODE_OPEN | OC_MODE_OPEN_64BIT_ACCESS : OC_MODE_OPEN | OC_MODE_OPEN_64BIT_ACCESS, ++ 0, 0, (unsigned char*)volume, strlen(s) + 2, -1, ++ dowrite ? OC_MODE_CREATE | OC_MODE_TRUNCATE | OC_MODE_OPEN | OC_MODE_OPEN_64BIT_ACCESS : OC_MODE_OPEN | OC_MODE_OPEN_64BIT_ACCESS, + 0, AR_READ_ONLY|AR_WRITE_ONLY, RIM_ALL, + &iii, sizeof(iii), NULL, NULL, fh); + if (dserr) { +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/mkattr.c +--- a/contrib/testing/mkattr.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/mkattr.c Sat Jun 11 19:59:00 2005 +0000 +@@ -201,7 +201,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/mkclass.c +--- a/contrib/testing/mkclass.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/mkclass.c Sat Jun 11 19:59:00 2005 +0000 +@@ -218,7 +218,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/mkfile.c +--- a/contrib/testing/mkfile.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/mkfile.c Sat Jun 11 19:59:00 2005 +0000 +@@ -221,12 +221,12 @@ int main(int argc, char *argv[]) { + volume[1] = strlen(s); + { + struct nw_info_struct2 iii; +- u_int8_t fh[10]; ++ u_int8_t fh[6]; + + memset(&iii, 0xCC, sizeof(iii)); + + dserr = ncp_ns_open_create_entry(conn, destns, searchattr, NCP_DIRSTYLE_DIRBASE, +- 3, rim, volume, strlen(s) + 2, -1, 0x0B, 0, 0, 0xFF, ++ 3, rim, (unsigned char*)volume, strlen(s) + 2, -1, 0x0B, 0, 0, 0xFF, + &iii, sizeof(iii), NULL, NULL, fh); + if (dserr) { + fprintf(stderr, "Cannot obtain info: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/mkobj.c +--- a/contrib/testing/mkobj.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/mkobj.c Sat Jun 11 19:59:00 2005 +0000 +@@ -202,7 +202,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/modclass.c +--- a/contrib/testing/modclass.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/modclass.c Sat Jun 11 19:59:00 2005 +0000 +@@ -191,7 +191,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/modobj.c +--- a/contrib/testing/modobj.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/modobj.c Sat Jun 11 19:59:00 2005 +0000 +@@ -145,7 +145,7 @@ int main(int argc, char *argv[]) { + dserr = NWDSSetContext(ctx, DCK_CONFIDENCE, &confidence); + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/mvobj.c +--- a/contrib/testing/mvobj.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/mvobj.c Sat Jun 11 19:59:00 2005 +0000 +@@ -180,7 +180,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/nwdsgethost.c +--- a/contrib/testing/nwdsgethost.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/nwdsgethost.c Sat Jun 11 19:59:00 2005 +0000 +@@ -177,7 +177,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/nwdsgetstat.c +--- a/contrib/testing/nwdsgetstat.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/nwdsgetstat.c Sat Jun 11 19:59:00 2005 +0000 +@@ -168,7 +168,7 @@ int main(int argc, char *argv[]) { + } + #ifdef N_PLAT_LINUX + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/nwdslist.c +--- a/contrib/testing/nwdslist.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/nwdslist.c Sat Jun 11 19:59:00 2005 +0000 +@@ -209,7 +209,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/nwdspartjoin.c +--- a/contrib/testing/nwdspartjoin.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/nwdspartjoin.c Sat Jun 11 19:59:00 2005 +0000 +@@ -171,7 +171,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/nwdspartlist.c +--- a/contrib/testing/nwdspartlist.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/nwdspartlist.c Sat Jun 11 19:59:00 2005 +0000 +@@ -184,7 +184,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/nwdspartrm.c +--- a/contrib/testing/nwdspartrm.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/nwdspartrm.c Sat Jun 11 19:59:00 2005 +0000 +@@ -165,7 +165,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/nwdspartsplit.c +--- a/contrib/testing/nwdspartsplit.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/nwdspartsplit.c Sat Jun 11 19:59:00 2005 +0000 +@@ -171,7 +171,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/nwdsresetstat.c +--- a/contrib/testing/nwdsresetstat.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/nwdsresetstat.c Sat Jun 11 19:59:00 2005 +0000 +@@ -167,7 +167,7 @@ int main(int argc, char *argv[]) { + } + #ifdef N_PLAT_LINUX + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/nwgettime.c +--- a/contrib/testing/nwgettime.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/nwgettime.c Sat Jun 11 19:59:00 2005 +0000 +@@ -173,7 +173,7 @@ int main(int argc, char *argv[]) { + } + #ifdef N_PLAT_LINUX + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/partroot.c +--- a/contrib/testing/partroot.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/partroot.c Sat Jun 11 19:59:00 2005 +0000 +@@ -168,7 +168,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/pp/bcastmd.c +--- a/contrib/testing/pp/bcastmd.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/pp/bcastmd.c Sat Jun 11 19:59:00 2005 +0000 +@@ -193,7 +193,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/pp/getsynt.c +--- a/contrib/testing/pp/getsynt.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/pp/getsynt.c Sat Jun 11 19:59:00 2005 +0000 +@@ -175,7 +175,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/pp/nwc_next_object.c +--- a/contrib/testing/pp/nwc_next_object.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/pp/nwc_next_object.c Sat Jun 11 19:59:00 2005 +0000 +@@ -202,7 +202,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/pp/nwgetconnlist.c +--- a/contrib/testing/pp/nwgetconnlist.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/pp/nwgetconnlist.c Sat Jun 11 19:59:00 2005 +0000 +@@ -300,7 +300,7 @@ static void printConn (NWCONN_HANDLE con + } + + static void getAsMuchAsYouCan ( NWCONN_HANDLE conn) { +- char buffer[8192]; ++ unsigned char buffer[8192]; + int len=sizeof(buffer); + + NWCCTranAddr aux; +@@ -335,7 +335,7 @@ static void getAsMuchAsYouCan ( NWCONN_H + printf("NWCC_INFO_SECURITY %s\n",strnwerror(NWCCGetConnInfo(conn,NWCC_INFO_SECURITY, sizeof (int), buffer))); + + +- dump_hex("tranaddr:",(char *)&aux,sizeof(aux)); ++ dump_hex("tranaddr:",(const unsigned char *)&aux,sizeof(aux)); + dump_hex("tranaddr II: ",aux.buffer,12); + + free (aux.buffer); +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/pp/nwwhoami.c +--- a/contrib/testing/pp/nwwhoami.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/pp/nwwhoami.c Sat Jun 11 19:59:00 2005 +0000 +@@ -199,7 +199,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/pp/open_conn_by_name.c +--- a/contrib/testing/pp/open_conn_by_name.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/pp/open_conn_by_name.c Sat Jun 11 19:59:00 2005 +0000 +@@ -186,7 +186,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/pp/readsdef.c +--- a/contrib/testing/pp/readsdef.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/pp/readsdef.c Sat Jun 11 19:59:00 2005 +0000 +@@ -182,7 +182,7 @@ int main(int argc, char *argv[]) { + */ + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/pp/readsynt.c +--- a/contrib/testing/pp/readsynt.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/pp/readsynt.c Sat Jun 11 19:59:00 2005 +0000 +@@ -447,7 +447,7 @@ int main(int argc, char *argv[]) { + */ + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/pp/return_block_of_tree.c +--- a/contrib/testing/pp/return_block_of_tree.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/pp/return_block_of_tree.c Sat Jun 11 19:59:00 2005 +0000 +@@ -184,7 +184,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/pp/scantree.c +--- a/contrib/testing/pp/scantree.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/pp/scantree.c Sat Jun 11 19:59:00 2005 +0000 +@@ -188,7 +188,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/pp/scanvolr.c +--- a/contrib/testing/pp/scanvolr.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/pp/scanvolr.c Sat Jun 11 19:59:00 2005 +0000 +@@ -211,7 +211,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/pp/semaphor.c +--- a/contrib/testing/pp/semaphor.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/pp/semaphor.c Sat Jun 11 19:59:00 2005 +0000 +@@ -188,7 +188,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +@@ -231,7 +231,8 @@ int main(int argc, char *argv[]) { + + { + nuint32 semHandle; +- nuint16 semCurrentCount,semValue,semOpenCount; ++ nuint16 semCurrentCount, semOpenCount; ++ nint16 semValue; + + err=NWOpenSemaphore (conn,semName,maxAccess,&semHandle, &semCurrentCount); + if (err) { +@@ -243,7 +244,7 @@ int main(int argc, char *argv[]) { + printf ("%s is open with handle(%x) for %u max concurrent access. Currently it has %d access\n", + semName,semHandle,maxAccess,semCurrentCount); + +- err=NWExamineSemaphore (conn,semHandle,&semValue,&semOpenCount); ++ err=NWExamineSemaphore(conn, semHandle, &semValue, &semOpenCount); + if (err) { + fprintf(stderr, "NWExamineSemaphore failed with error %s\n", + strnwerror(err)); +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/pp/volres.c +--- a/contrib/testing/pp/volres.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/pp/volres.c Sat Jun 11 19:59:00 2005 +0000 +@@ -209,7 +209,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/readaddr.c +--- a/contrib/testing/readaddr.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/readaddr.c Sat Jun 11 19:59:00 2005 +0000 +@@ -66,7 +66,7 @@ int main(int argc, char *argv[]) { + NWDSContextHandle ctx; + NWCONN_HANDLE conn; + const char* context = "OrgUnit.Org.Country"; +- unsigned char buff[1000]; ++ char buff[1000]; + const char* server = "CDROM"; + int opt; + u_int32_t ctxflag = 0; +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/readadef.c +--- a/contrib/testing/readadef.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/readadef.c Sat Jun 11 19:59:00 2005 +0000 +@@ -201,7 +201,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/readattr.c +--- a/contrib/testing/readattr.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/readattr.c Sat Jun 11 19:59:00 2005 +0000 +@@ -640,7 +640,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/readcc.c +--- a/contrib/testing/readcc.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/readcc.c Sat Jun 11 19:59:00 2005 +0000 +@@ -182,7 +182,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/readcls.c +--- a/contrib/testing/readcls.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/readcls.c Sat Jun 11 19:59:00 2005 +0000 +@@ -223,7 +223,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/readsynt.c +--- a/contrib/testing/readsynt.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/readsynt.c Sat Jun 11 19:59:00 2005 +0000 +@@ -200,7 +200,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/renobj.c +--- a/contrib/testing/renobj.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/renobj.c Sat Jun 11 19:59:00 2005 +0000 +@@ -180,7 +180,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/replops.c +--- a/contrib/testing/replops.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/replops.c Sat Jun 11 19:59:00 2005 +0000 +@@ -217,7 +217,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/resint.c +--- a/contrib/testing/resint.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/resint.c Sat Jun 11 19:59:00 2005 +0000 +@@ -206,7 +206,7 @@ int main(int argc, char *argv[]) { + return 122; + } + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/resolve.c +--- a/contrib/testing/resolve.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/resolve.c Sat Jun 11 19:59:00 2005 +0000 +@@ -142,7 +142,7 @@ int main(int argc, char *argv[]) { + return 122; + } + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/rmattr.c +--- a/contrib/testing/rmattr.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/rmattr.c Sat Jun 11 19:59:00 2005 +0000 +@@ -167,7 +167,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/rmclass.c +--- a/contrib/testing/rmclass.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/rmclass.c Sat Jun 11 19:59:00 2005 +0000 +@@ -167,7 +167,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/rmobj.c +--- a/contrib/testing/rmobj.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/rmobj.c Sat Jun 11 19:59:00 2005 +0000 +@@ -170,7 +170,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/schsync.c +--- a/contrib/testing/schsync.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/schsync.c Sat Jun 11 19:59:00 2005 +0000 +@@ -172,7 +172,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/setkeys.c +--- a/contrib/testing/setkeys.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/setkeys.c Sat Jun 11 19:59:00 2005 +0000 +@@ -172,7 +172,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/timeinfo.c +--- a/contrib/testing/timeinfo.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/timeinfo.c Sat Jun 11 19:59:00 2005 +0000 +@@ -256,7 +256,7 @@ int main(int argc, char *argv[]) { + } + #ifdef N_PLAT_LINUX + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/testing/verpwd.c +--- a/contrib/testing/verpwd.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/testing/verpwd.c Sat Jun 11 19:59:00 2005 +0000 +@@ -192,7 +192,7 @@ int main(int argc, char *argv[]) { + } + #ifndef N_PLAT_MSW4 + { +- static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ++ static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + dserr = NWDSSetTransport(ctx, 16, add); + if (dserr) { + fprintf(stderr, "NWDSSetTransport failed: %s\n", +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/tests/dsfilter.c +--- a/contrib/tests/dsfilter.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/tests/dsfilter.c Sat Jun 11 19:59:00 2005 +0000 +@@ -86,7 +86,7 @@ static int searchtest(const char* testna + Buf_T *buf = NULL; + Filter_Cursor_T *cur = NULL; + +- static const u_int32_t add[] = ++ static const NET_ADDRESS_TYPE add[] = + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; + + NWCallsInit (NULL, NULL); +diff -r 3fc1f5c9c744 -r 06020cf028e1 contrib/tests/putfilte.c +--- a/contrib/tests/putfilte.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/contrib/tests/putfilte.c Sat Jun 11 19:59:00 2005 +0000 +@@ -67,7 +67,7 @@ ndsfindusercontext (NWDSContextHandle ct + if ((nwerr = NWDSAddFilterToken (cur, FTOK_EQ, NULL, 0))) + goto out; + +- if ((nwerr = NWDSAddFilterToken (cur, FTOK_AVAL, (char *) ousername, SYN_CI_STRING))) ++ if ((nwerr = NWDSAddFilterToken (cur, FTOK_AVAL, (const char *) ousername, SYN_CI_STRING))) + goto out; + + if ((nwerr = NWDSAddFilterToken (cur, FTOK_RPAREN, NULL, 0))) +@@ -133,7 +133,7 @@ main (int argc, char *argv[]) + NWDSContextHandle ctx; + NWCONN_HANDLE conn; + struct ncp_conn_spec connsp; +- static const u_int32_t add[] = ++ static const NET_ADDRESS_TYPE add[] = + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; + + mtrace (); +diff -r 3fc1f5c9c744 -r 06020cf028e1 include/ncp/kernel/ncp_fs.h +--- a/include/ncp/kernel/ncp_fs.h Sun Jun 05 21:25:42 2005 +0000 ++++ b/include/ncp/kernel/ncp_fs.h Sat Jun 11 19:59:00 2005 +0000 +@@ -50,8 +50,8 @@ + + struct ncp_sign_init + { +- char sign_root[8]; +- char sign_last[16]; ++ unsigned char sign_root[8]; ++ unsigned char sign_last[16]; + }; + + union ncp_sockaddr { +@@ -72,7 +72,7 @@ struct ncp_ioctl_request { + struct ncp_ioctl_request { + unsigned int function; + unsigned int size; +- char *data; ++ unsigned char *data; + }; + + struct ncp_fs_info { +@@ -130,13 +130,13 @@ struct ncp_nls_ioctl_old + struct ncp_nls_ioctl_old + { + int codepage; +- unsigned char iocharset[NCP_IOCSNAME_LEN+1]; ++ char iocharset[NCP_IOCSNAME_LEN+1]; + }; + + struct ncp_nls_ioctl + { +- unsigned char codepage[NCP_IOCSNAME_LEN+1]; +- unsigned char iocharset[NCP_IOCSNAME_LEN+1]; ++ char codepage[NCP_IOCSNAME_LEN+1]; ++ char iocharset[NCP_IOCSNAME_LEN+1]; + }; + + #define NCP_IOC_NCPREQUEST _IOR('n', 1, struct ncp_ioctl_request) +diff -r 3fc1f5c9c744 -r 06020cf028e1 include/ncp/ncp.h +--- a/include/ncp/ncp.h Sun Jun 05 21:25:42 2005 +0000 ++++ b/include/ncp/ncp.h Sat Jun 11 19:59:00 2005 +0000 +@@ -73,7 +73,7 @@ struct ncp_bindery_object { + #ifdef SWIG + fixedCharArray object_name[NCP_BINDERY_NAME_LEN]; + #else +- u_int8_t object_name[NCP_BINDERY_NAME_LEN]; ++ char object_name[NCP_BINDERY_NAME_LEN]; + #endif + u_int8_t object_flags; + u_int8_t object_security; +diff -r 3fc1f5c9c744 -r 06020cf028e1 include/ncp/ncplib.h +--- a/include/ncp/ncplib.h Sun Jun 05 21:25:42 2005 +0000 ++++ b/include/ncp/ncplib.h Sat Jun 11 19:59:00 2005 +0000 +@@ -474,7 +474,7 @@ struct ncp_file_server_info + #else + struct ncp_file_server_info + { +- u_int8_t ServerName[48] __attribute__((packed)); ++ char ServerName[48] __attribute__((packed)); + u_int8_t FileServiceVersion __attribute__((packed)); + u_int8_t FileServiceSubVersion __attribute__((packed)); + u_int16_t MaximumServiceConnections __attribute__((packed)); +@@ -499,7 +499,7 @@ struct ncp_file_server_info_2 { + #ifdef SWIG + fixedArray ServerName[49]; + #else +- u_int8_t ServerName[49]; ++ char ServerName[49]; + #endif + u_int8_t FileServiceVersion; + u_int8_t FileServiceSubVersion; +@@ -560,7 +560,7 @@ long + + long + ncp_get_encryption_key(NWCONN_HANDLE conn, +- char *encryption_key); ++ unsigned char encryption_key[8]); + long + ncp_get_bindery_object_id(NWCONN_HANDLE conn, + NWObjectType object_type, +@@ -710,19 +710,19 @@ long + ncp_login_encrypted(NWCONN_HANDLE conn, + const struct ncp_bindery_object *object, + const unsigned char *key, +- const unsigned char *passwd); ++ const char *passwd); + + long + ncp_login_unencrypted(NWCONN_HANDLE conn, + NWObjectType object_type, const char *object_name, +- const unsigned char *passwd); ++ const char *passwd); + + long + ncp_change_login_passwd(NWCONN_HANDLE conn, + const struct ncp_bindery_object *object, + const unsigned char *key, +- const unsigned char *oldpasswd, +- const unsigned char *newpasswd); ++ const char *oldpasswd, ++ const char *newpasswd); + + #define NCP_GRACE_PERIOD (0xdf) + +@@ -782,8 +782,8 @@ const char* strnwerror(int err); + + long + ncp_login_user(NWCONN_HANDLE conn, +- const unsigned char *username, +- const unsigned char *password); ++ const char *username, ++ const char *password); + + long + ncp_get_volume_info_with_number(NWCONN_HANDLE conn, int n, +@@ -815,7 +815,7 @@ long + int attr, int accessm, + struct ncp_file_info *target); + +-long ncp_close_file(NWCONN_HANDLE conn, const char fileHandle[6]); ++long ncp_close_file(NWCONN_HANDLE conn, const unsigned char fileHandle[6]); + + long + ncp_create_newfile(NWCONN_HANDLE conn, +@@ -878,11 +878,11 @@ long + + #ifdef SWIG + long +- ncp_read(NWCONN_HANDLE conn, const char fileHandle[6], ++ ncp_read(NWCONN_HANDLE conn, const unsigned char fileHandle[6], + ncp_off_t offset, size_t count, char *RETBUFFER_LENPREV); + + long +- ncp_write(NWCONN_HANDLE conn, const char fileHandle[6], ++ ncp_write(NWCONN_HANDLE conn, const unsigned char fileHandle[6], + ncp_off_t offset, size_t IGNORE, const char *STRING_LENPREV); + + long +@@ -895,23 +895,23 @@ long + u_int32_t * OUTPUT); + #else + long +- ncp_read(NWCONN_HANDLE conn, const char fileHandle[6], +- ncp_off_t offset, size_t count, char *target); +- +-long +- ncp_write(NWCONN_HANDLE conn, const char fileHandle[6], +- ncp_off_t offset, size_t count, const char *source); +- +-NWCCODE ncp_read64(NWCONN_HANDLE conn, const char fileHandle[6], ++ ncp_read(NWCONN_HANDLE conn, const unsigned char fileHandle[6], ++ ncp_off_t offset, size_t count, void *target); ++ ++long ++ ncp_write(NWCONN_HANDLE conn, const unsigned char fileHandle[6], ++ ncp_off_t offset, size_t count, const void *source); ++ ++NWCCODE ncp_read64(NWCONN_HANDLE conn, const unsigned char fileHandle[6], + ncp_off64_t offset, size_t count, void *target, size_t *bytesread); + +-NWCCODE ncp_write64(NWCONN_HANDLE conn, const char fileHandle[6], ++NWCCODE ncp_write64(NWCONN_HANDLE conn, const unsigned char fileHandle[6], + ncp_off64_t offset, size_t count, const void *source, size_t *byteswritten); + + long + ncp_copy_file(NWCONN_HANDLE conn, +- const char source_file[6], +- const char target_file[6], ++ const unsigned char source_file[6], ++ const unsigned char target_file[6], + u_int32_t source_offset, + u_int32_t target_offset, + u_int32_t count, +@@ -1167,8 +1167,8 @@ long + long + ncp_send_nds_frag(NWCONN_HANDLE conn, + int ndsverb, +- const char *inbuf, size_t inbuflen, +- char *outbuf, size_t outbufsize, size_t *outbuflen); ++ const void *inbuf, size_t inbuflen, ++ void *outbuf, size_t outbufsize, size_t *outbuflen); + + long + ncp_send_nds(NWCONN_HANDLE conn, int fn, +@@ -1423,7 +1423,7 @@ ncp_ns_open_create_entry(NWCONN_HANDLE c + /* struct nw_info_struct2 */ void* target, size_t sizeoftarget, + u_int8_t* oc_action, + u_int8_t* oc_callback, +- char fileHandle[6] /* ?? u_int32_t* or NW_FILE_HANDLE* ?? */ ++ unsigned char fileHandle[6] /* ?? u_int32_t* or NW_FILE_HANDLE* ?? */ + ); + + NWCCODE +@@ -1660,7 +1660,7 @@ NWCCODE + NWCCODE + ncp_get_file_size(NWCONN_HANDLE conn, + /* input */ +- const char fileHandle[6], ++ const unsigned char fileHandle[6], + /* output */ + ncp_off64_t* fileSize); + +@@ -1684,14 +1684,14 @@ const char* ncp_namespace_to_str(char r[ + #define NCP_PHYSREC_EX 0x01 + #define NCP_PHYSREC_SH 0x03 + +-NWCCODE ncp_log_physical_record(NWCONN_HANDLE conn, const char fileHandle[6], ++NWCCODE ncp_log_physical_record(NWCONN_HANDLE conn, const unsigned char fileHandle[6], + ncp_off64_t startOffset, u_int64_t length, unsigned int flags, + unsigned int timeout); + +-NWCCODE ncp_clear_physical_record(NWCONN_HANDLE conn, const char fileHandle[6], ++NWCCODE ncp_clear_physical_record(NWCONN_HANDLE conn, const unsigned char fileHandle[6], + ncp_off64_t startOffset, u_int64_t length); + +-NWCCODE ncp_release_physical_record(NWCONN_HANDLE conn, const char fileHandle[6], ++NWCCODE ncp_release_physical_record(NWCONN_HANDLE conn, const unsigned char fileHandle[6], + ncp_off64_t startOffset, u_int64_t length); + + #ifdef __cplusplus +diff -r 3fc1f5c9c744 -r 06020cf028e1 include/ncp/nwnet.h.in +--- a/include/ncp/nwnet.h.in Sun Jun 05 21:25:42 2005 +0000 ++++ b/include/ncp/nwnet.h.in Sat Jun 11 19:59:00 2005 +0000 +@@ -661,7 +661,7 @@ NWDSCCODE __NWDSCompare(NWDSContextHandl + NWObjectID objectID, Buf_T* buf, nbool8* matched); + NWDSCCODE __NWDSOpenStream(NWDSContextHandle ctx, const NWDSChar* objectName, + const NWDSChar* attrName, nflag32 flags, NWCONN_HANDLE* rconn, +- char fileHandle[6], ncp_off64_t* fileSize); ++ unsigned char fileHandle[6], ncp_off64_t* fileSize); + + NWDSCCODE NWDSAddObject(NWDSContextHandle ctx, const NWDSChar* name, + nuint32* iterHandle, nbool8 more, Buf_T* buf); /* D */ +diff -r 3fc1f5c9c744 -r 06020cf028e1 lib/ds/dsgetstat.c +--- a/lib/ds/dsgetstat.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/lib/ds/dsgetstat.c Sat Jun 11 19:59:00 2005 +0000 +@@ -230,7 +230,7 @@ NWDSCCODE NWDSGetDSVerInfo( + switch (version) { + case 0x00000009: + { +- char asciiName[MAX_TREE_NAME_CHARS + 1]; ++ unsigned char asciiName[MAX_TREE_NAME_CHARS + 1]; + nuint32 asciiNameLen; + + dserr = NWDSBufGetLE32(&buf, &asciiNameLen); +diff -r 3fc1f5c9c744 -r 06020cf028e1 lib/ds/dsstream.c +--- a/lib/ds/dsstream.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/lib/ds/dsstream.c Sat Jun 11 19:59:00 2005 +0000 +@@ -69,7 +69,7 @@ NWDSCCODE __NWDSOpenStream( + const NWDSChar* attrName, + nflag32 flags, + NWCONN_HANDLE* rconn, +- char fh[6], ++ unsigned char fh[6], + ncp_off64_t* size) { + NWDSCCODE err; + char rq_b[DEFAULT_MESSAGE_LEN]; +diff -r 3fc1f5c9c744 -r 06020cf028e1 lib/ds/partops.c +--- a/lib/ds/partops.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/lib/ds/partops.c Sat Jun 11 19:59:00 2005 +0000 +@@ -339,12 +339,12 @@ NWDSCCODE NWDSGetPartitionExtInfoPtr( + } + fields = partitions->dsiFlags; + if (fields & DSP_OUTPUT_FIELDS) { +- *infoPtr = partitions->curPos; ++ *infoPtr = (char*)partitions->curPos; + dserr = NWDSBufGetLE32(partitions, &fields); + if (dserr) + return dserr; + } else { +- *infoPtr = partitions->curPos - 4; ++ *infoPtr = (char*)partitions->curPos - 4; + DSET_LH(partitions->curPos - 4, 0, fields); + } + if (fields & DSP_PARTITION_ID) +@@ -372,7 +372,7 @@ NWDSCCODE NWDSGetPartitionExtInfoPtr( + return NWE_PARAM_INVALID; + if (partitions->curPos > partitions->dataend) + return ERR_BUFFER_EMPTY; +- *infoPtrEnd = partitions->curPos; ++ *infoPtrEnd = (char*)partitions->curPos; + return 0; + } + +diff -r 3fc1f5c9c744 -r 06020cf028e1 lib/ds/search.c +--- a/lib/ds/search.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/lib/ds/search.c Sat Jun 11 19:59:00 2005 +0000 +@@ -166,7 +166,7 @@ struct search_referrals { + struct search_referrals { + struct search_referrals* next; + nuint32 referrals; +- char data[0]; ++ unsigned char data[0]; + }; + + struct SearchIH { +diff -r 3fc1f5c9c744 -r 06020cf028e1 lib/ds/setkeys.c +--- a/lib/ds/setkeys.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/lib/ds/setkeys.c Sat Jun 11 19:59:00 2005 +0000 +@@ -221,10 +221,10 @@ static NWDSCCODE __NWDSGenerateObjectKey + return 0; + } + +-static void __NWDSHashPasswordUpper(const nuint8* objectPassword, +- NWObjectID pseudoID, +- size_t pwdLen, +- nuint8 pwdHash[16] ++static void __NWDSHashPasswordUpper(const char* objectPassword, ++ NWObjectID pseudoID, ++ size_t pwdLen, ++ nuint8 pwdHash[16] + ) { + nuint8 newPwd[pwdLen + 1]; + size_t i; +@@ -238,10 +238,10 @@ static void __NWDSHashPasswordUpper(cons + shuffle(tmpID, newPwd, pwdLen, pwdHash); + } + +-static void __NWDSHashPassword(const nuint8* objectPassword, +- NWObjectID pseudoID, +- size_t pwdLen, +- nuint8 pwdHash[16] ++static void __NWDSHashPassword(const char* objectPassword, ++ NWObjectID pseudoID, ++ size_t pwdLen, ++ nuint8 pwdHash[16] + ) { + nuint8 tmpID[4]; + +diff -r 3fc1f5c9c744 -r 06020cf028e1 lib/filemgmt.c +--- a/lib/filemgmt.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/lib/filemgmt.c Sat Jun 11 19:59:00 2005 +0000 +@@ -410,7 +410,7 @@ ncp_open_file(struct ncp_conn *conn, + } + + long +-ncp_close_file(struct ncp_conn *conn, const char *file_id) ++ncp_close_file(struct ncp_conn *conn, const unsigned char *file_id) + { + long result; + +@@ -630,7 +630,7 @@ ncp_get_trustee(struct ncp_conn *conn, u + } + *contin = ncp_reply_word_hl(conn, 0); + *trustee = ncp_reply_byte(conn, 6); +- strncpy(path, ncp_reply_data(conn, 8), len); ++ memcpy(path, ncp_reply_data(conn, 8), len); + path[len] = 0; + ncp_unlock_conn(conn); + return 0; +@@ -799,7 +799,7 @@ ncp_add_handle_path2(struct ncp_conn *co + ncp_add_byte(conn, dir_style); /* 1 = dir_base, 0xFF = no handle, 0 = handle */ + if (encpath) { + if (pathlen == NCP_PATH_STD) { +- int p = ncp_path_to_NW_format2(encpath, dir_style, conn->current_point, conn->packet + sizeof(conn->packet) - conn->current_point); ++ int p = ncp_path_to_NW_format2((const char*)encpath, dir_style, conn->current_point, conn->packet + sizeof(conn->packet) - conn->current_point); + if (p < 0) { + return p; + } +@@ -823,7 +823,7 @@ ncp_extract_file_info(void *structure, s + memcpy(target, structure, info_struct_size); + name_len = (u_int8_t*)structure + info_struct_size; + target->nameLen = *name_len; +- strncpy(target->entryName, name_len + 1, *name_len); ++ memcpy(target->entryName, name_len + 1, *name_len); + target->entryName[*name_len] = '\0'; + } + return; +@@ -1215,9 +1215,9 @@ ncp_ren_or_mov_file_or_subdir(struct ncp + } + + static int +-ncp_do_read(struct ncp_conn *conn, const char *file_id, ++ncp_do_read(struct ncp_conn *conn, const unsigned char *file_id, + u_int32_t offset, u_int16_t to_read, +- char *target, int *bytes_read) ++ void *target, int *bytes_read) + { + long result; + unsigned int off; +@@ -1252,11 +1252,12 @@ ncp_do_read(struct ncp_conn *conn, const + } + + long +-ncp_read(struct ncp_conn *conn, const char *file_id, +- off_t offset, size_t count, char *target) ++ncp_read(struct ncp_conn *conn, const unsigned char *file_id, ++ off_t offset, size_t count, void *itarget) + { + int bufsize = conn->i.buffer_size; + size_t already_read = 0; ++ u_int8_t* target = itarget; + + if (!file_id || !target) { + return ERR_NULL_POINTER; +@@ -1290,7 +1291,7 @@ static NWCCODE + static NWCCODE + ncp_do_read_64(struct ncp_conn *conn, u_int32_t fh, + ncp_off64_t offset, size_t to_read, +- void *target, size_t *bytes_read) ++ char *target, size_t *bytes_read) + { + long result; + unsigned int off; +@@ -1367,7 +1368,7 @@ ncp_read_64(struct ncp_conn *conn, u_int + return 0; + } + +-NWCCODE ncp_read64(struct ncp_conn *conn, const char file_handle[6], ++NWCCODE ncp_read64(struct ncp_conn *conn, const unsigned char file_handle[6], + ncp_off64_t offset, size_t count, void *target, size_t *readbytes) { + NWCCODE result; + +@@ -1400,9 +1401,9 @@ NWCCODE ncp_read64(struct ncp_conn *conn + } + + static int +-ncp_do_write(struct ncp_conn *conn, const char *file_id, ++ncp_do_write(struct ncp_conn *conn, const unsigned char *file_id, + u_int32_t offset, u_int16_t to_write, +- const char *source, int *bytes_written) ++ const void *source, int *bytes_written) + { + long result; + +@@ -1425,11 +1426,12 @@ ncp_do_write(struct ncp_conn *conn, cons + } + + long +-ncp_write(struct ncp_conn *conn, const char *file_id, +- off_t offset, size_t count, const char *source) ++ncp_write(struct ncp_conn *conn, const unsigned char *file_id, ++ off_t offset, size_t count, const void *isource) + { + int bufsize = conn->i.buffer_size; + size_t already_written = 0; ++ const u_int8_t* source = isource; + + if (!file_id || !source) { + return ERR_NULL_POINTER; +@@ -1520,7 +1522,7 @@ static NWCCODE ncp_write_64(struct ncp_c + return 0; + } + +-NWCCODE ncp_write64(struct ncp_conn *conn, const char file_handle[6], ++NWCCODE ncp_write64(struct ncp_conn *conn, const unsigned char file_handle[6], + ncp_off64_t offset, size_t count, const void *target, size_t *bytes) { + NWCCODE result; + +@@ -1554,8 +1556,8 @@ NWCCODE ncp_write64(struct ncp_conn *con + + long + ncp_copy_file(struct ncp_conn *conn, +- const char source_file[6], +- const char target_file[6], ++ const unsigned char source_file[6], ++ const unsigned char target_file[6], + u_int32_t source_offset, + u_int32_t target_offset, + u_int32_t count, +@@ -2940,7 +2942,7 @@ ncp_ns_open_create_entry(struct ncp_conn + /* struct nw_info_struct2 */ void* target, size_t sizeoftarget, + u_int8_t* oc_action, + u_int8_t* oc_callback, +- char file_handle[6]) ++ unsigned char file_handle[6]) + { + NWCCODE result; + u_int32_t fhandle; +@@ -3484,10 +3486,10 @@ ncp_get_mount_volume_list_compat(struct + unsigned int *itemcnt, + void* b, size_t* blen) { + unsigned int vol; +- unsigned char* buffer = b; ++ char* buffer = b; + unsigned int items = 0; + size_t needSize; +- unsigned char* bend = buffer + *blen; ++ char* bend = buffer + *blen; + + if (flags & 1) { + needSize = 4 + 1 + 17; +@@ -3527,7 +3529,7 @@ ncp_get_mount_volume_list_compat(struct + return NWE_SERVER_FAILURE; + } + *itemcnt = items; +- *blen = buffer - (unsigned char*)b; ++ *blen = buffer - (char*)b; + return 0; + } + +@@ -3667,7 +3669,7 @@ ncp_volume_list_next(NWVOL_HANDLE h, + unsigned int itemcnt; + unsigned char buffer[1024]; + size_t blen = sizeof(buffer); +- char* b; ++ unsigned char* b; + + if (h->err) { + result = h->err; +@@ -3696,7 +3698,7 @@ ncp_volume_list_next(NWVOL_HANDLE h, + } + + /* let's build buffer */ +- b = (char*)malloc(blen); ++ b = malloc(blen); + if (!b) { + result = ENOMEM; + goto quit; +@@ -4018,7 +4020,7 @@ ncp_ns_search_end(NWDIRLIST_HANDLE h) { + + static NWCCODE ncp_get_file_size_32( + NWCONN_HANDLE conn, +- const char fileHandle[6], ++ const unsigned char fileHandle[6], + ncp_off64_t* fileSize) { + NWCCODE result; + +@@ -4069,7 +4071,7 @@ NWCCODE + NWCCODE + ncp_get_file_size( + NWCONN_HANDLE conn, +- const char fileHandle[6], ++ const unsigned char fileHandle[6], + ncp_off64_t* fileSize) { + NWCCODE result; + +diff -r 3fc1f5c9c744 -r 06020cf028e1 lib/fs/filelock.c +--- a/lib/fs/filelock.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/lib/fs/filelock.c Sat Jun 11 19:59:00 2005 +0000 +@@ -29,7 +29,7 @@ + #include + #include + +-static NWCCODE ncp_log_physical_record32(NWCONN_HANDLE conn, const char fh[6], ++static NWCCODE ncp_log_physical_record32(NWCONN_HANDLE conn, const unsigned char fh[6], + u_int32_t startOffset, u_int32_t length, unsigned int flags, + unsigned int timeout) { + NWCCODE err; +@@ -62,7 +62,7 @@ static NWCCODE ncp_log_physical_record64 + return err; + } + +-NWCCODE ncp_log_physical_record(NWCONN_HANDLE conn, const char file_handle[6], ++NWCCODE ncp_log_physical_record(NWCONN_HANDLE conn, const unsigned char file_handle[6], + ncp_off64_t startOffset, u_int64_t length, unsigned int flags, + unsigned int timeout) { + NWCCODE err; +@@ -93,7 +93,7 @@ NWCCODE ncp_log_physical_record(NWCONN_H + } + + +-static NWCCODE ncp_clear_release_physical_record32(NWCONN_HANDLE conn, const char fh[6], ++static NWCCODE ncp_clear_release_physical_record32(NWCONN_HANDLE conn, const unsigned char fh[6], + u_int32_t startOffset, u_int32_t length, int release) { + NWCCODE err; + +@@ -128,7 +128,7 @@ static NWCCODE ncp_clear_release_physica + return err; + } + +-static NWCCODE ncp_clear_release_physical_record(NWCONN_HANDLE conn, const char file_handle[6], ++static NWCCODE ncp_clear_release_physical_record(NWCONN_HANDLE conn, const unsigned char file_handle[6], + ncp_off64_t startOffset, u_int64_t length, int release) { + NWCCODE err; + +@@ -154,12 +154,12 @@ static NWCCODE ncp_clear_release_physica + return err; + } + +-NWCCODE ncp_clear_physical_record(NWCONN_HANDLE conn, const char file_handle[6], ++NWCCODE ncp_clear_physical_record(NWCONN_HANDLE conn, const unsigned char file_handle[6], + ncp_off64_t startOffset, u_int64_t length) { + return ncp_clear_release_physical_record(conn, file_handle, startOffset, length, 0); + } + +-NWCCODE ncp_release_physical_record(NWCONN_HANDLE conn, const char file_handle[6], ++NWCCODE ncp_release_physical_record(NWCONN_HANDLE conn, const unsigned char file_handle[6], + ncp_off64_t startOffset, u_int64_t length) { + return ncp_clear_release_physical_record(conn, file_handle, startOffset, length, 1); + } +diff -r 3fc1f5c9c744 -r 06020cf028e1 lib/ncplib.c +--- a/lib/ncplib.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/lib/ncplib.c Sat Jun 11 19:59:00 2005 +0000 +@@ -216,10 +216,10 @@ ncp_negotiate_size_and_options(struct nc + #endif + + static long +- ncp_login_object(struct ncp_conn *conn, +- const unsigned char *username, ++ncp_login_object(struct ncp_conn *conn, ++ const char *username, + int login_type, +- const unsigned char *password); ++ const char *password); + + static long + ncp_do_close(struct ncp_conn *conn); +@@ -666,7 +666,7 @@ static void run_wdog(struct ncp_conn *co + if (pfd[0].revents & POLLIN) { + struct sockaddr_ipx sender; + int sizeofaddr = sizeof(struct sockaddr_ipx); +- char buf[1024]; ++ unsigned char buf[1024]; + size_t pktsize; + NWCCODE err; + +@@ -1294,7 +1294,7 @@ ncp_connect_ipx_addr(struct ncp_conn *co + int ncp_sock, wdog_sock; + long err; + +- conn->ncp_reply_buffer = (char*)malloc(NCP_PACKET_SIZE); ++ conn->ncp_reply_buffer = malloc(NCP_PACKET_SIZE); + if (!conn->ncp_reply_buffer) { + return ENOMEM; + } +@@ -1397,7 +1397,7 @@ ncp_connect_in_addr(struct ncp_conn *con + int ncp_sock; + long err; + +- conn->ncp_reply_buffer = (char*)malloc(NCP_PACKET_SIZE); ++ conn->ncp_reply_buffer = malloc(NCP_PACKET_SIZE); + if (!conn->ncp_reply_buffer) { + return ENOMEM; + } +@@ -2444,6 +2444,30 @@ ncp_find_conn_spec(const char *server, c + uid, 0, err); + } + ++static int ++ncp_init_get_argument(int *argc, char **argv, int arg_no, const char **target) ++{ ++ int count = 1; ++ ++ if (target != NULL) { ++ if (arg_no + 1 >= *argc) { ++ /* No argument to switch */ ++ errno = EINVAL; ++ return -1; ++ } ++ *target = argv[arg_no + 1]; ++ count = 2; ++ } ++ /* Delete the consumed switch from the argument list ++ and decrement the argument count */ ++ while (count + arg_no < *argc) { ++ argv[arg_no] = argv[arg_no + count]; ++ arg_no += 1; ++ } ++ *argc -= count; ++ return 0; ++} ++ + struct ncp_conn * + ncp_initialize_2(int *argc, char **argv, int login_necessary, + int login_type, long *err, int required) +@@ -2457,28 +2481,6 @@ ncp_initialize_2(int *argc, char **argv, + int i = 1; + NWCCODE nwerr; + +- static int get_argument(int arg_no, const char **target) { +- int count = 1; +- +- if (target != NULL) { +- if (arg_no + 1 >= *argc) { +- /* No argument to switch */ +- errno = EINVAL; +- return -1; +- } +- *target = argv[arg_no + 1]; +- count = 2; +- } +- /* Delete the consumed switch from the argument list +- and decrement the argument count */ +- while (count + arg_no < *argc) { +- argv[arg_no] = argv[arg_no + count]; +- arg_no += 1; +- } +- *argc -= count; +- return 0; +- } +- + *err = EINVAL; + + while (i < *argc) { +@@ -2489,17 +2491,17 @@ ncp_initialize_2(int *argc, char **argv, + } + switch (argv[i][1]) { + case 'S': +- if (get_argument(i, &server) != 0) { ++ if (ncp_init_get_argument(argc, argv, i, &server) != 0) { + return NULL; + } + continue; + case 'U': +- if (get_argument(i, &user) != 0) { ++ if (ncp_init_get_argument(argc, argv, i, &user) != 0) { + return NULL; + } + continue; + case 'P': +- if (get_argument(i, &password) != 0) { ++ if (ncp_init_get_argument(argc, argv, i, &password) != 0) { + return NULL; + } + if (password) { +@@ -2509,14 +2511,14 @@ ncp_initialize_2(int *argc, char **argv, + } + continue; + case 'n': +- if (get_argument(i, NULL) != 0) { ++ if (ncp_init_get_argument(argc, argv, i, NULL) != 0) { + return NULL; + } + password = NWC_NOPASSWORD; + continue; + #ifdef NDS_SUPPORT + case 'b': +- if (get_argument(i, NULL) != 0) { ++ if (ncp_init_get_argument(argc, argv, i, NULL) != 0) { + return NULL; + } + bindery_only = 1; +@@ -2524,7 +2526,7 @@ ncp_initialize_2(int *argc, char **argv, + #endif + #ifdef CONFIG_NATIVE_IP + case 'A': +- if (get_argument(i, &address) != 0) { ++ if (ncp_init_get_argument(argc, argv, i, &address) != 0) { + return NULL; + } + continue; +@@ -3036,7 +3038,7 @@ ncp_send_broadcast2(struct ncp_conn *con + */ + long + ncp_get_encryption_key(struct ncp_conn *conn, +- char *target) ++ unsigned char *target) + { + NW_FRAGMENT rp; + NWCCODE err; +@@ -3529,7 +3531,7 @@ ncp_keyed_verify_password(struct ncp_con + ncp_keyed_verify_password(struct ncp_conn *conn, + const struct ncp_bindery_object *object, + const unsigned char *key, +- const unsigned char *passwd) ++ const char *passwd) + { + dword tmpID = htonl(object->object_id); + unsigned char buf[128]; +@@ -3599,7 +3601,7 @@ ncp_login_encrypted(struct ncp_conn *con + ncp_login_encrypted(struct ncp_conn *conn, + const struct ncp_bindery_object *object, + const unsigned char *key, +- const unsigned char *passwd) ++ const char *passwd) + { + dword tmpID; + unsigned char buf[128]; +@@ -3642,7 +3644,7 @@ long + long + ncp_login_unencrypted(struct ncp_conn *conn, + NWObjectType object_type, const char *object_name, +- const unsigned char *passwd) ++ const char *passwd) + { + long result; + +@@ -3669,8 +3671,8 @@ ncp_change_login_passwd(struct ncp_conn + ncp_change_login_passwd(struct ncp_conn *conn, + const struct ncp_bindery_object *object, + const unsigned char *key, +- const unsigned char *oldpasswd, +- const unsigned char *newpasswd) ++ const char *oldpasswd, ++ const char *newpasswd) + { + long id; + unsigned char cryptkey[8]; +@@ -3687,8 +3689,8 @@ ncp_change_login_passwd(struct ncp_conn + shuffle((byte *) & id, oldpasswd, strlen(oldpasswd), oldpwd); + shuffle((byte *) & id, newpasswd, strlen(newpasswd), newpwd); + nw_encrypt(cryptkey, oldpwd, cryptkey); +- newpassencrypt(oldpwd, newpwd, newpwd); +- newpassencrypt(oldpwd + 8, newpwd + 8, newpwd + 8); ++ newpassencrypt(oldpwd, newpwd); ++ newpassencrypt(oldpwd + 8, newpwd + 8); + if ((len = strlen(newpasswd)) > 63) { + len = 63; + } +@@ -3707,17 +3709,17 @@ ncp_change_login_passwd(struct ncp_conn + + long + ncp_login_user(struct ncp_conn *conn, +- const unsigned char *username, +- const unsigned char *password) ++ const char *username, ++ const char *password) + { + return ncp_login_object(conn, username, NCP_BINDERY_USER, password); + } + + static long + ncp_login_object(struct ncp_conn *conn, +- const unsigned char *username, ++ const char *username, + int login_type, +- const unsigned char *password) ++ const char *password) + { + long result; + unsigned char ncp_key[8]; +@@ -3790,10 +3792,10 @@ ncp_sign_stop(UNUSED(NWCONN_HANDLE conn) + } + + long +-ncp_sign_start(struct ncp_conn *conn, const char *sign_root) ++ncp_sign_start(struct ncp_conn *conn, const unsigned char *sign_root) + { + #ifdef SIGNATURES +- static const char init_last[16]= ++ static const unsigned char init_last[16]= + {0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef, + 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10}; + if (ncp_get_sign_wanted(conn)) { +@@ -3829,8 +3831,8 @@ long + long + ncp_send_nds_frag(struct ncp_conn *conn, + int ndsverb, +- const char *inbuf, size_t inbuflen, +- char *outbuf, size_t outbufsize, size_t *outbuflen) ++ const void *iinbuf, size_t inbuflen, ++ void *ioutbuf, size_t outbufsize, size_t *outbuflen) + { + long result; + size_t sizeleft, i; +@@ -3841,6 +3843,8 @@ ncp_send_nds_frag(struct ncp_conn *conn, + int32_t ndsCode = -399; + size_t replyLen = 0; + size_t fragLen; ++ const nuint8* inbuf = iinbuf; ++ nuint8* outbuf = ioutbuf; + + if (inbuflen && !inbuf) { + return ERR_NULL_POINTER; +diff -r 3fc1f5c9c744 -r 06020cf028e1 lib/ncplib_i.h +--- a/lib/ncplib_i.h Sun Jun 05 21:25:42 2005 +0000 ++++ b/lib/ncplib_i.h Sat Jun 11 19:59:00 2005 +0000 +@@ -110,7 +110,7 @@ struct ncp_conn { + int conn_status; + + /* Fields used to setup ncp requests */ +- char *current_point; ++ unsigned char *current_point; + int has_subfunction; + int verbose; + size_t ncp_reply_size; +@@ -120,9 +120,9 @@ struct ncp_conn { + + int lock; + +- char packet[NCP_PACKET_SIZE]; +- char *ncp_reply; +- char *ncp_reply_buffer; ++ unsigned char packet[NCP_PACKET_SIZE]; ++ unsigned char *ncp_reply; ++ unsigned char *ncp_reply_buffer; + size_t ncp_reply_alloc; + + /* Field used to make packet signatures */ +@@ -244,7 +244,7 @@ static inline int ncp_add_seek(struct nc + + void ncp_add_pstring(struct ncp_conn *conn, const char *s); + +-static inline char* ncp_reply_data(struct ncp_conn *conn, int offset) { ++static inline unsigned char* ncp_reply_data(struct ncp_conn *conn, int offset) { + return conn->ncp_reply + sizeof(struct ncp_reply_header) + offset; + } + +@@ -284,21 +284,21 @@ static inline unsigned int min(unsigned + return (a < b) ? a : b; + } + +-static inline void ConvertToNWfromDWORD(u_int32_t sfd, char nwhandle[6]) { ++static inline void ConvertToNWfromDWORD(u_int32_t sfd, unsigned char nwhandle[6]) { + DSET_LH(nwhandle, 2, sfd); + WSET_LH(nwhandle, 0, sfd+1); + } + +-static inline u_int32_t ConvertToDWORDfromNW(const char nwhandle[6]) { ++static inline u_int32_t ConvertToDWORDfromNW(const unsigned char nwhandle[6]) { + return DVAL_LH(nwhandle, 2); + } + + void ncp_init_request(struct ncp_conn *conn); + void ncp_init_request_s(struct ncp_conn *conn, int subfunction); + +-long ncp_sign_start(struct ncp_conn *conn, const char *sign_root); +- +-void shuffle(const unsigned char *objid, const unsigned char *pwd, int buflen, unsigned char *out); ++long ncp_sign_start(struct ncp_conn *conn, const unsigned char *sign_root); ++ ++void shuffle(const unsigned char *objid, const void *pwd, size_t buflen, unsigned char *out); + + NWCCODE ncp_set_private_key(struct ncp_conn *conn, const void* pk, size_t pk_len); + NWCCODE ncp_get_private_key(struct ncp_conn *conn, void* pk, size_t* pk_len); +diff -r 3fc1f5c9c744 -r 06020cf028e1 lib/ncpsign.c +--- a/lib/ncpsign.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/lib/ncpsign.c Sat Jun 11 19:59:00 2005 +0000 +@@ -44,12 +44,12 @@ + + #define min(a,b) ((a)<(b)?(a):(b)) + +-static void nwsign(const char r_data1[16], char r_data2[64], char outdata[16]) { ++static void nwsign(const unsigned char r_data1[16], unsigned char r_data2[64], unsigned char outdata[16]) { + int i; + unsigned int w0,w1,w2,w3; + static int rbit[4]={0, 2, 1, 3}; + #ifdef __i386__ +- unsigned int *data2=(int *)r_data2; ++ unsigned int *data2=(unsigned int *)r_data2; + #else + unsigned int data2[16]; + for (i=0;i<16;i++) +@@ -92,7 +92,7 @@ void sign_init(const unsigned char *logi + static const unsigned char initlast[16] = + { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, + 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}; +- static const unsigned char *initdata = "Authorized NetWare Client"; ++ static const unsigned char initdata[] = "Authorized NetWare Client"; + unsigned char msg[64]; + unsigned char hash[16]; + +diff -r 3fc1f5c9c744 -r 06020cf028e1 lib/ndscrypt.c +--- a/lib/ndscrypt.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/lib/ndscrypt.c Sat Jun 11 19:59:00 2005 +0000 +@@ -111,7 +111,7 @@ static unsigned char nwhashdata[256] = + 0x4C,0xFF,0x43,0xAB}; + + +-void nwencrypt(const unsigned short *cryptbuf, const char *in, char *out) { ++void nwencrypt(const unsigned short *cryptbuf, const unsigned char *in, unsigned char *out) { + int i, j; + register unsigned int i1, i2, i3, i4; + const unsigned short *p; +@@ -141,7 +141,7 @@ void nwencrypt(const unsigned short *cry + WSET_LH(out, 6, i4); + } + +-void nwdecrypt(const unsigned short *cryptbuf, const char *in, char *out) { ++void nwdecrypt(const unsigned short *cryptbuf, const unsigned char *in, unsigned char *out) { + int i, j; + const unsigned short *p; + register unsigned int i1, i2, i3, i4; +@@ -171,26 +171,25 @@ void nwdecrypt(const unsigned short *cry + WSET_LH(out, 6, i4); + } + +-void nwcryptinit(unsigned short *scryptbuf, const char *key) { ++void nwcryptinit(unsigned short *scryptbuf, const unsigned char *key) { + int i; + unsigned char cryptbuf[128], *p; + + memcpy(cryptbuf, key, 8); + for (i = 0; i < 120; i++) + cryptbuf[i + 8] = +- nwcryptdata[(unsigned char)(cryptbuf[i] + cryptbuf[i + 7]) & 255]; +- cryptbuf[128 - 8] = nwcryptdata[(unsigned char)cryptbuf[128 - 8] & 255]; ++ nwcryptdata[(cryptbuf[i] + cryptbuf[i + 7]) & 255]; ++ cryptbuf[128 - 8] = nwcryptdata[cryptbuf[128 - 8]]; + for (i = 127 - 8; i >= 0; i--) +- cryptbuf[i] = nwcryptdata[(unsigned char)cryptbuf[i + 1] ^ +- (unsigned char)cryptbuf[i + 8]]; ++ cryptbuf[i] = nwcryptdata[cryptbuf[i + 1] ^ cryptbuf[i + 8]]; + for (i = 0, p = cryptbuf; i < 64; i++, p += 2) + scryptbuf[i] = (*p) | (*(p+1)) << 8; + } + +-void nwencryptblock(const char *cryptkey, const char *buf, int buflen, +- char *outbuf) { ++void nwencryptblock(const unsigned char *cryptkey, const unsigned char *buf, int buflen, ++ unsigned char *outbuf) { + int i; +- char nhash[8]; ++ unsigned char nhash[8]; + unsigned short cryptbuf[64]; + + nwcryptinit(cryptbuf, cryptkey); +@@ -206,10 +205,10 @@ void nwencryptblock(const char *cryptkey + memset(cryptbuf, 0, sizeof(cryptbuf)); + } + +-void nwdecryptblock(const char *cryptkey, const char *buf, int buflen, +- char *outbuf) { ++void nwdecryptblock(const unsigned char *cryptkey, const unsigned char *buf, int buflen, ++ unsigned char *outbuf) { + int i; +- char nhash[16], *p; ++ unsigned char nhash[16], *p; + unsigned short cryptbuf[64]; + + nwcryptinit(cryptbuf, cryptkey); +@@ -227,30 +226,30 @@ void nwdecryptblock(const char *cryptkey + memset(cryptbuf, 0, sizeof(cryptbuf)); + } + +-void nwhash1(char *hash, int hashlen, const char *data, int datalen) { ++void nwhash1(unsigned char *hash, int hashlen, const unsigned char *data, int datalen) { + unsigned char *hp, *hp1, *hend, c; + const unsigned char *dp; + +- hp1 = (hp = (unsigned char *)hash) + 1; ++ hp1 = (hp = hash) + 1; + hend = hp + hashlen; +- dp = (const unsigned char *)data; ++ dp = data; + while (datalen--) { + *hp = nwhashdata[*hp1 ^ *hp] ^ *dp++; + hp = hp1++; + if (hp1 == hend) +- hp1 = (unsigned char *)hash; +- } +- while (hp-- > (unsigned char *)hash) { +- hp1 = (unsigned char *)hash; ++ hp1 = hash; ++ } ++ while (hp-- > hash) { ++ hp1 = hash; + c = *hp1++; +- while (*(hp1 - 1) = *hp1, ++hp1 < (unsigned char *)hash + hashlen); ++ while (*(hp1 - 1) = *hp1, ++hp1 < hash + hashlen); + *(hp1 - 1) = c; + } + } + +-void nwhash2(char *hashbuf, char c) { +- int i, j; +- char *p = hashbuf + hashbuf[0x40]; ++void nwhash2(unsigned char *hashbuf, unsigned char c) { ++ int i, j; ++ unsigned char *p = hashbuf + hashbuf[0x40]; + + p[0x20] = p[0x00] ^ (p[0x10] = c); + hashbuf[0x41] = (p[0x30] ^= nwhashdata[(unsigned char)(c ^ hashbuf[0x41])]); +@@ -262,12 +261,12 @@ void nwhash2(char *hashbuf, char c) { + } + } + +-void nwhash2block(char *hashbuf, const char *data, int datalen) { ++void nwhash2block(unsigned char *hashbuf, const unsigned char *data, size_t datalen) { + while (datalen--) + nwhash2(hashbuf, *data++); + } + +-void nwhash2end(char *hashbuf) { ++void nwhash2end(unsigned char *hashbuf) { + int i, j; + + for(j = i = 16 - hashbuf[0x40]; j; j--) +diff -r 3fc1f5c9c744 -r 06020cf028e1 lib/ndscrypt.h +--- a/lib/ndscrypt.h Sun Jun 05 21:25:42 2005 +0000 ++++ b/lib/ndscrypt.h Sat Jun 11 19:59:00 2005 +0000 +@@ -22,20 +22,20 @@ + + #include + +-void nwencrypt(const unsigned short *cryptbuf, const char *in, char *out); +-void nwdecrypt(const unsigned short *cryptbuf, const char *in, char *out); +-void nwcryptinit(unsigned short *scryptbuf, const char *key); +-void nwencryptblock(const char *cryptkey, const char *buf, int buflen, +- char *outbuf); +-void nwdecryptblock(const char *cryptkey, const char *buf, int buflen, +- char *outbuf); ++void nwencrypt(const unsigned short *cryptbuf, const unsigned char *in, unsigned char *out); ++void nwdecrypt(const unsigned short *cryptbuf, const unsigned char *in, unsigned char *out); ++void nwcryptinit(unsigned short *scryptbuf, const unsigned char *key); ++void nwencryptblock(const unsigned char *cryptkey, const unsigned char *buf, int buflen, ++ unsigned char *outbuf); ++void nwdecryptblock(const unsigned char *cryptkey, const unsigned char *buf, int buflen, ++ unsigned char *outbuf); + + #define nwhash1init(hash, hashlen) memset(hash, 0, hashlen) +-void nwhash1(char *hash, int hashlen, const char *data, int datalen); ++void nwhash1(unsigned char *hash, int hashlen, const unsigned char *data, int datalen); + + #define nwhash2init(hashbuf) memset(hashbuf, 0, 0x42) +-void nwhash2(char *hashbuf, char c); +-void nwhash2block(char *hashbuf, const char *data, int datalen); +-void nwhash2end(char *hashbuf); ++void nwhash2(unsigned char *hashbuf, unsigned char c); ++void nwhash2block(unsigned char *hashbuf, const unsigned char *data, size_t datalen); ++void nwhash2end(unsigned char *hashbuf); + + #endif /* _NDSCRYPT_H */ +diff -r 3fc1f5c9c744 -r 06020cf028e1 lib/ndslib.c +--- a/lib/ndslib.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/lib/ndslib.c Sat Jun 11 19:59:00 2005 +0000 +@@ -188,10 +188,10 @@ static char *g_rndp = global_randbuf + R + + static ncpt_mutex_t randbuflock = NCPT_MUTEX_INITIALIZER; + +-static void fillrandom(char *buf, int buflen) { ++static void fillrandom(nuint8 *buf, size_t buflen) { + ncpt_mutex_lock(&randbuflock); + do { +- int i; ++ size_t i; + + if (g_rndp == global_randbuf + RANDBUFSIZE) { + int fh; +@@ -206,7 +206,10 @@ static void fillrandom(char *buf, int bu + } + g_rndp = global_randbuf; + } +- if ((i = RANDBUFSIZE - (g_rndp - global_randbuf)) > buflen) i = buflen; ++ i = RANDBUFSIZE - (g_rndp - global_randbuf); ++ if (i > buflen) { ++ i = buflen; ++ } + memcpy(buf, g_rndp, i); + buf += i; + g_rndp += i; +@@ -215,7 +218,7 @@ static void fillrandom(char *buf, int bu + ncpt_mutex_unlock(&randbuflock); + } + #else +-static void fillrandom(char *buf, int buflen) { ++static void fillrandom(nuint8 *buf, size_t buflen) { + int fh; + char *p; + +@@ -230,11 +233,11 @@ static void fillrandom(char *buf, int bu + } + #endif + +-static int countbits_l(char *buf, int bufsize) { ++static int countbits_l(unsigned char *buf, int bufsize) { + unsigned char b; + + while ((--bufsize) && (!buf[bufsize])); +- b = (unsigned char)buf[bufsize]; ++ b = buf[bufsize]; + bufsize <<= 3; + while (b) { + b >>= 2; bufsize++; +@@ -250,33 +253,33 @@ static void copyfill(void *outbuf, int o + + static char keyprefix[] = {1, 0, 0, 0, 3, 0, 1, 0}; + +-static int initkey(const char *key, char **keyptr, size_t *keylen) { /* 1=ok, 0=err */ ++static int initkey(const unsigned char *key, unsigned char **keyptr, size_t *keylen) { /* 1=ok, 0=err */ + if (!memcmp(key, keyprefix, 8)) { + if (keylen) *keylen = WVAL_LH(key, 8); +- if (keyptr) *keyptr = (char*)key + 10; ++ if (keyptr) *keyptr = key + 10; + return 1; + } else + return 0; + } + +-static void clearkey(char *key) { +- char *keyptr; ++static void clearkey(unsigned char *key) { ++ unsigned char *keyptr; + size_t keylen; ++ + if (initkey(key, &keyptr, &keylen)) + memset(key, 0, keylen + 10); + } + +-static int findchunk(const char *keyptr, int keylen, const char *chunk, +- char **chunkptr) { +- const char *p; ++static int findchunk(const unsigned char *keyptr, size_t keylen, const char *chunk, unsigned char **chunkptr) { ++ const unsigned char *p; + + if ((p = keyptr)) { +- while (p - keyptr < keylen) { +- if ((p[0] != chunk[0]) || (p[1] != chunk[1])) +- p += 4 + (unsigned char)p[2] + (unsigned char)p[3]; +- else { +- if (chunkptr) *chunkptr = (char*)p + 4; +- return (unsigned char)p[2] + (unsigned char)p[3]; ++ while (p < keyptr + keylen) { ++ if ((p[0] != chunk[0]) || (p[1] != chunk[1])) { ++ p += 4 + p[2] + p[3]; ++ } else { ++ if (chunkptr) *chunkptr = (unsigned char*)p + 4; ++ return p[2] + p[3]; + } + } + } +@@ -327,9 +330,9 @@ static void dumpkey(const nuint8 *key, s + } + #endif + +-static int checkkey(const char *key) { /* 0 - wrong key, != 0 - key ok */ +- char temp[8]; +- char *keyptr, *p; ++static int checkkey(const unsigned char *key) { /* 0 - wrong key, != 0 - key ok */ ++ unsigned char temp[8]; ++ unsigned char *keyptr, *p; + size_t keylen; + + if ((initkey(key, &keyptr, &keylen)) && +@@ -346,13 +349,13 @@ static int checkkey(const char *key) { / + + static ncpt_mutex_t mpilock = NCPT_MUTEX_INITIALIZER; + +-static long modexpkey(const char *s_key, char *buf, char *outbuf, int bufsize) { +- char *s_keyptr; ++static long modexpkey(const unsigned char *s_key, unsigned char *buf, unsigned char *outbuf, int bufsize) { ++ unsigned char *s_keyptr; + size_t s_keylen; + int i, nbits, nblocksize; + int err = -1; + unitptr nmod, nexp, nin, nout; +- char *p; ++ unsigned char *p; + + nmod = nexp = nin = nout = NULL; + +@@ -399,7 +402,7 @@ end1: + + /* ctx must be in WCHAR_T mode, without DCV_CANONICALIZE_NAMES */ + static NWDSCCODE get_public_key(NWDSContextHandle ctx, const wchar_t* objname, nuint8 **key) { +- char *keybuf, *kptr; ++ unsigned char *keybuf, *kptr; + NWDSCCODE err; + size_t keylen, ofs, klen; + Octet_String_T* ost; +@@ -434,7 +437,7 @@ static NWDSCCODE __AlignAndEncryptBlockW + const nuint8* hash, + const nuint8* idata, + size_t ilen, +- char* odata, ++ nuint8* odata, + size_t* olen + ) { + size_t filler; +@@ -472,7 +475,7 @@ NWDSCCODE __NWEncryptWithSK( + for (i = 0; i < 10; i++) { + nwhash1(hash, 8, hashsrc, hashsrclen); + } +- err = __AlignAndEncryptBlockWithSK(hash, idata, ilen, (char*)odata + 12, &len); ++ err = __AlignAndEncryptBlockWithSK(hash, idata, ilen, (nuint8*)odata + 12, &len); + if (err) + return err; + *olen = len + 12; +@@ -492,12 +495,12 @@ NWDSCCODE rsa_crypt2( + Buf_T* output) { + char hashrand[8], temp[8]; + unsigned short cryptbuf[128]; +- char buf2[56]; ++ nuint8 buf2[56]; + NWDSCCODE err; + void* data; + size_t datalen; + nuint8* outp; +- char b2[28]; ++ nuint8 b2[28]; + nuint8* ln1; + nuint8* sp1; + size_t outlen; +@@ -904,7 +907,7 @@ NWDSCCODE __NWDSGetPrivateKey( + p += 8; + + { +- char* tb; ++ unsigned char* tb; + if (!(tb = malloc(n3 + 10))) { + err = ENOMEM; + goto err_exit; +@@ -951,9 +954,9 @@ static NWDSCCODE nds_beginauth2( + NWCONN_HANDLE conn, + NWObjectID user_id, + nuint8 authid[4], +- const char* s_key) { +- char *p, *pend, *n_temp, temp[8], *k1end; +- char randno[4]; ++ const nuint8* s_key) { ++ nuint8 *p, *pend, *n_temp, temp[8], *k1end; ++ nuint8 randno[4]; + NWDSCCODE err; + int n1, n3; + u_int16_t n3a; +@@ -1068,9 +1071,9 @@ err_exit: + return err; + } + +-static char *allocfillchunk(const char *keyptr, int keylen, ++static unsigned char *allocfillchunk(const unsigned char *keyptr, int keylen, + const char *chunk, int destsize) { +- char *p, *p2; ++ unsigned char *p, *p2; + int i; + + i = findchunk(keyptr, keylen, chunk, &p); +@@ -1100,12 +1103,12 @@ static NWDSCCODE nds_beginauth( + + static NWDSCCODE gen_auth_data( + Buf_T* outbuf, +- const char *u_key, +- const char *u_priv_key, ++ const unsigned char *u_key, ++ const unsigned char *u_priv_key, + const nuint8* authid, +- char *loginstrc, ++ nuint8 *loginstrc, + int loginstrc_len) { +- char *keyptr; ++ nuint8 *keyptr; + size_t keylen; + int i, j; + int nbits, nblocksize, nbytes, nblocksize_nw; +@@ -1114,9 +1117,9 @@ static NWDSCCODE gen_auth_data( + unitptr n_key_dp, n_key_dq; + unitptr up, up2; + unitptr randbuf; +- char *p; +- char *tempbuf; +- char hashbuf[0x42]; ++ nuint8 *p; ++ nuint8 *tempbuf; ++ nuint8 hashbuf[0x42]; + NWDSCCODE err; + + n_temp = n_mod = n_exp = n_pn = n_qn = n_dp = n_dq = n_cr = n_key = NULL; +@@ -1198,8 +1201,8 @@ static NWDSCCODE gen_auth_data( + + up = randbuf; up2 = (unitptr)(p + 12); + for (i = 3; i; i--) { +- fillrandom((char *)up, nbytes); +- ((char *)up)[nbytes - 1] &= nmask; ++ fillrandom((nuint8 *)up, nbytes); ++ ((nuint8 *)up)[nbytes - 1] &= nmask; + if (!(j = mp_compare(up, n_mod))) { + mp_dec(up); + } else if (j > 0) { +@@ -1251,7 +1254,7 @@ NWDSCCODE NWDSAuthenticateConn( + nuint8 authid[4]; + NWDSCCODE err; + size_t user_name_len; +- char *loginstrc; ++ nuint8 *loginstrc; + size_t loginstrc_len; + nuint8 *u_key; + Buf_T signbuf; +@@ -1260,7 +1263,7 @@ NWDSCCODE NWDSAuthenticateConn( + char keybuf_b[DEFAULT_MESSAGE_LEN]; + wchar_t server_name[MAX_DN_CHARS+1]; + NWObjectID user_id; +- char signkey[8]; ++ unsigned char signkey[8]; + wchar_t* w_user_name; + nuint8* u_priv_key; + nuint8* logindata; +@@ -1363,7 +1366,7 @@ long nds_login_auth(struct ncp_conn *con + const char *pwd) { + long err; + wchar_t user_w[MAX_DN_CHARS+1]; +- char *u_priv_key = NULL; ++ nuint8 *u_priv_key = NULL; + wchar_t server_name[MAX_DN_CHARS+1]; + NWCONN_HANDLE userconn = NULL; + int i; +diff -r 3fc1f5c9c744 -r 06020cf028e1 lib/nwcrypt.c +--- a/lib/nwcrypt.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/lib/nwcrypt.c Sat Jun 11 19:59:00 2005 +0000 +@@ -144,51 +144,46 @@ shuffle1(buf32 temp, unsigned char *targ + + + void +-shuffle(const unsigned char *lon, const unsigned char *buf, int buflen, ++shuffle(const unsigned char *lon, const void *ibuf, size_t buflen, + unsigned char *target) + { +- int b2, d, s; ++ size_t b2, d; ++ unsigned int s; + buf32 temp; ++ const unsigned char* buf = ibuf; + + while ((buflen > 0) +- && (buf[buflen - 1] == 0)) +- { ++ && (buf[buflen - 1] == 0)) { + buflen = buflen - 1; + } + +- for (s = 0; s < 32; s++) +- { ++ for (s = 0; s < 32; s++) { + temp[s] = 0; + } + + d = 0; +- while (buflen >= 32) +- { +- for (s = 0; s <= 31; ++s) +- { +- temp[s] = temp[s] ^ buf[d]; ++ while (buflen >= 32) { ++ for (s = 0; s < 32; ++s) { ++ temp[s] ^= buf[d]; + d = d + 1; + } + buflen = buflen - 32; + } + b2 = d; +- if (buflen > 0) +- { +- for (s = 0; s <= 31; ++s) +- { +- if (d + buflen == b2) +- { ++ if (buflen > 0) { ++ for (s = 0; s < 32; ++s) { ++ if (d + buflen == b2) { + b2 = d; +- temp[s] = temp[s] ^ encryptkeys[s]; +- } else +- { +- temp[s] = temp[s] ^ buf[b2]; ++ temp[s] ^= encryptkeys[s]; ++ } else { ++ temp[s] ^= buf[b2]; + b2 = b2 + 1; + } + } + } +- for (s = 0; s <= 31; ++s) +- temp[s] = temp[s] ^ lon[s & 3]; ++ for (s = 0; s < 32; ++s) { ++ temp[s] ^= lon[s & 3]; ++ } + + shuffle1(temp, target); + } +@@ -200,16 +195,18 @@ nw_encrypt(const unsigned char *fra, + unsigned char *til) + { + buf32 k; +- int s; ++ unsigned int s; + + shuffle(&(fra[0]), buf, 16, &(k[0])); + shuffle(&(fra[4]), buf, 16, &(k[16])); + +- for (s = 0; s <= 15; ++s) +- k[s] = k[s] ^ k[31 - s]; +- +- for (s = 0; s <= 7; ++s) ++ for (s = 0; s < 16; ++s) { ++ k[s] ^= k[31 - s]; ++ } ++ ++ for (s = 0; s < 8; ++s) { + til[s] = k[s] ^ k[15 - s]; ++ } + } + + /*****************************************************************************/ +@@ -230,8 +227,8 @@ nw_encrypt(const unsigned char *fra, + old internal password) ^ (second byte of old internal password) + */ + +-static char +- newshuffle[256 + 16] = ++static unsigned char ++ newshuffle[256] = + { + 0x0f, 0x08, 0x05, 0x07, 0x0c, 0x02, 0x0e, 0x09, + 0x00, 0x01, 0x06, 0x0d, 0x03, 0x04, 0x0b, 0x0a, +@@ -272,7 +269,9 @@ static char + 0x0d, 0x0b, 0x0c, 0x02, 0x00, 0x0f, 0x06, 0x0a, + 0x09, 0x0a, 0x0b, 0x0d, 0x05, 0x03, 0x0f, 0x00, + 0x01, 0x0c, 0x08, 0x07, 0x06, 0x04, 0x0e, 0x02, +- ++}; ++ ++static const unsigned char final_shuffle[16] = { + 0x03, 0x0e, 0x0f, 0x02, 0x0d, 0x0c, 0x04, 0x05, + 0x09, 0x06, 0x00, 0x01, 0x0b, 0x07, 0x0a, 0x08, + }; +@@ -303,17 +302,17 @@ static char + */ + + static void +-newpassencrypt(char *old, char *new, char *out) +-{ +- char *p, *bx; +- char copy[8]; +- int i, di, ax; +- char cl, dl, ch; +- +- memcpy(copy, new, 8); +- +- for (i = 0; i < 16; i++) +- { ++newpassencrypt(unsigned char *old, unsigned char *npwd) ++{ ++ int i; ++ ++ for (i = 0; i < 16; i++) { ++ int di, ax; ++ unsigned char *p, *bx; ++ unsigned char cl, dl, ch; ++ unsigned char copy[8]; ++ ++ memcpy(copy, npwd, 8); + for (di = 0, ax = 0, p = old; di < 8; di++, ax += 0x20, p++) + { + cl = newshuffle[(((copy[di] ^ *p) >> 4) & 0x0f) + ax + 0x10] << 4; +@@ -328,17 +327,16 @@ newpassencrypt(char *old, char *new, cha + } + *old = ((ch >> 4) & 0x0f) | (*old) << 4; + +- memset(out, '\0', 8); ++ memset(npwd, 0, 8); + + for (di = 0; di < 16; di++) + { +- if (newshuffle[di + 0x100] & 1) +- ch = ((copy[newshuffle[di + 0x100] / 2] >> 4) & 0x0f); ++ if (final_shuffle[di] & 1) ++ ch = ((copy[final_shuffle[di] / 2] >> 4) & 0x0f); + else +- ch = copy[newshuffle[di + 0x100] / 2] & 0x0f; +- out[di / 2] |= ((di & 1) ? ch << 4 : ch); +- } +- memcpy(copy, out, 8); +- } +-} +- ++ ch = copy[final_shuffle[di] / 2] & 0x0f; ++ npwd[di / 2] |= ((di & 1) ? ch << 4 : ch); ++ } ++ } ++} ++ +diff -r 3fc1f5c9c744 -r 06020cf028e1 lib/nwnet.c +--- a/lib/nwnet.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/lib/nwnet.c Sat Jun 11 19:59:00 2005 +0000 +@@ -1205,7 +1205,7 @@ NWDSCCODE NWDSCreateContextHandle(NWDSCo + tmp->dck.rdn.depth = 0; + tmp->dck.namectx = NULL; + { +- static const nuint32 t[] = { ++ static const NET_ADDRESS_TYPE t[] = { + #ifdef NCP_IPX_SUPPORT + NT_IPX, + #endif +@@ -1582,7 +1582,7 @@ void NWDSSetupBuf(Buf_T* buf, void* ptr, + buf->cmdFlags = 0; + buf->dsiFlags = 0; + buf->data = buf->curPos = ptr; +- buf->dataend = buf->allocend = (char*)ptr + len; ++ buf->dataend = buf->allocend = (unsigned char*)ptr + len; + buf->operation = 0; + buf->attrCountPtr = NULL; + buf->valCountPtr = NULL; +@@ -1947,7 +1947,7 @@ static NWDSCCODE NWDSXlateCtxToUni(NWDSC + return err; + if (val & DCV_XLATE_STRINGS) { + NWDSCCODE err2; +- const nuint8* srcEnd; ++ const char* srcEnd; + + ncpt_mutex_lock(&ctx->xlate.fromlock); + __NWULocalInit(ctx->xlate.from); +@@ -1957,7 +1957,7 @@ static NWDSCCODE NWDSXlateCtxToUni(NWDSC + else + ln = strlen(src) + 1; + } +- srcEnd = (const nuint8*)src + ln; ++ srcEnd = (const char*)src + ln; + do { + wchar_t tbuff[128]; + wchar_t* tEnd; +@@ -3760,7 +3760,7 @@ NWDSCCODE NWDSGetObjectNameAndInfo( + return ERR_BAD_VERB; + } + if (info) +- *info = buffer->curPos; ++ *info = (char*)buffer->curPos; + dsiflags = buffer->dsiFlags; + if (dsiflags & DSI_OUTPUT_FIELDS) { + err = NWDSBufGetLE32(buffer, &dsiflags); +diff -r 3fc1f5c9c744 -r 06020cf028e1 lib/o_ndslib.c +--- a/lib/o_ndslib.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/lib/o_ndslib.c Sat Jun 11 19:59:00 2005 +0000 +@@ -150,13 +150,14 @@ long nds_resolve_name(struct ncp_conn *c + case DS_RESOLVE_REPLY_REMOTE_ENTRY: + { + NWObjectID ID; ++ nuint32 dummy; + + err = NWDSBufGetID(rp, &ID); + if (err) + goto q_buf; + if (entry_id) + *entry_id = ID; +- err = NWDSBufGetLE32(rp, &flags); ++ err = NWDSBufGetLE32(rp, &dummy); + if (err) + goto q_buf; + if (remote) +diff -r 3fc1f5c9c744 -r 06020cf028e1 sutil/ncpm_common.h +--- a/sutil/ncpm_common.h Sun Jun 05 21:25:42 2005 +0000 ++++ b/sutil/ncpm_common.h Sat Jun 11 19:59:00 2005 +0000 +@@ -34,9 +34,9 @@ struct ncp_mount_data_independent { + int message_fd; + uid_t mounted_uid; + struct sockaddr_ipx serv_addr; +- unsigned char *server_name; +- unsigned char *mount_point; +- const unsigned char *mounted_vol; ++ char *server_name; ++ char *mount_point; ++ const char *mounted_vol; + unsigned int time_out; + unsigned int retry_count; + struct { +diff -r 3fc1f5c9c744 -r 06020cf028e1 sutil/ncpmount.h +--- a/sutil/ncpmount.h Sun Jun 05 21:25:42 2005 +0000 ++++ b/sutil/ncpmount.h Sat Jun 11 19:59:00 2005 +0000 +@@ -30,10 +30,10 @@ struct ncp_mount_data_v2 { + __ker20_uid_t mounted_uid; /* Who may umount() this filesystem? */ + + struct sockaddr_ipx serv_addr; +- unsigned char server_name[NCP_BINDERY_NAME_LEN]; ++ char server_name[NCP_BINDERY_NAME_LEN]; + +- unsigned char mount_point[PATH_MAX_V20+1]; +- unsigned char mounted_vol[NCP_VOLNAME_LEN+1]; ++ char mount_point[PATH_MAX_V20+1]; ++ char mounted_vol[NCP_VOLNAME_LEN+1]; + + unsigned int time_out; /* How long should I wait after + sending a NCP request? */ +@@ -64,7 +64,7 @@ struct ncp_mount_data_v3 { + __ker21_uid_t mounted_uid; /* Who may umount() this filesystem? */ + __ker21_pid_t wdog_pid; /* Who cares for our watchdog packets? */ + +- unsigned char mounted_vol[NCP_VOLNAME_LEN + 1]; ++ char mounted_vol[NCP_VOLNAME_LEN + 1]; + unsigned int time_out; /* How long should I wait after + sending a NCP request? */ + unsigned int retry_count; /* And how often should I retry? */ +diff -r 3fc1f5c9c744 -r 06020cf028e1 util/ncopy.c +--- a/util/ncopy.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/util/ncopy.c Sat Jun 11 19:59:00 2005 +0000 +@@ -532,10 +532,13 @@ dstDetermined:; + ncopy = 1; + } + } else { +- err = NWCCGetConnInfo(scon, NWCC_INFO_SERVER_NAME, sizeof(saddr), saddr); +- if (!err) err = NWCCGetConnInfo(dcon, NWCC_INFO_SERVER_NAME, sizeof(daddr), daddr); ++ char saddrs[100]; ++ char daddrs[100]; ++ ++ err = NWCCGetConnInfo(scon, NWCC_INFO_SERVER_NAME, sizeof(saddrs), saddrs); ++ if (!err) err = NWCCGetConnInfo(dcon, NWCC_INFO_SERVER_NAME, sizeof(daddrs), daddrs); + if (!err) { +- ncopy = !strcmp(saddr, daddr); ++ ncopy = !strcmp(saddrs, daddrs); + } + } + if (ncopy) { +diff -r 3fc1f5c9c744 -r 06020cf028e1 util/nwbpvalues.c +--- a/util/nwbpvalues.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/util/nwbpvalues.c Sat Jun 11 19:59:00 2005 +0000 +@@ -44,7 +44,7 @@ static char *progname; + static char *progname; + + static void +- print_property(char *prop_name, u_int8_t * val, int segments); ++print_property(char *prop_name, const u_int8_t * val, int segments); + + static void + usage(void) +@@ -265,7 +265,7 @@ main(int argc, char *argv[]) + } + + static void +-print_unknown(u_int8_t * val) ++print_unknown(const u_int8_t * val) + { + int j = (128 / 16); + while (1) +@@ -292,9 +292,9 @@ print_unknown(u_int8_t * val) + } + + static void +-print_string(u_int8_t * val, int segments) +-{ +- puts(val); ++print_string(const u_int8_t * val, int segments) ++{ ++ puts((const char*)val); + (void)segments; + } + +@@ -351,12 +351,12 @@ static inline size_t my_strftime(char *s + + + static void +-print_login_control(u_int8_t * val, int segments) ++print_login_control(const u_int8_t * val, int segments) + { + static const time_t zero_time_t = 0; + int i, j, mask; + char buff[32]; +- struct ncp_prop_login_control *a = (struct ncp_prop_login_control *) val; ++ const struct ncp_prop_login_control *a = (const struct ncp_prop_login_control *) val; + + if (a->LastLogin[2] || a->LastLogin[1] || a->LastLogin[0] || + a->LastLogin[3] || a->LastLogin[4] || a->LastLogin[5]) +@@ -495,17 +495,17 @@ print_login_control(u_int8_t * val, int + } + + static void +-print_addr(u_int8_t * val, int segments) ++print_addr(const u_int8_t * val, int segments) + { + char buff[50]; + print_station_addr("(%L): %N[%S]", +- (struct ncp_station_addr *) val, buff); ++ (const struct ncp_station_addr *) val, buff); + printf("%s\n", buff); + (void)segments; + } + + static void +-print_hex(u_int8_t *val, int segments) { ++print_hex(const u_int8_t *val, int segments) { + int i; + + for (i = 0; i < segments; i++) { +@@ -517,7 +517,7 @@ print_hex(u_int8_t *val, int segments) { + + static const struct + { +- void (*func) (u_int8_t *, int); ++ void (*func)(const u_int8_t *, int); + const char *pname; + } + formats[] = +@@ -534,7 +534,7 @@ formats[] = + }; + + static void +-print_property(char *prop_name, u_int8_t * val, int segments) ++print_property(char *prop_name, const u_int8_t * val, int segments) + { + int i; + +diff -r 3fc1f5c9c744 -r 06020cf028e1 util/nwpasswd.c +--- a/util/nwpasswd.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/util/nwpasswd.c Sat Jun 11 19:59:00 2005 +0000 +@@ -65,7 +65,7 @@ main(int argc, char *argv[]) + int object_type = NCP_BINDERY_USER; + unsigned char ncp_key[8]; + struct ncp_bindery_object user; +- unsigned char buf_obj_name[50]; ++ char *buf_obj_name; + long err; + + char *str; +@@ -113,12 +113,14 @@ main(int argc, char *argv[]) + com_err(argv[0], err, _("trying to find server")); + exit(1); + } +- if (!object_name) +- { ++ if (!object_name) { + object_name = spec.user; +- } else +- { +- strcpy(buf_obj_name, object_name); ++ } else { ++ buf_obj_name = strdup(object_name); ++ if (!buf_obj_name) { ++ fprintf(stderr, _("%s: Out of memory!\n"), progname); ++ exit(1); ++ } + object_name = buf_obj_name; + str_upper(object_name); + } +diff -r 3fc1f5c9c744 -r 06020cf028e1 util/nwpjmv.c +--- a/util/nwpjmv.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/util/nwpjmv.c Sat Jun 11 19:59:00 2005 +0000 +@@ -124,6 +124,16 @@ init_queue(struct ncp_conn *conn, char * + } + + ++static char* ++add_string(char *target, char *target_end, const char *str) { ++ size_t len = strlen(str); ++ if (target + len + 1 > target_end) { ++ len = target_end - target - 1; ++ } ++ memcpy(target, str, len); ++ return target + len; ++} ++ + static void + build_command(struct nw_queue *q, struct queue_job *j, + char *target, int target_size, char *user) +@@ -131,26 +141,12 @@ build_command(struct nw_queue *q, struct + char *s = q->command; + char *target_end = target + target_size; + +- static void add_string(const char *str) +- { +- int len = strlen(str); +- if (target + len + 1 > target_end) +- { +- len = target_end - target - 1; +- } +- strncpy(target, str, len); +- target += len; +- } +- + memset(target, 0, target_size); + + while ((*s != 0) && (target < target_end)) + { +- if (*s != '%') +- { +- *target = *s; +- target += 1; +- s += 1; ++ if (*s != '%') { ++ *target++ = *s++; + continue; + } + switch (*(s + 1)) +@@ -160,13 +156,13 @@ build_command(struct nw_queue *q, struct + target += 1; + break; + case 'u': +- add_string(user); ++ target = add_string(target, target_end, user); + break; + case 'd': + if (j->j.JobTextDescription[0]) +- add_string(j->j.JobTextDescription); ++ target = add_string(target, target_end, j->j.JobTextDescription); + else +- add_string(_("No Description")); ++ target = add_string(target, target_end, _("No Description")); + break; + default: + *target = '%'; +diff -r 3fc1f5c9c744 -r 06020cf028e1 util/nwsalvage.c +--- a/util/nwsalvage.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/util/nwsalvage.c Sat Jun 11 19:59:00 2005 +0000 +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + #include "private/libintl.h" + #define _(X) gettext(X) +diff -r 3fc1f5c9c744 -r 06020cf028e1 util/pserver.c +--- a/util/pserver.c Sun Jun 05 21:25:42 2005 +0000 ++++ b/util/pserver.c Sat Jun 11 19:59:00 2005 +0000 +@@ -146,49 +146,44 @@ init_queue(struct ncp_conn *conn, char * + } + + ++static char* ++add_string(char* target, char* target_end, const char *str) { ++ size_t len = strlen(str); ++ ++ if (target + len + 1 > target_end) { ++ len = target_end - target - 1; ++ } ++ memcpy(target, str, len); ++ return target + len; ++} ++ + static void + build_command(struct nw_queue *q, struct queue_job *j, +- char *target, int target_size, char *user) ++ char *target, size_t target_size, char *user) + { + char *s = q->command; + char *target_end = target + target_size; + +- static void add_string(const char *str) +- { +- int len = strlen(str); +- if (target + len + 1 > target_end) +- { +- len = target_end - target - 1; +- } +- strncpy(target, str, len); +- target += len; +- } +- + memset(target, 0, target_size); + + while ((*s != 0) && (target < target_end)) + { +- if (*s != '%') +- { +- *target = *s; +- target += 1; +- s += 1; ++ if (*s != '%') { ++ *target++ = *s++; + continue; + } +- switch (*(s + 1)) +- { ++ switch (*(s + 1)) { + case '%': +- *target = '%'; +- target += 1; ++ *target++ = '%'; + break; + case 'u': +- add_string(user); ++ target = add_string(target, target_end, user); + break; + case 'd': + if (j->j.JobTextDescription[0]) +- add_string(j->j.JobTextDescription); ++ target = add_string(target, target_end, j->j.JobTextDescription); + else +- add_string(_("No Description")); ++ target = add_string(target, target_end, _("No Description")); + break; + default: + *target = '%'; + diff --git a/contrib/pam/pam_ncp_auth.c b/contrib/pam/pam_ncp_auth.c index 4542691..e966ffd 100644 --- a/contrib/pam/pam_ncp_auth.c +++ b/contrib/pam/pam_ncp_auth.c @@ -902,7 +902,7 @@ nw_ctx_search(const char *user_cn, NWCONN_HANDLE conn, char *contexts, size_t ma NWDSContextHandle context; NWDSCCODE ccode; nuint32 iterationHandle; - nint32 countObjectsSearched; + nuint32 countObjectsSearched; nuint32 objCntr; nuint32 objCount; char objectName[MAX_DN_CHARS + 1]; @@ -1472,7 +1472,7 @@ nw_retrieve_bindery_user_info(struct nw_user_info *ui, NWCONN_HANDLE conn, UNUSE if (ui->qflag & QF_DEBUG) syslog(LOG_NOTICE, "%s:got a full name %s for %s\n ", me, p.value, userName); - v = strdup(p.value); + v = strdup((char*)p.value); if (!v) { syslog(LOG_WARNING, "%s:Not enough memory for strdup()\n", me); return ENOMEM; @@ -1490,13 +1490,13 @@ nw_retrieve_bindery_user_info(struct nw_user_info *ui, NWCONN_HANDLE conn, UNUSE err = ncp_read_property_value(conn, NCP_BINDERY_USER, userName, 1, "HOME_DIRECTORY", &p); if (!err && p.value[0]) { char *v1; - char *mark = strchr(p.value, ':'); + char *mark = strchr((char*)p.value, ':'); if (mark && *(mark + 1)) { if (ui->qflag & QF_DEBUG) syslog(LOG_NOTICE, "%s:got a home directory %s for %s\n ", me, p.value, userName); *mark = 0; - v = strdup(p.value); + v = strdup((char*)p.value); if (!v) { syslog(LOG_WARNING, "%s:Not enough memory for strdup()\n", me); return ENOMEM; @@ -1793,7 +1793,7 @@ nds_group_name(UNUSED(NWDSContextHandle ctx), const NWDSChar * objname, struct n syslog(LOG_WARNING, "Not enough memory for strdup()\n"); return ENOMEM; } - f = objname; + f = (const unsigned char*)objname; for (; (c = *f++) != 0; *buff++ = c) { if (c >= 'a' && c <= 'z') continue; diff --git a/contrib/php/libtool b/contrib/php/libtool index 04d054f..a5e0c34 100755 --- a/contrib/php/libtool +++ b/contrib/php/libtool @@ -76,10 +76,10 @@ AR="ar" AR_FLAGS="cru" # A C compiler. -LTCC="gcc" +LTCC="gcc-4.0" # A language-specific compiler. -CC="gcc" +CC="gcc-4.0" # Is the compiler the GNU C compiler? with_gcc=yes @@ -316,7 +316,7 @@ variables_saved_for_relink="PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBR link_all_deplibs=unknown # Compile-time system search path for libraries -sys_lib_search_path_spec=" /usr/lib/gcc-lib/i486-linux/3.3.6/ /usr/lib/gcc/i486-linux/3.3.6/ /usr/lib/gcc-lib/i486-linux/3.3.6/../../../../i486-linux/lib/i486-linux/3.3.6/ /usr/lib/gcc-lib/i486-linux/3.3.6/../../../../i486-linux/lib/ /usr/lib/gcc-lib/i486-linux/3.3.6/../../../i486-linux/3.3.6/ /usr/lib/gcc-lib/i486-linux/3.3.6/../../../ /lib/i486-linux/3.3.6/ /lib/ /usr/lib/i486-linux/3.3.6/ /usr/lib/" +sys_lib_search_path_spec=" /usr/lib/gcc/i486-linux/4.0.1/ /usr/lib/gcc/i486-linux/4.0.1/ /usr/lib/gcc/i486-linux/4.0.1/../../../../i486-linux/lib/i486-linux/4.0.1/ /usr/lib/gcc/i486-linux/4.0.1/../../../../i486-linux/lib/ /usr/lib/gcc/i486-linux/4.0.1/../../../i486-linux/4.0.1/ /usr/lib/gcc/i486-linux/4.0.1/../../../ /lib/i486-linux/4.0.1/ /lib/ /usr/lib/i486-linux/4.0.1/ /usr/lib/" # Run-time system search path for libraries sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/X11R6/lib @@ -6740,7 +6740,7 @@ AR="ar" AR_FLAGS="cru" # A C compiler. -LTCC="gcc" +LTCC="gcc-4.0" # A language-specific compiler. CC="g++" diff --git a/contrib/php/php_auth_nds.c b/contrib/php/php_auth_nds.c index e1d7d9a..bfc6408 100644 --- a/contrib/php/php_auth_nds.c +++ b/contrib/php/php_auth_nds.c @@ -388,7 +388,7 @@ static NWDSCCODE nw_ctx_search( NWDSCCODE ccode; nuint32 iterationHandle = NO_MORE_ITERATIONS; - nint32 countObjectsSearched; + nuint32 countObjectsSearched; nuint32 objCntr; nuint32 objCount; char objectName[MAX_DN_CHARS+1]; diff --git a/contrib/tcl-utils/chgpwd.c b/contrib/tcl-utils/chgpwd.c index d138043..1c5ec25 100644 --- a/contrib/tcl-utils/chgpwd.c +++ b/contrib/tcl-utils/chgpwd.c @@ -62,6 +62,7 @@ typedef u_int32_t Time_T; #include #include +#include #include #include @@ -254,7 +255,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/tcl-utils/ncplist.c b/contrib/tcl-utils/ncplist.c index f547433..619ab67 100644 --- a/contrib/tcl-utils/ncplist.c +++ b/contrib/tcl-utils/ncplist.c @@ -85,6 +85,7 @@ typedef u_int32_t Time_T; #include #include #include +#include #include #include @@ -151,7 +152,7 @@ int main(int argc, char *argv[]) { nuint32 ih = NO_MORE_ITERATIONS; Buf_T* buf; size_t size = DEFAULT_MESSAGE_LEN; - size_t cnt; + size_t ccnt; char treeName [MAX_TREE_NAME_CHARS +1]=""; char serverName [MAX_SCHEMA_NAME_CHARS+1]=""; @@ -263,7 +264,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", @@ -345,7 +346,7 @@ int main(int argc, char *argv[]) { case 0:dserr = NWDSList(ctx, objectname, &ih, buf); break; case 1:dserr = NWDSListContainers(ctx, objectname, &ih, buf); break; case 2:dserr = NWDSListByClassAndName(ctx, objectname, classname, subjectname, &ih, buf); break; - case 3:dserr = NWDSGetCountByClassAndName(ctx, objectname, classname, subjectname, &cnt); break; + case 3:dserr = NWDSGetCountByClassAndName(ctx, objectname, classname, subjectname, &ccnt); break; case 4:dserr = NWDSExtSyncList(ctx, objectname, classname, subjectname, &ih, &ts, 0, buf); @@ -413,7 +414,7 @@ int main(int argc, char *argv[]) { #endif } else { if (!quiet) - printf("%u objects found\n", cnt); + printf("%u objects found\n", ccnt); } } while ((dserr == 0) && (ih != NO_MORE_ITERATIONS)); NWCCCloseConn(conn); diff --git a/contrib/tcl-utils/ncplisttrees.c b/contrib/tcl-utils/ncplisttrees.c index 003712e..9c914aa 100644 --- a/contrib/tcl-utils/ncplisttrees.c +++ b/contrib/tcl-utils/ncplisttrees.c @@ -204,7 +204,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/tcl-utils/ncpreadprop.c b/contrib/tcl-utils/ncpreadprop.c index ee79c1d..cdf1911 100644 --- a/contrib/tcl-utils/ncpreadprop.c +++ b/contrib/tcl-utils/ncpreadprop.c @@ -72,7 +72,7 @@ static char *progname; -static void +static void __attribute__((noreturn)) usage(void) { fprintf(stderr, _("usage: %s [options] \n"), progname); @@ -197,7 +197,7 @@ static int doPrintOut (NWDSContextHandle ctx, const void * name, const enum SYNT } break; case SYN_PO_ADDRESS:{ - const NWDSChar** pa = (const NWDSChar**)name; + const NWDSChar*const* pa = (const NWDSChar*const*)name; printf("%s:%s:%s:%s:%s:%s\n",pa[0],pa[1],pa[2],pa[3],pa[4],pa[5]); } break; @@ -442,7 +442,7 @@ main(int argc, char *argv[]) #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/tcl-utils/ncpreadprops.c b/contrib/tcl-utils/ncpreadprops.c index d51d90c..b1b4e24 100644 --- a/contrib/tcl-utils/ncpreadprops.c +++ b/contrib/tcl-utils/ncpreadprops.c @@ -67,7 +67,7 @@ Ppollet:0 CN=FCPC2_APPS home\ppollet:1 2 3 4 5 6:Patrick Pollet:9999 static char *progname; -static void +static void __attribute__((noreturn)) usage(void) { fprintf(stderr, _("usage: %s [options] \n"), progname); @@ -191,7 +191,7 @@ static int doPrintOut (NWDSContextHandle ctx, const void * name, const enum SYNT } break; case SYN_PO_ADDRESS:{ - const NWDSChar** pa = (const NWDSChar**)name; + const NWDSChar*const* pa = (const NWDSChar*const*)name; printf("%s%c%s%c%s%c%s%c%s%c%s",pa[0],sep,pa[1],sep,pa[2],sep,pa[3],sep,pa[4],sep,pa[5]); } break; @@ -479,7 +479,7 @@ main(int argc, char *argv[]) #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/tcl-utils/ncpvrest.c b/contrib/tcl-utils/ncpvrest.c index ed2650c..0af14c3 100644 --- a/contrib/tcl-utils/ncpvrest.c +++ b/contrib/tcl-utils/ncpvrest.c @@ -37,6 +37,7 @@ #include #include +#include #include #include @@ -148,7 +149,7 @@ int main(int argc, char *argv[]) { { - int optv=-1; + NWVOL_NUM optv; nuint32 nwuid,rest,inUse; struct ncp_volume_info target; diff --git a/contrib/tcl-utils/ncpwhoami.c b/contrib/tcl-utils/ncpwhoami.c index 4bcca47..99a2377 100644 --- a/contrib/tcl-utils/ncpwhoami.c +++ b/contrib/tcl-utils/ncpwhoami.c @@ -78,7 +78,7 @@ static const char * gDefaultFields ="TSVUX"; static const char * gUserFields=NULL; -static void +static void __attribute__((noreturn)) usage(void) { fprintf(stderr, _("failed. usage: %s [-options] \n"), progname); diff --git a/contrib/tcl-utils/vlist.c b/contrib/tcl-utils/vlist.c index 4dcc1d6..f4d58a5 100644 --- a/contrib/tcl-utils/vlist.c +++ b/contrib/tcl-utils/vlist.c @@ -46,7 +46,7 @@ static char *progname; -static void +static void __attribute__((noreturn)) usage(void) { fprintf(stderr, _("failed. usage: %s [options] servername\n"), progname); diff --git a/contrib/testing/chgpwd.c b/contrib/testing/chgpwd.c index 8066c26..df82ce9 100644 --- a/contrib/testing/chgpwd.c +++ b/contrib/testing/chgpwd.c @@ -200,7 +200,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/cmpattr.c b/contrib/testing/cmpattr.c index 20b0fa8..ad19dee 100644 --- a/contrib/testing/cmpattr.c +++ b/contrib/testing/cmpattr.c @@ -186,7 +186,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/dirlist2.c b/contrib/testing/dirlist2.c index 3613227..28c0900 100644 --- a/contrib/testing/dirlist2.c +++ b/contrib/testing/dirlist2.c @@ -30,7 +30,6 @@ #define MAKE_NCPLIB #include #include -#include "../../lib/ncplib_i.h" #include #include @@ -42,6 +41,8 @@ #include "private/libintl.h" #define _(X) gettext(X) +#include "../../lib/ncplib_i.h" + static char *progname; static void @@ -70,7 +71,7 @@ int main(int argc, char *argv[]) { unsigned int searchattr = SA_ALL; u_int32_t destns = NW_NS_DOS; int searchmode = 0; - const char* sstr = "\xFF*"; + const unsigned char* sstr = (const unsigned char*)"\xFF*"; size_t sslen = 2; setlocale(LC_ALL, ""); diff --git a/contrib/testing/dssearch.c b/contrib/testing/dssearch.c index 3299822..9dbea5f 100644 --- a/contrib/testing/dssearch.c +++ b/contrib/testing/dssearch.c @@ -554,7 +554,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/dsstream.c b/contrib/testing/dsstream.c index 30646e5..e0ebd07 100644 --- a/contrib/testing/dsstream.c +++ b/contrib/testing/dsstream.c @@ -188,7 +188,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/effright.c b/contrib/testing/effright.c index 22b3283..e1fbde8 100644 --- a/contrib/testing/effright.c +++ b/contrib/testing/effright.c @@ -175,7 +175,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/large.c b/contrib/testing/large.c index 7c1051d..fbbdde2 100644 --- a/contrib/testing/large.c +++ b/contrib/testing/large.c @@ -244,7 +244,8 @@ int main(int argc, char *argv[]) { memset(&iii, 0xCC, sizeof(iii)); dserr = ncp_ns_open_create_entry(conn, destns, searchattr, NCP_DIRSTYLE_DIRBASE, - 0, 0, volume, strlen(s) + 2, -1, dowrite ? OC_MODE_CREATE | OC_MODE_TRUNCATE | OC_MODE_OPEN | OC_MODE_OPEN_64BIT_ACCESS : OC_MODE_OPEN | OC_MODE_OPEN_64BIT_ACCESS, + 0, 0, (unsigned char*)volume, strlen(s) + 2, -1, + dowrite ? OC_MODE_CREATE | OC_MODE_TRUNCATE | OC_MODE_OPEN | OC_MODE_OPEN_64BIT_ACCESS : OC_MODE_OPEN | OC_MODE_OPEN_64BIT_ACCESS, 0, AR_READ_ONLY|AR_WRITE_ONLY, RIM_ALL, &iii, sizeof(iii), NULL, NULL, fh); if (dserr) { diff --git a/contrib/testing/mkattr.c b/contrib/testing/mkattr.c index 677d9f4..1582d8b 100644 --- a/contrib/testing/mkattr.c +++ b/contrib/testing/mkattr.c @@ -201,7 +201,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/mkclass.c b/contrib/testing/mkclass.c index 8bd6c82..dc48569 100644 --- a/contrib/testing/mkclass.c +++ b/contrib/testing/mkclass.c @@ -218,7 +218,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/mkfile.c b/contrib/testing/mkfile.c index 55938b6..c7e62c0 100644 --- a/contrib/testing/mkfile.c +++ b/contrib/testing/mkfile.c @@ -221,12 +221,12 @@ int main(int argc, char *argv[]) { volume[1] = strlen(s); { struct nw_info_struct2 iii; - u_int8_t fh[10]; + u_int8_t fh[6]; memset(&iii, 0xCC, sizeof(iii)); dserr = ncp_ns_open_create_entry(conn, destns, searchattr, NCP_DIRSTYLE_DIRBASE, - 3, rim, volume, strlen(s) + 2, -1, 0x0B, 0, 0, 0xFF, + 3, rim, (unsigned char*)volume, strlen(s) + 2, -1, 0x0B, 0, 0, 0xFF, &iii, sizeof(iii), NULL, NULL, fh); if (dserr) { fprintf(stderr, "Cannot obtain info: %s\n", diff --git a/contrib/testing/mkobj.c b/contrib/testing/mkobj.c index 704f21b..962b6e6 100644 --- a/contrib/testing/mkobj.c +++ b/contrib/testing/mkobj.c @@ -202,7 +202,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/modclass.c b/contrib/testing/modclass.c index 4b383b5..0795b72 100644 --- a/contrib/testing/modclass.c +++ b/contrib/testing/modclass.c @@ -191,7 +191,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/modobj.c b/contrib/testing/modobj.c index 882473c..27776ce 100644 --- a/contrib/testing/modobj.c +++ b/contrib/testing/modobj.c @@ -145,7 +145,7 @@ int main(int argc, char *argv[]) { dserr = NWDSSetContext(ctx, DCK_CONFIDENCE, &confidence); #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/mvobj.c b/contrib/testing/mvobj.c index 7286d73..0ab69fe 100644 --- a/contrib/testing/mvobj.c +++ b/contrib/testing/mvobj.c @@ -180,7 +180,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/nwdsgethost.c b/contrib/testing/nwdsgethost.c index aa052cb..790670c 100644 --- a/contrib/testing/nwdsgethost.c +++ b/contrib/testing/nwdsgethost.c @@ -177,7 +177,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/nwdsgetstat.c b/contrib/testing/nwdsgetstat.c index bb24136..f1bcec7 100644 --- a/contrib/testing/nwdsgetstat.c +++ b/contrib/testing/nwdsgetstat.c @@ -168,7 +168,7 @@ int main(int argc, char *argv[]) { } #ifdef N_PLAT_LINUX { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/nwdslist.c b/contrib/testing/nwdslist.c index 021e1fc..0f968cc 100644 --- a/contrib/testing/nwdslist.c +++ b/contrib/testing/nwdslist.c @@ -209,7 +209,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/nwdspartjoin.c b/contrib/testing/nwdspartjoin.c index 8c39cff..f4b13f0 100644 --- a/contrib/testing/nwdspartjoin.c +++ b/contrib/testing/nwdspartjoin.c @@ -171,7 +171,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/nwdspartlist.c b/contrib/testing/nwdspartlist.c index 2c347d4..823331c 100644 --- a/contrib/testing/nwdspartlist.c +++ b/contrib/testing/nwdspartlist.c @@ -184,7 +184,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/nwdspartrm.c b/contrib/testing/nwdspartrm.c index d2d67cf..f4b78b5 100644 --- a/contrib/testing/nwdspartrm.c +++ b/contrib/testing/nwdspartrm.c @@ -165,7 +165,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/nwdspartsplit.c b/contrib/testing/nwdspartsplit.c index ad2c27d..e2b181e 100644 --- a/contrib/testing/nwdspartsplit.c +++ b/contrib/testing/nwdspartsplit.c @@ -171,7 +171,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/nwdsresetstat.c b/contrib/testing/nwdsresetstat.c index 2d1c735..add275a 100644 --- a/contrib/testing/nwdsresetstat.c +++ b/contrib/testing/nwdsresetstat.c @@ -167,7 +167,7 @@ int main(int argc, char *argv[]) { } #ifdef N_PLAT_LINUX { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/nwgettime.c b/contrib/testing/nwgettime.c index ad2a861..62718ef 100644 --- a/contrib/testing/nwgettime.c +++ b/contrib/testing/nwgettime.c @@ -173,7 +173,7 @@ int main(int argc, char *argv[]) { } #ifdef N_PLAT_LINUX { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/partroot.c b/contrib/testing/partroot.c index 114a5a1..d3e0443 100644 --- a/contrib/testing/partroot.c +++ b/contrib/testing/partroot.c @@ -168,7 +168,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/pp/bcastmd.c b/contrib/testing/pp/bcastmd.c index 355ba9f..c939c85 100644 --- a/contrib/testing/pp/bcastmd.c +++ b/contrib/testing/pp/bcastmd.c @@ -193,7 +193,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/pp/getsynt.c b/contrib/testing/pp/getsynt.c index 0673ff6..eb4b280 100644 --- a/contrib/testing/pp/getsynt.c +++ b/contrib/testing/pp/getsynt.c @@ -175,7 +175,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/pp/nwc_next_object.c b/contrib/testing/pp/nwc_next_object.c index e4a5b49..2ae2536 100644 --- a/contrib/testing/pp/nwc_next_object.c +++ b/contrib/testing/pp/nwc_next_object.c @@ -202,7 +202,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/pp/nwgetconnlist.c b/contrib/testing/pp/nwgetconnlist.c index de21aa9..aa96922 100644 --- a/contrib/testing/pp/nwgetconnlist.c +++ b/contrib/testing/pp/nwgetconnlist.c @@ -300,7 +300,7 @@ static void printConn (NWCONN_HANDLE conn, int stage) { } static void getAsMuchAsYouCan ( NWCONN_HANDLE conn) { - char buffer[8192]; + unsigned char buffer[8192]; int len=sizeof(buffer); NWCCTranAddr aux; @@ -335,7 +335,7 @@ static void getAsMuchAsYouCan ( NWCONN_HANDLE conn) { printf("NWCC_INFO_SECURITY %s\n",strnwerror(NWCCGetConnInfo(conn,NWCC_INFO_SECURITY, sizeof (int), buffer))); - dump_hex("tranaddr:",(char *)&aux,sizeof(aux)); + dump_hex("tranaddr:",(const unsigned char *)&aux,sizeof(aux)); dump_hex("tranaddr II: ",aux.buffer,12); free (aux.buffer); diff --git a/contrib/testing/pp/nwwhoami.c b/contrib/testing/pp/nwwhoami.c index d8e6616..4db89d1 100644 --- a/contrib/testing/pp/nwwhoami.c +++ b/contrib/testing/pp/nwwhoami.c @@ -199,7 +199,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/pp/open_conn_by_name.c b/contrib/testing/pp/open_conn_by_name.c index e407c23..6abd05a 100644 --- a/contrib/testing/pp/open_conn_by_name.c +++ b/contrib/testing/pp/open_conn_by_name.c @@ -186,7 +186,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/pp/readsdef.c b/contrib/testing/pp/readsdef.c index 4060b19..217b617 100644 --- a/contrib/testing/pp/readsdef.c +++ b/contrib/testing/pp/readsdef.c @@ -182,7 +182,7 @@ int main(int argc, char *argv[]) { */ #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/pp/readsynt.c b/contrib/testing/pp/readsynt.c index e0bef29..aa12dc7 100644 --- a/contrib/testing/pp/readsynt.c +++ b/contrib/testing/pp/readsynt.c @@ -447,7 +447,7 @@ int main(int argc, char *argv[]) { */ #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/pp/return_block_of_tree.c b/contrib/testing/pp/return_block_of_tree.c index 9ff57dd..d9fd539 100644 --- a/contrib/testing/pp/return_block_of_tree.c +++ b/contrib/testing/pp/return_block_of_tree.c @@ -184,7 +184,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/pp/scantree.c b/contrib/testing/pp/scantree.c index 898a832..6f4ced2 100644 --- a/contrib/testing/pp/scantree.c +++ b/contrib/testing/pp/scantree.c @@ -188,7 +188,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/pp/scanvolr.c b/contrib/testing/pp/scanvolr.c index 6ce04be..b66cc70 100644 --- a/contrib/testing/pp/scanvolr.c +++ b/contrib/testing/pp/scanvolr.c @@ -211,7 +211,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/pp/semaphor.c b/contrib/testing/pp/semaphor.c index 3d79eaf..5ce81b4 100644 --- a/contrib/testing/pp/semaphor.c +++ b/contrib/testing/pp/semaphor.c @@ -188,7 +188,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", @@ -231,7 +231,8 @@ int main(int argc, char *argv[]) { { nuint32 semHandle; - nuint16 semCurrentCount,semValue,semOpenCount; + nuint16 semCurrentCount, semOpenCount; + nint16 semValue; err=NWOpenSemaphore (conn,semName,maxAccess,&semHandle, &semCurrentCount); if (err) { @@ -243,7 +244,7 @@ int main(int argc, char *argv[]) { printf ("%s is open with handle(%x) for %u max concurrent access. Currently it has %d access\n", semName,semHandle,maxAccess,semCurrentCount); - err=NWExamineSemaphore (conn,semHandle,&semValue,&semOpenCount); + err=NWExamineSemaphore(conn, semHandle, &semValue, &semOpenCount); if (err) { fprintf(stderr, "NWExamineSemaphore failed with error %s\n", strnwerror(err)); diff --git a/contrib/testing/pp/volres.c b/contrib/testing/pp/volres.c index c45cea7..e9c9c68 100644 --- a/contrib/testing/pp/volres.c +++ b/contrib/testing/pp/volres.c @@ -209,7 +209,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/readaddr.c b/contrib/testing/readaddr.c index 8c874fc..7e00689 100644 --- a/contrib/testing/readaddr.c +++ b/contrib/testing/readaddr.c @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) { NWDSContextHandle ctx; NWCONN_HANDLE conn; const char* context = "OrgUnit.Org.Country"; - unsigned char buff[1000]; + char buff[1000]; const char* server = "CDROM"; int opt; u_int32_t ctxflag = 0; diff --git a/contrib/testing/readadef.c b/contrib/testing/readadef.c index b0495cb..693e432 100644 --- a/contrib/testing/readadef.c +++ b/contrib/testing/readadef.c @@ -201,7 +201,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/readattr.c b/contrib/testing/readattr.c index dc09dd6..abfb039 100644 --- a/contrib/testing/readattr.c +++ b/contrib/testing/readattr.c @@ -640,7 +640,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/readcc.c b/contrib/testing/readcc.c index 1019ebb..11e48fd 100644 --- a/contrib/testing/readcc.c +++ b/contrib/testing/readcc.c @@ -182,7 +182,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/readcls.c b/contrib/testing/readcls.c index 23dea01..3c84875 100644 --- a/contrib/testing/readcls.c +++ b/contrib/testing/readcls.c @@ -223,7 +223,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/readsynt.c b/contrib/testing/readsynt.c index 95ac48b..7b2adb6 100644 --- a/contrib/testing/readsynt.c +++ b/contrib/testing/readsynt.c @@ -200,7 +200,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/renobj.c b/contrib/testing/renobj.c index d22689e..829d874 100644 --- a/contrib/testing/renobj.c +++ b/contrib/testing/renobj.c @@ -180,7 +180,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/replops.c b/contrib/testing/replops.c index d03a04b..96e9a53 100644 --- a/contrib/testing/replops.c +++ b/contrib/testing/replops.c @@ -217,7 +217,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/resint.c b/contrib/testing/resint.c index 210a8f2..36d8b0f 100644 --- a/contrib/testing/resint.c +++ b/contrib/testing/resint.c @@ -206,7 +206,7 @@ int main(int argc, char *argv[]) { return 122; } { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/resolve.c b/contrib/testing/resolve.c index 2cdfcff..32d23b5 100644 --- a/contrib/testing/resolve.c +++ b/contrib/testing/resolve.c @@ -142,7 +142,7 @@ int main(int argc, char *argv[]) { return 122; } { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/rmattr.c b/contrib/testing/rmattr.c index da2bcd8..07d9469 100644 --- a/contrib/testing/rmattr.c +++ b/contrib/testing/rmattr.c @@ -167,7 +167,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/rmclass.c b/contrib/testing/rmclass.c index 0c89caa..0285535 100644 --- a/contrib/testing/rmclass.c +++ b/contrib/testing/rmclass.c @@ -167,7 +167,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/rmobj.c b/contrib/testing/rmobj.c index ae0ee20..6575a17 100644 --- a/contrib/testing/rmobj.c +++ b/contrib/testing/rmobj.c @@ -170,7 +170,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/schsync.c b/contrib/testing/schsync.c index 57d47b4..a06e755 100644 --- a/contrib/testing/schsync.c +++ b/contrib/testing/schsync.c @@ -172,7 +172,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/setkeys.c b/contrib/testing/setkeys.c index e9c9cd8..bbbae49 100644 --- a/contrib/testing/setkeys.c +++ b/contrib/testing/setkeys.c @@ -172,7 +172,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/timeinfo.c b/contrib/testing/timeinfo.c index 27d1bfb..b122126 100644 --- a/contrib/testing/timeinfo.c +++ b/contrib/testing/timeinfo.c @@ -256,7 +256,7 @@ int main(int argc, char *argv[]) { } #ifdef N_PLAT_LINUX { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/testing/verpwd.c b/contrib/testing/verpwd.c index 13a8ff8..5c7b0c4 100644 --- a/contrib/testing/verpwd.c +++ b/contrib/testing/verpwd.c @@ -192,7 +192,7 @@ int main(int argc, char *argv[]) { } #ifndef N_PLAT_MSW4 { - static const u_int32_t add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + static const NET_ADDRESS_TYPE add[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; dserr = NWDSSetTransport(ctx, 16, add); if (dserr) { fprintf(stderr, "NWDSSetTransport failed: %s\n", diff --git a/contrib/tests/dsfilter.c b/contrib/tests/dsfilter.c index ac48981..c836234 100644 --- a/contrib/tests/dsfilter.c +++ b/contrib/tests/dsfilter.c @@ -86,7 +86,7 @@ static int searchtest(const char* testname, NWDSCCODE (*fn)(Filter_Cursor_T*)) Buf_T *buf = NULL; Filter_Cursor_T *cur = NULL; - static const u_int32_t add[] = + static const NET_ADDRESS_TYPE add[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; NWCallsInit (NULL, NULL); diff --git a/contrib/tests/putfilte.c b/contrib/tests/putfilte.c index 8756c2e..859d77c 100644 --- a/contrib/tests/putfilte.c +++ b/contrib/tests/putfilte.c @@ -67,7 +67,7 @@ ndsfindusercontext (NWDSContextHandle ctx, const char *ousername) if ((nwerr = NWDSAddFilterToken (cur, FTOK_EQ, NULL, 0))) goto out; - if ((nwerr = NWDSAddFilterToken (cur, FTOK_AVAL, (char *) ousername, SYN_CI_STRING))) + if ((nwerr = NWDSAddFilterToken (cur, FTOK_AVAL, (const char *) ousername, SYN_CI_STRING))) goto out; if ((nwerr = NWDSAddFilterToken (cur, FTOK_RPAREN, NULL, 0))) @@ -133,7 +133,7 @@ main (int argc, char *argv[]) NWDSContextHandle ctx; NWCONN_HANDLE conn; struct ncp_conn_spec connsp; - static const u_int32_t add[] = + static const NET_ADDRESS_TYPE add[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; mtrace (); diff --git a/include/ncp/kernel/ncp_fs.h b/include/ncp/kernel/ncp_fs.h index 9c14d9a..3b0d60a 100644 --- a/include/ncp/kernel/ncp_fs.h +++ b/include/ncp/kernel/ncp_fs.h @@ -50,8 +50,8 @@ struct ncp_sign_init { - char sign_root[8]; - char sign_last[16]; + unsigned char sign_root[8]; + unsigned char sign_last[16]; }; union ncp_sockaddr { @@ -72,7 +72,7 @@ union ncp_sockaddr { struct ncp_ioctl_request { unsigned int function; unsigned int size; - char *data; + unsigned char *data; }; struct ncp_fs_info { @@ -130,13 +130,13 @@ struct ncp_privatedata_ioctl struct ncp_nls_ioctl_old { int codepage; - unsigned char iocharset[NCP_IOCSNAME_LEN+1]; + char iocharset[NCP_IOCSNAME_LEN+1]; }; struct ncp_nls_ioctl { - unsigned char codepage[NCP_IOCSNAME_LEN+1]; - unsigned char iocharset[NCP_IOCSNAME_LEN+1]; + char codepage[NCP_IOCSNAME_LEN+1]; + char iocharset[NCP_IOCSNAME_LEN+1]; }; #define NCP_IOC_NCPREQUEST _IOR('n', 1, struct ncp_ioctl_request) diff --git a/include/ncp/ncp.h b/include/ncp/ncp.h index 9740c79..ad7030e 100644 --- a/include/ncp/ncp.h +++ b/include/ncp/ncp.h @@ -73,7 +73,7 @@ struct ncp_bindery_object { #ifdef SWIG fixedCharArray object_name[NCP_BINDERY_NAME_LEN]; #else - u_int8_t object_name[NCP_BINDERY_NAME_LEN]; + char object_name[NCP_BINDERY_NAME_LEN]; #endif u_int8_t object_flags; u_int8_t object_security; diff --git a/include/ncp/ncplib.h b/include/ncp/ncplib.h index b60fdeb..e009a37 100644 --- a/include/ncp/ncplib.h +++ b/include/ncp/ncplib.h @@ -474,7 +474,7 @@ struct ncp_file_server_info #else struct ncp_file_server_info { - u_int8_t ServerName[48] __attribute__((packed)); + char ServerName[48] __attribute__((packed)); u_int8_t FileServiceVersion __attribute__((packed)); u_int8_t FileServiceSubVersion __attribute__((packed)); u_int16_t MaximumServiceConnections __attribute__((packed)); @@ -499,7 +499,7 @@ struct ncp_file_server_info_2 { #ifdef SWIG fixedArray ServerName[49]; #else - u_int8_t ServerName[49]; + char ServerName[49]; #endif u_int8_t FileServiceVersion; u_int8_t FileServiceSubVersion; @@ -560,7 +560,7 @@ long long ncp_get_encryption_key(NWCONN_HANDLE conn, - char *encryption_key); + unsigned char encryption_key[8]); long ncp_get_bindery_object_id(NWCONN_HANDLE conn, NWObjectType object_type, @@ -710,19 +710,19 @@ long ncp_login_encrypted(NWCONN_HANDLE conn, const struct ncp_bindery_object *object, const unsigned char *key, - const unsigned char *passwd); + const char *passwd); long ncp_login_unencrypted(NWCONN_HANDLE conn, NWObjectType object_type, const char *object_name, - const unsigned char *passwd); + const char *passwd); long ncp_change_login_passwd(NWCONN_HANDLE conn, const struct ncp_bindery_object *object, const unsigned char *key, - const unsigned char *oldpasswd, - const unsigned char *newpasswd); + const char *oldpasswd, + const char *newpasswd); #define NCP_GRACE_PERIOD (0xdf) @@ -782,8 +782,8 @@ const char* strnwerror(int err); long ncp_login_user(NWCONN_HANDLE conn, - const unsigned char *username, - const unsigned char *password); + const char *username, + const char *password); long ncp_get_volume_info_with_number(NWCONN_HANDLE conn, int n, @@ -815,7 +815,7 @@ long int attr, int accessm, struct ncp_file_info *target); -long ncp_close_file(NWCONN_HANDLE conn, const char fileHandle[6]); +long ncp_close_file(NWCONN_HANDLE conn, const unsigned char fileHandle[6]); long ncp_create_newfile(NWCONN_HANDLE conn, @@ -878,11 +878,11 @@ long #ifdef SWIG long - ncp_read(NWCONN_HANDLE conn, const char fileHandle[6], + ncp_read(NWCONN_HANDLE conn, const unsigned char fileHandle[6], ncp_off_t offset, size_t count, char *RETBUFFER_LENPREV); long - ncp_write(NWCONN_HANDLE conn, const char fileHandle[6], + ncp_write(NWCONN_HANDLE conn, const unsigned char fileHandle[6], ncp_off_t offset, size_t IGNORE, const char *STRING_LENPREV); long @@ -895,23 +895,23 @@ long u_int32_t * OUTPUT); #else long - ncp_read(NWCONN_HANDLE conn, const char fileHandle[6], - ncp_off_t offset, size_t count, char *target); + ncp_read(NWCONN_HANDLE conn, const unsigned char fileHandle[6], + ncp_off_t offset, size_t count, void *target); long - ncp_write(NWCONN_HANDLE conn, const char fileHandle[6], - ncp_off_t offset, size_t count, const char *source); + ncp_write(NWCONN_HANDLE conn, const unsigned char fileHandle[6], + ncp_off_t offset, size_t count, const void *source); -NWCCODE ncp_read64(NWCONN_HANDLE conn, const char fileHandle[6], +NWCCODE ncp_read64(NWCONN_HANDLE conn, const unsigned char fileHandle[6], ncp_off64_t offset, size_t count, void *target, size_t *bytesread); -NWCCODE ncp_write64(NWCONN_HANDLE conn, const char fileHandle[6], +NWCCODE ncp_write64(NWCONN_HANDLE conn, const unsigned char fileHandle[6], ncp_off64_t offset, size_t count, const void *source, size_t *byteswritten); long ncp_copy_file(NWCONN_HANDLE conn, - const char source_file[6], - const char target_file[6], + const unsigned char source_file[6], + const unsigned char target_file[6], u_int32_t source_offset, u_int32_t target_offset, u_int32_t count, @@ -1167,8 +1167,8 @@ ncp_set_dentry_ttl(NWCONN_HANDLE conn, unsigned int ttl); long ncp_send_nds_frag(NWCONN_HANDLE conn, int ndsverb, - const char *inbuf, size_t inbuflen, - char *outbuf, size_t outbufsize, size_t *outbuflen); + const void *inbuf, size_t inbuflen, + void *outbuf, size_t outbufsize, size_t *outbuflen); long ncp_send_nds(NWCONN_HANDLE conn, int fn, @@ -1423,7 +1423,7 @@ ncp_ns_open_create_entry(NWCONN_HANDLE conn, /* struct nw_info_struct2 */ void* target, size_t sizeoftarget, u_int8_t* oc_action, u_int8_t* oc_callback, - char fileHandle[6] /* ?? u_int32_t* or NW_FILE_HANDLE* ?? */ + unsigned char fileHandle[6] /* ?? u_int32_t* or NW_FILE_HANDLE* ?? */ ); NWCCODE @@ -1660,7 +1660,7 @@ ncp_volume_list_end(NWVOL_HANDLE handle); NWCCODE ncp_get_file_size(NWCONN_HANDLE conn, /* input */ - const char fileHandle[6], + const unsigned char fileHandle[6], /* output */ ncp_off64_t* fileSize); @@ -1684,14 +1684,14 @@ const char* ncp_namespace_to_str(char r[5], unsigned int ns); #define NCP_PHYSREC_EX 0x01 #define NCP_PHYSREC_SH 0x03 -NWCCODE ncp_log_physical_record(NWCONN_HANDLE conn, const char fileHandle[6], +NWCCODE ncp_log_physical_record(NWCONN_HANDLE conn, const unsigned char fileHandle[6], ncp_off64_t startOffset, u_int64_t length, unsigned int flags, unsigned int timeout); -NWCCODE ncp_clear_physical_record(NWCONN_HANDLE conn, const char fileHandle[6], +NWCCODE ncp_clear_physical_record(NWCONN_HANDLE conn, const unsigned char fileHandle[6], ncp_off64_t startOffset, u_int64_t length); -NWCCODE ncp_release_physical_record(NWCONN_HANDLE conn, const char fileHandle[6], +NWCCODE ncp_release_physical_record(NWCONN_HANDLE conn, const unsigned char fileHandle[6], ncp_off64_t startOffset, u_int64_t length); #ifdef __cplusplus diff --git a/include/ncp/nwnet.h.in b/include/ncp/nwnet.h.in index 9d70b61..bcb325c 100644 --- a/include/ncp/nwnet.h.in +++ b/include/ncp/nwnet.h.in @@ -661,7 +661,7 @@ NWDSCCODE __NWDSCompare(NWDSContextHandle ctx, NWCONN_HANDLE conn, NWObjectID objectID, Buf_T* buf, nbool8* matched); NWDSCCODE __NWDSOpenStream(NWDSContextHandle ctx, const NWDSChar* objectName, const NWDSChar* attrName, nflag32 flags, NWCONN_HANDLE* rconn, - char fileHandle[6], ncp_off64_t* fileSize); + unsigned char fileHandle[6], ncp_off64_t* fileSize); NWDSCCODE NWDSAddObject(NWDSContextHandle ctx, const NWDSChar* name, nuint32* iterHandle, nbool8 more, Buf_T* buf); /* D */ diff --git a/lib/ds/dsgetstat.c b/lib/ds/dsgetstat.c index 93950ca..e8b3611 100644 --- a/lib/ds/dsgetstat.c +++ b/lib/ds/dsgetstat.c @@ -230,7 +230,7 @@ NWDSCCODE NWDSGetDSVerInfo( switch (version) { case 0x00000009: { - char asciiName[MAX_TREE_NAME_CHARS + 1]; + unsigned char asciiName[MAX_TREE_NAME_CHARS + 1]; nuint32 asciiNameLen; dserr = NWDSBufGetLE32(&buf, &asciiNameLen); diff --git a/lib/ds/dsstream.c b/lib/ds/dsstream.c index 584d184..af18a3a 100644 --- a/lib/ds/dsstream.c +++ b/lib/ds/dsstream.c @@ -69,7 +69,7 @@ NWDSCCODE __NWDSOpenStream( const NWDSChar* attrName, nflag32 flags, NWCONN_HANDLE* rconn, - char fh[6], + unsigned char fh[6], ncp_off64_t* size) { NWDSCCODE err; char rq_b[DEFAULT_MESSAGE_LEN]; diff --git a/lib/ds/partops.c b/lib/ds/partops.c index 4e93408..4650ac7 100644 --- a/lib/ds/partops.c +++ b/lib/ds/partops.c @@ -339,12 +339,12 @@ NWDSCCODE NWDSGetPartitionExtInfoPtr( } fields = partitions->dsiFlags; if (fields & DSP_OUTPUT_FIELDS) { - *infoPtr = partitions->curPos; + *infoPtr = (char*)partitions->curPos; dserr = NWDSBufGetLE32(partitions, &fields); if (dserr) return dserr; } else { - *infoPtr = partitions->curPos - 4; + *infoPtr = (char*)partitions->curPos - 4; DSET_LH(partitions->curPos - 4, 0, fields); } if (fields & DSP_PARTITION_ID) @@ -372,7 +372,7 @@ NWDSCCODE NWDSGetPartitionExtInfoPtr( return NWE_PARAM_INVALID; if (partitions->curPos > partitions->dataend) return ERR_BUFFER_EMPTY; - *infoPtrEnd = partitions->curPos; + *infoPtrEnd = (char*)partitions->curPos; return 0; } diff --git a/lib/ds/search.c b/lib/ds/search.c index 418c4dd..03f9882 100644 --- a/lib/ds/search.c +++ b/lib/ds/search.c @@ -166,7 +166,7 @@ static NWDSCCODE __NWDSSearchV4( struct search_referrals { struct search_referrals* next; nuint32 referrals; - char data[0]; + unsigned char data[0]; }; struct SearchIH { diff --git a/lib/ds/setkeys.c b/lib/ds/setkeys.c index bf62415..1bf25f4 100644 --- a/lib/ds/setkeys.c +++ b/lib/ds/setkeys.c @@ -221,10 +221,10 @@ static NWDSCCODE __NWDSGenerateObjectKeyPairStep3( return 0; } -static void __NWDSHashPasswordUpper(const nuint8* objectPassword, - NWObjectID pseudoID, - size_t pwdLen, - nuint8 pwdHash[16] +static void __NWDSHashPasswordUpper(const char* objectPassword, + NWObjectID pseudoID, + size_t pwdLen, + nuint8 pwdHash[16] ) { nuint8 newPwd[pwdLen + 1]; size_t i; @@ -238,10 +238,10 @@ static void __NWDSHashPasswordUpper(const nuint8* objectPassword, shuffle(tmpID, newPwd, pwdLen, pwdHash); } -static void __NWDSHashPassword(const nuint8* objectPassword, - NWObjectID pseudoID, - size_t pwdLen, - nuint8 pwdHash[16] +static void __NWDSHashPassword(const char* objectPassword, + NWObjectID pseudoID, + size_t pwdLen, + nuint8 pwdHash[16] ) { nuint8 tmpID[4]; diff --git a/lib/filemgmt.c b/lib/filemgmt.c index 8016d44..746aaf6 100644 --- a/lib/filemgmt.c +++ b/lib/filemgmt.c @@ -410,7 +410,7 @@ ncp_open_file(struct ncp_conn *conn, } long -ncp_close_file(struct ncp_conn *conn, const char *file_id) +ncp_close_file(struct ncp_conn *conn, const unsigned char *file_id) { long result; @@ -630,7 +630,7 @@ ncp_get_trustee(struct ncp_conn *conn, u_int32_t object_id, } *contin = ncp_reply_word_hl(conn, 0); *trustee = ncp_reply_byte(conn, 6); - strncpy(path, ncp_reply_data(conn, 8), len); + memcpy(path, ncp_reply_data(conn, 8), len); path[len] = 0; ncp_unlock_conn(conn); return 0; @@ -799,7 +799,7 @@ ncp_add_handle_path2(struct ncp_conn *conn, ncp_add_byte(conn, dir_style); /* 1 = dir_base, 0xFF = no handle, 0 = handle */ if (encpath) { if (pathlen == NCP_PATH_STD) { - int p = ncp_path_to_NW_format2(encpath, dir_style, conn->current_point, conn->packet + sizeof(conn->packet) - conn->current_point); + int p = ncp_path_to_NW_format2((const char*)encpath, dir_style, conn->current_point, conn->packet + sizeof(conn->packet) - conn->current_point); if (p < 0) { return p; } @@ -823,7 +823,7 @@ ncp_extract_file_info(void *structure, struct nw_info_struct *target) memcpy(target, structure, info_struct_size); name_len = (u_int8_t*)structure + info_struct_size; target->nameLen = *name_len; - strncpy(target->entryName, name_len + 1, *name_len); + memcpy(target->entryName, name_len + 1, *name_len); target->entryName[*name_len] = '\0'; } return; @@ -1215,9 +1215,9 @@ ncp_ren_or_mov_file_or_subdir(struct ncp_conn *conn, } static int -ncp_do_read(struct ncp_conn *conn, const char *file_id, +ncp_do_read(struct ncp_conn *conn, const unsigned char *file_id, u_int32_t offset, u_int16_t to_read, - char *target, int *bytes_read) + void *target, int *bytes_read) { long result; unsigned int off; @@ -1252,11 +1252,12 @@ ncp_do_read(struct ncp_conn *conn, const char *file_id, } long -ncp_read(struct ncp_conn *conn, const char *file_id, - off_t offset, size_t count, char *target) +ncp_read(struct ncp_conn *conn, const unsigned char *file_id, + off_t offset, size_t count, void *itarget) { int bufsize = conn->i.buffer_size; size_t already_read = 0; + u_int8_t* target = itarget; if (!file_id || !target) { return ERR_NULL_POINTER; @@ -1290,7 +1291,7 @@ ncp_read(struct ncp_conn *conn, const char *file_id, static NWCCODE ncp_do_read_64(struct ncp_conn *conn, u_int32_t fh, ncp_off64_t offset, size_t to_read, - void *target, size_t *bytes_read) + char *target, size_t *bytes_read) { long result; unsigned int off; @@ -1367,7 +1368,7 @@ ncp_read_64(struct ncp_conn *conn, u_int32_t fh, ncp_off64_t offset, return 0; } -NWCCODE ncp_read64(struct ncp_conn *conn, const char file_handle[6], +NWCCODE ncp_read64(struct ncp_conn *conn, const unsigned char file_handle[6], ncp_off64_t offset, size_t count, void *target, size_t *readbytes) { NWCCODE result; @@ -1400,9 +1401,9 @@ NWCCODE ncp_read64(struct ncp_conn *conn, const char file_handle[6], } static int -ncp_do_write(struct ncp_conn *conn, const char *file_id, +ncp_do_write(struct ncp_conn *conn, const unsigned char *file_id, u_int32_t offset, u_int16_t to_write, - const char *source, int *bytes_written) + const void *source, int *bytes_written) { long result; @@ -1425,11 +1426,12 @@ ncp_do_write(struct ncp_conn *conn, const char *file_id, } long -ncp_write(struct ncp_conn *conn, const char *file_id, - off_t offset, size_t count, const char *source) +ncp_write(struct ncp_conn *conn, const unsigned char *file_id, + off_t offset, size_t count, const void *isource) { int bufsize = conn->i.buffer_size; size_t already_written = 0; + const u_int8_t* source = isource; if (!file_id || !source) { return ERR_NULL_POINTER; @@ -1520,7 +1522,7 @@ static NWCCODE ncp_write_64(struct ncp_conn *conn, u_int32_t fh, return 0; } -NWCCODE ncp_write64(struct ncp_conn *conn, const char file_handle[6], +NWCCODE ncp_write64(struct ncp_conn *conn, const unsigned char file_handle[6], ncp_off64_t offset, size_t count, const void *target, size_t *bytes) { NWCCODE result; @@ -1554,8 +1556,8 @@ NWCCODE ncp_write64(struct ncp_conn *conn, const char file_handle[6], long ncp_copy_file(struct ncp_conn *conn, - const char source_file[6], - const char target_file[6], + const unsigned char source_file[6], + const unsigned char target_file[6], u_int32_t source_offset, u_int32_t target_offset, u_int32_t count, @@ -2940,7 +2942,7 @@ ncp_ns_open_create_entry(struct ncp_conn *conn, /* struct nw_info_struct2 */ void* target, size_t sizeoftarget, u_int8_t* oc_action, u_int8_t* oc_callback, - char file_handle[6]) + unsigned char file_handle[6]) { NWCCODE result; u_int32_t fhandle; @@ -3484,10 +3486,10 @@ ncp_get_mount_volume_list_compat(struct ncp_conn *conn, unsigned int *itemcnt, void* b, size_t* blen) { unsigned int vol; - unsigned char* buffer = b; + char* buffer = b; unsigned int items = 0; size_t needSize; - unsigned char* bend = buffer + *blen; + char* bend = buffer + *blen; if (flags & 1) { needSize = 4 + 1 + 17; @@ -3527,7 +3529,7 @@ ncp_get_mount_volume_list_compat(struct ncp_conn *conn, return NWE_SERVER_FAILURE; } *itemcnt = items; - *blen = buffer - (unsigned char*)b; + *blen = buffer - (char*)b; return 0; } @@ -3667,7 +3669,7 @@ ncp_volume_list_next(NWVOL_HANDLE h, unsigned int itemcnt; unsigned char buffer[1024]; size_t blen = sizeof(buffer); - char* b; + unsigned char* b; if (h->err) { result = h->err; @@ -3696,7 +3698,7 @@ ncp_volume_list_next(NWVOL_HANDLE h, } /* let's build buffer */ - b = (char*)malloc(blen); + b = malloc(blen); if (!b) { result = ENOMEM; goto quit; @@ -4018,7 +4020,7 @@ ncp_ns_search_end(NWDIRLIST_HANDLE h) { static NWCCODE ncp_get_file_size_32( NWCONN_HANDLE conn, - const char fileHandle[6], + const unsigned char fileHandle[6], ncp_off64_t* fileSize) { NWCCODE result; @@ -4069,7 +4071,7 @@ static NWCCODE ncp_get_file_size_64( NWCCODE ncp_get_file_size( NWCONN_HANDLE conn, - const char fileHandle[6], + const unsigned char fileHandle[6], ncp_off64_t* fileSize) { NWCCODE result; diff --git a/lib/fs/filelock.c b/lib/fs/filelock.c index 06d6215..bef60e2 100644 --- a/lib/fs/filelock.c +++ b/lib/fs/filelock.c @@ -29,7 +29,7 @@ #include #include -static NWCCODE ncp_log_physical_record32(NWCONN_HANDLE conn, const char fh[6], +static NWCCODE ncp_log_physical_record32(NWCONN_HANDLE conn, const unsigned char fh[6], u_int32_t startOffset, u_int32_t length, unsigned int flags, unsigned int timeout) { NWCCODE err; @@ -62,7 +62,7 @@ static NWCCODE ncp_log_physical_record64(NWCONN_HANDLE conn, u_int32_t fh, return err; } -NWCCODE ncp_log_physical_record(NWCONN_HANDLE conn, const char file_handle[6], +NWCCODE ncp_log_physical_record(NWCONN_HANDLE conn, const unsigned char file_handle[6], ncp_off64_t startOffset, u_int64_t length, unsigned int flags, unsigned int timeout) { NWCCODE err; @@ -93,7 +93,7 @@ NWCCODE ncp_log_physical_record(NWCONN_HANDLE conn, const char file_handle[6], } -static NWCCODE ncp_clear_release_physical_record32(NWCONN_HANDLE conn, const char fh[6], +static NWCCODE ncp_clear_release_physical_record32(NWCONN_HANDLE conn, const unsigned char fh[6], u_int32_t startOffset, u_int32_t length, int release) { NWCCODE err; @@ -128,7 +128,7 @@ static NWCCODE ncp_clear_release_physical_record64(NWCONN_HANDLE conn, u_int32_t return err; } -static NWCCODE ncp_clear_release_physical_record(NWCONN_HANDLE conn, const char file_handle[6], +static NWCCODE ncp_clear_release_physical_record(NWCONN_HANDLE conn, const unsigned char file_handle[6], ncp_off64_t startOffset, u_int64_t length, int release) { NWCCODE err; @@ -154,12 +154,12 @@ static NWCCODE ncp_clear_release_physical_record(NWCONN_HANDLE conn, const char return err; } -NWCCODE ncp_clear_physical_record(NWCONN_HANDLE conn, const char file_handle[6], +NWCCODE ncp_clear_physical_record(NWCONN_HANDLE conn, const unsigned char file_handle[6], ncp_off64_t startOffset, u_int64_t length) { return ncp_clear_release_physical_record(conn, file_handle, startOffset, length, 0); } -NWCCODE ncp_release_physical_record(NWCONN_HANDLE conn, const char file_handle[6], +NWCCODE ncp_release_physical_record(NWCONN_HANDLE conn, const unsigned char file_handle[6], ncp_off64_t startOffset, u_int64_t length) { return ncp_clear_release_physical_record(conn, file_handle, startOffset, length, 1); } diff --git a/lib/ncplib.c b/lib/ncplib.c index ff0a0bc..8192e3b 100644 --- a/lib/ncplib.c +++ b/lib/ncplib.c @@ -216,10 +216,10 @@ ncp_negotiate_size_and_options(struct ncp_conn *conn, #endif static long - ncp_login_object(struct ncp_conn *conn, - const unsigned char *username, +ncp_login_object(struct ncp_conn *conn, + const char *username, int login_type, - const unsigned char *password); + const char *password); static long ncp_do_close(struct ncp_conn *conn); @@ -666,7 +666,7 @@ static void run_wdog(struct ncp_conn *conn, int fd) { if (pfd[0].revents & POLLIN) { struct sockaddr_ipx sender; int sizeofaddr = sizeof(struct sockaddr_ipx); - char buf[1024]; + unsigned char buf[1024]; size_t pktsize; NWCCODE err; @@ -1294,7 +1294,7 @@ ncp_connect_ipx_addr(struct ncp_conn *conn, const struct sockaddr_ipx *target, int ncp_sock, wdog_sock; long err; - conn->ncp_reply_buffer = (char*)malloc(NCP_PACKET_SIZE); + conn->ncp_reply_buffer = malloc(NCP_PACKET_SIZE); if (!conn->ncp_reply_buffer) { return ENOMEM; } @@ -1397,7 +1397,7 @@ ncp_connect_in_addr(struct ncp_conn *conn, const struct sockaddr_in *target, int ncp_sock; long err; - conn->ncp_reply_buffer = (char*)malloc(NCP_PACKET_SIZE); + conn->ncp_reply_buffer = malloc(NCP_PACKET_SIZE); if (!conn->ncp_reply_buffer) { return ENOMEM; } @@ -2444,6 +2444,30 @@ ncp_find_conn_spec(const char *server, const char *user, const char *password, uid, 0, err); } +static int +ncp_init_get_argument(int *argc, char **argv, int arg_no, const char **target) +{ + int count = 1; + + if (target != NULL) { + if (arg_no + 1 >= *argc) { + /* No argument to switch */ + errno = EINVAL; + return -1; + } + *target = argv[arg_no + 1]; + count = 2; + } + /* Delete the consumed switch from the argument list + and decrement the argument count */ + while (count + arg_no < *argc) { + argv[arg_no] = argv[arg_no + count]; + arg_no += 1; + } + *argc -= count; + return 0; +} + struct ncp_conn * ncp_initialize_2(int *argc, char **argv, int login_necessary, int login_type, long *err, int required) @@ -2457,28 +2481,6 @@ ncp_initialize_2(int *argc, char **argv, int login_necessary, int i = 1; NWCCODE nwerr; - static int get_argument(int arg_no, const char **target) { - int count = 1; - - if (target != NULL) { - if (arg_no + 1 >= *argc) { - /* No argument to switch */ - errno = EINVAL; - return -1; - } - *target = argv[arg_no + 1]; - count = 2; - } - /* Delete the consumed switch from the argument list - and decrement the argument count */ - while (count + arg_no < *argc) { - argv[arg_no] = argv[arg_no + count]; - arg_no += 1; - } - *argc -= count; - return 0; - } - *err = EINVAL; while (i < *argc) { @@ -2489,17 +2491,17 @@ ncp_initialize_2(int *argc, char **argv, int login_necessary, } switch (argv[i][1]) { case 'S': - if (get_argument(i, &server) != 0) { + if (ncp_init_get_argument(argc, argv, i, &server) != 0) { return NULL; } continue; case 'U': - if (get_argument(i, &user) != 0) { + if (ncp_init_get_argument(argc, argv, i, &user) != 0) { return NULL; } continue; case 'P': - if (get_argument(i, &password) != 0) { + if (ncp_init_get_argument(argc, argv, i, &password) != 0) { return NULL; } if (password) { @@ -2509,14 +2511,14 @@ ncp_initialize_2(int *argc, char **argv, int login_necessary, } continue; case 'n': - if (get_argument(i, NULL) != 0) { + if (ncp_init_get_argument(argc, argv, i, NULL) != 0) { return NULL; } password = NWC_NOPASSWORD; continue; #ifdef NDS_SUPPORT case 'b': - if (get_argument(i, NULL) != 0) { + if (ncp_init_get_argument(argc, argv, i, NULL) != 0) { return NULL; } bindery_only = 1; @@ -2524,7 +2526,7 @@ ncp_initialize_2(int *argc, char **argv, int login_necessary, #endif #ifdef CONFIG_NATIVE_IP case 'A': - if (get_argument(i, &address) != 0) { + if (ncp_init_get_argument(argc, argv, i, &address) != 0) { return NULL; } continue; @@ -3036,7 +3038,7 @@ ncp_send_broadcast2(struct ncp_conn *conn, */ long ncp_get_encryption_key(struct ncp_conn *conn, - char *target) + unsigned char *target) { NW_FRAGMENT rp; NWCCODE err; @@ -3529,7 +3531,7 @@ static long ncp_keyed_verify_password(struct ncp_conn *conn, const struct ncp_bindery_object *object, const unsigned char *key, - const unsigned char *passwd) + const char *passwd) { dword tmpID = htonl(object->object_id); unsigned char buf[128]; @@ -3599,7 +3601,7 @@ long ncp_login_encrypted(struct ncp_conn *conn, const struct ncp_bindery_object *object, const unsigned char *key, - const unsigned char *passwd) + const char *passwd) { dword tmpID; unsigned char buf[128]; @@ -3642,7 +3644,7 @@ ncp_login_encrypted(struct ncp_conn *conn, long ncp_login_unencrypted(struct ncp_conn *conn, NWObjectType object_type, const char *object_name, - const unsigned char *passwd) + const char *passwd) { long result; @@ -3669,8 +3671,8 @@ long ncp_change_login_passwd(struct ncp_conn *conn, const struct ncp_bindery_object *object, const unsigned char *key, - const unsigned char *oldpasswd, - const unsigned char *newpasswd) + const char *oldpasswd, + const char *newpasswd) { long id; unsigned char cryptkey[8]; @@ -3687,8 +3689,8 @@ ncp_change_login_passwd(struct ncp_conn *conn, shuffle((byte *) & id, oldpasswd, strlen(oldpasswd), oldpwd); shuffle((byte *) & id, newpasswd, strlen(newpasswd), newpwd); nw_encrypt(cryptkey, oldpwd, cryptkey); - newpassencrypt(oldpwd, newpwd, newpwd); - newpassencrypt(oldpwd + 8, newpwd + 8, newpwd + 8); + newpassencrypt(oldpwd, newpwd); + newpassencrypt(oldpwd + 8, newpwd + 8); if ((len = strlen(newpasswd)) > 63) { len = 63; } @@ -3707,17 +3709,17 @@ ncp_change_login_passwd(struct ncp_conn *conn, long ncp_login_user(struct ncp_conn *conn, - const unsigned char *username, - const unsigned char *password) + const char *username, + const char *password) { return ncp_login_object(conn, username, NCP_BINDERY_USER, password); } static long ncp_login_object(struct ncp_conn *conn, - const unsigned char *username, + const char *username, int login_type, - const unsigned char *password) + const char *password) { long result; unsigned char ncp_key[8]; @@ -3790,10 +3792,10 @@ ncp_sign_stop(UNUSED(NWCONN_HANDLE conn)) } long -ncp_sign_start(struct ncp_conn *conn, const char *sign_root) +ncp_sign_start(struct ncp_conn *conn, const unsigned char *sign_root) { #ifdef SIGNATURES - static const char init_last[16]= + static const unsigned char init_last[16]= {0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef, 0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10}; if (ncp_get_sign_wanted(conn)) { @@ -3829,8 +3831,8 @@ ncp_sign_start(struct ncp_conn *conn, const char *sign_root) long ncp_send_nds_frag(struct ncp_conn *conn, int ndsverb, - const char *inbuf, size_t inbuflen, - char *outbuf, size_t outbufsize, size_t *outbuflen) + const void *iinbuf, size_t inbuflen, + void *ioutbuf, size_t outbufsize, size_t *outbuflen) { long result; size_t sizeleft, i; @@ -3841,6 +3843,8 @@ ncp_send_nds_frag(struct ncp_conn *conn, int32_t ndsCode = -399; size_t replyLen = 0; size_t fragLen; + const nuint8* inbuf = iinbuf; + nuint8* outbuf = ioutbuf; if (inbuflen && !inbuf) { return ERR_NULL_POINTER; diff --git a/lib/ncplib_i.h b/lib/ncplib_i.h index c168f95..0accd69 100644 --- a/lib/ncplib_i.h +++ b/lib/ncplib_i.h @@ -110,7 +110,7 @@ struct ncp_conn { int conn_status; /* Fields used to setup ncp requests */ - char *current_point; + unsigned char *current_point; int has_subfunction; int verbose; size_t ncp_reply_size; @@ -120,9 +120,9 @@ struct ncp_conn { int lock; - char packet[NCP_PACKET_SIZE]; - char *ncp_reply; - char *ncp_reply_buffer; + unsigned char packet[NCP_PACKET_SIZE]; + unsigned char *ncp_reply; + unsigned char *ncp_reply_buffer; size_t ncp_reply_alloc; /* Field used to make packet signatures */ @@ -244,7 +244,7 @@ static inline int ncp_add_seek(struct ncp_conn *conn, int pos) { void ncp_add_pstring(struct ncp_conn *conn, const char *s); -static inline char* ncp_reply_data(struct ncp_conn *conn, int offset) { +static inline unsigned char* ncp_reply_data(struct ncp_conn *conn, int offset) { return conn->ncp_reply + sizeof(struct ncp_reply_header) + offset; } @@ -284,21 +284,21 @@ static inline unsigned int min(unsigned int a, unsigned int b) { return (a < b) ? a : b; } -static inline void ConvertToNWfromDWORD(u_int32_t sfd, char nwhandle[6]) { +static inline void ConvertToNWfromDWORD(u_int32_t sfd, unsigned char nwhandle[6]) { DSET_LH(nwhandle, 2, sfd); WSET_LH(nwhandle, 0, sfd+1); } -static inline u_int32_t ConvertToDWORDfromNW(const char nwhandle[6]) { +static inline u_int32_t ConvertToDWORDfromNW(const unsigned char nwhandle[6]) { return DVAL_LH(nwhandle, 2); } void ncp_init_request(struct ncp_conn *conn); void ncp_init_request_s(struct ncp_conn *conn, int subfunction); -long ncp_sign_start(struct ncp_conn *conn, const char *sign_root); +long ncp_sign_start(struct ncp_conn *conn, const unsigned char *sign_root); -void shuffle(const unsigned char *objid, const unsigned char *pwd, int buflen, unsigned char *out); +void shuffle(const unsigned char *objid, const void *pwd, size_t buflen, unsigned char *out); NWCCODE ncp_set_private_key(struct ncp_conn *conn, const void* pk, size_t pk_len); NWCCODE ncp_get_private_key(struct ncp_conn *conn, void* pk, size_t* pk_len); diff --git a/lib/ncpsign.c b/lib/ncpsign.c index bb4d30f..8c582a4 100644 --- a/lib/ncpsign.c +++ b/lib/ncpsign.c @@ -44,12 +44,12 @@ #define min(a,b) ((a)<(b)?(a):(b)) -static void nwsign(const char r_data1[16], char r_data2[64], char outdata[16]) { +static void nwsign(const unsigned char r_data1[16], unsigned char r_data2[64], unsigned char outdata[16]) { int i; unsigned int w0,w1,w2,w3; static int rbit[4]={0, 2, 1, 3}; #ifdef __i386__ - unsigned int *data2=(int *)r_data2; + unsigned int *data2=(unsigned int *)r_data2; #else unsigned int data2[16]; for (i=0;i<16;i++) @@ -92,7 +92,7 @@ void sign_init(const unsigned char *logindata, unsigned char *sign_root) { static const unsigned char initlast[16] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}; - static const unsigned char *initdata = "Authorized NetWare Client"; + static const unsigned char initdata[] = "Authorized NetWare Client"; unsigned char msg[64]; unsigned char hash[16]; diff --git a/lib/ndscrypt.c b/lib/ndscrypt.c index 76e7cc1..f52956e 100644 --- a/lib/ndscrypt.c +++ b/lib/ndscrypt.c @@ -111,7 +111,7 @@ static unsigned char nwhashdata[256] = 0x4C,0xFF,0x43,0xAB}; -void nwencrypt(const unsigned short *cryptbuf, const char *in, char *out) { +void nwencrypt(const unsigned short *cryptbuf, const unsigned char *in, unsigned char *out) { int i, j; register unsigned int i1, i2, i3, i4; const unsigned short *p; @@ -141,7 +141,7 @@ void nwencrypt(const unsigned short *cryptbuf, const char *in, char *out) { WSET_LH(out, 6, i4); } -void nwdecrypt(const unsigned short *cryptbuf, const char *in, char *out) { +void nwdecrypt(const unsigned short *cryptbuf, const unsigned char *in, unsigned char *out) { int i, j; const unsigned short *p; register unsigned int i1, i2, i3, i4; @@ -171,26 +171,25 @@ void nwdecrypt(const unsigned short *cryptbuf, const char *in, char *out) { WSET_LH(out, 6, i4); } -void nwcryptinit(unsigned short *scryptbuf, const char *key) { +void nwcryptinit(unsigned short *scryptbuf, const unsigned char *key) { int i; unsigned char cryptbuf[128], *p; memcpy(cryptbuf, key, 8); for (i = 0; i < 120; i++) cryptbuf[i + 8] = - nwcryptdata[(unsigned char)(cryptbuf[i] + cryptbuf[i + 7]) & 255]; - cryptbuf[128 - 8] = nwcryptdata[(unsigned char)cryptbuf[128 - 8] & 255]; + nwcryptdata[(cryptbuf[i] + cryptbuf[i + 7]) & 255]; + cryptbuf[128 - 8] = nwcryptdata[cryptbuf[128 - 8]]; for (i = 127 - 8; i >= 0; i--) - cryptbuf[i] = nwcryptdata[(unsigned char)cryptbuf[i + 1] ^ - (unsigned char)cryptbuf[i + 8]]; + cryptbuf[i] = nwcryptdata[cryptbuf[i + 1] ^ cryptbuf[i + 8]]; for (i = 0, p = cryptbuf; i < 64; i++, p += 2) scryptbuf[i] = (*p) | (*(p+1)) << 8; } -void nwencryptblock(const char *cryptkey, const char *buf, int buflen, - char *outbuf) { +void nwencryptblock(const unsigned char *cryptkey, const unsigned char *buf, int buflen, + unsigned char *outbuf) { int i; - char nhash[8]; + unsigned char nhash[8]; unsigned short cryptbuf[64]; nwcryptinit(cryptbuf, cryptkey); @@ -206,10 +205,10 @@ void nwencryptblock(const char *cryptkey, const char *buf, int buflen, memset(cryptbuf, 0, sizeof(cryptbuf)); } -void nwdecryptblock(const char *cryptkey, const char *buf, int buflen, - char *outbuf) { +void nwdecryptblock(const unsigned char *cryptkey, const unsigned char *buf, int buflen, + unsigned char *outbuf) { int i; - char nhash[16], *p; + unsigned char nhash[16], *p; unsigned short cryptbuf[64]; nwcryptinit(cryptbuf, cryptkey); @@ -227,30 +226,30 @@ void nwdecryptblock(const char *cryptkey, const char *buf, int buflen, memset(cryptbuf, 0, sizeof(cryptbuf)); } -void nwhash1(char *hash, int hashlen, const char *data, int datalen) { +void nwhash1(unsigned char *hash, int hashlen, const unsigned char *data, int datalen) { unsigned char *hp, *hp1, *hend, c; const unsigned char *dp; - hp1 = (hp = (unsigned char *)hash) + 1; + hp1 = (hp = hash) + 1; hend = hp + hashlen; - dp = (const unsigned char *)data; + dp = data; while (datalen--) { *hp = nwhashdata[*hp1 ^ *hp] ^ *dp++; hp = hp1++; if (hp1 == hend) - hp1 = (unsigned char *)hash; + hp1 = hash; } - while (hp-- > (unsigned char *)hash) { - hp1 = (unsigned char *)hash; + while (hp-- > hash) { + hp1 = hash; c = *hp1++; - while (*(hp1 - 1) = *hp1, ++hp1 < (unsigned char *)hash + hashlen); + while (*(hp1 - 1) = *hp1, ++hp1 < hash + hashlen); *(hp1 - 1) = c; } } -void nwhash2(char *hashbuf, char c) { +void nwhash2(unsigned char *hashbuf, unsigned char c) { int i, j; - char *p = hashbuf + hashbuf[0x40]; + unsigned char *p = hashbuf + hashbuf[0x40]; p[0x20] = p[0x00] ^ (p[0x10] = c); hashbuf[0x41] = (p[0x30] ^= nwhashdata[(unsigned char)(c ^ hashbuf[0x41])]); @@ -262,12 +261,12 @@ void nwhash2(char *hashbuf, char c) { } } -void nwhash2block(char *hashbuf, const char *data, int datalen) { +void nwhash2block(unsigned char *hashbuf, const unsigned char *data, size_t datalen) { while (datalen--) nwhash2(hashbuf, *data++); } -void nwhash2end(char *hashbuf) { +void nwhash2end(unsigned char *hashbuf) { int i, j; for(j = i = 16 - hashbuf[0x40]; j; j--) diff --git a/lib/ndscrypt.h b/lib/ndscrypt.h index 906135f..045e86a 100644 --- a/lib/ndscrypt.h +++ b/lib/ndscrypt.h @@ -22,20 +22,20 @@ #include -void nwencrypt(const unsigned short *cryptbuf, const char *in, char *out); -void nwdecrypt(const unsigned short *cryptbuf, const char *in, char *out); -void nwcryptinit(unsigned short *scryptbuf, const char *key); -void nwencryptblock(const char *cryptkey, const char *buf, int buflen, - char *outbuf); -void nwdecryptblock(const char *cryptkey, const char *buf, int buflen, - char *outbuf); +void nwencrypt(const unsigned short *cryptbuf, const unsigned char *in, unsigned char *out); +void nwdecrypt(const unsigned short *cryptbuf, const unsigned char *in, unsigned char *out); +void nwcryptinit(unsigned short *scryptbuf, const unsigned char *key); +void nwencryptblock(const unsigned char *cryptkey, const unsigned char *buf, int buflen, + unsigned char *outbuf); +void nwdecryptblock(const unsigned char *cryptkey, const unsigned char *buf, int buflen, + unsigned char *outbuf); #define nwhash1init(hash, hashlen) memset(hash, 0, hashlen) -void nwhash1(char *hash, int hashlen, const char *data, int datalen); +void nwhash1(unsigned char *hash, int hashlen, const unsigned char *data, int datalen); #define nwhash2init(hashbuf) memset(hashbuf, 0, 0x42) -void nwhash2(char *hashbuf, char c); -void nwhash2block(char *hashbuf, const char *data, int datalen); -void nwhash2end(char *hashbuf); +void nwhash2(unsigned char *hashbuf, unsigned char c); +void nwhash2block(unsigned char *hashbuf, const unsigned char *data, size_t datalen); +void nwhash2end(unsigned char *hashbuf); #endif /* _NDSCRYPT_H */ diff --git a/lib/ndslib.c b/lib/ndslib.c index aba6b28..5a18492 100644 --- a/lib/ndslib.c +++ b/lib/ndslib.c @@ -188,10 +188,10 @@ static char *g_rndp = global_randbuf + RANDBUFSIZE; static ncpt_mutex_t randbuflock = NCPT_MUTEX_INITIALIZER; -static void fillrandom(char *buf, int buflen) { +static void fillrandom(nuint8 *buf, size_t buflen) { ncpt_mutex_lock(&randbuflock); do { - int i; + size_t i; if (g_rndp == global_randbuf + RANDBUFSIZE) { int fh; @@ -206,7 +206,10 @@ static void fillrandom(char *buf, int buflen) { } g_rndp = global_randbuf; } - if ((i = RANDBUFSIZE - (g_rndp - global_randbuf)) > buflen) i = buflen; + i = RANDBUFSIZE - (g_rndp - global_randbuf); + if (i > buflen) { + i = buflen; + } memcpy(buf, g_rndp, i); buf += i; g_rndp += i; @@ -215,7 +218,7 @@ static void fillrandom(char *buf, int buflen) { ncpt_mutex_unlock(&randbuflock); } #else -static void fillrandom(char *buf, int buflen) { +static void fillrandom(nuint8 *buf, size_t buflen) { int fh; char *p; @@ -230,11 +233,11 @@ static void fillrandom(char *buf, int buflen) { } #endif -static int countbits_l(char *buf, int bufsize) { +static int countbits_l(unsigned char *buf, int bufsize) { unsigned char b; while ((--bufsize) && (!buf[bufsize])); - b = (unsigned char)buf[bufsize]; + b = buf[bufsize]; bufsize <<= 3; while (b) { b >>= 2; bufsize++; @@ -250,33 +253,33 @@ static void copyfill(void *outbuf, int outsize, const void *inbuf, int insize) { static char keyprefix[] = {1, 0, 0, 0, 3, 0, 1, 0}; -static int initkey(const char *key, char **keyptr, size_t *keylen) { /* 1=ok, 0=err */ +static int initkey(const unsigned char *key, unsigned char **keyptr, size_t *keylen) { /* 1=ok, 0=err */ if (!memcmp(key, keyprefix, 8)) { if (keylen) *keylen = WVAL_LH(key, 8); - if (keyptr) *keyptr = (char*)key + 10; + if (keyptr) *keyptr = key + 10; return 1; } else return 0; } -static void clearkey(char *key) { - char *keyptr; +static void clearkey(unsigned char *key) { + unsigned char *keyptr; size_t keylen; + if (initkey(key, &keyptr, &keylen)) memset(key, 0, keylen + 10); } -static int findchunk(const char *keyptr, int keylen, const char *chunk, - char **chunkptr) { - const char *p; +static int findchunk(const unsigned char *keyptr, size_t keylen, const char *chunk, unsigned char **chunkptr) { + const unsigned char *p; if ((p = keyptr)) { - while (p - keyptr < keylen) { - if ((p[0] != chunk[0]) || (p[1] != chunk[1])) - p += 4 + (unsigned char)p[2] + (unsigned char)p[3]; - else { - if (chunkptr) *chunkptr = (char*)p + 4; - return (unsigned char)p[2] + (unsigned char)p[3]; + while (p < keyptr + keylen) { + if ((p[0] != chunk[0]) || (p[1] != chunk[1])) { + p += 4 + p[2] + p[3]; + } else { + if (chunkptr) *chunkptr = (unsigned char*)p + 4; + return p[2] + p[3]; } } } @@ -327,9 +330,9 @@ static void dumpkey(const nuint8 *key, size_t keylen) { } #endif -static int checkkey(const char *key) { /* 0 - wrong key, != 0 - key ok */ - char temp[8]; - char *keyptr, *p; +static int checkkey(const unsigned char *key) { /* 0 - wrong key, != 0 - key ok */ + unsigned char temp[8]; + unsigned char *keyptr, *p; size_t keylen; if ((initkey(key, &keyptr, &keylen)) && @@ -346,13 +349,13 @@ static int checkkey(const char *key) { /* 0 - wrong key, != 0 - key ok */ static ncpt_mutex_t mpilock = NCPT_MUTEX_INITIALIZER; -static long modexpkey(const char *s_key, char *buf, char *outbuf, int bufsize) { - char *s_keyptr; +static long modexpkey(const unsigned char *s_key, unsigned char *buf, unsigned char *outbuf, int bufsize) { + unsigned char *s_keyptr; size_t s_keylen; int i, nbits, nblocksize; int err = -1; unitptr nmod, nexp, nin, nout; - char *p; + unsigned char *p; nmod = nexp = nin = nout = NULL; @@ -399,7 +402,7 @@ end1: /* ctx must be in WCHAR_T mode, without DCV_CANONICALIZE_NAMES */ static NWDSCCODE get_public_key(NWDSContextHandle ctx, const wchar_t* objname, nuint8 **key) { - char *keybuf, *kptr; + unsigned char *keybuf, *kptr; NWDSCCODE err; size_t keylen, ofs, klen; Octet_String_T* ost; @@ -434,7 +437,7 @@ static NWDSCCODE __AlignAndEncryptBlockWithSK( const nuint8* hash, const nuint8* idata, size_t ilen, - char* odata, + nuint8* odata, size_t* olen ) { size_t filler; @@ -472,7 +475,7 @@ NWDSCCODE __NWEncryptWithSK( for (i = 0; i < 10; i++) { nwhash1(hash, 8, hashsrc, hashsrclen); } - err = __AlignAndEncryptBlockWithSK(hash, idata, ilen, (char*)odata + 12, &len); + err = __AlignAndEncryptBlockWithSK(hash, idata, ilen, (nuint8*)odata + 12, &len); if (err) return err; *olen = len + 12; @@ -492,12 +495,12 @@ NWDSCCODE rsa_crypt2( Buf_T* output) { char hashrand[8], temp[8]; unsigned short cryptbuf[128]; - char buf2[56]; + nuint8 buf2[56]; NWDSCCODE err; void* data; size_t datalen; nuint8* outp; - char b2[28]; + nuint8 b2[28]; nuint8* ln1; nuint8* sp1; size_t outlen; @@ -904,7 +907,7 @@ NWDSCCODE __NWDSGetPrivateKey( p += 8; { - char* tb; + unsigned char* tb; if (!(tb = malloc(n3 + 10))) { err = ENOMEM; goto err_exit; @@ -951,9 +954,9 @@ static NWDSCCODE nds_beginauth2( NWCONN_HANDLE conn, NWObjectID user_id, nuint8 authid[4], - const char* s_key) { - char *p, *pend, *n_temp, temp[8], *k1end; - char randno[4]; + const nuint8* s_key) { + nuint8 *p, *pend, *n_temp, temp[8], *k1end; + nuint8 randno[4]; NWDSCCODE err; int n1, n3; u_int16_t n3a; @@ -1068,9 +1071,9 @@ err_exit: return err; } -static char *allocfillchunk(const char *keyptr, int keylen, +static unsigned char *allocfillchunk(const unsigned char *keyptr, int keylen, const char *chunk, int destsize) { - char *p, *p2; + unsigned char *p, *p2; int i; i = findchunk(keyptr, keylen, chunk, &p); @@ -1100,12 +1103,12 @@ static NWDSCCODE nds_beginauth( static NWDSCCODE gen_auth_data( Buf_T* outbuf, - const char *u_key, - const char *u_priv_key, + const unsigned char *u_key, + const unsigned char *u_priv_key, const nuint8* authid, - char *loginstrc, + nuint8 *loginstrc, int loginstrc_len) { - char *keyptr; + nuint8 *keyptr; size_t keylen; int i, j; int nbits, nblocksize, nbytes, nblocksize_nw; @@ -1114,9 +1117,9 @@ static NWDSCCODE gen_auth_data( unitptr n_key_dp, n_key_dq; unitptr up, up2; unitptr randbuf; - char *p; - char *tempbuf; - char hashbuf[0x42]; + nuint8 *p; + nuint8 *tempbuf; + nuint8 hashbuf[0x42]; NWDSCCODE err; n_temp = n_mod = n_exp = n_pn = n_qn = n_dp = n_dq = n_cr = n_key = NULL; @@ -1198,8 +1201,8 @@ static NWDSCCODE gen_auth_data( up = randbuf; up2 = (unitptr)(p + 12); for (i = 3; i; i--) { - fillrandom((char *)up, nbytes); - ((char *)up)[nbytes - 1] &= nmask; + fillrandom((nuint8 *)up, nbytes); + ((nuint8 *)up)[nbytes - 1] &= nmask; if (!(j = mp_compare(up, n_mod))) { mp_dec(up); } else if (j > 0) { @@ -1251,7 +1254,7 @@ NWDSCCODE NWDSAuthenticateConn( nuint8 authid[4]; NWDSCCODE err; size_t user_name_len; - char *loginstrc; + nuint8 *loginstrc; size_t loginstrc_len; nuint8 *u_key; Buf_T signbuf; @@ -1260,7 +1263,7 @@ NWDSCCODE NWDSAuthenticateConn( char keybuf_b[DEFAULT_MESSAGE_LEN]; wchar_t server_name[MAX_DN_CHARS+1]; NWObjectID user_id; - char signkey[8]; + unsigned char signkey[8]; wchar_t* w_user_name; nuint8* u_priv_key; nuint8* logindata; @@ -1363,7 +1366,7 @@ long nds_login_auth(struct ncp_conn *conn, const char *user, const char *pwd) { long err; wchar_t user_w[MAX_DN_CHARS+1]; - char *u_priv_key = NULL; + nuint8 *u_priv_key = NULL; wchar_t server_name[MAX_DN_CHARS+1]; NWCONN_HANDLE userconn = NULL; int i; diff --git a/lib/nwcrypt.c b/lib/nwcrypt.c index 27d079e..88d7c92 100644 --- a/lib/nwcrypt.c +++ b/lib/nwcrypt.c @@ -144,51 +144,46 @@ shuffle1(buf32 temp, unsigned char *target) void -shuffle(const unsigned char *lon, const unsigned char *buf, int buflen, +shuffle(const unsigned char *lon, const void *ibuf, size_t buflen, unsigned char *target) { - int b2, d, s; + size_t b2, d; + unsigned int s; buf32 temp; + const unsigned char* buf = ibuf; while ((buflen > 0) - && (buf[buflen - 1] == 0)) - { + && (buf[buflen - 1] == 0)) { buflen = buflen - 1; } - for (s = 0; s < 32; s++) - { + for (s = 0; s < 32; s++) { temp[s] = 0; } d = 0; - while (buflen >= 32) - { - for (s = 0; s <= 31; ++s) - { - temp[s] = temp[s] ^ buf[d]; + while (buflen >= 32) { + for (s = 0; s < 32; ++s) { + temp[s] ^= buf[d]; d = d + 1; } buflen = buflen - 32; } b2 = d; - if (buflen > 0) - { - for (s = 0; s <= 31; ++s) - { - if (d + buflen == b2) - { + if (buflen > 0) { + for (s = 0; s < 32; ++s) { + if (d + buflen == b2) { b2 = d; - temp[s] = temp[s] ^ encryptkeys[s]; - } else - { - temp[s] = temp[s] ^ buf[b2]; + temp[s] ^= encryptkeys[s]; + } else { + temp[s] ^= buf[b2]; b2 = b2 + 1; } } } - for (s = 0; s <= 31; ++s) - temp[s] = temp[s] ^ lon[s & 3]; + for (s = 0; s < 32; ++s) { + temp[s] ^= lon[s & 3]; + } shuffle1(temp, target); } @@ -200,16 +195,18 @@ nw_encrypt(const unsigned char *fra, unsigned char *til) { buf32 k; - int s; + unsigned int s; shuffle(&(fra[0]), buf, 16, &(k[0])); shuffle(&(fra[4]), buf, 16, &(k[16])); - for (s = 0; s <= 15; ++s) - k[s] = k[s] ^ k[31 - s]; + for (s = 0; s < 16; ++s) { + k[s] ^= k[31 - s]; + } - for (s = 0; s <= 7; ++s) + for (s = 0; s < 8; ++s) { til[s] = k[s] ^ k[15 - s]; + } } /*****************************************************************************/ @@ -230,8 +227,8 @@ nw_encrypt(const unsigned char *fra, old internal password) ^ (second byte of old internal password) */ -static char - newshuffle[256 + 16] = +static unsigned char + newshuffle[256] = { 0x0f, 0x08, 0x05, 0x07, 0x0c, 0x02, 0x0e, 0x09, 0x00, 0x01, 0x06, 0x0d, 0x03, 0x04, 0x0b, 0x0a, @@ -272,7 +269,9 @@ static char 0x0d, 0x0b, 0x0c, 0x02, 0x00, 0x0f, 0x06, 0x0a, 0x09, 0x0a, 0x0b, 0x0d, 0x05, 0x03, 0x0f, 0x00, 0x01, 0x0c, 0x08, 0x07, 0x06, 0x04, 0x0e, 0x02, +}; +static const unsigned char final_shuffle[16] = { 0x03, 0x0e, 0x0f, 0x02, 0x0d, 0x0c, 0x04, 0x05, 0x09, 0x06, 0x00, 0x01, 0x0b, 0x07, 0x0a, 0x08, }; @@ -303,17 +302,17 @@ static char */ static void -newpassencrypt(char *old, char *new, char *out) +newpassencrypt(unsigned char *old, unsigned char *npwd) { - char *p, *bx; - char copy[8]; - int i, di, ax; - char cl, dl, ch; + int i; - memcpy(copy, new, 8); + for (i = 0; i < 16; i++) { + int di, ax; + unsigned char *p, *bx; + unsigned char cl, dl, ch; + unsigned char copy[8]; - for (i = 0; i < 16; i++) - { + memcpy(copy, npwd, 8); for (di = 0, ax = 0, p = old; di < 8; di++, ax += 0x20, p++) { cl = newshuffle[(((copy[di] ^ *p) >> 4) & 0x0f) + ax + 0x10] << 4; @@ -328,17 +327,16 @@ newpassencrypt(char *old, char *new, char *out) } *old = ((ch >> 4) & 0x0f) | (*old) << 4; - memset(out, '\0', 8); + memset(npwd, 0, 8); for (di = 0; di < 16; di++) { - if (newshuffle[di + 0x100] & 1) - ch = ((copy[newshuffle[di + 0x100] / 2] >> 4) & 0x0f); + if (final_shuffle[di] & 1) + ch = ((copy[final_shuffle[di] / 2] >> 4) & 0x0f); else - ch = copy[newshuffle[di + 0x100] / 2] & 0x0f; - out[di / 2] |= ((di & 1) ? ch << 4 : ch); + ch = copy[final_shuffle[di] / 2] & 0x0f; + npwd[di / 2] |= ((di & 1) ? ch << 4 : ch); } - memcpy(copy, out, 8); } } diff --git a/lib/nwnet.c b/lib/nwnet.c index 24e1a68..77968d4 100644 --- a/lib/nwnet.c +++ b/lib/nwnet.c @@ -1205,7 +1205,7 @@ NWDSCCODE NWDSCreateContextHandle(NWDSContextHandle *ctx) { tmp->dck.rdn.depth = 0; tmp->dck.namectx = NULL; { - static const nuint32 t[] = { + static const NET_ADDRESS_TYPE t[] = { #ifdef NCP_IPX_SUPPORT NT_IPX, #endif @@ -1582,7 +1582,7 @@ void NWDSSetupBuf(Buf_T* buf, void* ptr, size_t len) { buf->cmdFlags = 0; buf->dsiFlags = 0; buf->data = buf->curPos = ptr; - buf->dataend = buf->allocend = (char*)ptr + len; + buf->dataend = buf->allocend = (unsigned char*)ptr + len; buf->operation = 0; buf->attrCountPtr = NULL; buf->valCountPtr = NULL; @@ -1947,7 +1947,7 @@ static NWDSCCODE NWDSXlateCtxToUni(NWDSContextHandle ctx, unicode* data, return err; if (val & DCV_XLATE_STRINGS) { NWDSCCODE err2; - const nuint8* srcEnd; + const char* srcEnd; ncpt_mutex_lock(&ctx->xlate.fromlock); __NWULocalInit(ctx->xlate.from); @@ -1957,7 +1957,7 @@ static NWDSCCODE NWDSXlateCtxToUni(NWDSContextHandle ctx, unicode* data, else ln = strlen(src) + 1; } - srcEnd = (const nuint8*)src + ln; + srcEnd = (const char*)src + ln; do { wchar_t tbuff[128]; wchar_t* tEnd; @@ -3760,7 +3760,7 @@ NWDSCCODE NWDSGetObjectNameAndInfo( return ERR_BAD_VERB; } if (info) - *info = buffer->curPos; + *info = (char*)buffer->curPos; dsiflags = buffer->dsiFlags; if (dsiflags & DSI_OUTPUT_FIELDS) { err = NWDSBufGetLE32(buffer, &dsiflags); diff --git a/lib/o_ndslib.c b/lib/o_ndslib.c index 42a1de0..208d4d8 100644 --- a/lib/o_ndslib.c +++ b/lib/o_ndslib.c @@ -150,13 +150,14 @@ long nds_resolve_name(struct ncp_conn *conn, int flags, uni_char *entry_name, case DS_RESOLVE_REPLY_REMOTE_ENTRY: { NWObjectID ID; + nuint32 dummy; err = NWDSBufGetID(rp, &ID); if (err) goto q_buf; if (entry_id) *entry_id = ID; - err = NWDSBufGetLE32(rp, &flags); + err = NWDSBufGetLE32(rp, &dummy); if (err) goto q_buf; if (remote) diff --git a/sutil/ncpm_common.h b/sutil/ncpm_common.h index e4fbd2a..f2895d0 100644 --- a/sutil/ncpm_common.h +++ b/sutil/ncpm_common.h @@ -34,9 +34,9 @@ struct ncp_mount_data_independent { int message_fd; uid_t mounted_uid; struct sockaddr_ipx serv_addr; - unsigned char *server_name; - unsigned char *mount_point; - const unsigned char *mounted_vol; + char *server_name; + char *mount_point; + const char *mounted_vol; unsigned int time_out; unsigned int retry_count; struct { diff --git a/sutil/ncpmount.h b/sutil/ncpmount.h index f5fc077..fb6f626 100644 --- a/sutil/ncpmount.h +++ b/sutil/ncpmount.h @@ -30,10 +30,10 @@ struct ncp_mount_data_v2 { __ker20_uid_t mounted_uid; /* Who may umount() this filesystem? */ struct sockaddr_ipx serv_addr; - unsigned char server_name[NCP_BINDERY_NAME_LEN]; + char server_name[NCP_BINDERY_NAME_LEN]; - unsigned char mount_point[PATH_MAX_V20+1]; - unsigned char mounted_vol[NCP_VOLNAME_LEN+1]; + char mount_point[PATH_MAX_V20+1]; + char mounted_vol[NCP_VOLNAME_LEN+1]; unsigned int time_out; /* How long should I wait after sending a NCP request? */ @@ -64,7 +64,7 @@ struct ncp_mount_data_v3 { __ker21_uid_t mounted_uid; /* Who may umount() this filesystem? */ __ker21_pid_t wdog_pid; /* Who cares for our watchdog packets? */ - unsigned char mounted_vol[NCP_VOLNAME_LEN + 1]; + char mounted_vol[NCP_VOLNAME_LEN + 1]; unsigned int time_out; /* How long should I wait after sending a NCP request? */ unsigned int retry_count; /* And how often should I retry? */ diff --git a/util/ncopy.c b/util/ncopy.c index 05dce9c..6fdd64f 100644 --- a/util/ncopy.c +++ b/util/ncopy.c @@ -532,10 +532,13 @@ dstDetermined:; ncopy = 1; } } else { - err = NWCCGetConnInfo(scon, NWCC_INFO_SERVER_NAME, sizeof(saddr), saddr); - if (!err) err = NWCCGetConnInfo(dcon, NWCC_INFO_SERVER_NAME, sizeof(daddr), daddr); + char saddrs[100]; + char daddrs[100]; + + err = NWCCGetConnInfo(scon, NWCC_INFO_SERVER_NAME, sizeof(saddrs), saddrs); + if (!err) err = NWCCGetConnInfo(dcon, NWCC_INFO_SERVER_NAME, sizeof(daddrs), daddrs); if (!err) { - ncopy = !strcmp(saddr, daddr); + ncopy = !strcmp(saddrs, daddrs); } } if (ncopy) { diff --git a/util/nwbpvalues.c b/util/nwbpvalues.c index 7367b66..e688311 100644 --- a/util/nwbpvalues.c +++ b/util/nwbpvalues.c @@ -44,7 +44,7 @@ static char *progname; static void - print_property(char *prop_name, u_int8_t * val, int segments); +print_property(char *prop_name, const u_int8_t * val, int segments); static void usage(void) @@ -265,7 +265,7 @@ main(int argc, char *argv[]) } static void -print_unknown(u_int8_t * val) +print_unknown(const u_int8_t * val) { int j = (128 / 16); while (1) @@ -292,9 +292,9 @@ print_unknown(u_int8_t * val) } static void -print_string(u_int8_t * val, int segments) +print_string(const u_int8_t * val, int segments) { - puts(val); + puts((const char*)val); (void)segments; } @@ -351,12 +351,12 @@ static inline size_t my_strftime(char *s, size_t max, const char *fmt, const str static void -print_login_control(u_int8_t * val, int segments) +print_login_control(const u_int8_t * val, int segments) { static const time_t zero_time_t = 0; int i, j, mask; char buff[32]; - struct ncp_prop_login_control *a = (struct ncp_prop_login_control *) val; + const struct ncp_prop_login_control *a = (const struct ncp_prop_login_control *) val; if (a->LastLogin[2] || a->LastLogin[1] || a->LastLogin[0] || a->LastLogin[3] || a->LastLogin[4] || a->LastLogin[5]) @@ -495,17 +495,17 @@ print_login_control(u_int8_t * val, int segments) } static void -print_addr(u_int8_t * val, int segments) +print_addr(const u_int8_t * val, int segments) { char buff[50]; print_station_addr("(%L): %N[%S]", - (struct ncp_station_addr *) val, buff); + (const struct ncp_station_addr *) val, buff); printf("%s\n", buff); (void)segments; } static void -print_hex(u_int8_t *val, int segments) { +print_hex(const u_int8_t *val, int segments) { int i; for (i = 0; i < segments; i++) { @@ -517,7 +517,7 @@ print_hex(u_int8_t *val, int segments) { static const struct { - void (*func) (u_int8_t *, int); + void (*func)(const u_int8_t *, int); const char *pname; } formats[] = @@ -534,7 +534,7 @@ formats[] = }; static void -print_property(char *prop_name, u_int8_t * val, int segments) +print_property(char *prop_name, const u_int8_t * val, int segments) { int i; diff --git a/util/nwpasswd.c b/util/nwpasswd.c index 1a40cb0..0859660 100644 --- a/util/nwpasswd.c +++ b/util/nwpasswd.c @@ -65,7 +65,7 @@ main(int argc, char *argv[]) int object_type = NCP_BINDERY_USER; unsigned char ncp_key[8]; struct ncp_bindery_object user; - unsigned char buf_obj_name[50]; + char *buf_obj_name; long err; char *str; @@ -113,12 +113,14 @@ main(int argc, char *argv[]) com_err(argv[0], err, _("trying to find server")); exit(1); } - if (!object_name) - { + if (!object_name) { object_name = spec.user; - } else - { - strcpy(buf_obj_name, object_name); + } else { + buf_obj_name = strdup(object_name); + if (!buf_obj_name) { + fprintf(stderr, _("%s: Out of memory!\n"), progname); + exit(1); + } object_name = buf_obj_name; str_upper(object_name); } diff --git a/util/nwpjmv.c b/util/nwpjmv.c index 96b7e6b..417e16f 100644 --- a/util/nwpjmv.c +++ b/util/nwpjmv.c @@ -124,6 +124,16 @@ init_queue(struct ncp_conn *conn, char *queue_name, char *command, } +static char* +add_string(char *target, char *target_end, const char *str) { + size_t len = strlen(str); + if (target + len + 1 > target_end) { + len = target_end - target - 1; + } + memcpy(target, str, len); + return target + len; +} + static void build_command(struct nw_queue *q, struct queue_job *j, char *target, int target_size, char *user) @@ -131,26 +141,12 @@ build_command(struct nw_queue *q, struct queue_job *j, char *s = q->command; char *target_end = target + target_size; - static void add_string(const char *str) - { - int len = strlen(str); - if (target + len + 1 > target_end) - { - len = target_end - target - 1; - } - strncpy(target, str, len); - target += len; - } - memset(target, 0, target_size); while ((*s != 0) && (target < target_end)) { - if (*s != '%') - { - *target = *s; - target += 1; - s += 1; + if (*s != '%') { + *target++ = *s++; continue; } switch (*(s + 1)) @@ -160,13 +156,13 @@ build_command(struct nw_queue *q, struct queue_job *j, target += 1; break; case 'u': - add_string(user); + target = add_string(target, target_end, user); break; case 'd': if (j->j.JobTextDescription[0]) - add_string(j->j.JobTextDescription); + target = add_string(target, target_end, j->j.JobTextDescription); else - add_string(_("No Description")); + target = add_string(target, target_end, _("No Description")); break; default: *target = '%'; diff --git a/util/nwsalvage.c b/util/nwsalvage.c index e24ece2..cc64729 100644 --- a/util/nwsalvage.c +++ b/util/nwsalvage.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "private/libintl.h" #define _(X) gettext(X) diff --git a/util/pserver.c b/util/pserver.c index 47097a0..20090ea 100644 --- a/util/pserver.c +++ b/util/pserver.c @@ -146,49 +146,44 @@ init_queue(struct ncp_conn *conn, char *queue_name, char *command, } +static char* +add_string(char* target, char* target_end, const char *str) { + size_t len = strlen(str); + + if (target + len + 1 > target_end) { + len = target_end - target - 1; + } + memcpy(target, str, len); + return target + len; +} + static void build_command(struct nw_queue *q, struct queue_job *j, - char *target, int target_size, char *user) + char *target, size_t target_size, char *user) { char *s = q->command; char *target_end = target + target_size; - static void add_string(const char *str) - { - int len = strlen(str); - if (target + len + 1 > target_end) - { - len = target_end - target - 1; - } - strncpy(target, str, len); - target += len; - } - memset(target, 0, target_size); while ((*s != 0) && (target < target_end)) { - if (*s != '%') - { - *target = *s; - target += 1; - s += 1; + if (*s != '%') { + *target++ = *s++; continue; } - switch (*(s + 1)) - { + switch (*(s + 1)) { case '%': - *target = '%'; - target += 1; + *target++ = '%'; break; case 'u': - add_string(user); + target = add_string(target, target_end, user); break; case 'd': if (j->j.JobTextDescription[0]) - add_string(j->j.JobTextDescription); + target = add_string(target, target_end, j->j.JobTextDescription); else - add_string(_("No Description")); + target = add_string(target, target_end, _("No Description")); break; default: *target = '%';