diff options
author | Andrew Tridgell <tridge@samba.org> | 2001-07-04 07:15:53 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2001-07-04 07:15:53 +0000 |
commit | 87fbb7092b8f8b2f0db0f361c3d625e19de57cd9 (patch) | |
tree | 3c302f710cbaa03e3c0d46549e8982771b12b8a5 /source3 | |
parent | 9e9e73303ec10a64bd744b9b33f4e6cd7d394f03 (diff) | |
download | samba-87fbb7092b8f8b2f0db0f361c3d625e19de57cd9.tar.gz samba-87fbb7092b8f8b2f0db0f361c3d625e19de57cd9.tar.bz2 samba-87fbb7092b8f8b2f0db0f361c3d625e19de57cd9.zip |
The big character set handling changeover!
This commit gets rid of all our old codepage handling and replaces it with
iconv. All internal strings in Samba are now in "unix" charset, which may
be multi-byte. See internals.doc and my posting to samba-technical for
a more complete explanation.
(This used to be commit debb471267960e56005a741817ebd227ecfc512a)
Diffstat (limited to 'source3')
133 files changed, 2412 insertions, 8860 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index b44e3cabf1..6aec0df336 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -72,7 +72,7 @@ CODEPAGELIST= 437 737 775 850 852 861 932 866 949 950 936 1251 ISO8859-1 ISO8859 PASSWD_FLAGS = -DPASSWD_PROGRAM=\"$(PASSWD_PROGRAM)\" -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" -DPRIVATE_DIR=\"$(PRIVATE_DIR)\" FLAGS1 = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper $(CPPFLAGS) -DLOGFILEBASE=\"$(LOGFILEBASE)\" FLAGS2 = -DCONFIGFILE=\"$(CONFIGFILE)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" -FLAGS3 = -DSWATDIR=\"$(SWATDIR)\" -DSBINDIR=\"$(SBINDIR)\" -DLOCKDIR=\"$(LOCKDIR)\" -DCODEPAGEDIR=\"$(CODEPAGEDIR)\" +FLAGS3 = -DSWATDIR=\"$(SWATDIR)\" -DSBINDIR=\"$(SBINDIR)\" -DLOCKDIR=\"$(LOCKDIR)\" FLAGS4 = -DDRIVERFILE=\"$(DRIVERFILE)\" -DBINDIR=\"$(BINDIR)\" -DFORMSFILE=\"$(FORMSFILE)\" -DNTDRIVERSDIR=\"$(NTDRIVERSDIR)\" FLAGS5 = $(FLAGS1) $(FLAGS2) $(FLAGS3) $(FLAGS4) -DHAVE_INCLUDES_H FLAGS = $(ISA) $(FLAGS5) $(PASSWD_FLAGS) @@ -80,7 +80,7 @@ FLAGS32 = $(ISA32) $(FLAGS5) $(PASSWD_FLAGS) SPROGS = bin/smbd bin/nmbd bin/swat PROGS1 = bin/smbclient bin/smbspool bin/testparm bin/testprns bin/smbstatus bin/smbcontrol @RUNPROG@ -PROGS2 = bin/smbpasswd bin/make_smbcodepage bin/make_unicodemap bin/rpcclient bin/smbcacls @WRAP@ @WRAP32@ @PAM_MOD@ +PROGS2 = bin/smbpasswd bin/rpcclient bin/smbcacls @WRAP@ @WRAP32@ @PAM_MOD@ MPROGS = @MPROGS@ WINBIND_PROGS = nsswitch/libnss_winbind.so bin/winbindd bin/wbinfo WINBIND_PAM_PROGS = nsswitch/pam_winbind.so @@ -98,10 +98,10 @@ QUOTAOBJS=@QUOTAOBJS@ TDB_OBJ = tdb/tdb.o tdb/spinlock.o tdb/tdbutil.o -LIB_OBJ = lib/charcnv.o lib/charset.o lib/debug.o lib/fault.o \ - lib/getsmbpass.o lib/interface.o lib/kanji.o lib/md4.o \ +LIB_OBJ = lib/charcnv.o lib/debug.o lib/fault.o \ + lib/getsmbpass.o lib/interface.o lib/md4.o \ lib/interfaces.o lib/pidfile.o lib/replace.o \ - lib/signal.o lib/system.o lib/doscalls.o lib/time.o \ + lib/signal.o lib/system.o lib/time.o \ lib/ufc.o lib/genrand.o lib/username.o lib/access.o lib/smbrun.o \ lib/bitmap.o lib/crc32.o lib/snprintf.o lib/wins_srv.o \ lib/util_array.o lib/util_str.o lib/util_sid.o \ @@ -109,7 +109,8 @@ LIB_OBJ = lib/charcnv.o lib/charset.o lib/debug.o lib/fault.o \ lib/util.o lib/util_sock.o lib/util_sec.o smbd/ssl.o \ lib/talloc.o lib/hash.o lib/substitute.o lib/fsusage.o \ lib/ms_fnmatch.o lib/select.o lib/error.o lib/messages.o \ - nsswitch/wb_client.o nsswitch/wb_common.o $(TDB_OBJ) + lib/iconv.o \ + nsswitch/wb_client.o nsswitch/wb_common.o $(TDB_OBJ) READLINE_OBJ = lib/readline.o @@ -229,12 +230,6 @@ SWAT_OBJ = web/cgi.o web/diagnose.o web/startstop.o web/statuspage.o \ SMBSH_OBJ = smbwrapper/smbsh.o smbwrapper/shared.o \ $(PARAM_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) -MAKE_SMBCODEPAGE_OBJ = utils/make_smbcodepage.o $(PARAM_OBJ) \ - $(UBIQX_OBJ) $(LIB_OBJ) - -MAKE_UNICODEMAP_OBJ = utils/make_unicodemap.o $(PARAM_OBJ) \ - $(UBIQX_OBJ) $(LIB_OBJ) - MAKE_PRINTERDEF_OBJ = utils/make_printerdef.o $(PARAM_OBJ) \ $(UBIQX_OBJ) $(LIB_OBJ) @@ -354,10 +349,10 @@ PAM_SMBPASS_OBJ_0 = pam_smbpass/pam_smb_auth.o pam_smbpass/pam_smb_passwd.o \ lib/debug.o lib/util_sid.o lib/messages.o lib/util_str.o \ lib/wins_srv.o lib/substitute.o lib/select.o lib/util.o \ nsswitch/wb_client.o nsswitch/wb_common.o \ - lib/system.o lib/charset.o lib/util_file.o lib/kanji.o \ + lib/system.o lib/util_file.o \ lib/genrand.o lib/username.o lib/charcnv.o lib/time.o \ lib/md4.o lib/util_unistr.o lib/signal.o lib/talloc.o \ - lib/ms_fnmatch.o lib/util_sock.o lib/doscalls.o lib/smbrun.o \ + lib/ms_fnmatch.o lib/util_sock.o lib/smbrun.o \ lib/util_sec.o \ ubiqx/ubi_sLinkList.o libsmb/smbencrypt.o libsmb/smbdes.o \ $(PARAM_OBJ) $(TDB_OBJ) $(PASSDB_OBJ) @@ -548,14 +543,6 @@ bin/smbgroupedit: $(SMBGROUPEDIT_OBJ) bin/.dummy @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(SMBGROUPEDIT_OBJ) $(LDFLAGS) $(LIBS) -bin/make_smbcodepage: $(MAKE_SMBCODEPAGE_OBJ) bin/.dummy - @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(MAKE_SMBCODEPAGE_OBJ) $(LDFLAGS) $(LIBS) - -bin/make_unicodemap: $(MAKE_UNICODEMAP_OBJ) bin/.dummy - @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(MAKE_UNICODEMAP_OBJ) $(LDFLAGS) $(LIBS) - bin/nmblookup: $(NMBLOOKUP_OBJ) bin/.dummy @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(NMBLOOKUP_OBJ) $(LDFLAGS) $(LIBS) @@ -650,11 +637,11 @@ bin/pam_smbpass.@SHLIBEXT@: $(PAM_SMBPASS_PICOOBJ) @echo "Linking shared library $@" $(LD) @LDSHFLAGS@ -symbolic -o $@ $(PAM_SMBPASS_PICOOBJ) -lpam $(LIBS) -lc -install: installbin installman installscripts installcp installswat +install: installbin installman installscripts installswat installdirs: $(SHELL) $(srcdir)/install-sh -d -m $(INSTALLPERMS) \ - $(BASEDIR) $(SBINDIR) $(BINDIR) $(LIBDIR) $(VARDIR) $(CODEPAGEDIR) + $(BASEDIR) $(SBINDIR) $(BINDIR) $(LIBDIR) $(VARDIR) installservers: all installdirs @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(BASEDIR) $(SBINDIR) $(LIBDIR) $(VARDIR) $(SPROGS) @@ -666,9 +653,6 @@ installbin: all installdirs installscripts: installdirs @$(SHELL) $(srcdir)/script/installscripts.sh $(INSTALLPERMS) $(BINDIR) $(SCRIPTS) -installcp: installdirs - @$(SHELL) $(srcdir)/script/installcp.sh $(srcdir) $(LIBDIR) $(CODEPAGEDIR) $(BINDIR) $(CODEPAGELIST) - installswat: installdirs @$(SHELL) $(srcdir)/script/installswat.sh $(SWATDIR) $(srcdir) @@ -685,7 +669,7 @@ revert: installman: @$(SHELL) $(srcdir)/script/installman.sh $(MANDIR) $(srcdir) "@ROFF@" -uninstall: uninstallman uninstallbin uninstallscripts uninstallcp +uninstall: uninstallman uninstallbin uninstallscripts uninstallman: @$(SHELL) $(srcdir)/script/uninstallman.sh $(MANDIR) $(srcdir) @@ -697,9 +681,6 @@ uninstallbin: uninstallscripts: @$(SHELL) $(srcdir)/script/uninstallscripts.sh $(INSTALLPERMS) $(BINDIR) $(SCRIPTS) -uninstallcp: - @$(SHELL) $(srcdir)/script/uninstallcp.sh $(CODEPAGEDIR) $(CODEPAGELIST) - clean: -rm -f core */*~ *~ */*.o */*.po */*.po32 */*.@SHLIBEXT@ $(PROGS) $(SPROGS) diff --git a/source3/acconfig.h b/source3/acconfig.h index 29f0586e75..cdb4b8235a 100644 --- a/source3/acconfig.h +++ b/source3/acconfig.h @@ -153,3 +153,4 @@ #undef HAVE_VASPRINTF_DECL #undef HAVE_SNPRINTF_DECL #undef HAVE_VSNPRINTF_DECL +#undef HAVE_NATIVE_ICONV diff --git a/source3/client/client.c b/source3/client/client.c index db2866324d..ccbeb72e81 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -190,13 +190,6 @@ static void send_message(void) msg[l] = c; } - /* - * The message is in UNIX codepage format. Convert to - * DOS before sending. - */ - - unix_to_dos(msg, True); - if (!cli_message_text(cli, msg, l, grp_id)) { printf("SMBsendtxt failed (%s)\n",cli_errstr(cli)); return; @@ -1645,9 +1638,8 @@ static void browse_fn(const char *name, uint32 m, case STYPE_IPC: fstrcpy(typestr,"IPC"); break; } - - printf("\t%-15.15s%-10.10s%s\n", - name, typestr,comment); + printf("\t%-15.15s%-10.10s%s\n", + name,typestr,comment); } @@ -1682,7 +1674,7 @@ try and browse available connections on a host static BOOL list_servers(char *wk_grp) { if (!cli->server_domain) return False; - + printf("\n\tServer Comment\n"); printf("\t--------- -------\n"); @@ -1928,14 +1920,17 @@ static void process_stdin(void) while (1) { fstring tok; fstring the_prompt; - char *line; + char *cline; + pstring line; int i; /* display a prompt */ slprintf(the_prompt, sizeof(the_prompt)-1, "smb: %s> ", cur_dir); - line = smb_readline(the_prompt, readline_callback, completion_fn); - - if (!line) break; + cline = smb_readline(the_prompt, readline_callback, completion_fn); + + if (!cline) break; + + pstrcpy(line, cline); /* special case - first char is ! */ if (*line == '!') { @@ -1961,11 +1956,11 @@ static void process_stdin(void) /***************************************************** return a connection to a server *******************************************************/ -struct cli_state *do_connect(char *server, char *share) +struct cli_state *do_connect(const char *server, const char *share) { struct cli_state *c; struct nmb_name called, calling; - char *server_n; + const char *server_n; struct in_addr ip; extern struct in_addr ipzero; fstring servicename; @@ -2058,9 +2053,10 @@ struct cli_state *do_connect(char *server, char *share) * mode to turn these on/off ? JRA. */ - if (*c->server_domain || *c->server_os || *c->server_type) + if (*c->server_domain || *c->server_os || *c->server_type){ DEBUG(1,("Domain=[%s] OS=[%s] Server=[%s]\n", c->server_domain,c->server_os,c->server_type)); + } DEBUG(4,(" session setup ok\n")); @@ -2329,7 +2325,6 @@ static int do_message_op(void) } TimeInit(); - charset_initialise(); in_client = True; /* Make sure that we tell lp_load we are */ @@ -2339,8 +2334,6 @@ static int do_message_op(void) } DEBUGLEVEL = old_debug; - codepage_initialise(lp_client_code_page()); - #ifdef WITH_SSL sslutil_init(0); #endif @@ -2583,9 +2576,6 @@ static int do_message_op(void) if(*new_name_resolve_order) lp_set_name_resolve_order(new_name_resolve_order); - if (*term_code) - interpret_coding_system(term_code); - if (!tar_type && !*query_host && !*service && !message) { usage(pname); exit(1); diff --git a/source3/client/clitar.c b/source3/client/clitar.c index 3c35e41155..8f935da4e0 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -421,31 +421,12 @@ static void dotareof(int f) ****************************************************************************/ static void fixtarname(char *tptr, char *fp, int l) { - /* add a '.' to start of file name, convert from ugly dos \'s in path - * to lovely unix /'s :-} */ - - *tptr++='.'; - - while (l > 0) { - int skip = get_character_len(*fp); - if(skip != 0) { - if (skip == 2) { - *tptr++ = *fp++; - *tptr++ = *fp++; - l -= 2; - } else if (skip == 1) { - *tptr++ = *fp++; - l--; - } - } else if (*fp == '\\') { - *tptr++ = '/'; - fp++; - l--; - } else { - *tptr++ = *fp++; - l--; - } - } + /* add a '.' to start of file name, convert from ugly dos \'s in path + * to lovely unix /'s :-} */ + *tptr++='.'; + + safe_strcpy(tptr, fp, l); + string_replace(tptr, '\\', '/'); } /**************************************************************************** @@ -877,43 +858,25 @@ Convert from UNIX to DOS file names ***************************************************************************/ static void unfixtarname(char *tptr, char *fp, int l, BOOL first) { - /* remove '.' from start of file name, convert from unix /'s to - * dos \'s in path. Kill any absolute path names. But only if first! - */ - - DEBUG(5, ("firstb=%lX, secondb=%lX, len=%i\n", (long)tptr, (long)fp, l)); - - if (first) { - if (*fp == '.') { - fp++; - l--; - } - if (*fp == '\\' || *fp == '/') { - fp++; - l--; - } - } + /* remove '.' from start of file name, convert from unix /'s to + * dos \'s in path. Kill any absolute path names. But only if first! + */ + + DEBUG(5, ("firstb=%lX, secondb=%lX, len=%i\n", (long)tptr, (long)fp, l)); + + if (first) { + if (*fp == '.') { + fp++; + l--; + } + if (*fp == '\\' || *fp == '/') { + fp++; + l--; + } + } - while (l > 0) { - int skip = get_character_len(*fp); - if(skip != 0) { - if (skip == 2) { - *tptr++ = *fp++; - *tptr++ = *fp++; - l -= 2; - } else if (skip == 1) { - *tptr++ = *fp++; - l--; - } - } else if (*fp == '/') { - *tptr++ = '\\'; - fp++; - l--; - } else { - *tptr++ = *fp++; - l--; - } - } + safe_strcpy(tptr, fp, l); + string_replace(tptr, '/', '\\'); } @@ -1718,7 +1681,7 @@ int tar_parseargs(int argc, char *argv[], char *Optarg, int Optind) SMB_STRUCT_STAT stbuf; extern time_t newer_than; - if (dos_stat(argv[Optind], &stbuf) == 0) { + if (sys_stat(argv[Optind], &stbuf) == 0) { newer_than = stbuf.st_mtime; DEBUG(1,("Getting files newer than %s", asctime(LocalTime(&newer_than)))); diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c index a121d1fa22..076be0ccb8 100644 --- a/source3/client/smbmount.c +++ b/source3/client/smbmount.c @@ -818,7 +818,6 @@ static void parse_mount_smb(int argc, char **argv) setup_logging("mount.smbfs",True); TimeInit(); - charset_initialise(); in_client = True; /* Make sure that we tell lp_load we are */ @@ -861,8 +860,6 @@ static void parse_mount_smb(int argc, char **argv) DEBUG(3,("mount.smbfs started (version %s)\n", VERSION)); - codepage_initialise(lp_client_code_page()); - if (*workgroup == 0) { pstrcpy(workgroup,lp_workgroup()); } diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c index ce920d1a58..1c85de11dd 100644 --- a/source3/client/smbspool.c +++ b/source3/client/smbspool.c @@ -188,7 +188,6 @@ static int smb_print(struct cli_state *, char *, FILE *); setup_logging("smbspool", True); TimeInit(); - charset_initialise(); in_client = True; /* Make sure that we tell lp_load we are */ @@ -201,8 +200,6 @@ static int smb_print(struct cli_state *, char *, FILE *); if (workgroup == NULL) workgroup = lp_workgroup(); - codepage_initialise(lp_client_code_page()); - load_interfaces(); do diff --git a/source3/configure b/source3/configure index 843483f5bd..621965f83b 100755 --- a/source3/configure +++ b/source3/configure @@ -948,7 +948,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -for ac_prog in gawk mawk nawk awk +for ac_prog in mawk gawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 @@ -2990,6 +2990,7 @@ else #line 2991 "configure" #include "confdefs.h" #include <stdio.h> +#include <sys/types.h> main() { FILE *f=fopen("conftestval", "w"); @@ -2998,7 +2999,7 @@ main() exit(0); } EOF -if { (eval echo configure:3002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_int=`cat conftestval` else @@ -3018,7 +3019,7 @@ EOF echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:3022: checking size of long" >&5 +echo "configure:3023: checking size of long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3026,9 +3027,10 @@ else ac_cv_sizeof_long=cross else cat > conftest.$ac_ext <<EOF -#line 3030 "configure" +#line 3031 "configure" #include "confdefs.h" #include <stdio.h> +#include <sys/types.h> main() { FILE *f=fopen("conftestval", "w"); @@ -3037,7 +3039,7 @@ main() exit(0); } EOF -if { (eval echo configure:3041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3043: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long=`cat conftestval` else @@ -3057,7 +3059,7 @@ EOF echo $ac_n "checking size of short""... $ac_c" 1>&6 -echo "configure:3061: checking size of short" >&5 +echo "configure:3063: checking size of short" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3065,9 +3067,10 @@ else ac_cv_sizeof_short=cross else cat > conftest.$ac_ext <<EOF -#line 3069 "configure" +#line 3071 "configure" #include "confdefs.h" #include <stdio.h> +#include <sys/types.h> main() { FILE *f=fopen("conftestval", "w"); @@ -3076,7 +3079,7 @@ main() exit(0); } EOF -if { (eval echo configure:3080: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3083: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_short=`cat conftestval` else @@ -3097,12 +3100,12 @@ EOF echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:3101: checking for working const" >&5 +echo "configure:3104: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3106 "configure" +#line 3109 "configure" #include "confdefs.h" int main() { @@ -3151,7 +3154,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:3155: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3158: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -3172,21 +3175,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:3176: checking for inline" >&5 +echo "configure:3179: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <<EOF -#line 3183 "configure" +#line 3186 "configure" #include "confdefs.h" int main() { } $ac_kw foo() { ; return 0; } EOF -if { (eval echo configure:3190: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3193: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -3212,14 +3215,14 @@ EOF esac echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:3216: checking whether byte ordering is bigendian" >&5 +echo "configure:3219: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext <<EOF -#line 3223 "configure" +#line 3226 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -3230,11 +3233,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:3234: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3237: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext <<EOF -#line 3238 "configure" +#line 3241 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -3245,7 +3248,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:3249: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3252: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -3265,7 +3268,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 3269 "configure" +#line 3272 "configure" #include "confdefs.h" main () { /* Are we little or big endian? From Harbison&Steele. */ @@ -3278,7 +3281,7 @@ main () { exit (u.c[sizeof (long) - 1] == 1); } EOF -if { (eval echo configure:3282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3285: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -3302,14 +3305,14 @@ EOF fi echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6 -echo "configure:3306: checking whether char is unsigned" >&5 +echo "configure:3309: checking whether char is unsigned" >&5 if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$GCC" = yes; then # GCC predefines this symbol on systems where it applies. cat > conftest.$ac_ext <<EOF -#line 3313 "configure" +#line 3316 "configure" #include "confdefs.h" #ifdef __CHAR_UNSIGNED__ yes @@ -3331,7 +3334,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 3335 "configure" +#line 3338 "configure" #include "confdefs.h" /* volatile prevents gcc2 from optimizing the test away on sparcs. */ #if !defined(__STDC__) || __STDC__ != 1 @@ -3341,7 +3344,7 @@ main() { volatile char c = 255; exit(c < 0); } EOF -if { (eval echo configure:3345: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3348: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_char_unsigned=yes else @@ -3366,12 +3369,12 @@ fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:3370: checking return type of signal handlers" >&5 +echo "configure:3373: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3375 "configure" +#line 3378 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -3388,7 +3391,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:3392: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3395: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -3407,12 +3410,12 @@ EOF echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:3411: checking for uid_t in sys/types.h" >&5 +echo "configure:3414: checking for uid_t in sys/types.h" >&5 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3416 "configure" +#line 3419 "configure" #include "confdefs.h" #include <sys/types.h> EOF @@ -3441,12 +3444,12 @@ EOF fi echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:3445: checking for mode_t" >&5 +echo "configure:3448: checking for mode_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3450 "configure" +#line 3453 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -3474,12 +3477,12 @@ EOF fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:3478: checking for off_t" >&5 +echo "configure:3481: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3483 "configure" +#line 3486 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -3507,12 +3510,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:3511: checking for size_t" >&5 +echo "configure:3514: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3516 "configure" +#line 3519 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -3540,12 +3543,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:3544: checking for pid_t" >&5 +echo "configure:3547: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3549 "configure" +#line 3552 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -3573,12 +3576,12 @@ EOF fi echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6 -echo "configure:3577: checking for st_rdev in struct stat" >&5 +echo "configure:3580: checking for st_rdev in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3582 "configure" +#line 3585 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -3586,7 +3589,7 @@ int main() { struct stat s; s.st_rdev; ; return 0; } EOF -if { (eval echo configure:3590: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3593: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_rdev=yes else @@ -3607,12 +3610,12 @@ EOF fi echo $ac_n "checking for d_off in dirent""... $ac_c" 1>&6 -echo "configure:3611: checking for d_off in dirent" >&5 +echo "configure:3614: checking for d_off in dirent" >&5 if eval "test \"`echo '$''{'ac_cv_dirent_d_off'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3616 "configure" +#line 3619 "configure" #include "confdefs.h" #include <unistd.h> @@ -3622,7 +3625,7 @@ int main() { struct dirent d; d.d_off; ; return 0; } EOF -if { (eval echo configure:3626: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3629: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_dirent_d_off=yes else @@ -3643,12 +3646,12 @@ EOF fi echo $ac_n "checking for ino_t""... $ac_c" 1>&6 -echo "configure:3647: checking for ino_t" >&5 +echo "configure:3650: checking for ino_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_ino_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3652 "configure" +#line 3655 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -3676,12 +3679,12 @@ EOF fi echo $ac_n "checking for loff_t""... $ac_c" 1>&6 -echo "configure:3680: checking for loff_t" >&5 +echo "configure:3683: checking for loff_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_loff_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3685 "configure" +#line 3688 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -3709,12 +3712,12 @@ EOF fi echo $ac_n "checking for offset_t""... $ac_c" 1>&6 -echo "configure:3713: checking for offset_t" >&5 +echo "configure:3716: checking for offset_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_offset_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3718 "configure" +#line 3721 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -3742,12 +3745,12 @@ EOF fi echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 -echo "configure:3746: checking for ssize_t" >&5 +echo "configure:3749: checking for ssize_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3751 "configure" +#line 3754 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -3775,12 +3778,12 @@ EOF fi echo $ac_n "checking for wchar_t""... $ac_c" 1>&6 -echo "configure:3779: checking for wchar_t" >&5 +echo "configure:3782: checking for wchar_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_wchar_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3784 "configure" +#line 3787 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -3810,7 +3813,7 @@ fi # we need libcups for CUPS support... echo $ac_n "checking for httpConnect in -lcups""... $ac_c" 1>&6 -echo "configure:3814: checking for httpConnect in -lcups" >&5 +echo "configure:3817: checking for httpConnect in -lcups" >&5 ac_lib_var=`echo cups'_'httpConnect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3818,7 +3821,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcups $LIBS" cat > conftest.$ac_ext <<EOF -#line 3822 "configure" +#line 3825 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3829,7 +3832,7 @@ int main() { httpConnect() ; return 0; } EOF -if { (eval echo configure:3833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3836: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3859,7 +3862,7 @@ fi # we need libdl for PAM and the new VFS code echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:3863: checking for dlopen in -ldl" >&5 +echo "configure:3866: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3867,7 +3870,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 3871 "configure" +#line 3874 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3878,7 +3881,7 @@ int main() { dlopen() ; return 0; } EOF -if { (eval echo configure:3882: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3904,13 +3907,13 @@ fi echo $ac_n "checking for socklen_t type""... $ac_c" 1>&6 -echo "configure:3908: checking for socklen_t type" >&5 +echo "configure:3911: checking for socklen_t type" >&5 if eval "test \"`echo '$''{'samba_cv_socklen_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3914 "configure" +#line 3917 "configure" #include "confdefs.h" #include <sys/types.h> @@ -3923,7 +3926,7 @@ int main() { socklen_t i = 0 ; return 0; } EOF -if { (eval echo configure:3927: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3930: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_socklen_t=yes else @@ -3944,13 +3947,13 @@ EOF fi echo $ac_n "checking for sig_atomic_t type""... $ac_c" 1>&6 -echo "configure:3948: checking for sig_atomic_t type" >&5 +echo "configure:3951: checking for sig_atomic_t type" >&5 if eval "test \"`echo '$''{'samba_cv_sig_atomic_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3954 "configure" +#line 3957 "configure" #include "confdefs.h" #include <sys/types.h> @@ -3963,7 +3966,7 @@ int main() { sig_atomic_t i = 0 ; return 0; } EOF -if { (eval echo configure:3967: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3970: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_sig_atomic_t=yes else @@ -3986,20 +3989,20 @@ fi # stupid headers have the functions but no declaration. grrrr. echo $ac_n "checking for errno declaration""... $ac_c" 1>&6 -echo "configure:3990: checking for errno declaration" >&5 +echo "configure:3993: checking for errno declaration" >&5 if eval "test \"`echo '$''{'ac_cv_have_errno_decl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3996 "configure" +#line 3999 "configure" #include "confdefs.h" #include <errno.h> int main() { int i = (int)errno ; return 0; } EOF -if { (eval echo configure:4003: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4006: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_errno_decl=yes else @@ -4021,20 +4024,20 @@ EOF echo $ac_n "checking for setresuid declaration""... $ac_c" 1>&6 -echo "configure:4025: checking for setresuid declaration" >&5 +echo "configure:4028: checking for setresuid declaration" >&5 if eval "test \"`echo '$''{'ac_cv_have_setresuid_decl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4031 "configure" +#line 4034 "configure" #include "confdefs.h" #include <unistd.h> int main() { int i = (int)setresuid ; return 0; } EOF -if { (eval echo configure:4038: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4041: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_setresuid_decl=yes else @@ -4056,20 +4059,20 @@ EOF echo $ac_n "checking for setresgid declaration""... $ac_c" 1>&6 -echo "configure:4060: checking for setresgid declaration" >&5 +echo "configure:4063: checking for setresgid declaration" >&5 if eval "test \"`echo '$''{'ac_cv_have_setresgid_decl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4066 "configure" +#line 4069 "configure" #include "confdefs.h" #include <unistd.h> int main() { int i = (int)setresgid ; return 0; } EOF -if { (eval echo configure:4073: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4076: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_setresgid_decl=yes else @@ -4091,20 +4094,20 @@ EOF echo $ac_n "checking for asprintf declaration""... $ac_c" 1>&6 -echo "configure:4095: checking for asprintf declaration" >&5 +echo "configure:4098: checking for asprintf declaration" >&5 if eval "test \"`echo '$''{'ac_cv_have_asprintf_decl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4101 "configure" +#line 4104 "configure" #include "confdefs.h" #include <stdio.h> int main() { int i = (int)asprintf ; return 0; } EOF -if { (eval echo configure:4108: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4111: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_asprintf_decl=yes else @@ -4126,20 +4129,20 @@ EOF echo $ac_n "checking for vasprintf declaration""... $ac_c" 1>&6 -echo "configure:4130: checking for vasprintf declaration" >&5 +echo "configure:4133: checking for vasprintf declaration" >&5 if eval "test \"`echo '$''{'ac_cv_have_vasprintf_decl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4136 "configure" +#line 4139 "configure" #include "confdefs.h" #include <stdio.h> int main() { int i = (int)vasprintf ; return 0; } EOF -if { (eval echo configure:4143: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4146: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_vasprintf_decl=yes else @@ -4161,20 +4164,20 @@ EOF echo $ac_n "checking for vsnprintf declaration""... $ac_c" 1>&6 -echo "configure:4165: checking for vsnprintf declaration" >&5 +echo "configure:4168: checking for vsnprintf declaration" >&5 if eval "test \"`echo '$''{'ac_cv_have_vsnprintf_decl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4171 "configure" +#line 4174 "configure" #include "confdefs.h" #include <stdio.h> int main() { int i = (int)vsnprintf ; return 0; } EOF -if { (eval echo configure:4178: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4181: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_vsnprintf_decl=yes else @@ -4196,20 +4199,20 @@ EOF echo $ac_n "checking for snprintf declaration""... $ac_c" 1>&6 -echo "configure:4200: checking for snprintf declaration" >&5 +echo "configure:4203: checking for snprintf declaration" >&5 if eval "test \"`echo '$''{'ac_cv_have_snprintf_decl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4206 "configure" +#line 4209 "configure" #include "confdefs.h" #include <stdio.h> int main() { int i = (int)snprintf ; return 0; } EOF -if { (eval echo configure:4213: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4216: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_snprintf_decl=yes else @@ -4233,7 +4236,7 @@ EOF # and glibc has setresuid under linux but the function does # nothing until kernel 2.1.44! very dumb. echo $ac_n "checking for real setresuid""... $ac_c" 1>&6 -echo "configure:4237: checking for real setresuid" >&5 +echo "configure:4240: checking for real setresuid" >&5 if eval "test \"`echo '$''{'samba_cv_have_setresuid'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4242,12 +4245,12 @@ else samba_cv_have_setresuid=cross else cat > conftest.$ac_ext <<EOF -#line 4246 "configure" +#line 4249 "configure" #include "confdefs.h" #include <errno.h> main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);} EOF -if { (eval echo configure:4251: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_have_setresuid=yes else @@ -4272,7 +4275,7 @@ fi # Do the same check for setresguid... # echo $ac_n "checking for real setresgid""... $ac_c" 1>&6 -echo "configure:4276: checking for real setresgid" >&5 +echo "configure:4279: checking for real setresgid" >&5 if eval "test \"`echo '$''{'samba_cv_have_setresgid'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4281,13 +4284,13 @@ else samba_cv_have_setresgid=cross else cat > conftest.$ac_ext <<EOF -#line 4285 "configure" +#line 4288 "configure" #include "confdefs.h" #include <unistd.h> #include <errno.h> main() { errno = 0; setresgid(1,1,1); exit(errno != 0 ? (errno==EPERM ? 0 : 1) : 0);} EOF -if { (eval echo configure:4291: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4294: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_have_setresgid=yes else @@ -4310,7 +4313,7 @@ EOF fi echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:4314: checking for 8-bit clean memcmp" >&5 +echo "configure:4317: checking for 8-bit clean memcmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4318,7 +4321,7 @@ else ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <<EOF -#line 4322 "configure" +#line 4325 "configure" #include "confdefs.h" main() @@ -4328,7 +4331,7 @@ main() } EOF -if { (eval echo configure:4332: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4335: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_memcmp_clean=yes else @@ -4351,12 +4354,12 @@ test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}" for ac_func in crypt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4355: checking for $ac_func" >&5 +echo "configure:4358: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4360 "configure" +#line 4363 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4379,7 +4382,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4383: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4405,7 +4408,7 @@ done if test x"$ac_cv_func_crypt" = x"no"; then echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 -echo "configure:4409: checking for crypt in -lcrypt" >&5 +echo "configure:4412: checking for crypt in -lcrypt" >&5 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4413,7 +4416,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcrypt $LIBS" cat > conftest.$ac_ext <<EOF -#line 4417 "configure" +#line 4420 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4424,7 +4427,7 @@ int main() { crypt() ; return 0; } EOF -if { (eval echo configure:4428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4431: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4457,7 +4460,7 @@ test "${with_readline+set}" != "set" && with_readline=yes # test for where we get readline() from echo $ac_n "checking whether to use readline""... $ac_c" 1>&6 -echo "configure:4461: checking whether to use readline" >&5 +echo "configure:4464: checking whether to use readline" >&5 # Check whether --with-readline or --without-readline was given. if test "${with_readline+set}" = set; then withval="$with_readline" @@ -4469,17 +4472,17 @@ if test "${with_readline+set}" = set; then do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4473: checking for $ac_hdr" >&5 +echo "configure:4476: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4478 "configure" +#line 4481 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4483: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4486: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4509,17 +4512,17 @@ done do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4513: checking for $ac_hdr" >&5 +echo "configure:4516: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4518 "configure" +#line 4521 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4523: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4526: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4550,17 +4553,17 @@ done do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4554: checking for $ac_hdr" >&5 +echo "configure:4557: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4559 "configure" +#line 4562 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4564: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4567: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4583,7 +4586,7 @@ EOF for termlib in ncurses curses termcap terminfo termlib; do echo $ac_n "checking for tgetent in -l${termlib}""... $ac_c" 1>&6 -echo "configure:4587: checking for tgetent in -l${termlib}" >&5 +echo "configure:4590: checking for tgetent in -l${termlib}" >&5 ac_lib_var=`echo ${termlib}'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4591,7 +4594,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l${termlib} $LIBS" cat > conftest.$ac_ext <<EOF -#line 4595 "configure" +#line 4598 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4602,7 +4605,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:4606: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4609: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4624,7 +4627,7 @@ fi done echo $ac_n "checking for rl_callback_handler_install in -lreadline""... $ac_c" 1>&6 -echo "configure:4628: checking for rl_callback_handler_install in -lreadline" >&5 +echo "configure:4631: checking for rl_callback_handler_install in -lreadline" >&5 ac_lib_var=`echo readline'_'rl_callback_handler_install | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4632,7 +4635,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lreadline $TERMLIBS $LIBS" cat > conftest.$ac_ext <<EOF -#line 4636 "configure" +#line 4639 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4643,7 +4646,7 @@ int main() { rl_callback_handler_install() ; return 0; } EOF -if { (eval echo configure:4647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4694,17 +4697,17 @@ done do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4698: checking for $ac_hdr" >&5 +echo "configure:4701: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4703 "configure" +#line 4706 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4708: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4711: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4734,17 +4737,17 @@ done do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4738: checking for $ac_hdr" >&5 +echo "configure:4741: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4743 "configure" +#line 4746 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4748: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4751: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4775,17 +4778,17 @@ done do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4779: checking for $ac_hdr" >&5 +echo "configure:4782: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4784 "configure" +#line 4787 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4789: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4792: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4808,7 +4811,7 @@ EOF for termlib in ncurses curses termcap terminfo termlib; do echo $ac_n "checking for tgetent in -l${termlib}""... $ac_c" 1>&6 -echo "configure:4812: checking for tgetent in -l${termlib}" >&5 +echo "configure:4815: checking for tgetent in -l${termlib}" >&5 ac_lib_var=`echo ${termlib}'_'tgetent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4816,7 +4819,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l${termlib} $LIBS" cat > conftest.$ac_ext <<EOF -#line 4820 "configure" +#line 4823 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4827,7 +4830,7 @@ int main() { tgetent() ; return 0; } EOF -if { (eval echo configure:4831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4849,7 +4852,7 @@ fi done echo $ac_n "checking for rl_callback_handler_install in -lreadline""... $ac_c" 1>&6 -echo "configure:4853: checking for rl_callback_handler_install in -lreadline" >&5 +echo "configure:4856: checking for rl_callback_handler_install in -lreadline" >&5 ac_lib_var=`echo readline'_'rl_callback_handler_install | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4857,7 +4860,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lreadline $TERMLIBS $LIBS" cat > conftest.$ac_ext <<EOF -#line 4861 "configure" +#line 4864 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4868,7 +4871,7 @@ int main() { rl_callback_handler_install() ; return 0; } EOF -if { (eval echo configure:4872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4923,12 +4926,12 @@ fi for ac_func in connect do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4927: checking for $ac_func" >&5 +echo "configure:4930: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4932 "configure" +#line 4935 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4951,7 +4954,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4955: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4979,7 +4982,7 @@ if test x"$ac_cv_func_connect" = x"no"; then case "$LIBS" in *-lnsl*) ;; *) echo $ac_n "checking for printf in -lnsl_s""... $ac_c" 1>&6 -echo "configure:4983: checking for printf in -lnsl_s" >&5 +echo "configure:4986: checking for printf in -lnsl_s" >&5 ac_lib_var=`echo nsl_s'_'printf | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4987,7 +4990,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl_s $LIBS" cat > conftest.$ac_ext <<EOF -#line 4991 "configure" +#line 4994 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4998,7 +5001,7 @@ int main() { printf() ; return 0; } EOF -if { (eval echo configure:5002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5005: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5029,7 +5032,7 @@ fi case "$LIBS" in *-lnsl*) ;; *) echo $ac_n "checking for printf in -lnsl""... $ac_c" 1>&6 -echo "configure:5033: checking for printf in -lnsl" >&5 +echo "configure:5036: checking for printf in -lnsl" >&5 ac_lib_var=`echo nsl'_'printf | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5037,7 +5040,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <<EOF -#line 5041 "configure" +#line 5044 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -5048,7 +5051,7 @@ int main() { printf() ; return 0; } EOF -if { (eval echo configure:5052: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5055: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5079,7 +5082,7 @@ fi case "$LIBS" in *-lsocket*) ;; *) echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:5083: checking for connect in -lsocket" >&5 +echo "configure:5086: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5087,7 +5090,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <<EOF -#line 5091 "configure" +#line 5094 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -5098,7 +5101,7 @@ int main() { connect() ; return 0; } EOF -if { (eval echo configure:5102: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5105: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5129,7 +5132,7 @@ fi case "$LIBS" in *-linet*) ;; *) echo $ac_n "checking for connect in -linet""... $ac_c" 1>&6 -echo "configure:5133: checking for connect in -linet" >&5 +echo "configure:5136: checking for connect in -linet" >&5 ac_lib_var=`echo inet'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5137,7 +5140,7 @@ else ac_save_LIBS="$LIBS" LIBS="-linet $LIBS" cat > conftest.$ac_ext <<EOF -#line 5141 "configure" +#line 5144 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -5148,7 +5151,7 @@ int main() { connect() ; return 0; } EOF -if { (eval echo configure:5152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5192,12 +5195,12 @@ fi for ac_func in yp_get_default_domain do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5196: checking for $ac_func" >&5 +echo "configure:5199: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5201 "configure" +#line 5204 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5220,7 +5223,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5224: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5246,7 +5249,7 @@ done if test x"$ac_cv_func_yp_get_default_domain" = x"no"; then echo $ac_n "checking for yp_get_default_domain in -lnsl""... $ac_c" 1>&6 -echo "configure:5250: checking for yp_get_default_domain in -lnsl" >&5 +echo "configure:5253: checking for yp_get_default_domain in -lnsl" >&5 ac_lib_var=`echo nsl'_'yp_get_default_domain | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5254,7 +5257,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <<EOF -#line 5258 "configure" +#line 5261 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -5265,7 +5268,7 @@ int main() { yp_get_default_domain() ; return 0; } EOF -if { (eval echo configure:5269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5272: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5295,12 +5298,12 @@ fi for ac_func in execl do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5299: checking for $ac_func" >&5 +echo "configure:5302: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5304 "configure" +#line 5307 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5323,7 +5326,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5327: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5330: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5356,12 +5359,12 @@ fi for ac_func in waitpid getcwd strdup strtoul strerror chown fchown chmod fchmod chroot do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5360: checking for $ac_func" >&5 +echo "configure:5363: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5365 "configure" +#line 5368 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5384,7 +5387,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5388: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5411,12 +5414,12 @@ done for ac_func in fstat strchr utime utimes getrlimit fsync bzero memset do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5415: checking for $ac_func" >&5 +echo "configure:5418: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5420 "configure" +#line 5423 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5439,7 +5442,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5443: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5446: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5466,12 +5469,12 @@ done for ac_func in memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5470: checking for $ac_func" >&5 +echo "configure:5473: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5475 "configure" +#line 5478 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5494,7 +5497,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5498: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5521,12 +5524,12 @@ done for ac_func in strftime sigprocmask sigblock sigaction innetgr setnetgrent getnetgrent endnetgrent do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5525: checking for $ac_func" >&5 +echo "configure:5528: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5530 "configure" +#line 5533 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5549,7 +5552,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5553: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5556: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5576,12 +5579,12 @@ done for ac_func in initgroups select poll rdchk getgrnam getgrent pathconf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5580: checking for $ac_func" >&5 +echo "configure:5583: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5585 "configure" +#line 5588 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5604,7 +5607,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5608: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5611: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5631,12 +5634,12 @@ done for ac_func in setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate stat64 fstat64 do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5635: checking for $ac_func" >&5 +echo "configure:5638: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5640 "configure" +#line 5643 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5659,7 +5662,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5666: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5686,12 +5689,12 @@ done for ac_func in lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64 do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5690: checking for $ac_func" >&5 +echo "configure:5693: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5695 "configure" +#line 5698 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5714,7 +5717,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5721: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5741,12 +5744,12 @@ done for ac_func in fseek64 fseeko64 ftell64 ftello64 setluid getpwanam setlinebuf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5745: checking for $ac_func" >&5 +echo "configure:5748: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5750 "configure" +#line 5753 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5769,7 +5772,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5776: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5796,12 +5799,12 @@ done for ac_func in srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5800: checking for $ac_func" >&5 +echo "configure:5803: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5805 "configure" +#line 5808 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5824,7 +5827,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5852,12 +5855,12 @@ done for ac_func in setbuffer do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5856: checking for $ac_func" >&5 +echo "configure:5859: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5861 "configure" +#line 5864 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5880,7 +5883,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5887: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5909,12 +5912,12 @@ done for ac_func in syscall do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5913: checking for $ac_func" >&5 +echo "configure:5916: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5918 "configure" +#line 5921 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5937,7 +5940,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5941: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5944: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5965,12 +5968,12 @@ done for ac_func in _dup _dup2 _opendir _readdir _seekdir _telldir _closedir do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5969: checking for $ac_func" >&5 +echo "configure:5972: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5974 "configure" +#line 5977 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5993,7 +5996,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5997: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6000: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6020,12 +6023,12 @@ done for ac_func in __dup __dup2 __opendir __readdir __seekdir __telldir __closedir do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6024: checking for $ac_func" >&5 +echo "configure:6027: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6029 "configure" +#line 6032 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6048,7 +6051,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6052: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6055: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6075,12 +6078,12 @@ done for ac_func in __getcwd _getcwd do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6079: checking for $ac_func" >&5 +echo "configure:6082: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6084 "configure" +#line 6087 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6103,7 +6106,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6130,12 +6133,12 @@ done for ac_func in __xstat __fxstat __lxstat do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6134: checking for $ac_func" >&5 +echo "configure:6137: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6139 "configure" +#line 6142 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6158,7 +6161,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6185,12 +6188,12 @@ done for ac_func in _stat _lstat _fstat __stat __lstat __fstat do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6189: checking for $ac_func" >&5 +echo "configure:6192: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6194 "configure" +#line 6197 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6213,7 +6216,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6220: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6240,12 +6243,12 @@ done for ac_func in _acl __acl _facl __facl _open __open _chdir __chdir do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6244: checking for $ac_func" >&5 +echo "configure:6247: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6249 "configure" +#line 6252 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6268,7 +6271,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6272: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6295,12 +6298,12 @@ done for ac_func in _close __close _fchdir __fchdir _fcntl __fcntl do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6299: checking for $ac_func" >&5 +echo "configure:6302: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6304 "configure" +#line 6307 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6323,7 +6326,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6327: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6330: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6350,12 +6353,12 @@ done for ac_func in getdents _getdents __getdents _lseek __lseek _read __read do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6354: checking for $ac_func" >&5 +echo "configure:6357: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6359 "configure" +#line 6362 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6378,7 +6381,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6382: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6385: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6405,12 +6408,12 @@ done for ac_func in _write __write _fork __fork do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6409: checking for $ac_func" >&5 +echo "configure:6412: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6414 "configure" +#line 6417 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6433,7 +6436,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6437: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6440: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6460,12 +6463,12 @@ done for ac_func in _stat64 __stat64 _fstat64 __fstat64 _lstat64 __lstat64 do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6464: checking for $ac_func" >&5 +echo "configure:6467: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6469 "configure" +#line 6472 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6488,7 +6491,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6492: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6515,12 +6518,12 @@ done for ac_func in __sys_llseek llseek _llseek __llseek readdir64 _readdir64 __readdir64 do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6519: checking for $ac_func" >&5 +echo "configure:6522: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6524 "configure" +#line 6527 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6543,7 +6546,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6547: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6550: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6570,12 +6573,12 @@ done for ac_func in pread _pread __pread pread64 _pread64 __pread64 do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6574: checking for $ac_func" >&5 +echo "configure:6577: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6579 "configure" +#line 6582 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6598,7 +6601,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6602: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6605: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6625,12 +6628,12 @@ done for ac_func in pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64 do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6629: checking for $ac_func" >&5 +echo "configure:6632: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6634 "configure" +#line 6637 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6653,7 +6656,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6657: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6680,12 +6683,12 @@ done for ac_func in open64 _open64 __open64 creat64 do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6684: checking for $ac_func" >&5 +echo "configure:6687: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6689 "configure" +#line 6692 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6708,7 +6711,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6712: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6715: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6739,9 +6742,9 @@ done if test x$ac_cv_func_stat64 = xno ; then echo $ac_n "checking for stat64 in <sys/stat.h>""... $ac_c" 1>&6 -echo "configure:6743: checking for stat64 in <sys/stat.h>" >&5 +echo "configure:6746: checking for stat64 in <sys/stat.h>" >&5 cat > conftest.$ac_ext <<EOF -#line 6745 "configure" +#line 6748 "configure" #include "confdefs.h" #if defined(HAVE_UNISTD_H) @@ -6753,7 +6756,7 @@ int main() { struct stat64 st64; exit(stat64(".",&st64)); ; return 0; } EOF -if { (eval echo configure:6757: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_stat64=yes else @@ -6772,9 +6775,9 @@ fi if test x$ac_cv_func_lstat64 = xno ; then echo $ac_n "checking for lstat64 in <sys/stat.h>""... $ac_c" 1>&6 -echo "configure:6776: checking for lstat64 in <sys/stat.h>" >&5 +echo "configure:6779: checking for lstat64 in <sys/stat.h>" >&5 cat > conftest.$ac_ext <<EOF -#line 6778 "configure" +#line 6781 "configure" #include "confdefs.h" #if defined(HAVE_UNISTD_H) @@ -6786,7 +6789,7 @@ int main() { struct stat64 st64; exit(lstat64(".",&st64)); ; return 0; } EOF -if { (eval echo configure:6790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_lstat64=yes else @@ -6805,9 +6808,9 @@ fi if test x$ac_cv_func_fstat64 = xno ; then echo $ac_n "checking for fstat64 in <sys/stat.h>""... $ac_c" 1>&6 -echo "configure:6809: checking for fstat64 in <sys/stat.h>" >&5 +echo "configure:6812: checking for fstat64 in <sys/stat.h>" >&5 cat > conftest.$ac_ext <<EOF -#line 6811 "configure" +#line 6814 "configure" #include "confdefs.h" #if defined(HAVE_UNISTD_H) @@ -6819,7 +6822,7 @@ int main() { struct stat64 st64; exit(fstat64(0,&st64)); ; return 0; } EOF -if { (eval echo configure:6823: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6826: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_fstat64=yes else @@ -6844,7 +6847,7 @@ fi if test x$ac_cv_func_strcasecmp = xno ; then echo $ac_n "checking for strcasecmp in -lresolv""... $ac_c" 1>&6 -echo "configure:6848: checking for strcasecmp in -lresolv" >&5 +echo "configure:6851: checking for strcasecmp in -lresolv" >&5 ac_lib_var=`echo resolv'_'strcasecmp | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6852,7 +6855,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <<EOF -#line 6856 "configure" +#line 6859 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -6863,7 +6866,7 @@ int main() { strcasecmp() ; return 0; } EOF -if { (eval echo configure:6867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6870: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6899,12 +6902,12 @@ case "$LIBS" in *-lsecurity*) for ac_func in putprpwnam do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6903: checking for $ac_func" >&5 +echo "configure:6906: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6908 "configure" +#line 6911 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6927,7 +6930,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6934: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6952,7 +6955,7 @@ fi done ;; *) echo $ac_n "checking for putprpwnam in -lsecurity""... $ac_c" 1>&6 -echo "configure:6956: checking for putprpwnam in -lsecurity" >&5 +echo "configure:6959: checking for putprpwnam in -lsecurity" >&5 ac_lib_var=`echo security'_'putprpwnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6960,7 +6963,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsecurity $LIBS" cat > conftest.$ac_ext <<EOF -#line 6964 "configure" +#line 6967 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -6971,7 +6974,7 @@ int main() { putprpwnam() ; return 0; } EOF -if { (eval echo configure:6975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6978: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7001,12 +7004,12 @@ fi for ac_func in putprpwnam do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7005: checking for $ac_func" >&5 +echo "configure:7008: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7010 "configure" +#line 7013 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -7029,7 +7032,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:7033: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7036: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7060,12 +7063,12 @@ case "$LIBS" in *-lsec*) for ac_func in putprpwnam do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7064: checking for $ac_func" >&5 +echo "configure:7067: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7069 "configure" +#line 7072 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -7088,7 +7091,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:7092: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7095: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7113,7 +7116,7 @@ fi done ;; *) echo $ac_n "checking for putprpwnam in -lsec""... $ac_c" 1>&6 -echo "configure:7117: checking for putprpwnam in -lsec" >&5 +echo "configure:7120: checking for putprpwnam in -lsec" >&5 ac_lib_var=`echo sec'_'putprpwnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7121,7 +7124,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsec $LIBS" cat > conftest.$ac_ext <<EOF -#line 7125 "configure" +#line 7128 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -7132,7 +7135,7 @@ int main() { putprpwnam() ; return 0; } EOF -if { (eval echo configure:7136: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7139: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7162,12 +7165,12 @@ fi for ac_func in putprpwnam do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7166: checking for $ac_func" >&5 +echo "configure:7169: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7171 "configure" +#line 7174 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -7190,7 +7193,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:7194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7222,12 +7225,12 @@ case "$LIBS" in *-lsecurity*) for ac_func in set_auth_parameters do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7226: checking for $ac_func" >&5 +echo "configure:7229: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7231 "configure" +#line 7234 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -7250,7 +7253,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:7254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7257: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7275,7 +7278,7 @@ fi done ;; *) echo $ac_n "checking for set_auth_parameters in -lsecurity""... $ac_c" 1>&6 -echo "configure:7279: checking for set_auth_parameters in -lsecurity" >&5 +echo "configure:7282: checking for set_auth_parameters in -lsecurity" >&5 ac_lib_var=`echo security'_'set_auth_parameters | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7283,7 +7286,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsecurity $LIBS" cat > conftest.$ac_ext <<EOF -#line 7287 "configure" +#line 7290 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -7294,7 +7297,7 @@ int main() { set_auth_parameters() ; return 0; } EOF -if { (eval echo configure:7298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7301: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7324,12 +7327,12 @@ fi for ac_func in set_auth_parameters do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7328: checking for $ac_func" >&5 +echo "configure:7331: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7333 "configure" +#line 7336 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -7352,7 +7355,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:7356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7383,12 +7386,12 @@ case "$LIBS" in *-lsec*) for ac_func in set_auth_parameters do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7387: checking for $ac_func" >&5 +echo "configure:7390: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7392 "configure" +#line 7395 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -7411,7 +7414,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:7415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7418: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7436,7 +7439,7 @@ fi done ;; *) echo $ac_n "checking for set_auth_parameters in -lsec""... $ac_c" 1>&6 -echo "configure:7440: checking for set_auth_parameters in -lsec" >&5 +echo "configure:7443: checking for set_auth_parameters in -lsec" >&5 ac_lib_var=`echo sec'_'set_auth_parameters | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7444,7 +7447,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsec $LIBS" cat > conftest.$ac_ext <<EOF -#line 7448 "configure" +#line 7451 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -7455,7 +7458,7 @@ int main() { set_auth_parameters() ; return 0; } EOF -if { (eval echo configure:7459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7485,12 +7488,12 @@ fi for ac_func in set_auth_parameters do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7489: checking for $ac_func" >&5 +echo "configure:7492: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7494 "configure" +#line 7497 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -7513,7 +7516,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:7517: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7520: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7546,12 +7549,12 @@ case "$LIBS" in *-lgen*) for ac_func in getspnam do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7550: checking for $ac_func" >&5 +echo "configure:7553: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7555 "configure" +#line 7558 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -7574,7 +7577,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:7578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7581: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7599,7 +7602,7 @@ fi done ;; *) echo $ac_n "checking for getspnam in -lgen""... $ac_c" 1>&6 -echo "configure:7603: checking for getspnam in -lgen" >&5 +echo "configure:7606: checking for getspnam in -lgen" >&5 ac_lib_var=`echo gen'_'getspnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7607,7 +7610,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgen $LIBS" cat > conftest.$ac_ext <<EOF -#line 7611 "configure" +#line 7614 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -7618,7 +7621,7 @@ int main() { getspnam() ; return 0; } EOF -if { (eval echo configure:7622: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7625: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7648,12 +7651,12 @@ fi for ac_func in getspnam do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7652: checking for $ac_func" >&5 +echo "configure:7655: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7657 "configure" +#line 7660 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -7676,7 +7679,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:7680: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7683: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7708,12 +7711,12 @@ case "$LIBS" in *-lsecurity*) for ac_func in getspnam do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7712: checking for $ac_func" >&5 +echo "configure:7715: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7717 "configure" +#line 7720 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -7736,7 +7739,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:7740: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7761,7 +7764,7 @@ fi done ;; *) echo $ac_n "checking for getspnam in -lsecurity""... $ac_c" 1>&6 -echo "configure:7765: checking for getspnam in -lsecurity" >&5 +echo "configure:7768: checking for getspnam in -lsecurity" >&5 ac_lib_var=`echo security'_'getspnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7769,7 +7772,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsecurity $LIBS" cat > conftest.$ac_ext <<EOF -#line 7773 "configure" +#line 7776 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -7780,7 +7783,7 @@ int main() { getspnam() ; return 0; } EOF -if { (eval echo configure:7784: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7810,12 +7813,12 @@ fi for ac_func in getspnam do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7814: checking for $ac_func" >&5 +echo "configure:7817: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7819 "configure" +#line 7822 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -7838,7 +7841,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:7842: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7845: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7869,12 +7872,12 @@ case "$LIBS" in *-lsec*) for ac_func in getspnam do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7873: checking for $ac_func" >&5 +echo "configure:7876: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7878 "configure" +#line 7881 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -7897,7 +7900,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:7901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7904: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7922,7 +7925,7 @@ fi done ;; *) echo $ac_n "checking for getspnam in -lsec""... $ac_c" 1>&6 -echo "configure:7926: checking for getspnam in -lsec" >&5 +echo "configure:7929: checking for getspnam in -lsec" >&5 ac_lib_var=`echo sec'_'getspnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7930,7 +7933,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsec $LIBS" cat > conftest.$ac_ext <<EOF -#line 7934 "configure" +#line 7937 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -7941,7 +7944,7 @@ int main() { getspnam() ; return 0; } EOF -if { (eval echo configure:7945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7971,12 +7974,12 @@ fi for ac_func in getspnam do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7975: checking for $ac_func" >&5 +echo "configure:7978: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7980 "configure" +#line 7983 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -7999,7 +8002,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:8003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8006: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -8031,12 +8034,12 @@ case "$LIBS" in *-lsecurity*) for ac_func in bigcrypt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8035: checking for $ac_func" >&5 +echo "configure:8038: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8040 "configure" +#line 8043 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -8059,7 +8062,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:8063: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -8084,7 +8087,7 @@ fi done ;; *) echo $ac_n "checking for bigcrypt in -lsecurity""... $ac_c" 1>&6 -echo "configure:8088: checking for bigcrypt in -lsecurity" >&5 +echo "configure:8091: checking for bigcrypt in -lsecurity" >&5 ac_lib_var=`echo security'_'bigcrypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8092,7 +8095,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsecurity $LIBS" cat > conftest.$ac_ext <<EOF -#line 8096 "configure" +#line 8099 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -8103,7 +8106,7 @@ int main() { bigcrypt() ; return 0; } EOF -if { (eval echo configure:8107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8133,12 +8136,12 @@ fi for ac_func in bigcrypt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8137: checking for $ac_func" >&5 +echo "configure:8140: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8142 "configure" +#line 8145 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -8161,7 +8164,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:8165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -8192,12 +8195,12 @@ case "$LIBS" in *-lsec*) for ac_func in bigcrypt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8196: checking for $ac_func" >&5 +echo "configure:8199: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8201 "configure" +#line 8204 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -8220,7 +8223,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:8224: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -8245,7 +8248,7 @@ fi done ;; *) echo $ac_n "checking for bigcrypt in -lsec""... $ac_c" 1>&6 -echo "configure:8249: checking for bigcrypt in -lsec" >&5 +echo "configure:8252: checking for bigcrypt in -lsec" >&5 ac_lib_var=`echo sec'_'bigcrypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8253,7 +8256,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsec $LIBS" cat > conftest.$ac_ext <<EOF -#line 8257 "configure" +#line 8260 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -8264,7 +8267,7 @@ int main() { bigcrypt() ; return 0; } EOF -if { (eval echo configure:8268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8271: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8294,12 +8297,12 @@ fi for ac_func in bigcrypt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8298: checking for $ac_func" >&5 +echo "configure:8301: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8303 "configure" +#line 8306 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -8322,7 +8325,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:8326: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -8354,12 +8357,12 @@ case "$LIBS" in *-lsecurity*) for ac_func in getprpwnam do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8358: checking for $ac_func" >&5 +echo "configure:8361: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8363 "configure" +#line 8366 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -8382,7 +8385,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:8386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -8407,7 +8410,7 @@ fi done ;; *) echo $ac_n "checking for getprpwnam in -lsecurity""... $ac_c" 1>&6 -echo "configure:8411: checking for getprpwnam in -lsecurity" >&5 +echo "configure:8414: checking for getprpwnam in -lsecurity" >&5 ac_lib_var=`echo security'_'getprpwnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8415,7 +8418,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsecurity $LIBS" cat > conftest.$ac_ext <<EOF -#line 8419 "configure" +#line 8422 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -8426,7 +8429,7 @@ int main() { getprpwnam() ; return 0; } EOF -if { (eval echo configure:8430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8433: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8456,12 +8459,12 @@ fi for ac_func in getprpwnam do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8460: checking for $ac_func" >&5 +echo "configure:8463: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8465 "configure" +#line 8468 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -8484,7 +8487,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:8488: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8491: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -8515,12 +8518,12 @@ case "$LIBS" in *-lsec*) for ac_func in getprpwnam do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8519: checking for $ac_func" >&5 +echo "configure:8522: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8524 "configure" +#line 8527 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -8543,7 +8546,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:8547: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8550: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -8568,7 +8571,7 @@ fi done ;; *) echo $ac_n "checking for getprpwnam in -lsec""... $ac_c" 1>&6 -echo "configure:8572: checking for getprpwnam in -lsec" >&5 +echo "configure:8575: checking for getprpwnam in -lsec" >&5 ac_lib_var=`echo sec'_'getprpwnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8576,7 +8579,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsec $LIBS" cat > conftest.$ac_ext <<EOF -#line 8580 "configure" +#line 8583 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -8587,7 +8590,7 @@ int main() { getprpwnam() ; return 0; } EOF -if { (eval echo configure:8591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8617,12 +8620,12 @@ fi for ac_func in getprpwnam do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8621: checking for $ac_func" >&5 +echo "configure:8624: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8626 "configure" +#line 8629 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -8645,7 +8648,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:8649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8652: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -8755,7 +8758,7 @@ EOF *dgux*) # Extract the first word of "groff", so it can be a program name with args. set dummy groff; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:8759: checking for $ac_word" >&5 +echo "configure:8762: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ROFF'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8810,7 +8813,7 @@ esac # try to work out how to produce PIC code with this compiler echo $ac_n "checking whether ${CC-cc} accepts -fPIC""... $ac_c" 1>&6 -echo "configure:8814: checking whether ${CC-cc} accepts -fPIC" >&5 +echo "configure:8817: checking whether ${CC-cc} accepts -fPIC" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_fPIC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8830,7 +8833,7 @@ if test $ac_cv_prog_cc_fPIC = yes; then fi if test x$PICFLAG = x; then echo $ac_n "checking whether ${CC-cc} accepts -KPIC""... $ac_c" 1>&6 -echo "configure:8834: checking whether ${CC-cc} accepts -KPIC" >&5 +echo "configure:8837: checking whether ${CC-cc} accepts -KPIC" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_KPIC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8851,7 +8854,7 @@ echo "$ac_t""$ac_cv_prog_cc_KPIC" 1>&6 fi if test x$PICFLAG = x; then echo $ac_n "checking whether ${CC-cc} accepts -Kpic""... $ac_c" 1>&6 -echo "configure:8855: checking whether ${CC-cc} accepts -Kpic" >&5 +echo "configure:8858: checking whether ${CC-cc} accepts -Kpic" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_Kpic'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8874,7 +8877,7 @@ fi ################ echo $ac_n "checking for long long""... $ac_c" 1>&6 -echo "configure:8878: checking for long long" >&5 +echo "configure:8881: checking for long long" >&5 if eval "test \"`echo '$''{'samba_cv_have_longlong'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8883,12 +8886,12 @@ if test "$cross_compiling" = yes; then samba_cv_have_longlong=cross else cat > conftest.$ac_ext <<EOF -#line 8887 "configure" +#line 8890 "configure" #include "confdefs.h" #include <stdio.h> main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); } EOF -if { (eval echo configure:8892: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8895: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_have_longlong=yes else @@ -8915,20 +8918,20 @@ fi # AIX needs this. echo $ac_n "checking for LL suffix on long long integers""... $ac_c" 1>&6 -echo "configure:8919: checking for LL suffix on long long integers" >&5 +echo "configure:8922: checking for LL suffix on long long integers" >&5 if eval "test \"`echo '$''{'samba_cv_compiler_supports_ll'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 8925 "configure" +#line 8928 "configure" #include "confdefs.h" #include <stdio.h> int main() { long long i = 0x8000000000LL ; return 0; } EOF -if { (eval echo configure:8932: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:8935: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_compiler_supports_ll=yes else @@ -8950,7 +8953,7 @@ fi echo $ac_n "checking for 64 bit off_t""... $ac_c" 1>&6 -echo "configure:8954: checking for 64 bit off_t" >&5 +echo "configure:8957: checking for 64 bit off_t" >&5 if eval "test \"`echo '$''{'samba_cv_SIZEOF_OFF_T'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8959,13 +8962,13 @@ if test "$cross_compiling" = yes; then samba_cv_SIZEOF_OFF_T=cross else cat > conftest.$ac_ext <<EOF -#line 8963 "configure" +#line 8966 "configure" #include "confdefs.h" #include <stdio.h> #include <sys/stat.h> main() { exit((sizeof(off_t) == 8) ? 0 : 1); } EOF -if { (eval echo configure:8969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8972: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_SIZEOF_OFF_T=yes else @@ -8988,7 +8991,7 @@ EOF fi echo $ac_n "checking for off64_t""... $ac_c" 1>&6 -echo "configure:8992: checking for off64_t" >&5 +echo "configure:8995: checking for off64_t" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_OFF64_T'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8997,7 +9000,7 @@ if test "$cross_compiling" = yes; then samba_cv_HAVE_OFF64_T=cross else cat > conftest.$ac_ext <<EOF -#line 9001 "configure" +#line 9004 "configure" #include "confdefs.h" #if defined(HAVE_UNISTD_H) @@ -9007,7 +9010,7 @@ else #include <sys/stat.h> main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); } EOF -if { (eval echo configure:9011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:9014: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_OFF64_T=yes else @@ -9030,7 +9033,7 @@ EOF fi echo $ac_n "checking for 64 bit ino_t""... $ac_c" 1>&6 -echo "configure:9034: checking for 64 bit ino_t" >&5 +echo "configure:9037: checking for 64 bit ino_t" >&5 if eval "test \"`echo '$''{'samba_cv_SIZEOF_INO_T'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9039,13 +9042,13 @@ if test "$cross_compiling" = yes; then samba_cv_SIZEOF_INO_T=cross else cat > conftest.$ac_ext <<EOF -#line 9043 "configure" +#line 9046 "configure" #include "confdefs.h" #include <stdio.h> #include <sys/stat.h> main() { exit((sizeof(ino_t) == 8) ? 0 : 1); } EOF -if { (eval echo configure:9049: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:9052: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_SIZEOF_INO_T=yes else @@ -9068,7 +9071,7 @@ EOF fi echo $ac_n "checking for ino64_t""... $ac_c" 1>&6 -echo "configure:9072: checking for ino64_t" >&5 +echo "configure:9075: checking for ino64_t" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_INO64_T'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9077,7 +9080,7 @@ if test "$cross_compiling" = yes; then samba_cv_HAVE_INO64_T=cross else cat > conftest.$ac_ext <<EOF -#line 9081 "configure" +#line 9084 "configure" #include "confdefs.h" #if defined(HAVE_UNISTD_H) @@ -9087,7 +9090,7 @@ else #include <sys/stat.h> main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); } EOF -if { (eval echo configure:9091: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:9094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_INO64_T=yes else @@ -9110,13 +9113,13 @@ EOF fi echo $ac_n "checking for struct dirent64""... $ac_c" 1>&6 -echo "configure:9114: checking for struct dirent64" >&5 +echo "configure:9117: checking for struct dirent64" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_STRUCT_DIRENT64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9120 "configure" +#line 9123 "configure" #include "confdefs.h" #if defined(HAVE_UNISTD_H) @@ -9128,7 +9131,7 @@ int main() { struct dirent64 de; ; return 0; } EOF -if { (eval echo configure:9132: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9135: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_STRUCT_DIRENT64=yes else @@ -9149,7 +9152,7 @@ EOF fi echo $ac_n "checking for unsigned char""... $ac_c" 1>&6 -echo "configure:9153: checking for unsigned char" >&5 +echo "configure:9156: checking for unsigned char" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_UNSIGNED_CHAR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9158,12 +9161,12 @@ if test "$cross_compiling" = yes; then samba_cv_HAVE_UNSIGNED_CHAR=cross else cat > conftest.$ac_ext <<EOF -#line 9162 "configure" +#line 9165 "configure" #include "confdefs.h" #include <stdio.h> main() { char c; c=250; exit((c > 0)?0:1); } EOF -if { (eval echo configure:9167: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:9170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_UNSIGNED_CHAR=yes else @@ -9186,13 +9189,13 @@ EOF fi echo $ac_n "checking for sin_len in sock""... $ac_c" 1>&6 -echo "configure:9190: checking for sin_len in sock" >&5 +echo "configure:9193: checking for sin_len in sock" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_SOCK_SIN_LEN'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9196 "configure" +#line 9199 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/socket.h> @@ -9201,7 +9204,7 @@ int main() { struct sockaddr_in sock; sock.sin_len = sizeof(sock); ; return 0; } EOF -if { (eval echo configure:9205: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9208: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_SOCK_SIN_LEN=yes else @@ -9222,13 +9225,13 @@ EOF fi echo $ac_n "checking whether seekdir returns void""... $ac_c" 1>&6 -echo "configure:9226: checking whether seekdir returns void" >&5 +echo "configure:9229: checking whether seekdir returns void" >&5 if eval "test \"`echo '$''{'samba_cv_SEEKDIR_RETURNS_VOID'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9232 "configure" +#line 9235 "configure" #include "confdefs.h" #include <sys/types.h> #include <dirent.h> @@ -9237,7 +9240,7 @@ int main() { return 0; ; return 0; } EOF -if { (eval echo configure:9241: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9244: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_SEEKDIR_RETURNS_VOID=yes else @@ -9258,20 +9261,20 @@ EOF fi echo $ac_n "checking for __FILE__ macro""... $ac_c" 1>&6 -echo "configure:9262: checking for __FILE__ macro" >&5 +echo "configure:9265: checking for __FILE__ macro" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_FILE_MACRO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9268 "configure" +#line 9271 "configure" #include "confdefs.h" #include <stdio.h> int main() { printf("%s\n", __FILE__); ; return 0; } EOF -if { (eval echo configure:9275: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9278: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_FILE_MACRO=yes else @@ -9292,20 +9295,20 @@ EOF fi echo $ac_n "checking for __FUNCTION__ macro""... $ac_c" 1>&6 -echo "configure:9296: checking for __FUNCTION__ macro" >&5 +echo "configure:9299: checking for __FUNCTION__ macro" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_FUNCTION_MACRO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9302 "configure" +#line 9305 "configure" #include "confdefs.h" #include <stdio.h> int main() { printf("%s\n", __FUNCTION__); ; return 0; } EOF -if { (eval echo configure:9309: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9312: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_FUNCTION_MACRO=yes else @@ -9326,7 +9329,7 @@ EOF fi echo $ac_n "checking if gettimeofday takes tz argument""... $ac_c" 1>&6 -echo "configure:9330: checking if gettimeofday takes tz argument" >&5 +echo "configure:9333: checking if gettimeofday takes tz argument" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_GETTIMEOFDAY_TZ'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9335,14 +9338,14 @@ if test "$cross_compiling" = yes; then samba_cv_HAVE_GETTIMEOFDAY_TZ=cross else cat > conftest.$ac_ext <<EOF -#line 9339 "configure" +#line 9342 "configure" #include "confdefs.h" #include <sys/time.h> #include <unistd.h> main() { struct timeval tv; exit(gettimeofday(&tv, NULL));} EOF -if { (eval echo configure:9346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:9349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_GETTIMEOFDAY_TZ=yes else @@ -9365,7 +9368,7 @@ EOF fi echo $ac_n "checking for C99 vsnprintf""... $ac_c" 1>&6 -echo "configure:9369: checking for C99 vsnprintf" >&5 +echo "configure:9372: checking for C99 vsnprintf" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_C99_VSNPRINTF'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9374,7 +9377,7 @@ if test "$cross_compiling" = yes; then samba_cv_HAVE_C99_VSNPRINTF=cross else cat > conftest.$ac_ext <<EOF -#line 9378 "configure" +#line 9381 "configure" #include "confdefs.h" #include <sys/types.h> @@ -9396,7 +9399,7 @@ void foo(const char *format, ...) { main() { foo("hello"); } EOF -if { (eval echo configure:9400: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:9403: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_C99_VSNPRINTF=yes else @@ -9419,7 +9422,7 @@ EOF fi echo $ac_n "checking for broken readdir""... $ac_c" 1>&6 -echo "configure:9423: checking for broken readdir" >&5 +echo "configure:9426: checking for broken readdir" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_BROKEN_READDIR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9428,7 +9431,7 @@ if test "$cross_compiling" = yes; then samba_cv_HAVE_BROKEN_READDIR=cross else cat > conftest.$ac_ext <<EOF -#line 9432 "configure" +#line 9435 "configure" #include "confdefs.h" #include <sys/types.h> #include <dirent.h> @@ -9436,7 +9439,7 @@ main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d); if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 && di->d_name[0] == 0) exit(0); exit(1);} EOF -if { (eval echo configure:9440: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:9443: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_BROKEN_READDIR=yes else @@ -9459,13 +9462,13 @@ EOF fi echo $ac_n "checking for utimbuf""... $ac_c" 1>&6 -echo "configure:9463: checking for utimbuf" >&5 +echo "configure:9466: checking for utimbuf" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_UTIMBUF'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9469 "configure" +#line 9472 "configure" #include "confdefs.h" #include <sys/types.h> #include <utime.h> @@ -9473,7 +9476,7 @@ int main() { struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf)); ; return 0; } EOF -if { (eval echo configure:9477: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9480: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_UTIMBUF=yes else @@ -9497,12 +9500,12 @@ fi for ac_func in pututline pututxline updwtmp updwtmpx getutmpx do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:9501: checking for $ac_func" >&5 +echo "configure:9504: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9506 "configure" +#line 9509 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -9525,7 +9528,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:9529: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9532: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -9551,13 +9554,13 @@ done echo $ac_n "checking for ut_name in utmp""... $ac_c" 1>&6 -echo "configure:9555: checking for ut_name in utmp" >&5 +echo "configure:9558: checking for ut_name in utmp" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_UT_UT_NAME'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9561 "configure" +#line 9564 "configure" #include "confdefs.h" #include <sys/types.h> #include <utmp.h> @@ -9565,7 +9568,7 @@ int main() { struct utmp ut; ut.ut_name[0] = 'a'; ; return 0; } EOF -if { (eval echo configure:9569: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9572: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_UT_UT_NAME=yes else @@ -9586,13 +9589,13 @@ EOF fi echo $ac_n "checking for ut_user in utmp""... $ac_c" 1>&6 -echo "configure:9590: checking for ut_user in utmp" >&5 +echo "configure:9593: checking for ut_user in utmp" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_UT_UT_USER'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9596 "configure" +#line 9599 "configure" #include "confdefs.h" #include <sys/types.h> #include <utmp.h> @@ -9600,7 +9603,7 @@ int main() { struct utmp ut; ut.ut_user[0] = 'a'; ; return 0; } EOF -if { (eval echo configure:9604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9607: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_UT_UT_USER=yes else @@ -9621,13 +9624,13 @@ EOF fi echo $ac_n "checking for ut_id in utmp""... $ac_c" 1>&6 -echo "configure:9625: checking for ut_id in utmp" >&5 +echo "configure:9628: checking for ut_id in utmp" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_UT_UT_ID'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9631 "configure" +#line 9634 "configure" #include "confdefs.h" #include <sys/types.h> #include <utmp.h> @@ -9635,7 +9638,7 @@ int main() { struct utmp ut; ut.ut_id[0] = 'a'; ; return 0; } EOF -if { (eval echo configure:9639: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_UT_UT_ID=yes else @@ -9656,13 +9659,13 @@ EOF fi echo $ac_n "checking for ut_host in utmp""... $ac_c" 1>&6 -echo "configure:9660: checking for ut_host in utmp" >&5 +echo "configure:9663: checking for ut_host in utmp" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_UT_UT_HOST'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9666 "configure" +#line 9669 "configure" #include "confdefs.h" #include <sys/types.h> #include <utmp.h> @@ -9670,7 +9673,7 @@ int main() { struct utmp ut; ut.ut_host[0] = 'a'; ; return 0; } EOF -if { (eval echo configure:9674: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9677: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_UT_UT_HOST=yes else @@ -9691,13 +9694,13 @@ EOF fi echo $ac_n "checking for ut_time in utmp""... $ac_c" 1>&6 -echo "configure:9695: checking for ut_time in utmp" >&5 +echo "configure:9698: checking for ut_time in utmp" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_UT_UT_TIME'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9701 "configure" +#line 9704 "configure" #include "confdefs.h" #include <sys/types.h> #include <utmp.h> @@ -9705,7 +9708,7 @@ int main() { struct utmp ut; time_t t; ut.ut_time = t; ; return 0; } EOF -if { (eval echo configure:9709: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9712: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_UT_UT_TIME=yes else @@ -9726,13 +9729,13 @@ EOF fi echo $ac_n "checking for ut_tv in utmp""... $ac_c" 1>&6 -echo "configure:9730: checking for ut_tv in utmp" >&5 +echo "configure:9733: checking for ut_tv in utmp" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_UT_UT_TV'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9736 "configure" +#line 9739 "configure" #include "confdefs.h" #include <sys/types.h> #include <utmp.h> @@ -9740,7 +9743,7 @@ int main() { struct utmp ut; struct timeval tv; ut.ut_tv = tv; ; return 0; } EOF -if { (eval echo configure:9744: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9747: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_UT_UT_TV=yes else @@ -9761,13 +9764,13 @@ EOF fi echo $ac_n "checking for ut_type in utmp""... $ac_c" 1>&6 -echo "configure:9765: checking for ut_type in utmp" >&5 +echo "configure:9768: checking for ut_type in utmp" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_UT_UT_TYPE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9771 "configure" +#line 9774 "configure" #include "confdefs.h" #include <sys/types.h> #include <utmp.h> @@ -9775,7 +9778,7 @@ int main() { struct utmp ut; ut.ut_type = 0; ; return 0; } EOF -if { (eval echo configure:9779: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9782: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_UT_UT_TYPE=yes else @@ -9796,13 +9799,13 @@ EOF fi echo $ac_n "checking for ut_pid in utmp""... $ac_c" 1>&6 -echo "configure:9800: checking for ut_pid in utmp" >&5 +echo "configure:9803: checking for ut_pid in utmp" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_UT_UT_PID'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9806 "configure" +#line 9809 "configure" #include "confdefs.h" #include <sys/types.h> #include <utmp.h> @@ -9810,7 +9813,7 @@ int main() { struct utmp ut; ut.ut_pid = 0; ; return 0; } EOF -if { (eval echo configure:9814: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9817: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_UT_UT_PID=yes else @@ -9831,13 +9834,13 @@ EOF fi echo $ac_n "checking for ut_exit in utmp""... $ac_c" 1>&6 -echo "configure:9835: checking for ut_exit in utmp" >&5 +echo "configure:9838: checking for ut_exit in utmp" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_UT_UT_EXIT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9841 "configure" +#line 9844 "configure" #include "confdefs.h" #include <sys/types.h> #include <utmp.h> @@ -9845,7 +9848,7 @@ int main() { struct utmp ut; ut.ut_exit.e_exit = 0; ; return 0; } EOF -if { (eval echo configure:9849: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9852: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_UT_UT_EXIT=yes else @@ -9866,13 +9869,13 @@ EOF fi echo $ac_n "checking for ut_addr in utmp""... $ac_c" 1>&6 -echo "configure:9870: checking for ut_addr in utmp" >&5 +echo "configure:9873: checking for ut_addr in utmp" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_UT_UT_ADDR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9876 "configure" +#line 9879 "configure" #include "confdefs.h" #include <sys/types.h> #include <utmp.h> @@ -9880,7 +9883,7 @@ int main() { struct utmp ut; ut.ut_addr = 0; ; return 0; } EOF -if { (eval echo configure:9884: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9887: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_UT_UT_ADDR=yes else @@ -9902,13 +9905,13 @@ fi if test x$ac_cv_func_pututline = xyes ; then echo $ac_n "checking whether pututline returns pointer""... $ac_c" 1>&6 -echo "configure:9906: checking whether pututline returns pointer" >&5 +echo "configure:9909: checking whether pututline returns pointer" >&5 if eval "test \"`echo '$''{'samba_cv_PUTUTLINE_RETURNS_UTMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9912 "configure" +#line 9915 "configure" #include "confdefs.h" #include <sys/types.h> #include <utmp.h> @@ -9916,7 +9919,7 @@ int main() { struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg); ; return 0; } EOF -if { (eval echo configure:9920: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9923: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_PUTUTLINE_RETURNS_UTMP=yes else @@ -9938,13 +9941,13 @@ EOF fi echo $ac_n "checking for ut_syslen in utmpx""... $ac_c" 1>&6 -echo "configure:9942: checking for ut_syslen in utmpx" >&5 +echo "configure:9945: checking for ut_syslen in utmpx" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_UX_UT_SYSLEN'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 9948 "configure" +#line 9951 "configure" #include "confdefs.h" #include <sys/types.h> #include <utmpx.h> @@ -9952,7 +9955,7 @@ int main() { struct utmpx ux; ux.ut_syslen = 0; ; return 0; } EOF -if { (eval echo configure:9956: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:9959: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_UX_UT_SYSLEN=yes else @@ -9972,8 +9975,58 @@ EOF fi +############ +# check for iconv in libc, and if not then we build our own +echo $ac_n "checking for working iconv""... $ac_c" 1>&6 +echo "configure:9982: checking for working iconv" >&5 +if eval "test \"`echo '$''{'samba_cv_HAVE_NATIVE_ICONV'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +if test "$cross_compiling" = yes; then + samba_cv_HAVE_NATIVE_ICONV=cross +else + cat > conftest.$ac_ext <<EOF +#line 9991 "configure" +#include "confdefs.h" + +#include <iconv.h> +main() { + iconv_t cd = iconv_open("ASCII", "UCS2"); + if (cd == 0 || cd == (iconv_t)-1) return -1; + return 0; +} + +EOF +if { (eval echo configure:10002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + samba_cv_HAVE_NATIVE_ICONV=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + samba_cv_HAVE_NATIVE_ICONV=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$samba_cv_HAVE_NATIVE_ICONV" 1>&6 +if test x"$samba_cv_HAVE_NATIVE_ICONV" = x"yes"; then + cat >> confdefs.h <<\EOF +#define HAVE_NATIVE_ICONV 1 +EOF + + ICONV_OBJS="" +else + ICONV_OBJS="iconv/iconv.o" +fi + + + echo $ac_n "checking for Linux kernel oplocks""... $ac_c" 1>&6 -echo "configure:9977: checking for Linux kernel oplocks" >&5 +echo "configure:10030: checking for Linux kernel oplocks" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_KERNEL_OPLOCKS_LINUX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -9982,7 +10035,7 @@ if test "$cross_compiling" = yes; then samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross else cat > conftest.$ac_ext <<EOF -#line 9986 "configure" +#line 10039 "configure" #include "confdefs.h" #include <sys/types.h> @@ -9996,7 +10049,7 @@ main() { } EOF -if { (eval echo configure:10000: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes else @@ -10019,7 +10072,7 @@ EOF fi echo $ac_n "checking for kernel change notify support""... $ac_c" 1>&6 -echo "configure:10023: checking for kernel change notify support" >&5 +echo "configure:10076: checking for kernel change notify support" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_KERNEL_CHANGE_NOTIFY'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10028,7 +10081,7 @@ if test "$cross_compiling" = yes; then samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross else cat > conftest.$ac_ext <<EOF -#line 10032 "configure" +#line 10085 "configure" #include "confdefs.h" #include <sys/types.h> @@ -10042,7 +10095,7 @@ main() { } EOF -if { (eval echo configure:10046: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10099: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes else @@ -10065,7 +10118,7 @@ EOF fi echo $ac_n "checking for kernel share modes""... $ac_c" 1>&6 -echo "configure:10069: checking for kernel share modes" >&5 +echo "configure:10122: checking for kernel share modes" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_KERNEL_SHARE_MODES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10074,7 +10127,7 @@ if test "$cross_compiling" = yes; then samba_cv_HAVE_KERNEL_SHARE_MODES=cross else cat > conftest.$ac_ext <<EOF -#line 10078 "configure" +#line 10131 "configure" #include "confdefs.h" #include <sys/types.h> @@ -10090,7 +10143,7 @@ main() { } EOF -if { (eval echo configure:10094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10147: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_KERNEL_SHARE_MODES=yes else @@ -10116,13 +10169,13 @@ fi echo $ac_n "checking for IRIX kernel oplock type definitions""... $ac_c" 1>&6 -echo "configure:10120: checking for IRIX kernel oplock type definitions" >&5 +echo "configure:10173: checking for IRIX kernel oplock type definitions" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_KERNEL_OPLOCKS_IRIX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10126 "configure" +#line 10179 "configure" #include "confdefs.h" #include <sys/types.h> #include <fcntl.h> @@ -10130,7 +10183,7 @@ int main() { oplock_stat_t t; t.os_state = OP_REVOKE; t.os_dev = 1; t.os_ino = 1; ; return 0; } EOF -if { (eval echo configure:10134: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10187: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_KERNEL_OPLOCKS_IRIX=yes else @@ -10151,7 +10204,7 @@ EOF fi echo $ac_n "checking for irix specific capabilities""... $ac_c" 1>&6 -echo "configure:10155: checking for irix specific capabilities" >&5 +echo "configure:10208: checking for irix specific capabilities" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10160,7 +10213,7 @@ if test "$cross_compiling" = yes; then samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=cross else cat > conftest.$ac_ext <<EOF -#line 10164 "configure" +#line 10217 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/capability.h> @@ -10175,7 +10228,7 @@ main() { } EOF -if { (eval echo configure:10179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10232: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_IRIX_SPECIFIC_CAPABILITIES=yes else @@ -10203,13 +10256,13 @@ fi # echo $ac_n "checking for int16 typedef included by rpc/rpc.h""... $ac_c" 1>&6 -echo "configure:10207: checking for int16 typedef included by rpc/rpc.h" >&5 +echo "configure:10260: checking for int16 typedef included by rpc/rpc.h" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_INT16_FROM_RPC_RPC_H'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10213 "configure" +#line 10266 "configure" #include "confdefs.h" #include <sys/types.h> #if defined(HAVE_RPC_RPC_H) @@ -10219,7 +10272,7 @@ int main() { int16 testvar; ; return 0; } EOF -if { (eval echo configure:10223: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10276: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_INT16_FROM_RPC_RPC_H=yes else @@ -10240,13 +10293,13 @@ EOF fi echo $ac_n "checking for uint16 typedef included by rpc/rpc.h""... $ac_c" 1>&6 -echo "configure:10244: checking for uint16 typedef included by rpc/rpc.h" >&5 +echo "configure:10297: checking for uint16 typedef included by rpc/rpc.h" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_UINT16_FROM_RPC_RPC_H'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10250 "configure" +#line 10303 "configure" #include "confdefs.h" #include <sys/types.h> #if defined(HAVE_RPC_RPC_H) @@ -10256,7 +10309,7 @@ int main() { uint16 testvar; ; return 0; } EOF -if { (eval echo configure:10260: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10313: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_UINT16_FROM_RPC_RPC_H=yes else @@ -10277,13 +10330,13 @@ EOF fi echo $ac_n "checking for int32 typedef included by rpc/rpc.h""... $ac_c" 1>&6 -echo "configure:10281: checking for int32 typedef included by rpc/rpc.h" >&5 +echo "configure:10334: checking for int32 typedef included by rpc/rpc.h" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_INT32_FROM_RPC_RPC_H'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10287 "configure" +#line 10340 "configure" #include "confdefs.h" #include <sys/types.h> #if defined(HAVE_RPC_RPC_H) @@ -10293,7 +10346,7 @@ int main() { int32 testvar; ; return 0; } EOF -if { (eval echo configure:10297: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10350: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_INT32_FROM_RPC_RPC_H=yes else @@ -10314,13 +10367,13 @@ EOF fi echo $ac_n "checking for uint32 typedef included by rpc/rpc.h""... $ac_c" 1>&6 -echo "configure:10318: checking for uint32 typedef included by rpc/rpc.h" >&5 +echo "configure:10371: checking for uint32 typedef included by rpc/rpc.h" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_UINT32_FROM_RPC_RPC_H'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10324 "configure" +#line 10377 "configure" #include "confdefs.h" #include <sys/types.h> #if defined(HAVE_RPC_RPC_H) @@ -10330,7 +10383,7 @@ int main() { uint32 testvar; ; return 0; } EOF -if { (eval echo configure:10334: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10387: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_UINT32_FROM_RPC_RPC_H=yes else @@ -10352,13 +10405,13 @@ fi echo $ac_n "checking for conflicting AUTH_ERROR define in rpc/rpc.h""... $ac_c" 1>&6 -echo "configure:10356: checking for conflicting AUTH_ERROR define in rpc/rpc.h" >&5 +echo "configure:10409: checking for conflicting AUTH_ERROR define in rpc/rpc.h" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10362 "configure" +#line 10415 "configure" #include "confdefs.h" #include <sys/types.h> #ifdef HAVE_SYS_SECURITY_H @@ -10372,7 +10425,7 @@ int main() { int testvar; ; return 0; } EOF -if { (eval echo configure:10376: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10429: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_RPC_AUTH_ERROR_CONFLICT=no else @@ -10393,16 +10446,16 @@ EOF fi echo $ac_n "checking for test routines""... $ac_c" 1>&6 -echo "configure:10397: checking for test routines" >&5 +echo "configure:10450: checking for test routines" >&5 if test "$cross_compiling" = yes; then echo "configure: warning: cannot run when cross-compiling" 1>&2 else cat > conftest.$ac_ext <<EOF -#line 10402 "configure" +#line 10455 "configure" #include "confdefs.h" #include "${srcdir-.}/tests/trivial.c" EOF -if { (eval echo configure:10406: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then echo "$ac_t""yes" 1>&6 else @@ -10416,7 +10469,7 @@ fi echo $ac_n "checking for ftruncate extend""... $ac_c" 1>&6 -echo "configure:10420: checking for ftruncate extend" >&5 +echo "configure:10473: checking for ftruncate extend" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_FTRUNCATE_EXTEND'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10425,11 +10478,11 @@ if test "$cross_compiling" = yes; then samba_cv_HAVE_FTRUNCATE_EXTEND=cross else cat > conftest.$ac_ext <<EOF -#line 10429 "configure" +#line 10482 "configure" #include "confdefs.h" #include "${srcdir-.}/tests/ftruncate.c" EOF -if { (eval echo configure:10433: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10486: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_FTRUNCATE_EXTEND=yes else @@ -10452,7 +10505,7 @@ EOF fi echo $ac_n "checking for AF_LOCAL socket support""... $ac_c" 1>&6 -echo "configure:10456: checking for AF_LOCAL socket support" >&5 +echo "configure:10509: checking for AF_LOCAL socket support" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_WORKING_AF_LOCAL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10461,11 +10514,11 @@ if test "$cross_compiling" = yes; then samba_cv_HAVE_WORKING_AF_LOCAL=cross else cat > conftest.$ac_ext <<EOF -#line 10465 "configure" +#line 10518 "configure" #include "confdefs.h" #include "${srcdir-.}/tests/unixsock.c" EOF -if { (eval echo configure:10469: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10522: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_WORKING_AF_LOCAL=yes else @@ -10489,7 +10542,7 @@ EOF fi echo $ac_n "checking for broken getgroups""... $ac_c" 1>&6 -echo "configure:10493: checking for broken getgroups" >&5 +echo "configure:10546: checking for broken getgroups" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_BROKEN_GETGROUPS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10498,11 +10551,11 @@ if test "$cross_compiling" = yes; then samba_cv_HAVE_BROKEN_GETGROUPS=cross else cat > conftest.$ac_ext <<EOF -#line 10502 "configure" +#line 10555 "configure" #include "confdefs.h" #include "${srcdir-.}/tests/getgroups.c" EOF -if { (eval echo configure:10506: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10559: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_BROKEN_GETGROUPS=yes else @@ -10525,7 +10578,7 @@ EOF fi echo $ac_n "checking whether getpass should be replaced""... $ac_c" 1>&6 -echo "configure:10529: checking whether getpass should be replaced" >&5 +echo "configure:10582: checking whether getpass should be replaced" >&5 if eval "test \"`echo '$''{'samba_cv_REPLACE_GETPASS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10533,7 +10586,7 @@ else SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I${srcdir-.}/ -I${srcdir-.}/include -I${srcdir-.}/ubiqx -I${srcdir-.}/smbwrapper" cat > conftest.$ac_ext <<EOF -#line 10537 "configure" +#line 10590 "configure" #include "confdefs.h" #define REPLACE_GETPASS 1 @@ -10546,7 +10599,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:10550: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10603: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_REPLACE_GETPASS=yes else @@ -10569,7 +10622,7 @@ EOF fi echo $ac_n "checking for broken inet_ntoa""... $ac_c" 1>&6 -echo "configure:10573: checking for broken inet_ntoa" >&5 +echo "configure:10626: checking for broken inet_ntoa" >&5 if eval "test \"`echo '$''{'samba_cv_REPLACE_INET_NTOA'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10578,7 +10631,7 @@ if test "$cross_compiling" = yes; then samba_cv_REPLACE_INET_NTOA=cross else cat > conftest.$ac_ext <<EOF -#line 10582 "configure" +#line 10635 "configure" #include "confdefs.h" #include <stdio.h> @@ -10592,7 +10645,7 @@ if (strcmp(inet_ntoa(ip),"18.52.86.120") && strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); } exit(1);} EOF -if { (eval echo configure:10596: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_REPLACE_INET_NTOA=yes else @@ -10615,7 +10668,7 @@ EOF fi echo $ac_n "checking for secure mkstemp""... $ac_c" 1>&6 -echo "configure:10619: checking for secure mkstemp" >&5 +echo "configure:10672: checking for secure mkstemp" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_SECURE_MKSTEMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10624,7 +10677,7 @@ if test "$cross_compiling" = yes; then samba_cv_HAVE_SECURE_MKSTEMP=cross else cat > conftest.$ac_ext <<EOF -#line 10628 "configure" +#line 10681 "configure" #include "confdefs.h" #include <stdlib.h> #include <sys/types.h> @@ -10641,7 +10694,7 @@ main() { exit(0); } EOF -if { (eval echo configure:10645: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10698: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_SECURE_MKSTEMP=yes else @@ -10664,7 +10717,7 @@ EOF fi echo $ac_n "checking for sysconf(_SC_NGROUPS_MAX)""... $ac_c" 1>&6 -echo "configure:10668: checking for sysconf(_SC_NGROUPS_MAX)" >&5 +echo "configure:10721: checking for sysconf(_SC_NGROUPS_MAX)" >&5 if eval "test \"`echo '$''{'samba_cv_SYSCONF_SC_NGROUPS_MAX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10673,12 +10726,12 @@ if test "$cross_compiling" = yes; then samba_cv_SYSCONF_SC_NGROUPS_MAX=cross else cat > conftest.$ac_ext <<EOF -#line 10677 "configure" +#line 10730 "configure" #include "confdefs.h" #include <unistd.h> main() { exit(sysconf(_SC_NGROUPS_MAX) == -1 ? 1 : 0); } EOF -if { (eval echo configure:10682: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_SYSCONF_SC_NGROUPS_MAX=yes else @@ -10701,7 +10754,7 @@ EOF fi echo $ac_n "checking for root""... $ac_c" 1>&6 -echo "configure:10705: checking for root" >&5 +echo "configure:10758: checking for root" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_ROOT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10710,11 +10763,11 @@ if test "$cross_compiling" = yes; then samba_cv_HAVE_ROOT=cross else cat > conftest.$ac_ext <<EOF -#line 10714 "configure" +#line 10767 "configure" #include "confdefs.h" main() { exit(getuid() != 0); } EOF -if { (eval echo configure:10718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_ROOT=yes else @@ -10742,7 +10795,7 @@ fi # look for a method of finding the list of network interfaces iface=no; echo $ac_n "checking for iface AIX""... $ac_c" 1>&6 -echo "configure:10746: checking for iface AIX" >&5 +echo "configure:10799: checking for iface AIX" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_IFACE_AIX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10751,7 +10804,7 @@ if test "$cross_compiling" = yes; then samba_cv_HAVE_IFACE_AIX=cross else cat > conftest.$ac_ext <<EOF -#line 10755 "configure" +#line 10808 "configure" #include "confdefs.h" #define HAVE_IFACE_AIX 1 @@ -10759,7 +10812,7 @@ else #include "confdefs.h" #include "${srcdir-.}/lib/interfaces.c" EOF -if { (eval echo configure:10763: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10816: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_IFACE_AIX=yes else @@ -10783,7 +10836,7 @@ fi if test $iface = no; then echo $ac_n "checking for iface ifconf""... $ac_c" 1>&6 -echo "configure:10787: checking for iface ifconf" >&5 +echo "configure:10840: checking for iface ifconf" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_IFACE_IFCONF'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10792,7 +10845,7 @@ if test "$cross_compiling" = yes; then samba_cv_HAVE_IFACE_IFCONF=cross else cat > conftest.$ac_ext <<EOF -#line 10796 "configure" +#line 10849 "configure" #include "confdefs.h" #define HAVE_IFACE_IFCONF 1 @@ -10800,7 +10853,7 @@ else #include "confdefs.h" #include "${srcdir-.}/lib/interfaces.c" EOF -if { (eval echo configure:10804: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_IFACE_IFCONF=yes else @@ -10825,7 +10878,7 @@ fi if test $iface = no; then echo $ac_n "checking for iface ifreq""... $ac_c" 1>&6 -echo "configure:10829: checking for iface ifreq" >&5 +echo "configure:10882: checking for iface ifreq" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_IFACE_IFREQ'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10834,7 +10887,7 @@ if test "$cross_compiling" = yes; then samba_cv_HAVE_IFACE_IFREQ=cross else cat > conftest.$ac_ext <<EOF -#line 10838 "configure" +#line 10891 "configure" #include "confdefs.h" #define HAVE_IFACE_IFREQ 1 @@ -10842,7 +10895,7 @@ else #include "confdefs.h" #include "${srcdir-.}/lib/interfaces.c" EOF -if { (eval echo configure:10846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_IFACE_IFREQ=yes else @@ -10871,7 +10924,7 @@ fi seteuid=no; if test $seteuid = no; then echo $ac_n "checking for setresuid""... $ac_c" 1>&6 -echo "configure:10875: checking for setresuid" >&5 +echo "configure:10928: checking for setresuid" >&5 if eval "test \"`echo '$''{'samba_cv_USE_SETRESUID'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10880,7 +10933,7 @@ if test "$cross_compiling" = yes; then samba_cv_USE_SETRESUID=cross else cat > conftest.$ac_ext <<EOF -#line 10884 "configure" +#line 10937 "configure" #include "confdefs.h" #define AUTOCONF_TEST 1 @@ -10888,7 +10941,7 @@ else #include "confdefs.h" #include "${srcdir-.}/lib/util_sec.c" EOF -if { (eval echo configure:10892: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_USE_SETRESUID=yes else @@ -10914,7 +10967,7 @@ fi if test $seteuid = no; then echo $ac_n "checking for setreuid""... $ac_c" 1>&6 -echo "configure:10918: checking for setreuid" >&5 +echo "configure:10971: checking for setreuid" >&5 if eval "test \"`echo '$''{'samba_cv_USE_SETREUID'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10923,7 +10976,7 @@ if test "$cross_compiling" = yes; then samba_cv_USE_SETREUID=cross else cat > conftest.$ac_ext <<EOF -#line 10927 "configure" +#line 10980 "configure" #include "confdefs.h" #define AUTOCONF_TEST 1 @@ -10931,7 +10984,7 @@ else #include "confdefs.h" #include "${srcdir-.}/lib/util_sec.c" EOF -if { (eval echo configure:10935: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:10988: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_USE_SETREUID=yes else @@ -10956,7 +11009,7 @@ fi if test $seteuid = no; then echo $ac_n "checking for seteuid""... $ac_c" 1>&6 -echo "configure:10960: checking for seteuid" >&5 +echo "configure:11013: checking for seteuid" >&5 if eval "test \"`echo '$''{'samba_cv_USE_SETEUID'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10965,7 +11018,7 @@ if test "$cross_compiling" = yes; then samba_cv_USE_SETEUID=cross else cat > conftest.$ac_ext <<EOF -#line 10969 "configure" +#line 11022 "configure" #include "confdefs.h" #define AUTOCONF_TEST 1 @@ -10973,7 +11026,7 @@ else #include "confdefs.h" #include "${srcdir-.}/lib/util_sec.c" EOF -if { (eval echo configure:10977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:11030: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_USE_SETEUID=yes else @@ -10998,7 +11051,7 @@ fi if test $seteuid = no; then echo $ac_n "checking for setuidx""... $ac_c" 1>&6 -echo "configure:11002: checking for setuidx" >&5 +echo "configure:11055: checking for setuidx" >&5 if eval "test \"`echo '$''{'samba_cv_USE_SETUIDX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -11007,7 +11060,7 @@ if test "$cross_compiling" = yes; then samba_cv_USE_SETUIDX=cross else cat > conftest.$ac_ext <<EOF -#line 11011 "configure" +#line 11064 "configure" #include "confdefs.h" #define AUTOCONF_TEST 1 @@ -11015,7 +11068,7 @@ else #include "confdefs.h" #include "${srcdir-.}/lib/util_sec.c" EOF -if { (eval echo configure:11019: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:11072: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_USE_SETUIDX=yes else @@ -11040,7 +11093,7 @@ fi echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:11044: checking for working mmap" >&5 +echo "configure:11097: checking for working mmap" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_MMAP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -11049,11 +11102,11 @@ if test "$cross_compiling" = yes; then samba_cv_HAVE_MMAP=cross else cat > conftest.$ac_ext <<EOF -#line 11053 "configure" +#line 11106 "configure" #include "confdefs.h" #include "${srcdir-.}/tests/shared_mmap.c" EOF -if { (eval echo configure:11057: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:11110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_MMAP=yes else @@ -11076,7 +11129,7 @@ EOF fi echo $ac_n "checking for ftruncate needs root""... $ac_c" 1>&6 -echo "configure:11080: checking for ftruncate needs root" >&5 +echo "configure:11133: checking for ftruncate needs root" >&5 if eval "test \"`echo '$''{'samba_cv_FTRUNCATE_NEEDS_ROOT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -11085,11 +11138,11 @@ if test "$cross_compiling" = yes; then samba_cv_FTRUNCATE_NEEDS_ROOT=cross else cat > conftest.$ac_ext <<EOF -#line 11089 "configure" +#line 11142 "configure" #include "confdefs.h" #include "${srcdir-.}/tests/ftruncroot.c" EOF -if { (eval echo configure:11093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:11146: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_FTRUNCATE_NEEDS_ROOT=yes else @@ -11112,7 +11165,7 @@ EOF fi echo $ac_n "checking for fcntl locking""... $ac_c" 1>&6 -echo "configure:11116: checking for fcntl locking" >&5 +echo "configure:11169: checking for fcntl locking" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_FCNTL_LOCK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -11121,11 +11174,11 @@ if test "$cross_compiling" = yes; then samba_cv_HAVE_FCNTL_LOCK=cross else cat > conftest.$ac_ext <<EOF -#line 11125 "configure" +#line 11178 "configure" #include "confdefs.h" #include "${srcdir-.}/tests/fcntl_lock.c" EOF -if { (eval echo configure:11129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:11182: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_FCNTL_LOCK=yes else @@ -11148,7 +11201,7 @@ EOF fi echo $ac_n "checking for broken (glibc2.1/x86) 64 bit fcntl locking""... $ac_c" 1>&6 -echo "configure:11152: checking for broken (glibc2.1/x86) 64 bit fcntl locking" >&5 +echo "configure:11205: checking for broken (glibc2.1/x86) 64 bit fcntl locking" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_BROKEN_FCNTL64_LOCKS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -11157,11 +11210,11 @@ if test "$cross_compiling" = yes; then samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=cross else cat > conftest.$ac_ext <<EOF -#line 11161 "configure" +#line 11214 "configure" #include "confdefs.h" #include "${srcdir-.}/tests/fcntl_lock64.c" EOF -if { (eval echo configure:11165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:11218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_BROKEN_FCNTL64_LOCKS=yes else @@ -11186,7 +11239,7 @@ else echo $ac_n "checking for 64 bit fcntl locking""... $ac_c" 1>&6 -echo "configure:11190: checking for 64 bit fcntl locking" >&5 +echo "configure:11243: checking for 64 bit fcntl locking" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_STRUCT_FLOCK64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -11195,7 +11248,7 @@ else samba_cv_HAVE_STRUCT_FLOCK64=cross else cat > conftest.$ac_ext <<EOF -#line 11199 "configure" +#line 11252 "configure" #include "confdefs.h" #if defined(HAVE_UNISTD_H) @@ -11219,7 +11272,7 @@ exit(1); #endif } EOF -if { (eval echo configure:11223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:11276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_STRUCT_FLOCK64=yes else @@ -11244,7 +11297,7 @@ EOF fi echo $ac_n "checking for a crypt that needs truncated salt""... $ac_c" 1>&6 -echo "configure:11248: checking for a crypt that needs truncated salt" >&5 +echo "configure:11301: checking for a crypt that needs truncated salt" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_TRUNCATED_SALT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -11253,11 +11306,11 @@ if test "$cross_compiling" = yes; then samba_cv_HAVE_TRUNCATED_SALT=cross else cat > conftest.$ac_ext <<EOF -#line 11257 "configure" +#line 11310 "configure" #include "confdefs.h" #include "${srcdir-.}/tests/crypttest.c" EOF -if { (eval echo configure:11261: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:11314: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then samba_cv_HAVE_TRUNCATED_SALT=no else @@ -11280,13 +11333,13 @@ EOF fi echo $ac_n "checking for broken nisplus include files""... $ac_c" 1>&6 -echo "configure:11284: checking for broken nisplus include files" >&5 +echo "configure:11337: checking for broken nisplus include files" >&5 if eval "test \"`echo '$''{'samba_cv_BROKEN_NISPLUS_INCLUDE_FILES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 11290 "configure" +#line 11343 "configure" #include "confdefs.h" #include <sys/acl.h> #if defined(HAVE_RPCSVC_NIS_H) @@ -11296,7 +11349,7 @@ int main() { return 0; ; return 0; } EOF -if { (eval echo configure:11300: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:11353: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_BROKEN_NISPLUS_INCLUDE_FILES=no else @@ -11320,7 +11373,7 @@ fi ################################################# # check for smbwrapper support echo $ac_n "checking whether to use smbwrapper""... $ac_c" 1>&6 -echo "configure:11324: checking whether to use smbwrapper" >&5 +echo "configure:11377: checking whether to use smbwrapper" >&5 # Check whether --with-smbwrapper or --without-smbwrapper was given. if test "${with_smbwrapper+set}" = set; then withval="$with_smbwrapper" @@ -11364,7 +11417,7 @@ fi ################################################# # check for the AFS filesystem echo $ac_n "checking whether to use AFS""... $ac_c" 1>&6 -echo "configure:11368: checking whether to use AFS" >&5 +echo "configure:11421: checking whether to use AFS" >&5 # Check whether --with-afs or --without-afs was given. if test "${with_afs+set}" = set; then withval="$with_afs" @@ -11390,7 +11443,7 @@ fi ################################################# # check for the DFS auth system echo $ac_n "checking whether to use DFS auth""... $ac_c" 1>&6 -echo "configure:11394: checking whether to use DFS auth" >&5 +echo "configure:11447: checking whether to use DFS auth" >&5 # Check whether --with-dfs or --without-dfs was given. if test "${with_dfs+set}" = set; then withval="$with_dfs" @@ -11415,7 +11468,7 @@ fi ################################################# # check for Kerberos IV auth system echo $ac_n "checking whether to use Kerberos IV""... $ac_c" 1>&6 -echo "configure:11419: checking whether to use Kerberos IV" >&5 +echo "configure:11472: checking whether to use Kerberos IV" >&5 # Check whether --with-krb4 or --without-krb4 was given. if test "${with_krb4+set}" = set; then withval="$with_krb4" @@ -11425,7 +11478,7 @@ if test "${with_krb4+set}" = set; then EOF echo $ac_n "checking for dn_expand in -lresolv""... $ac_c" 1>&6 -echo "configure:11429: checking for dn_expand in -lresolv" >&5 +echo "configure:11482: checking for dn_expand in -lresolv" >&5 ac_lib_var=`echo resolv'_'dn_expand | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -11433,7 +11486,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <<EOF -#line 11437 "configure" +#line 11490 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -11444,7 +11497,7 @@ int main() { dn_expand() ; return 0; } EOF -if { (eval echo configure:11448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11483,7 +11536,7 @@ fi ################################################# # check for Kerberos 5 auth system echo $ac_n "checking whether to use Kerberos 5""... $ac_c" 1>&6 -echo "configure:11487: checking whether to use Kerberos 5" >&5 +echo "configure:11540: checking whether to use Kerberos 5" >&5 # Check whether --with-krb5 or --without-krb5 was given. if test "${with_krb5+set}" = set; then withval="$with_krb5" @@ -11504,7 +11557,7 @@ fi ################################################# # check for automount support echo $ac_n "checking whether to use AUTOMOUNT""... $ac_c" 1>&6 -echo "configure:11508: checking whether to use AUTOMOUNT" >&5 +echo "configure:11561: checking whether to use AUTOMOUNT" >&5 # Check whether --with-automount or --without-automount was given. if test "${with_automount+set}" = set; then withval="$with_automount" @@ -11529,7 +11582,7 @@ fi ################################################# # check for smbmount support echo $ac_n "checking whether to use SMBMOUNT""... $ac_c" 1>&6 -echo "configure:11533: checking whether to use SMBMOUNT" >&5 +echo "configure:11586: checking whether to use SMBMOUNT" >&5 # Check whether --with-smbmount or --without-smbmount was given. if test "${with_smbmount+set}" = set; then withval="$with_smbmount" @@ -11559,7 +11612,7 @@ fi # check for a PAM password database echo $ac_n "checking whether to use PAM password database""... $ac_c" 1>&6 -echo "configure:11563: checking whether to use PAM password database" >&5 +echo "configure:11616: checking whether to use PAM password database" >&5 # Check whether --with-pam or --without-pam was given. if test "${with_pam+set}" = set; then withval="$with_pam" @@ -11584,7 +11637,7 @@ fi # we can't build a pam module if we don't have pam. echo $ac_n "checking for pam_get_data in -lpam""... $ac_c" 1>&6 -echo "configure:11588: checking for pam_get_data in -lpam" >&5 +echo "configure:11641: checking for pam_get_data in -lpam" >&5 ac_lib_var=`echo pam'_'pam_get_data | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -11592,7 +11645,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpam $LIBS" cat > conftest.$ac_ext <<EOF -#line 11596 "configure" +#line 11649 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -11603,7 +11656,7 @@ int main() { pam_get_data() ; return 0; } EOF -if { (eval echo configure:11607: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11630,7 +11683,7 @@ fi ################################################# # check for pam_smbpass support echo $ac_n "checking whether to use pam_smbpass""... $ac_c" 1>&6 -echo "configure:11634: checking whether to use pam_smbpass" >&5 +echo "configure:11687: checking whether to use pam_smbpass" >&5 # Check whether --with-pam_smbpass or --without-pam_smbpass was given. if test "${with_pam_smbpass+set}" = set; then withval="$with_pam_smbpass" @@ -11672,12 +11725,12 @@ if test "$with_pam" != yes; then for ac_func in crypt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:11676: checking for $ac_func" >&5 +echo "configure:11729: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 11681 "configure" +#line 11734 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -11700,7 +11753,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:11704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11757: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -11726,7 +11779,7 @@ done if test x"$ac_cv_func_crypt" = x"no"; then echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 -echo "configure:11730: checking for crypt in -lcrypt" >&5 +echo "configure:11783: checking for crypt in -lcrypt" >&5 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -11734,7 +11787,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcrypt $LIBS" cat > conftest.$ac_ext <<EOF -#line 11738 "configure" +#line 11791 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -11745,7 +11798,7 @@ int main() { crypt() ; return 0; } EOF -if { (eval echo configure:11749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11802: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11776,7 +11829,7 @@ fi ################################################# # check for a TDB password database echo $ac_n "checking whether to use TDB password database""... $ac_c" 1>&6 -echo "configure:11780: checking whether to use TDB password database" >&5 +echo "configure:11833: checking whether to use TDB password database" >&5 # Check whether --with-tdbsam or --without-tdbsam was given. if test "${with_tdbsam+set}" = set; then withval="$with_tdbsam" @@ -11802,7 +11855,7 @@ fi ################################################# # check for a LDAP password database echo $ac_n "checking whether to use LDAP password database""... $ac_c" 1>&6 -echo "configure:11806: checking whether to use LDAP password database" >&5 +echo "configure:11859: checking whether to use LDAP password database" >&5 # Check whether --with-ldap or --without-ldap was given. if test "${with_ldap+set}" = set; then withval="$with_ldap" @@ -11828,7 +11881,7 @@ fi ################################################# # check for a NISPLUS password database echo $ac_n "checking whether to use NISPLUS password database""... $ac_c" 1>&6 -echo "configure:11832: checking whether to use NISPLUS password database" >&5 +echo "configure:11885: checking whether to use NISPLUS password database" >&5 # Check whether --with-nisplus or --without-nisplus was given. if test "${with_nisplus+set}" = set; then withval="$with_nisplus" @@ -11853,7 +11906,7 @@ fi ################################################# # check for a NISPLUS_HOME support echo $ac_n "checking whether to use NISPLUS_HOME""... $ac_c" 1>&6 -echo "configure:11857: checking whether to use NISPLUS_HOME" >&5 +echo "configure:11910: checking whether to use NISPLUS_HOME" >&5 # Check whether --with-nisplus-home or --without-nisplus-home was given. if test "${with_nisplus_home+set}" = set; then withval="$with_nisplus_home" @@ -11878,7 +11931,7 @@ fi ################################################# # check for the secure socket layer echo $ac_n "checking whether to use SSL""... $ac_c" 1>&6 -echo "configure:11882: checking whether to use SSL" >&5 +echo "configure:11935: checking whether to use SSL" >&5 # Check whether --with-ssl or --without-ssl was given. if test "${with_ssl+set}" = set; then withval="$with_ssl" @@ -11937,7 +11990,7 @@ fi ################################################# # check for syslog logging echo $ac_n "checking whether to use syslog logging""... $ac_c" 1>&6 -echo "configure:11941: checking whether to use syslog logging" >&5 +echo "configure:11994: checking whether to use syslog logging" >&5 # Check whether --with-syslog or --without-syslog was given. if test "${with_syslog+set}" = set; then withval="$with_syslog" @@ -11962,7 +12015,7 @@ fi ################################################# # check for a shared memory profiling support echo $ac_n "checking whether to use profiling""... $ac_c" 1>&6 -echo "configure:11966: checking whether to use profiling" >&5 +echo "configure:12019: checking whether to use profiling" >&5 # Check whether --with-profile or --without-profile was given. if test "${with_profile+set}" = set; then withval="$with_profile" @@ -11988,7 +12041,7 @@ fi ################################################# # check for experimental netatalk resource fork support echo $ac_n "checking whether to support netatalk""... $ac_c" 1>&6 -echo "configure:11992: checking whether to support netatalk" >&5 +echo "configure:12045: checking whether to support netatalk" >&5 # Check whether --with-netatalk or --without-netatalk was given. if test "${with_netatalk+set}" = set; then withval="$with_netatalk" @@ -12015,7 +12068,7 @@ fi QUOTAOBJS=smbd/noquotas.o echo $ac_n "checking whether to support disk-quotas""... $ac_c" 1>&6 -echo "configure:12019: checking whether to support disk-quotas" >&5 +echo "configure:12072: checking whether to support disk-quotas" >&5 # Check whether --with-quotas or --without-quotas was given. if test "${with_quotas+set}" = set; then withval="$with_quotas" @@ -12039,7 +12092,7 @@ fi # check for experimental utmp accounting echo $ac_n "checking whether to support utmp accounting""... $ac_c" 1>&6 -echo "configure:12043: checking whether to support utmp accounting" >&5 +echo "configure:12096: checking whether to support utmp accounting" >&5 # Check whether --with-utmp or --without-utmp was given. if test "${with_utmp+set}" = set; then withval="$with_utmp" @@ -12065,7 +12118,7 @@ fi # check for MS Dfs support echo $ac_n "checking whether to support Microsoft Dfs""... $ac_c" 1>&6 -echo "configure:12069: checking whether to support Microsoft Dfs" >&5 +echo "configure:12122: checking whether to support Microsoft Dfs" >&5 # Check whether --with-msdfs or --without-msdfs was given. if test "${with_msdfs+set}" = set; then withval="$with_msdfs" @@ -12165,14 +12218,14 @@ fi ################################################# # these tests are taken from the GNU fileutils package echo "checking how to get filesystem space usage" 1>&6 -echo "configure:12169: checking how to get filesystem space usage" >&5 +echo "configure:12222: checking how to get filesystem space usage" >&5 space=no # Test for statvfs64. if test $space = no; then # SVR4 echo $ac_n "checking statvfs64 function (SVR4)""... $ac_c" 1>&6 -echo "configure:12176: checking statvfs64 function (SVR4)" >&5 +echo "configure:12229: checking statvfs64 function (SVR4)" >&5 if eval "test \"`echo '$''{'fu_cv_sys_stat_statvfs64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -12180,7 +12233,7 @@ else fu_cv_sys_stat_statvfs64=cross else cat > conftest.$ac_ext <<EOF -#line 12184 "configure" +#line 12237 "configure" #include "confdefs.h" #if defined(HAVE_UNISTD_H) @@ -12194,7 +12247,7 @@ else exit (statvfs64 (".", &fsd)); } EOF -if { (eval echo configure:12198: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:12251: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then fu_cv_sys_stat_statvfs64=yes else @@ -12227,12 +12280,12 @@ fi if test $space = no; then # SVR4 echo $ac_n "checking statvfs function (SVR4)""... $ac_c" 1>&6 -echo "configure:12231: checking statvfs function (SVR4)" >&5 +echo "configure:12284: checking statvfs function (SVR4)" >&5 if eval "test \"`echo '$''{'fu_cv_sys_stat_statvfs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 12236 "configure" +#line 12289 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/statvfs.h> @@ -12240,7 +12293,7 @@ int main() { struct statvfs fsd; statvfs (0, &fsd); ; return 0; } EOF -if { (eval echo configure:12244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* fu_cv_sys_stat_statvfs=yes else @@ -12265,7 +12318,7 @@ fi if test $space = no; then # DEC Alpha running OSF/1 echo $ac_n "checking for 3-argument statfs function (DEC OSF/1)""... $ac_c" 1>&6 -echo "configure:12269: checking for 3-argument statfs function (DEC OSF/1)" >&5 +echo "configure:12322: checking for 3-argument statfs function (DEC OSF/1)" >&5 if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs3_osf1'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -12273,7 +12326,7 @@ else fu_cv_sys_stat_statfs3_osf1=no else cat > conftest.$ac_ext <<EOF -#line 12277 "configure" +#line 12330 "configure" #include "confdefs.h" #include <sys/param.h> @@ -12286,7 +12339,7 @@ else exit (statfs (".", &fsd, sizeof (struct statfs))); } EOF -if { (eval echo configure:12290: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:12343: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then fu_cv_sys_stat_statfs3_osf1=yes else @@ -12313,7 +12366,7 @@ fi if test $space = no; then # AIX echo $ac_n "checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)""... $ac_c" 1>&6 -echo "configure:12317: checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)" >&5 +echo "configure:12370: checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)" >&5 if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs2_bsize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -12321,7 +12374,7 @@ else fu_cv_sys_stat_statfs2_bsize=no else cat > conftest.$ac_ext <<EOF -#line 12325 "configure" +#line 12378 "configure" #include "confdefs.h" #ifdef HAVE_SYS_PARAM_H @@ -12340,7 +12393,7 @@ else exit (statfs (".", &fsd)); } EOF -if { (eval echo configure:12344: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:12397: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then fu_cv_sys_stat_statfs2_bsize=yes else @@ -12367,7 +12420,7 @@ fi if test $space = no; then # SVR3 echo $ac_n "checking for four-argument statfs (AIX-3.2.5, SVR3)""... $ac_c" 1>&6 -echo "configure:12371: checking for four-argument statfs (AIX-3.2.5, SVR3)" >&5 +echo "configure:12424: checking for four-argument statfs (AIX-3.2.5, SVR3)" >&5 if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs4'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -12375,7 +12428,7 @@ else fu_cv_sys_stat_statfs4=no else cat > conftest.$ac_ext <<EOF -#line 12379 "configure" +#line 12432 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/statfs.h> @@ -12385,7 +12438,7 @@ else exit (statfs (".", &fsd, sizeof fsd, 0)); } EOF -if { (eval echo configure:12389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:12442: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then fu_cv_sys_stat_statfs4=yes else @@ -12412,7 +12465,7 @@ fi if test $space = no; then # 4.4BSD and NetBSD echo $ac_n "checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)""... $ac_c" 1>&6 -echo "configure:12416: checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)" >&5 +echo "configure:12469: checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)" >&5 if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs2_fsize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -12420,7 +12473,7 @@ else fu_cv_sys_stat_statfs2_fsize=no else cat > conftest.$ac_ext <<EOF -#line 12424 "configure" +#line 12477 "configure" #include "confdefs.h" #include <sys/types.h> #ifdef HAVE_SYS_PARAM_H @@ -12436,7 +12489,7 @@ else exit (statfs (".", &fsd)); } EOF -if { (eval echo configure:12440: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:12493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then fu_cv_sys_stat_statfs2_fsize=yes else @@ -12463,7 +12516,7 @@ fi if test $space = no; then # Ultrix echo $ac_n "checking for two-argument statfs with struct fs_data (Ultrix)""... $ac_c" 1>&6 -echo "configure:12467: checking for two-argument statfs with struct fs_data (Ultrix)" >&5 +echo "configure:12520: checking for two-argument statfs with struct fs_data (Ultrix)" >&5 if eval "test \"`echo '$''{'fu_cv_sys_stat_fs_data'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -12471,7 +12524,7 @@ else fu_cv_sys_stat_fs_data=no else cat > conftest.$ac_ext <<EOF -#line 12475 "configure" +#line 12528 "configure" #include "confdefs.h" #include <sys/types.h> #ifdef HAVE_SYS_PARAM_H @@ -12491,7 +12544,7 @@ else exit (statfs (".", &fsd) != 1); } EOF -if { (eval echo configure:12495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:12548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then fu_cv_sys_stat_fs_data=yes else @@ -12524,9 +12577,9 @@ fi # file support. # echo $ac_n "checking if large file support can be enabled""... $ac_c" 1>&6 -echo "configure:12528: checking if large file support can be enabled" >&5 +echo "configure:12581: checking if large file support can be enabled" >&5 cat > conftest.$ac_ext <<EOF -#line 12530 "configure" +#line 12583 "configure" #include "confdefs.h" #if defined(HAVE_LONGLONG) && (defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8))) @@ -12539,7 +12592,7 @@ int main() { int i ; return 0; } EOF -if { (eval echo configure:12543: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:12596: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes else @@ -12604,7 +12657,7 @@ fi # check for ACL support echo $ac_n "checking whether to support ACLs""... $ac_c" 1>&6 -echo "configure:12608: checking whether to support ACLs" >&5 +echo "configure:12661: checking whether to support ACLs" >&5 # Check whether --with-acl-support or --without-acl-support was given. if test "${with_acl_support+set}" = set; then withval="$with_acl_support" @@ -12642,7 +12695,7 @@ EOF ;; *) echo $ac_n "checking for acl_get_file in -lacl""... $ac_c" 1>&6 -echo "configure:12646: checking for acl_get_file in -lacl" >&5 +echo "configure:12699: checking for acl_get_file in -lacl" >&5 ac_lib_var=`echo acl'_'acl_get_file | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -12650,7 +12703,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lacl $LIBS" cat > conftest.$ac_ext <<EOF -#line 12654 "configure" +#line 12707 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -12661,7 +12714,7 @@ int main() { acl_get_file() ; return 0; } EOF -if { (eval echo configure:12665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -12689,13 +12742,13 @@ else fi echo $ac_n "checking for ACL support""... $ac_c" 1>&6 -echo "configure:12693: checking for ACL support" >&5 +echo "configure:12746: checking for ACL support" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_POSIX_ACLS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 12699 "configure" +#line 12752 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/acl.h> @@ -12703,7 +12756,7 @@ int main() { acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p); ; return 0; } EOF -if { (eval echo configure:12707: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* samba_cv_HAVE_POSIX_ACLS=yes else @@ -12723,13 +12776,13 @@ echo "$ac_t""$samba_cv_HAVE_POSIX_ACLS" 1>&6 EOF echo $ac_n "checking for acl_get_perm_np""... $ac_c" 1>&6 -echo "configure:12727: checking for acl_get_perm_np" >&5 +echo "configure:12780: checking for acl_get_perm_np" >&5 if eval "test \"`echo '$''{'samba_cv_HAVE_ACL_GET_PERM_NP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 12733 "configure" +#line 12786 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/acl.h> @@ -12737,7 +12790,7 @@ int main() { acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm); ; return 0; } EOF -if { (eval echo configure:12741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12794: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* samba_cv_HAVE_ACL_GET_PERM_NP=yes else @@ -12782,7 +12835,7 @@ fi # check whether winbind is supported on this platform echo $ac_n "checking whether to compile winbind""... $ac_c" 1>&6 -echo "configure:12786: checking whether to compile winbind" >&5 +echo "configure:12839: checking whether to compile winbind" >&5 case "$host_os" in *linux*|*solaris*) @@ -12828,11 +12881,11 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 12832 "configure" +#line 12885 "configure" #include "confdefs.h" #include "${srcdir-.}/tests/summary.c" EOF -if { (eval echo configure:12836: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:12889: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then echo "configure OK"; else @@ -13021,6 +13074,7 @@ s%@LIBOBJS@%$LIBOBJS%g s%@TERMLIBS@%$TERMLIBS%g s%@TERMLDFLAGS@%$TERMLDFLAGS%g s%@ROFF@%$ROFF%g +s%@ICONV_OBJS@%$ICONV_OBJS%g s%@QUOTAOBJS@%$QUOTAOBJS%g s%@privatedir@%$privatedir%g s%@lockdir@%$lockdir%g diff --git a/source3/configure.in b/source3/configure.in index 6e690a5ffc..034da47341 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -976,6 +976,23 @@ if test x"$samba_cv_HAVE_UX_UT_SYSLEN" = x"yes"; then AC_DEFINE(HAVE_UX_UT_SYSLEN) fi +############ +# check for iconv in libc, and if not then we build our own +AC_CACHE_CHECK([for working iconv],samba_cv_HAVE_NATIVE_ICONV,[ +AC_TRY_RUN([ +#include <iconv.h> +main() { + iconv_t cd = iconv_open("ASCII", "UCS2"); + if (cd == 0 || cd == (iconv_t)-1) return -1; + return 0; +} +], +samba_cv_HAVE_NATIVE_ICONV=yes,samba_cv_HAVE_NATIVE_ICONV=no,samba_cv_HAVE_NATIVE_ICONV=cross)]) +if test x"$samba_cv_HAVE_NATIVE_ICONV" = x"yes"; then + AC_DEFINE(HAVE_NATIVE_ICONV) +fi + + AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[ AC_TRY_RUN([ #include <sys/types.h> diff --git a/source3/include/config.h.in b/source3/include/config.h.in index a983f49890..fa6c34dc44 100644 --- a/source3/include/config.h.in +++ b/source3/include/config.h.in @@ -1,4 +1,4 @@ -/* include/config.h.in. Generated automatically from configure.in by autoheader. */ +/* include/config.h.in. Generated automatically from configure.in by autoheader 2.13. */ /* Define if on AIX 3. System headers sometimes define this. @@ -216,6 +216,7 @@ #undef HAVE_VASPRINTF_DECL #undef HAVE_SNPRINTF_DECL #undef HAVE_VSNPRINTF_DECL +#undef HAVE_NATIVE_ICONV /* The number of bytes in a int. */ #undef SIZEOF_INT diff --git a/source3/include/includes.h b/source3/include/includes.h index c5f4720a5a..9ed7401df3 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -361,6 +361,10 @@ #include <sys/shm.h> #endif /* HAVE_SYS_SHM_H */ +#ifdef HAVE_NATIVE_ICONV +#include <iconv.h> +#endif + /* * Define VOLATILE if needed. */ @@ -656,9 +660,6 @@ extern int errno; #include "byteorder.h" -#include "kanji.h" -#include "charset.h" - #include "ntdomain.h" #include "msdfs.h" @@ -1016,6 +1017,7 @@ extern int DEBUGLEVEL; #define F_SETLKW 14 #endif + /* Needed for sys_dlopen/sys_dlsym/sys_dlclose */ #ifndef RTLD_GLOBAL #define RTLD_GLOBAL 0 diff --git a/source3/include/kanji.h b/source3/include/kanji.h deleted file mode 100644 index 58774a699d..0000000000 --- a/source3/include/kanji.h +++ /dev/null @@ -1,741 +0,0 @@ -/* - Unix SMB/Netbios implementation. - Version 1.9. - Kanji Extensions - Copyright (C) Andrew Tridgell 1992-1998 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - Adding for Japanese language by <fujita@ainix.isac.co.jp> 1994.9.5 - and extend coding system to EUC/SJIS/JIS/HEX at 1994.10.11 - and add all jis codes sequence at 1995.8.16 - Notes: Hexadecimal code by <ohki@gssm.otuka.tsukuba.ac.jp> - and add upper/lower case conversion 1997.8.21 -*/ -#ifndef _KANJI_H_ -#define _KANJI_H_ - -/* FOR SHIFT JIS CODE */ -#define is_shift_jis(c) \ - ((0x81 <= ((unsigned char) (c)) && ((unsigned char) (c)) <= 0x9f) \ - || (0xe0 <= ((unsigned char) (c)) && ((unsigned char) (c)) <= 0xfc)) -#define is_shift_jis2(c) \ - (0x40 <= ((unsigned char) (c)) && ((unsigned char) (c)) <= 0xfc \ - && ((unsigned char) (c)) != 0x7f) -#define is_kana(c) ((0xa0 <= ((unsigned char) (c)) && ((unsigned char) (c)) <= 0xdf)) - -/* case conversion */ -#define is_sj_upper2(c) \ - ((0x60 <= (unsigned char) (c)) && ((unsigned char) (c) <= 0x79)) -#define is_sj_lower2(c) \ - ((0x81 <= (unsigned char) (c)) && ((unsigned char) (c) <= 0x9A)) -#define sjis_alph 0x82 -#define is_sj_alph(c) (sjis_alph == (unsigned char) (c)) -#define is_sj_upper(c1, c2) (is_sj_alph (c1) && is_sj_upper2 (c2)) -#define is_sj_lower(c1, c2) (is_sj_alph (c1) && is_sj_lower2 (c2)) -#define sj_toupper2(c) \ - (is_sj_lower2 (c) ? ((int) ((unsigned char) (c) - 0x81 + 0x60)) : \ - ((int) (unsigned char) (c))) -#define sj_tolower2(c) \ - (is_sj_upper2 (c) ? ((int) ((unsigned char) (c) - 0x60 + 0x81)) : \ - ((int) (unsigned char) (c))) - -#define is_sj_ru_upper2(c) \ - ((0x40 <= (unsigned char) (c)) && ((unsigned char) (c) <= 0x60)) -#define is_sj_ru_lower2(c) \ - (((0x70 <= (unsigned char) (c)) && ((unsigned char) (c) <= 0x7e)) || \ - ((0x80 <= (unsigned char) (c)) && ((unsigned char) (c) <= 0x91))) -#define sjis_russian 0x84 -#define is_sj_russian(c) (sjis_russian == (unsigned char) (c)) -#define is_sj_ru_upper(c1, c2) (is_sj_russian (c1) && is_sj_ru_upper2 (c2)) -#define is_sj_ru_lower(c1, c2) (is_sj_russian (c1) && is_sj_ru_lower2 (c2)) -#define sj_ru_toupper2(c) \ - (is_sj_ru_lower2 (c) ? ((int) ((unsigned char) (c) + \ - (((unsigned char)(c) >= 0x4f) ? (0x70 - 0x40) : (0x80 - 0x4f)))) : \ - ((int) (unsigned char) (c))) -#define sj_ru_tolower2(c) \ - (is_sj_ru_upper2 (c) ? ((int) ((unsigned char) (c) - \ - (((unsigned char)(c) >= 0x80) ? (0x70 - 0x40) : (0x80 - 0x4f)))) : \ - ((int) (unsigned char) (c))) - -#ifdef _KANJI_C_ -/* FOR EUC CODE */ -#define euc_kana (0x8e) -#define is_euc_kana(c) (((unsigned char) (c)) == euc_kana) -#define is_euc(c) (0xa0 < ((unsigned char) (c)) && ((unsigned char) (c)) < 0xff) - -#define euc_sup (0x8f) -#define is_euc_sup(c) (((unsigned char ) (c)) == euc_sup) - -/* FOR JIS CODE */ -/* default jis third shift code, use for output */ -#ifndef JIS_KSO -#define JIS_KSO 'B' -#endif -#ifndef JIS_KSI -#define JIS_KSI 'J' -#endif -/* in: \E$B or \E$@ */ -/* out: \E(J or \E(B or \E(H */ -#define jis_esc (0x1b) -#define jis_so (0x0e) -#define jis_so1 ('$') -#define jis_so2 ('B') -#define jis_si (0x0f) -#define jis_si1 ('(') -#define jis_si2 ('J') -#define is_esc(c) (((unsigned char) (c)) == jis_esc) -#define is_so1(c) (((unsigned char) (c)) == jis_so1) -#define is_so2(c) (((unsigned char) (c)) == jis_so2 || ((unsigned char) (c)) == '@') -#define is_si1(c) (((unsigned char) (c)) == jis_si1) -#define is_si2(c) (((unsigned char) (c)) == jis_si2 || ((unsigned char) (c)) == 'B' \ - || ((unsigned char) (c)) == 'H') -#define is_so(c) (((unsigned char) (c)) == jis_so) -#define is_si(c) (((unsigned char) (c)) == jis_si) -#define junet_kana1 ('(') -#define junet_kana2 ('I') -#define is_juk1(c) (((unsigned char) (c)) == junet_kana1) -#define is_juk2(c) (((unsigned char) (c)) == junet_kana2) - -#define _KJ_ROMAN (0) -#define _KJ_KANJI (1) -#define _KJ_KANA (2) - -/* FOR HEX */ -#define HEXTAG ':' -#define hex2bin(x) \ - ( ((int) '0' <= ((int) (x)) && ((int) (x)) <= (int)'9')? \ - (((int) (x))-(int)'0'): \ - ((int) 'a'<= ((int) (x)) && ((int) (x))<= (int) 'f')? \ - (((int) (x)) - (int)'a'+10): \ - (((int) (x)) - (int)'A'+10) ) -#define bin2hex(x) \ - ( (((int) (x)) >= 10)? (((int) (x))-10 + (int) 'a'): (((int) (x)) + (int) '0') ) - -/* For Hangul (Korean - code page 949). */ -#define is_hangul(c) ((0x81 <= ((unsigned char) (c)) && ((unsigned char) (c)) <= 0xfd)) - -/* For traditional Chinese (known as Big5 encoding - code page 950). */ -#define is_big5_c1(c) ((0xa1 <= ((unsigned char) (c)) && ((unsigned char) (c)) <= 0xf9)) - -/* For simplified Chinese (code page - 936). */ -#define is_simpch_c1(c) ((0xa1 <= ((unsigned char) (c)) && ((unsigned char) (c)) <= 0xf7)) - -#else /* not _KANJI_C_ */ - -/* - * The following is needed for AIX systems that have - * their own #defines for strchr, strrchr, strstr - * and strtok. - */ - -#ifdef strchr -#undef strchr -#endif /* strchr */ - -#ifdef strrchr -#undef strrchr -#endif /* strrchr */ - -#ifdef strstr -#undef strstr -#endif /* strstr */ - -#ifdef strtok -#undef strtok -#endif /* strtok */ - -/* Ensure we use our definitions in all other files than kanji.c. */ - -/* Function pointers we will replace. */ -extern char *(*multibyte_strchr)(const char *s, int c); -extern char *(*multibyte_strrchr)(const char *s, int c); -extern char *(*multibyte_strstr)(const char *s1, const char *s2); -extern char *(*multibyte_strtok)(char *s1, const char *s2); -extern char *(*_dos_to_unix)(char *str, BOOL overwrite); -extern char *(*_unix_to_dos)(char *str, BOOL overwrite); -extern char *(*_dos_to_dos)(char *str, BOOL overwrite); -extern BOOL (*is_multibyte_char)(char c); -extern int (*_skip_multibyte_char)(char c); - -#define strchr(s1, c) ((*multibyte_strchr)((s1), (c))) -#define strrchr(s1, c) ((*multibyte_strrchr)((s1), (c))) -#define strstr(s1, s2) ((*multibyte_strstr)((s1), (s2))) -#define strtok(s1, s2) ((*multibyte_strtok)((s1), (s2))) -#define dos_to_unix(x,y) ((*_dos_to_unix)((x), (y))) -#define unix_to_dos(x,y) ((*_unix_to_dos)((x), (y))) -#define dos_to_dos(x,y) ((*_dos_to_dos)((x), (y))) -#define skip_multibyte_char(c) ((*_skip_multibyte_char)((c))) - -#endif /* _KANJI_C_ */ - -#define UNKNOWN_CODE (-1) -#define SJIS_CODE (0) -#define EUC_CODE (1) -#define JIS7_CODE (2) -#define JIS8_CODE (3) -#define JUNET_CODE (4) -#define HEX_CODE (5) -#define CAP_CODE (6) -#define DOSV_CODE SJIS_CODE -#define EUC3_CODE (7) -#define UTF8_CODE (8) - -#ifdef _KANJI_C_ - -/* For conversion */ - -#define EXTSJISC(c) (0xf0 <= ((unsigned char)(c)) \ - && ((unsigned char)(c) <= 0xfc)) -#define GETAHI (0x81) -#define GETALO (0xac) - -typedef struct _sjis_regur_t { - int start; - int end; - int rstart; -} sjis_regur_t; - -/* When Converting to EUC and JIS, there is no room for - * these SJIS codes whose hi byte is larger than 0xf0. - * - * So we must drop or convert it to harmless code. - * This is not standard way, so it is ad hoc but practical. - * It is also thought of backward and future compatibility. - * - * Miura. - */ - -static sjis_regur_t sjisconv[] = { -{0xfa40, 0xfa49, 0xeeef}, -{0xfa4a, 0xfa53, 0x8754}, -{0xfa54, 0xfa54, 0x81ca}, -{0xfa55, 0xfa57, 0xeefa}, -{0xfa58, 0xfa58, 0x878a}, -{0xfa59, 0xfa59, 0x8782}, -{0xfa5a, 0xfa5a, 0x8784}, -{0xfa5b, 0xfa5b, 0x81e6}, -{0xfa5c, 0xfa7e, 0xed40}, -{0xfa80, 0xfa9b, 0xed63}, -{0xfa9c, 0xfafc, 0xed80}, -{0xfb40, 0xfb5b, 0xede1}, -{0xfb5c, 0xfb7e, 0xee40}, -{0xfb80, 0xfb9b, 0xee63}, -{0xfb9c, 0xfbfc, 0xee80}, -{0xfc40, 0xfc4b, 0xeee1} -}; -#define SJISCONVTBLSIZ (sizeof(sjisconv) / sizeof(sjis_regur_t)) - -static sjis_regur_t sjisrev[] = { -{0x81ca, 0x81ca, 0xfa54}, -{0x81e6, 0x81e6, 0xfa5b}, -{0x8754, 0x875d, 0xfa4a}, -{0x8782, 0x8782, 0xfa59}, -{0x8784, 0x8784, 0xfa5a}, -{0x878a, 0x878a, 0xfa58}, -{0xed40, 0xed62, 0xfa5c}, -{0xed63, 0xed7e, 0xfa80}, -{0xed80, 0xede0, 0xfa9c}, -{0xede1, 0xedfc, 0xfb40}, -{0xee40, 0xee62, 0xfb5c}, -{0xee63, 0xee7e, 0xfb80}, -{0xee80, 0xeee0, 0xfb9c}, -{0xeee1, 0xeeec, 0xfc40}, -{0xeeef, 0xeef8, 0xfa40}, -{0xeefa, 0xeefc, 0xfa55} -}; -#define SJISREVTBLSIZ (sizeof(sjisrev) / sizeof(sjis_regur_t)) - -/* EUC3BYTE DEFINITIONS */ - -typedef struct _sjis_euc_map_t { - int sjis; - int euc; -} sjis_euc_map_t; - -static sjis_euc_map_t euc3conv2[] = { -{0x8754 , 0xf3fd}, -{0x8755 , 0xf3fe}, -{0x8756 , 0xf4a1}, -{0x8757 , 0xf4a2}, -{0x8758 , 0xf4a3}, -{0x8759 , 0xf4a4}, -{0x875a , 0xf4a5}, -{0x875b , 0xf4a6}, -{0x875c , 0xf4a7}, -{0x875d , 0xf4a8}, -{0x8782 , 0xf4ac}, -{0x8784 , 0xf4ad}, -{0x878a , 0xf4ab} -}; -#define EUC3CONV2TBLSIZ (sizeof(euc3conv2) / sizeof(sjis_euc_map_t)) - - -/* IBM Kanji to EUC 3byte */ -static int euc3conv[] = { -/* 0xfa40 */ -0xf3f3, 0xf3f4, 0xf3f5, 0xf3f6, 0xf3f7, 0xf3f8, 0xf3f9, 0xf3fa, 0xf3fb, 0xf3fc, 0xf3fd, 0xf3fe, 0xf4a1, 0xf4a2, 0xf4a3, 0xf4a4, -/* 0xfa50 */ -0xf4a5, 0xf4a6, 0xf4a7, 0xf4a8, 0, 0xa2c3, 0xf4a9, 0xf4aa, 0xf4ab, 0xf4ac, 0xf4ad, 0, 0xd4e3, 0xdcdf, 0xe4e9, 0xe3f8, -/* 0xfa60 */ -0xd9a1, 0xb1bb, 0xf4ae, 0xc2ad, 0xc3fc, 0xe4d0, 0xc2bf, 0xbcf4, 0xb0a9, 0xb0c8, 0xf4af, 0xb0d2, 0xb0d4, 0xb0e3, 0xb0ee, 0xb1a7, -/* 0xfa70 */ -0xb1a3, 0xb1ac, 0xb1a9, 0xb1be, 0xb1df, 0xb1d8, 0xb1c8, 0xb1d7, 0xb1e3, 0xb1f4, 0xb1e1, 0xb2a3, 0xf4b0, 0xb2bb, 0xb2e6, -/* 0xfa80 */ -0xb2ed, 0xb2f5, 0xb2fc, 0xf4b1, 0xb3b5, 0xb3d8, 0xb3db, 0xb3e5, 0xb3ee, 0xb3fb, 0xf4b2, 0xf4b3, 0xb4c0, 0xb4c7, 0xb4d0, 0xb4de, -/* 0xfa90 */ -0xf4b4, 0xb5aa, 0xf4b5, 0xb5af, 0xb5c4, 0xb5e8, 0xf4b6, 0xb7c2, 0xb7e4, 0xb7e8, 0xb7e7, 0xf4b7, 0xf4b8, 0xf4b9, 0xb8ce, 0xb8e1, -/* 0xfaa0 */ -0xb8f5, 0xb8f7, 0xb8f8, 0xb8fc, 0xb9af, 0xb9b7, 0xbabe, 0xbadb, 0xcdaa, 0xbae1, 0xf4ba, 0xbaeb, 0xbbb3, 0xbbb8, 0xf4bb, 0xbbca, -/* 0xfab0 */ -0xf4bc, 0xf4bd, 0xbbd0, 0xbbde, 0xbbf4, 0xbbf5, 0xbbf9, 0xbce4, 0xbced, 0xbcfe, 0xf4be, 0xbdc2, 0xbde7, 0xf4bf, 0xbdf0, 0xbeb0, -/* 0xfac0 */ -0xbeac, 0xf4c0, 0xbeb3, 0xbebd, 0xbecd, 0xbec9, 0xbee4, 0xbfa8, 0xbfc9, 0xc0c4, 0xc0e4, 0xc0f4, 0xc1a6, 0xf4c1, 0xc1f5, 0xc1fc, -/* 0xfad0 */ -0xf4c2, 0xc1f8, 0xc2ab, 0xc2a1, 0xc2a5, 0xf4c3, 0xc2b8, 0xc2ba, 0xf4c4, 0xc2c4, 0xc2d2, 0xc2d7, 0xc2db, 0xc2de, 0xc2ed, 0xc2f0, -/* 0xfae0 */ -0xf4c5, 0xc3a1, 0xc3b5, 0xc3c9, 0xc3b9, 0xf4c6, 0xc3d8, 0xc3fe, 0xf4c7, 0xc4cc, 0xf4c8, 0xc4d9, 0xc4ea, 0xc4fd, 0xf4c9, 0xc5a7, -/* 0xfaf0 */ - 0xc5b5, 0xc5b6, 0xf4ca, 0xc5d5, 0xc6b8, 0xc6d7, 0xc6e0, 0xc6ea, 0xc6e3, 0xc7a1, 0xc7ab, 0xc7c7, 0xc7c3, -/* 0xfb40 */ - 0xc7cb, 0xc7cf, 0xc7d9, 0xf4cb, 0xf4cc, 0xc7e6, 0xc7ee, 0xc7fc, 0xc7eb, 0xc7f0, 0xc8b1, 0xc8e5, 0xc8f8, 0xc9a6, 0xc9ab, 0xc9ad, -/* 0xfb50 */ - 0xf4cd, 0xc9ca, 0xc9d3, 0xc9e9, 0xc9e3, 0xc9fc, 0xc9f4, 0xc9f5, 0xf4ce, 0xcab3, 0xcabd, 0xcaef, 0xcaf1, 0xcbae, 0xf4cf, 0xcbca, -/* 0xfb60 */ - 0xcbe6, 0xcbea, 0xcbf0, 0xcbf4, 0xcbee, 0xcca5, 0xcbf9, 0xccab, 0xccae, 0xccad, 0xccb2, 0xccc2, 0xccd0, 0xccd9, 0xf4d0, 0xcdbb, -/* 0xfb70 */ -0xf4d1, 0xcebb, 0xf4d2, 0xceba, 0xcec3, 0xf4d3, 0xcef2, 0xb3dd, 0xcfd5, 0xcfe2, 0xcfe9, 0xcfed, 0xf4d4, 0xf4d5, 0xf4d6, -/* 0xfb80 */ - 0xf4d7, 0xd0e5, 0xf4d8, 0xd0e9, 0xd1e8, 0xf4d9, 0xf4da, 0xd1ec, 0xd2bb, 0xf4db, 0xd3e1, 0xd3e8, 0xd4a7, 0xf4dc, 0xf4dd, 0xd4d4, -/* 0xfb90 */ - 0xd4f2, 0xd5ae, 0xf4de, 0xd7de, 0xf4df, 0xd8a2, 0xd8b7, 0xd8c1, 0xd8d1, 0xd8f4, 0xd9c6, 0xd9c8, 0xd9d1, 0xf4e0, 0xf4e1, 0xf4e2, -/* 0xfba0 */ - 0xf4e3, 0xf4e4, 0xdcd3, 0xddc8, 0xddd4, 0xddea, 0xddfa, 0xdea4, 0xdeb0, 0xf4e5, 0xdeb5, 0xdecb, 0xf4e6, 0xdfb9, 0xf4e7, 0xdfc3, -/* 0xfbb0 */ - 0xf4e8, 0xf4e9, 0xe0d9, 0xf4ea, 0xf4eb, 0xe1e2, 0xf4ec, 0xf4ed, 0xf4ee, 0xe2c7, 0xe3a8, 0xe3a6, 0xe3a9, 0xe3af, 0xe3b0, 0xe3aa, -/* 0xfbc0 */ - 0xe3ab, 0xe3bc, 0xe3c1, 0xe3bf, 0xe3d5, 0xe3d8, 0xe3d6, 0xe3df, 0xe3e3, 0xe3e1, 0xe3d4, 0xe3e9, 0xe4a6, 0xe3f1, 0xe3f2, 0xe4cb, -/* 0xfbd0 */ - 0xe4c1, 0xe4c3, 0xe4be, 0xf4ef, 0xe4c0, 0xe4c7, 0xe4bf, 0xe4e0, 0xe4de, 0xe4d1, 0xf4f0, 0xe4dc, 0xe4d2, 0xe4db, 0xe4d4, 0xe4fa, -/* 0xfbe0 */ - 0xe4ef, 0xe5b3, 0xe5bf, 0xe5c9, 0xe5d0, 0xe5e2, 0xe5ea, 0xe5eb, 0xf4f1, 0xf4f2, 0xf4f3, 0xe6e8, 0xe6ef, 0xe7ac, 0xf4f4, 0xe7ae, -/* 0xfbf0 */ - 0xf4f5, 0xe7b1, 0xf4f6, 0xe7b2, 0xe8b1, 0xe8b6, 0xf4f7, 0xf4f8, 0xe8dd, 0xf4f9, 0xf4fa, 0xe9d1, 0xf4fb, -/* 0xfc40 */ - 0xe9ed, 0xeacd, 0xf4fc, 0xeadb, 0xeae6, 0xeaea, 0xeba5, 0xebfb, 0xebfa, 0xf4fd, 0xecd6, 0xf4fe -}; - -#define EUC3CONVTBLSIZ (sizeof(euc3conv) / sizeof(int)) - -/* EUC3byte to SJIS Code */ - -typedef struct _sjis_euc_revmap_t { - int euc; - int sjis; -} sjis_euc_revmap_t; - -static sjis_euc_revmap_t euc3rev[] = { -{0xa2c3, 0xfa55}, -{0xb0a9, 0xfa68}, -{0xb0c8, 0xfa69}, -{0xb0d2, 0xfa6b}, -{0xb0d4, 0xfa6c}, -{0xb0e3, 0xfa6d}, -{0xb0ee, 0xfa6e}, -{0xb1a3, 0xfa70}, -{0xb1a7, 0xfa6f}, -{0xb1a9, 0xfa72}, -{0xb1ac, 0xfa71}, -{0xb1bb, 0xfa61}, -{0xb1be, 0xfa73}, -{0xb1c8, 0xfa76}, -{0xb1d7, 0xfa77}, -{0xb1d8, 0xfa75}, -{0xb1df, 0xfa74}, -{0xb1e1, 0xfa7a}, -{0xb1e3, 0xfa78}, -{0xb1f4, 0xfa79}, -{0xb2a3, 0xfa7b}, -{0xb2bb, 0xfa7d}, -{0xb2e6, 0xfa7e}, -{0xb2ed, 0xfa80}, -{0xb2f5, 0xfa81}, -{0xb2fc, 0xfa82}, -{0xb3b5, 0xfa84}, -{0xb3d8, 0xfa85}, -{0xb3db, 0xfa86}, -{0xb3dd, 0xfb77}, -{0xb3e5, 0xfa87}, -{0xb3ee, 0xfa88}, -{0xb3fb, 0xfa89}, -{0xb4c0, 0xfa8c}, -{0xb4c7, 0xfa8d}, -{0xb4d0, 0xfa8e}, -{0xb4de, 0xfa8f}, -{0xb5aa, 0xfa91}, -{0xb5af, 0xfa93}, -{0xb5c4, 0xfa94}, -{0xb5e8, 0xfa95}, -{0xb7c2, 0xfa97}, -{0xb7e4, 0xfa98}, -{0xb7e7, 0xfa9a}, -{0xb7e8, 0xfa99}, -{0xb8ce, 0xfa9e}, -{0xb8e1, 0xfa9f}, -{0xb8f5, 0xfaa0}, -{0xb8f7, 0xfaa1}, -{0xb8f8, 0xfaa2}, -{0xb8fc, 0xfaa3}, -{0xb9af, 0xfaa4}, -{0xb9b7, 0xfaa5}, -{0xbabe, 0xfaa6}, -{0xbadb, 0xfaa7}, -{0xbae1, 0xfaa9}, -{0xbaeb, 0xfaab}, -{0xbbb3, 0xfaac}, -{0xbbb8, 0xfaad}, -{0xbbca, 0xfaaf}, -{0xbbd0, 0xfab2}, -{0xbbde, 0xfab3}, -{0xbbf4, 0xfab4}, -{0xbbf5, 0xfab5}, -{0xbbf9, 0xfab6}, -{0xbce4, 0xfab7}, -{0xbced, 0xfab8}, -{0xbcf4, 0xfa67}, -{0xbcfe, 0xfab9}, -{0xbdc2, 0xfabb}, -{0xbde7, 0xfabc}, -{0xbdf0, 0xfabe}, -{0xbeac, 0xfac0}, -{0xbeb0, 0xfabf}, -{0xbeb3, 0xfac2}, -{0xbebd, 0xfac3}, -{0xbec9, 0xfac5}, -{0xbecd, 0xfac4}, -{0xbee4, 0xfac6}, -{0xbfa8, 0xfac7}, -{0xbfc9, 0xfac8}, -{0xc0c4, 0xfac9}, -{0xc0e4, 0xfaca}, -{0xc0f4, 0xfacb}, -{0xc1a6, 0xfacc}, -{0xc1f5, 0xface}, -{0xc1f8, 0xfad1}, -{0xc1fc, 0xfacf}, -{0xc2a1, 0xfad3}, -{0xc2a5, 0xfad4}, -{0xc2ab, 0xfad2}, -{0xc2ad, 0xfa63}, -{0xc2b8, 0xfad6}, -{0xc2ba, 0xfad7}, -{0xc2bf, 0xfa66}, -{0xc2c4, 0xfad9}, -{0xc2d2, 0xfada}, -{0xc2d7, 0xfadb}, -{0xc2db, 0xfadc}, -{0xc2de, 0xfadd}, -{0xc2ed, 0xfade}, -{0xc2f0, 0xfadf}, -{0xc3a1, 0xfae1}, -{0xc3b5, 0xfae2}, -{0xc3b9, 0xfae4}, -{0xc3c9, 0xfae3}, -{0xc3d8, 0xfae6}, -{0xc3fc, 0xfa64}, -{0xc3fe, 0xfae7}, -{0xc4cc, 0xfae9}, -{0xc4d9, 0xfaeb}, -{0xc4ea, 0xfaec}, -{0xc4fd, 0xfaed}, -{0xc5a7, 0xfaef}, -{0xc5b5, 0xfaf0}, -{0xc5b6, 0xfaf1}, -{0xc5d5, 0xfaf3}, -{0xc6b8, 0xfaf4}, -{0xc6d7, 0xfaf5}, -{0xc6e0, 0xfaf6}, -{0xc6e3, 0xfaf8}, -{0xc6ea, 0xfaf7}, -{0xc7a1, 0xfaf9}, -{0xc7ab, 0xfafa}, -{0xc7c3, 0xfafc}, -{0xc7c7, 0xfafb}, -{0xc7cb, 0xfb40}, -{0xc7cf, 0xfb41}, -{0xc7d9, 0xfb42}, -{0xc7e6, 0xfb45}, -{0xc7eb, 0xfb48}, -{0xc7ee, 0xfb46}, -{0xc7f0, 0xfb49}, -{0xc7fc, 0xfb47}, -{0xc8b1, 0xfb4a}, -{0xc8e5, 0xfb4b}, -{0xc8f8, 0xfb4c}, -{0xc9a6, 0xfb4d}, -{0xc9ab, 0xfb4e}, -{0xc9ad, 0xfb4f}, -{0xc9ca, 0xfb51}, -{0xc9d3, 0xfb52}, -{0xc9e3, 0xfb54}, -{0xc9e9, 0xfb53}, -{0xc9f4, 0xfb56}, -{0xc9f5, 0xfb57}, -{0xc9fc, 0xfb55}, -{0xcab3, 0xfb59}, -{0xcabd, 0xfb5a}, -{0xcaef, 0xfb5b}, -{0xcaf1, 0xfb5c}, -{0xcbae, 0xfb5d}, -{0xcbca, 0xfb5f}, -{0xcbe6, 0xfb60}, -{0xcbea, 0xfb61}, -{0xcbee, 0xfb64}, -{0xcbf0, 0xfb62}, -{0xcbf4, 0xfb63}, -{0xcbf9, 0xfb66}, -{0xcca5, 0xfb65}, -{0xccab, 0xfb67}, -{0xccad, 0xfb69}, -{0xccae, 0xfb68}, -{0xccb2, 0xfb6a}, -{0xccc2, 0xfb6b}, -{0xccd0, 0xfb6c}, -{0xccd9, 0xfb6d}, -{0xcdaa, 0xfaa8}, -{0xcdbb, 0xfb6f}, -{0xceba, 0xfb73}, -{0xcebb, 0xfb71}, -{0xcec3, 0xfb74}, -{0xcef2, 0xfb76}, -{0xcfd5, 0xfb78}, -{0xcfe2, 0xfb79}, -{0xcfe9, 0xfb7a}, -{0xcfed, 0xfb7b}, -{0xd0e5, 0xfb81}, -{0xd0e9, 0xfb83}, -{0xd1e8, 0xfb84}, -{0xd1ec, 0xfb87}, -{0xd2bb, 0xfb88}, -{0xd3e1, 0xfb8a}, -{0xd3e8, 0xfb8b}, -{0xd4a7, 0xfb8c}, -{0xd4d4, 0xfb8f}, -{0xd4e3, 0xfa5c}, -{0xd4f2, 0xfb90}, -{0xd5ae, 0xfb91}, -{0xd7de, 0xfb93}, -{0xd8a2, 0xfb95}, -{0xd8b7, 0xfb96}, -{0xd8c1, 0xfb97}, -{0xd8d1, 0xfb98}, -{0xd8f4, 0xfb99}, -{0xd9a1, 0xfa60}, -{0xd9c6, 0xfb9a}, -{0xd9c8, 0xfb9b}, -{0xd9d1, 0xfb9c}, -{0xdcd3, 0xfba2}, -{0xdcdf, 0xfa5d}, -{0xddc8, 0xfba3}, -{0xddd4, 0xfba4}, -{0xddea, 0xfba5}, -{0xddfa, 0xfba6}, -{0xdea4, 0xfba7}, -{0xdeb0, 0xfba8}, -{0xdeb5, 0xfbaa}, -{0xdecb, 0xfbab}, -{0xdfb9, 0xfbad}, -{0xdfc3, 0xfbaf}, -{0xe0d9, 0xfbb2}, -{0xe1e2, 0xfbb5}, -{0xe2c7, 0xfbb9}, -{0xe3a6, 0xfbbb}, -{0xe3a8, 0xfbba}, -{0xe3a9, 0xfbbc}, -{0xe3aa, 0xfbbf}, -{0xe3ab, 0xfbc0}, -{0xe3af, 0xfbbd}, -{0xe3b0, 0xfbbe}, -{0xe3bc, 0xfbc1}, -{0xe3bf, 0xfbc3}, -{0xe3c1, 0xfbc2}, -{0xe3d4, 0xfbca}, -{0xe3d5, 0xfbc4}, -{0xe3d6, 0xfbc6}, -{0xe3d8, 0xfbc5}, -{0xe3df, 0xfbc7}, -{0xe3e1, 0xfbc9}, -{0xe3e3, 0xfbc8}, -{0xe3e9, 0xfbcb}, -{0xe3f1, 0xfbcd}, -{0xe3f2, 0xfbce}, -{0xe3f8, 0xfa5f}, -{0xe4a6, 0xfbcc}, -{0xe4be, 0xfbd2}, -{0xe4bf, 0xfbd6}, -{0xe4c0, 0xfbd4}, -{0xe4c1, 0xfbd0}, -{0xe4c3, 0xfbd1}, -{0xe4c7, 0xfbd5}, -{0xe4cb, 0xfbcf}, -{0xe4d0, 0xfa65}, -{0xe4d1, 0xfbd9}, -{0xe4d2, 0xfbdc}, -{0xe4d4, 0xfbde}, -{0xe4db, 0xfbdd}, -{0xe4dc, 0xfbdb}, -{0xe4de, 0xfbd8}, -{0xe4e0, 0xfbd7}, -{0xe4e9, 0xfa5e}, -{0xe4ef, 0xfbe0}, -{0xe4fa, 0xfbdf}, -{0xe5b3, 0xfbe1}, -{0xe5bf, 0xfbe2}, -{0xe5c9, 0xfbe3}, -{0xe5d0, 0xfbe4}, -{0xe5e2, 0xfbe5}, -{0xe5ea, 0xfbe6}, -{0xe5eb, 0xfbe7}, -{0xe6e8, 0xfbeb}, -{0xe6ef, 0xfbec}, -{0xe7ac, 0xfbed}, -{0xe7ae, 0xfbef}, -{0xe7b1, 0xfbf1}, -{0xe7b2, 0xfbf3}, -{0xe8b1, 0xfbf4}, -{0xe8b6, 0xfbf5}, -{0xe8dd, 0xfbf8}, -{0xe9d1, 0xfbfb}, -{0xe9ed, 0xfc40}, -{0xeacd, 0xfc41}, -{0xeadb, 0xfc43}, -{0xeae6, 0xfc44}, -{0xeaea, 0xfc45}, -{0xeba5, 0xfc46}, -{0xebfa, 0xfc48}, -{0xebfb, 0xfc47}, -{0xecd6, 0xfc4a}, -{0xf3f3, 0xfa40}, -{0xf3f4, 0xfa41}, -{0xf3f5, 0xfa42}, -{0xf3f6, 0xfa43}, -{0xf3f7, 0xfa44}, -{0xf3f8, 0xfa45}, -{0xf3f9, 0xfa46}, -{0xf3fa, 0xfa47}, -{0xf3fb, 0xfa48}, -{0xf3fc, 0xfa49}, -{0xf3fd, 0xfa4a}, -{0xf3fe, 0xfa4b}, -{0xf4a1, 0xfa4c}, -{0xf4a2, 0xfa4d}, -{0xf4a3, 0xfa4e}, -{0xf4a4, 0xfa4f}, -{0xf4a5, 0xfa50}, -{0xf4a6, 0xfa51}, -{0xf4a7, 0xfa52}, -{0xf4a8, 0xfa53}, -{0xf4a9, 0xfa56}, -{0xf4aa, 0xfa57}, -{0xf4ab, 0xfa58}, -{0xf4ac, 0xfa59}, -{0xf4ad, 0xfa5a}, -{0xf4ae, 0xfa62}, -{0xf4af, 0xfa6a}, -{0xf4b0, 0xfa7c}, -{0xf4b1, 0xfa83}, -{0xf4b2, 0xfa8a}, -{0xf4b3, 0xfa8b}, -{0xf4b4, 0xfa90}, -{0xf4b5, 0xfa92}, -{0xf4b6, 0xfa96}, -{0xf4b7, 0xfa9b}, -{0xf4b8, 0xfa9c}, -{0xf4b9, 0xfa9d}, -{0xf4ba, 0xfaaa}, -{0xf4bb, 0xfaae}, -{0xf4bc, 0xfab0}, -{0xf4bd, 0xfab1}, -{0xf4be, 0xfaba}, -{0xf4bf, 0xfabd}, -{0xf4c0, 0xfac1}, -{0xf4c1, 0xfacd}, -{0xf4c2, 0xfad0}, -{0xf4c3, 0xfad5}, -{0xf4c4, 0xfad8}, -{0xf4c5, 0xfae0}, -{0xf4c6, 0xfae5}, -{0xf4c7, 0xfae8}, -{0xf4c8, 0xfaea}, -{0xf4c9, 0xfaee}, -{0xf4ca, 0xfaf2}, -{0xf4cb, 0xfb43}, -{0xf4cc, 0xfb44}, -{0xf4cd, 0xfb50}, -{0xf4ce, 0xfb58}, -{0xf4cf, 0xfb5e}, -{0xf4d0, 0xfb6e}, -{0xf4d1, 0xfb70}, -{0xf4d2, 0xfb72}, -{0xf4d3, 0xfb75}, -{0xf4d4, 0xfb7c}, -{0xf4d5, 0xfb7d}, -{0xf4d6, 0xfb7e}, -{0xf4d7, 0xfb80}, -{0xf4d8, 0xfb82}, -{0xf4d9, 0xfb85}, -{0xf4da, 0xfb86}, -{0xf4db, 0xfb89}, -{0xf4dc, 0xfb8d}, -{0xf4dd, 0xfb8e}, -{0xf4de, 0xfb92}, -{0xf4df, 0xfb94}, -{0xf4e0, 0xfb9d}, -{0xf4e1, 0xfb9e}, -{0xf4e2, 0xfb9f}, -{0xf4e3, 0xfba0}, -{0xf4e4, 0xfba1}, -{0xf4e5, 0xfba9}, -{0xf4e6, 0xfbac}, -{0xf4e7, 0xfbae}, -{0xf4e8, 0xfbb0}, -{0xf4e9, 0xfbb1}, -{0xf4ea, 0xfbb3}, -{0xf4eb, 0xfbb4}, -{0xf4ec, 0xfbb6}, -{0xf4ed, 0xfbb7}, -{0xf4ee, 0xfbb8}, -{0xf4ef, 0xfbd3}, -{0xf4f0, 0xfbda}, -{0xf4f1, 0xfbe8}, -{0xf4f2, 0xfbe9}, -{0xf4f3, 0xfbea}, -{0xf4f4, 0xfbee}, -{0xf4f5, 0xfbf0}, -{0xf4f6, 0xfbf2}, -{0xf4f7, 0xfbf6}, -{0xf4f8, 0xfbf7}, -{0xf4f9, 0xfbf9}, -{0xf4fa, 0xfbfa}, -{0xf4fb, 0xfbfc}, -{0xf4fc, 0xfc42}, -{0xf4fd, 0xfc49}, -{0xf4fe, 0xfc4b}, -}; - -#define EUC3REVTBLSIZ (sizeof(euc3rev) / sizeof(sjis_euc_revmap_t)) - -#endif /* _KANJI_C_ */ -#endif /* _KANJI_H_ */ diff --git a/source3/include/safe_string.h b/source3/include/safe_string.h index 2c3d2eda01..3e379c48df 100644 --- a/source3/include/safe_string.h +++ b/source3/include/safe_string.h @@ -47,4 +47,11 @@ #define wfstrcpy(d,s) safe_strcpy_w((d),(s),sizeof(wfstring)) #define wfstrcat(d,s) safe_strcat_w((d),(s),sizeof(wfstring)) +/* replace some standard C library string functions with multi-byte + versions */ +#define strchr(s, c) strchr_m(s, c) +#define strrchr(s, c) strrchr_m(s, c) +#define strlower(s) strlower_m(s) +#define strupper(s) strupper_m(s) + #endif diff --git a/source3/include/smb.h b/source3/include/smb.h index 1cceb88983..091ed2ac66 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -53,11 +53,10 @@ typedef int BOOL; /* string manipulation flags - see clistr.c and srvstr.c */ #define STR_TERMINATE 1 -#define STR_CONVERT 2 -#define STR_UPPER 4 -#define STR_ASCII 8 -#define STR_UNICODE 16 -#define STR_NOALIGN 32 +#define STR_UPPER 2 +#define STR_ASCII 4 +#define STR_UNICODE 8 +#define STR_NOALIGN 16 /* how long to wait for secondary SMB packets (milli-seconds) */ #define SMB_SECONDARY_WAIT (60*1000) @@ -289,6 +288,16 @@ typedef uint16 smb_ucs2_t; typedef smb_ucs2_t wpstring[PSTRING_LEN]; typedef smb_ucs2_t wfstring[FSTRING_LEN]; + +#ifdef WORDS_BIGENDIAN +#define UCS2_SHIFT 8 +#else +#define UCS2_SHIFT 0 +#endif + +/* turn a 7 bit character into a ucs2 character */ +#define UCS2_CHAR(c) ((c) << UCS2_SHIFT) + /* pipe string names */ #define PIPE_LANMAN "\\PIPE\\LANMAN" #define PIPE_SRVSVC "\\PIPE\\srvsvc" @@ -790,7 +799,6 @@ struct bitmap { #define FLAG_GLOBAL 0x08 /* local options that should be globally settable in SWAT */ #define FLAG_DEPRECATED 0x10 /* options that should no longer be used */ #define FLAG_HIDE 0x20 /* options that should be hidden in SWAT */ -#define FLAG_DOS_STRING 0x40 /* convert from UNIX to DOS codepage when reading this string. */ #ifndef LOCKING_VERSION #define LOCKING_VERSION 4 @@ -1676,4 +1684,18 @@ typedef struct { TALLOC_CTX *mem_ctx; } CLI_POLICY_HND; + +/* generic iconv conversion structure */ +typedef struct { + size_t (*direct)(char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft); + size_t (*pull)(char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft); + size_t (*push)(char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft); +#ifdef HAVE_NATIVE_ICONV + iconv_t cd; +#endif +} *smb_iconv_t; + #endif /* _SMB_H */ diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h index cad6229f1a..b168d68862 100644 --- a/source3/include/smb_macros.h +++ b/source3/include/smb_macros.h @@ -217,45 +217,45 @@ copy an IP address from one buffer to another #define dos_format(fname) string_replace(fname,'/','\\') /******************************************************************* - vfs stat wrapper that calls dos_to_unix. + vfs stat wrapper that calls internal2unix. ********************************************************************/ -#define vfs_stat(conn, fname, st) ((conn)->vfs_ops.stat((conn), dos_to_unix((fname),False),(st))) +#define vfs_stat(conn, fname, st) ((conn)->vfs_ops.stat((conn), fname,(st))) /******************************************************************* - vfs fstat wrapper that calls dos_to_unix. + vfs fstat wrapper ********************************************************************/ #define vfs_fstat(fsp, fd, st) ((fsp)->conn->vfs_ops.fstat((fsp),(fd),(st))) /******************************************************************* - vfs rmdir wrapper that calls dos_to_unix. + vfs rmdir wrapper that calls internal2unix. ********************************************************************/ -#define vfs_rmdir(conn,fname) ((conn)->vfs_ops.rmdir((conn),dos_to_unix((fname),False))) +#define vfs_rmdir(conn,fname) ((conn)->vfs_ops.rmdir((conn),fname)) /******************************************************************* - vfs Unlink wrapper that calls dos_to_unix. + vfs Unlink wrapper that calls internal2unix. ********************************************************************/ -#define vfs_unlink(conn, fname) ((conn)->vfs_ops.unlink((conn),dos_to_unix((fname),False))) +#define vfs_unlink(conn, fname) ((conn)->vfs_ops.unlink((conn),fname)) /******************************************************************* - vfs chmod wrapper that calls dos_to_unix. + vfs chmod wrapper that calls internal2unix. ********************************************************************/ -#define vfs_chmod(conn,fname,mode) ((conn)->vfs_ops.chmod((conn),dos_to_unix((fname),False),(mode))) +#define vfs_chmod(conn,fname,mode) ((conn)->vfs_ops.chmod((conn),fname,(mode))) /******************************************************************* - vfs chown wrapper that calls dos_to_unix. + vfs chown wrapper that calls internal2unix. ********************************************************************/ -#define vfs_chown(conn,fname,uid,gid) ((conn)->vfs_ops.chown((conn),dos_to_unix((fname),False),(uid),(gid))) +#define vfs_chown(conn,fname,uid,gid) ((conn)->vfs_ops.chown((conn),fname,(uid),(gid))) /******************************************************************* A wrapper for vfs_chdir(). ********************************************************************/ -#define vfs_chdir(conn,fname) ((conn)->vfs_ops.chdir((conn),dos_to_unix((fname),False))) +#define vfs_chdir(conn,fname) ((conn)->vfs_ops.chdir((conn),fname)) #endif /* _SMB_MACROS_H */ diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 93823a5f23..5b1d804e4d 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -39,7 +39,7 @@ * vfs_ops below. JRA. */ -#define SMB_VFS_INTERFACE_VERSION 1 +#define SMB_VFS_INTERFACE_VERSION 2 /* VFS operations structure */ @@ -51,39 +51,39 @@ struct vfs_ops { /* Disk operations */ - int (*connect)(struct connection_struct *conn, char *service, char *user); + int (*connect)(struct connection_struct *conn, const char *service, const char *user); void (*disconnect)(struct connection_struct *conn); - SMB_BIG_UINT (*disk_free)(struct connection_struct *conn, char *path, BOOL small_query, SMB_BIG_UINT *bsize, + SMB_BIG_UINT (*disk_free)(struct connection_struct *conn, const char *path, BOOL small_query, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize); /* Directory operations */ - DIR *(*opendir)(struct connection_struct *conn, char *fname); + DIR *(*opendir)(struct connection_struct *conn, const char *fname); struct dirent *(*readdir)(struct connection_struct *conn, DIR *dirp); - int (*mkdir)(struct connection_struct *conn, char *path, mode_t mode); - int (*rmdir)(struct connection_struct *conn, char *path); + int (*mkdir)(struct connection_struct *conn, const char *path, mode_t mode); + int (*rmdir)(struct connection_struct *conn, const char *path); int (*closedir)(struct connection_struct *conn, DIR *dir); /* File operations */ - int (*open)(struct connection_struct *conn, char *fname, int flags, mode_t mode); + int (*open)(struct connection_struct *conn, const char *fname, int flags, mode_t mode); int (*close)(struct files_struct *fsp, int fd); ssize_t (*read)(struct files_struct *fsp, int fd, char *data, size_t n); - ssize_t (*write)(struct files_struct *fsp, int fd, char *data, size_t n); + ssize_t (*write)(struct files_struct *fsp, int fd, const char *data, size_t n); SMB_OFF_T (*lseek)(struct files_struct *fsp, int filedes, SMB_OFF_T offset, int whence); - int (*rename)(struct connection_struct *conn, char *old, char *new); + int (*rename)(struct connection_struct *conn, const char *old, const char *new); int (*fsync)(struct files_struct *fsp, int fd); - int (*stat)(struct connection_struct *conn, char *fname, SMB_STRUCT_STAT *sbuf); + int (*stat)(struct connection_struct *conn, const char *fname, SMB_STRUCT_STAT *sbuf); int (*fstat)(struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf); - int (*lstat)(struct connection_struct *conn, char *path, SMB_STRUCT_STAT *sbuf); - int (*unlink)(struct connection_struct *conn, char *path); - int (*chmod)(struct connection_struct *conn, char *path, mode_t mode); + int (*lstat)(struct connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf); + int (*unlink)(struct connection_struct *conn, const char *path); + int (*chmod)(struct connection_struct *conn, const char *path, mode_t mode); int (*fchmod)(struct files_struct *fsp, int fd, mode_t mode); - int (*chown)(struct connection_struct *conn, char *path, uid_t uid, gid_t gid); + int (*chown)(struct connection_struct *conn, const char *path, uid_t uid, gid_t gid); int (*fchown)(struct files_struct *fsp, int fd, uid_t uid, gid_t gid); - int (*chdir)(struct connection_struct *conn, char *path); + int (*chdir)(struct connection_struct *conn, const char *path); char *(*getwd)(struct connection_struct *conn, char *buf); - int (*utime)(struct connection_struct *conn, char *path, struct utimbuf *times); + int (*utime)(struct connection_struct *conn, const char *path, struct utimbuf *times); int (*ftruncate)(struct files_struct *fsp, int fd, SMB_OFF_T offset); BOOL (*lock)(struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); int (*symlink)(struct connection_struct *conn, const char *oldpath, const char *newpath); @@ -92,13 +92,13 @@ struct vfs_ops { /* NT ACL operations. */ size_t (*fget_nt_acl)(struct files_struct *fsp, int fd, struct security_descriptor_info **ppdesc); - size_t (*get_nt_acl)(struct files_struct *fsp, char *name, struct security_descriptor_info **ppdesc); + size_t (*get_nt_acl)(struct files_struct *fsp, const char *name, struct security_descriptor_info **ppdesc); BOOL (*fset_nt_acl)(struct files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor_info *psd); - BOOL (*set_nt_acl)(struct files_struct *fsp, char *name, uint32 security_info_sent, struct security_descriptor_info *psd); + BOOL (*set_nt_acl)(struct files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor_info *psd); /* POSIX ACL operations. */ - int (*chmod_acl)(struct connection_struct *conn, char *name, mode_t mode); + int (*chmod_acl)(struct connection_struct *conn, const char *name, mode_t mode); int (*fchmod_acl)(struct files_struct *fsp, int fd, mode_t mode); }; diff --git a/source3/internals.doc b/source3/internals.doc index 971f256738..c8cc6dd136 100644 --- a/source3/internals.doc +++ b/source3/internals.doc @@ -6,6 +6,75 @@ understood by anyone wishing to add features to Samba. +============================================================================= +This section describes character set handling in Samba, as implemented in +Samba 3.0 and above + +In the past Samba had very ad-hoc character set handling. Scattered +throughout the code were numerous calls which converted particular +strings to/from DOS codepages. The problem is that there was no way of +telling if a particular char* is in dos codepage or unix +codepage. This led to a nightmare of code that tried to cope with +particular cases without handlingt the general case. + +The new system works like this: + +- all char* strings inside Samba are "unix" strings. These are + multi-byte strings that are in the charset defined by the "unix + charset" option in smb.conf. + +- there is no single fixed character set for unix strings, but any + character set that is used does need the following properties: + * must not contain NULLs except for termination + * must be 7-bit compatible with C strings, so that a constant + string or character in C will be byte-for-byte identical to the + equivalent string in the chosen character set. + * when you uppercase or lowercase a string it does not become + longer than the original string + * must be able to correctly hold all characters that your client + will throw at it + For example, UTF-8 is fine, and most multi-byte asian character sets + are fine, but UCS2 could not be used for unix strings as they + contain nulls. + +- when you need to put a string into a buffer that will be sent on the + wire, or you need a string in a character set format that is + compatible with the clients character set then you need to use a + pull_ or push_ function. The pull_ functions pull a string from a + wire buffer into a (multi-byte) unix string. The push_ functions + push a string out to a wire buffer. + +- the two main pull_ and push_ functions you need to understand are + pull_string and push_string. These functions take a base pointer + that should point at the start of the SMB packet that the string is + in. The functions will check the flags field in this packet to + automatically determine if the packet is marked as a unicode packet, + and they will choose whether to use unicode for this string based on + that flag. You may also force this decision using the STR_UNICODE or + STR_ASCII flags. For use in smbd/ and libsmb/ there are wrapper + functions clistr_ and srvstr_ that call the pull_/push_ functions + with the appropriate first argument. + + You may also call the pull_ascii/pull_ucs2 or push_ascii/push_ucs2 + functions if you know that a particular string is ascii or + unicode. There are also a number of other convenience functions in + charcnv.c that call the pull_/push_ functions with particularly + common arguments, such as pull_ascii_pstring() + +The biggest thing to remember is that internal (unix) strings in Samba +may now contain multi-byte characters. This means you cannot assume +that characters are always 1 byte long. Often this means that you will +have to convert strings to ucs2 and back again in order to do some +(seemingly) simple task. For examples of how to do this see functions +like strchr_m(). I know this is very slow, and we will eventually +speed it up but right now we want this stuff correct not fast. + +Other rules: + + - all lp_ functions now return unix strings. The magic "DOS" flag on + parameters is gone. + - all vfs functions take unix strings. Don't convert when passing to + them ============================================================================= diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index 4a3d7090e3..388c05f816 100644 --- a/source3/lib/charcnv.c +++ b/source3/lib/charcnv.c @@ -1,8 +1,9 @@ /* Unix SMB/Netbios implementation. - Version 1.9. + Version 3.0 Character set conversion Extensions - Copyright (C) Andrew Tridgell 1992-1998 + Copyright (C) Igor Vergeichik <iverg@mail.ru> 2001 + Copyright (C) Andrew Tridgell 2001 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,351 +21,336 @@ */ #include "includes.h" -#define CTRLZ 26 + extern int DEBUGLEVEL; -static char cvtbuf[sizeof(pstring)]; +static pstring cvtbuf; -static BOOL mapsinited = 0; +static smb_iconv_t + ucs2_to_unix=(smb_iconv_t)-1, /*ucs2 (MS) <-> unix format */ + unix_to_ucs2=(smb_iconv_t)-1, + dos_to_unix=(smb_iconv_t)-1, /*unix format <-> dos codepage*/ + unix_to_dos=(smb_iconv_t)-1; /*for those clients who does not support unicode*/ -static char unix2dos[256]; -static char dos2unix[256]; + +/**************************************************************************** + Initialize iconv conversion descriptors +****************************************************************************/ +void init_iconv(char *unix_charset, char *dos_charset) +{ +#define ICONV(descr, from_name, to_name)\ + if(descr!=(smb_iconv_t)-1) smb_iconv_close(descr);\ + descr = smb_iconv_open(to_name, from_name);\ + if(descr==(smb_iconv_t)-1)\ + DEBUG(0,("Conversion from %s to %s is not supported\n",from_name,to_name)); + + if (!unix_charset || !*unix_charset) unix_charset = "ASCII"; + if (!dos_charset || !*dos_charset) dos_charset = "ASCII"; + + ICONV(ucs2_to_unix, "UCS2", unix_charset) + ICONV(unix_to_ucs2, unix_charset, "UCS2") + ICONV(dos_to_unix, dos_charset, unix_charset) + ICONV(unix_to_dos, unix_charset, dos_charset) + +#undef ICONV +} -static void initmaps(void) { - int k; +/**************************************************************************** + Convert string from one encoding to another, makeing error checking etc + Parameters: + descriptor - conversion descriptor, created in init_iconv + src - pointer to source string (multibute or singlebyte) + srclen - length of the source string in bytes + dest - pointer to destination string (multibyte or singlebyte) + destlen - maximal length allowed for string +return the number of bytes occupied in the destination +****************************************************************************/ +static size_t convert_string(smb_iconv_t descriptor, + void const *src, size_t srclen, + void *dest, size_t destlen) +{ + size_t i_len, o_len; + size_t retval; + char* inbuf = (char*)src; + char* outbuf = (char*)dest; + + if (descriptor == (smb_iconv_t)-1) { + /* conversion not supported, use as is */ + int len = MIN(srclen,destlen); + memcpy(dest,src,len); + return len; + } + + i_len=srclen; + o_len=destlen; + retval=smb_iconv(descriptor,&inbuf, &i_len, &outbuf, &o_len); + if(retval==-1) + { char *reason; + switch(errno) + { case EINVAL: reason="Incomplete multybyte sequence"; break; + case E2BIG: reason="No more room"; + DEBUG(0, ("Required %d, available %d\n", + srclen, destlen)); + break; + case EILSEQ: reason="Illegal myltybyte sequence"; break; + } + DEBUG(0,("Conversion error:%s(%s)\n",reason,inbuf)); + /* smb_panic(reason); */ + } + return destlen-o_len; +} - for (k = 0; k < 256; k++) unix2dos[k] = k; - for (k = 0; k < 256; k++) dos2unix[k] = k; +int unix_strupper(const char *src, size_t srclen, char *dest, size_t destlen) +{ + int size,len; + smb_ucs2_t *buffer=(smb_ucs2_t*)cvtbuf; + size=convert_string(unix_to_ucs2, src, srclen, buffer, sizeof(cvtbuf)); + len=size/2; + strupper_w(buffer); + return convert_string(ucs2_to_unix, buffer, size, dest, destlen); +} - mapsinited = True; +int unix_strlower(const char *src, size_t srclen, char *dest, size_t destlen) +{ + int size,len; + smb_ucs2_t *buffer=(smb_ucs2_t*)cvtbuf; + size=convert_string(unix_to_ucs2, src, srclen, buffer, sizeof(cvtbuf)); + len=size/2; + strlower_w(buffer); + return convert_string(ucs2_to_unix, buffer, size, dest, destlen); } -static void update_map(char *str) { - char *p; - for (p = str; *p; p++) { - if (p[1]) { - unix2dos[(unsigned char)*p] = p[1]; - dos2unix[(unsigned char)p[1]] = *p; - p++; - } - } +int ucs2_align(const void *base_ptr, const void *p, int flags) +{ + if (flags & (STR_NOALIGN|STR_ASCII)) return 0; + return PTR_DIFF(p, base_ptr) & 1; } -static void setupmaps(void) + +/**************************************************************************** +copy a string from a char* unix src to a dos codepage string destination +return the number of bytes occupied by the string in the destination +flags can have: + STR_TERMINATE means include the null termination + STR_UPPER means uppercase in the destination +dest_len is the maximum length allowed in the destination. If dest_len +is -1 then no maxiumum is used +****************************************************************************/ +int push_ascii(void *dest, const char *src, int dest_len, int flags) { - int i; - if (!mapsinited) initmaps(); - - /* Do not map undefined characters to some accidental code */ - for (i = 128; i < 256; i++) - { - unix2dos[i] = CTRLZ; - dos2unix[i] = CTRLZ; - } -} + int src_len = strlen(src); + pstring tmpbuf; -static void init_iso8859_1(int codepage) { - - setupmaps(); - - if (codepage == 437) { - /* MSDOS Code Page 437 -> ISO-8859-1 */ - update_map("\xA1\xAD\xA2\x98\xA3\x9C\xA4\xED\xA5\x9D\xA6\xB3\xA7\xEE"); - update_map("\xAA\xA6\xAB\xAE\xAC\xAA\xAE\xE9\xAF\xC4"); - update_map("\xB0\xF8\xB1\xF1\xB2\xFD\xB5\xE6\xB7\xFA\xBA\xA7\xBC\xAC\xBD\xAB\xBF\xA8"); - update_map("\xC0\x85\xC1\xA0\xC2\x83\xC4\x8E\xC5\x8F\xC6\x92\xC7\x80\xC8\x8A"); - update_map("\xC9\x90\xCA\x88\xCB\x89\xCC\x8D\xCD\xA1\xCE\x8C\xCF\x8B"); - update_map("\xD1\xA5\xD2\x96\xD3\xA2\xD4\x93\xD6\x99\xD9\x97\xDA\xA3\xDB\x96\xDC\x9A\xDF\xE1"); - update_map("\xE0\x85\xE1\xA0\xE2\x83\xE4\x84\xE5\x86\xE6\x91\xE7\x87\xE8\x8A\xE9\x82\xEA\x88\xEB\x89\xEC\x8D\xED\xA1\xEE\x8C\xEF\x8B"); - update_map("\xF0\xEB\xF1\xA4\xF2\x95\xF3\xA2\xF4\x93\xF6\x94\xF7\xF6\xF8\xED\xF9\x97\xFA\xA3\xFB\x96\xFC\x81\xFF\x98"); - } else { - /* MSDOS Code Page 850 -> ISO-8859-1 */ - update_map("\240\377\241\255\242\275\243\234\244\317\245\276\246\335\247\365"); - update_map("\250\371\251\270\252\246\253\256\254\252\255\360\256\251\257\356"); - update_map("\260\370\261\361\262\375\263\374\264\357\265\346\266\364\267\372"); - update_map("\270\367\271\373\272\247\273\257\274\254\275\253\276\363\277\250"); - update_map("\300\267\301\265\302\266\303\307\304\216\305\217\306\222\307\200"); - update_map("\310\324\311\220\312\322\313\323\314\336\315\326\316\327\317\330"); - update_map("\320\321\321\245\322\343\323\340\324\342\325\345\326\231\327\236"); - update_map("\330\235\331\353\332\351\333\352\334\232\335\355\336\350\337\341"); - update_map("\340\205\341\240\342\203\343\306\344\204\345\206\346\221\347\207"); - update_map("\350\212\351\202\352\210\353\211\354\215\355\241\356\214\357\213"); - update_map("\360\320\361\244\362\225\363\242\364\223\365\344\366\224\367\366"); - update_map("\370\233\371\227\372\243\373\226\374\201\375\354\376\347\377\230"); - } -} + /* treat a pstring as "unlimited" length */ + if (dest_len == -1) { + dest_len = sizeof(pstring); + } -static void init_iso8859_15(int codepage) { - - setupmaps(); - - - if (codepage == 775) { - /* MSDOS Code Page 775 -> ISO-8859-15 this is for estonian */ -update_map("\240\377\242\226\243\234\246\276\247\365"); -update_map("\250\325\251\250\253\256\254\252\255\360\256\251"); -update_map("\260\370\261\361\262\375\263\374\264\317\265\346\266\364\267\372"); -update_map("\270\330\271\373\273\257"); -update_map("\304\216\305\217\306\222"); -update_map("\311\220"); -update_map("\323\340\325\345\326\231\327\236"); -update_map("\330\235\334\232\337\341"); -update_map("\344\204\345\206\346\221"); -update_map("\351\202"); -update_map("\363\242\365\344\366\224\367\366"); -update_map("\370\233\374\201"); - } else { - /* MSDOS Code Page 850 -> ISO-8859-15 */ -update_map("\240\377\241\255\242\275\243\234\244\317\245\276\246\321\247\365"); -update_map("\250\320\251\270\252\246\253\256\254\252\255\360\256\251\257\356"); -update_map("\260\370\261\361\262\375\263\374\264\350\265\346\266\364\267\372"); -update_map("\270\347\271\373\272\247\273\257\274\254\275\253\276\363\277\250"); -update_map("\300\267\301\265\302\266\303\307\304\216\305\217\306\222\307\200"); -update_map("\310\324\311\220\312\322\313\323\314\336\315\326\316\327\317\330"); -update_map("\320\321\321\245\322\343\323\340\324\342\325\345\326\231\327\236"); -update_map("\330\235\331\353\332\351\333\352\334\232\335\355\336\350\337\341"); -update_map("\340\205\341\240\342\203\343\306\344\204\345\206\346\221\347\207"); -update_map("\350\212\351\202\352\210\353\211\354\215\355\241\356\214\357\213"); -update_map("\360\320\361\244\362\225\363\242\364\223\365\344\366\224\367\366"); -update_map("\370\233\371\227\372\243\373\226\374\201\375\354\376\347\377\230"); -} -} + if (flags & STR_UPPER) { + pstrcpy(tmpbuf, src); + strupper(tmpbuf); + src = tmpbuf; + } -/* Init for eastern european languages. */ - -static void init_iso8859_2(void) { - - setupmaps(); - -/* - * Tranlation table created by Petr Hubeny <psh@capitol.cz> - * Requires client code page = 852 - * and character set = ISO8859-2 in smb.conf - */ - -/* MSDOS Code Page 852 -> ISO-8859-2 */ -update_map("\240\377"); /* Fix for non-breaking space */ -update_map("\241\244\242\364\243\235\244\317\245\225\246\227\247\365"); -update_map("\250\371\251\346\252\270\253\233\254\215\256\246\257\275"); -update_map("\261\245\262\362\263\210\264\357\265\226\266\230\267\363"); -update_map("\270\367\271\347\272\255\273\234\274\253\275\361\276\247\277\276"); -update_map("\300\350\301\265\302\266\303\306\304\216\305\221\306\217\307\200"); -update_map("\310\254\311\220\312\250\313\323\314\267\315\326\316\327\317\322"); -update_map("\320\321\321\343\322\325\323\340\324\342\325\212\326\231\327\236"); -update_map("\330\374\331\336\332\351\333\353\334\232\335\355\336\335\337\341"); -update_map("\340\352\341\240\342\203\343\307\344\204\345\222\346\206\347\207"); -update_map("\350\237\351\202\352\251\353\211\354\330\355\241\356\214\357\324"); -update_map("\360\320\361\344\362\345\363\242\364\223\365\213\366\224\367\366"); -update_map("\370\375\371\205\372\243\373\373\374\201\375\354\376\356\377\372"); + if (flags & STR_TERMINATE) { + src_len++; + } + + return convert_string(unix_to_dos, src, src_len, dest, dest_len); } -/* Init for russian language (iso8859-5) */ +int push_ascii_fstring(void *dest, const char *src) +{ + return push_ascii(dest, src, sizeof(fstring), STR_TERMINATE); +} -/* Added by Max Khon <max@iclub.nsu.ru> */ +int push_ascii_pstring(void *dest, const char *src) +{ + return push_ascii(dest, src, sizeof(pstring), STR_TERMINATE); +} -static void init_iso8859_5(void) +int push_pstring(void *dest, const char *src) { - setupmaps(); - -/* MSDOS Code Page 866 -> ISO8859-5 */ -update_map("\260\200\261\201\262\202\263\203\264\204\265\205\266\206\267\207"); -update_map("\270\210\271\211\272\212\273\213\274\214\275\215\276\216\277\217"); -update_map("\300\220\301\221\302\222\303\223\304\224\305\225\306\226\307\227"); -update_map("\310\230\311\231\312\232\313\233\314\234\315\235\316\236\317\237"); -update_map("\320\240\321\241\322\242\323\243\324\244\325\245\326\246\327\247"); -update_map("\330\250\331\251\332\252\333\253\334\254\335\255\336\256\337\257"); -update_map("\340\340\341\341\342\342\343\343\344\344\345\345\346\346\347\347"); -update_map("\350\350\351\351\352\352\353\353\354\354\355\355\356\356\357\357"); -update_map("\241\360\361\361\244\362\364\363\247\364\367\365\256\366\376\367"); -update_map("\360\374\240\377"); + return push_ascii(dest, src, sizeof(pstring), STR_TERMINATE); } -/* Added by Antonios Kavarnos (Antonios.Kavarnos@softlab.ece.ntua.gr */ -static void init_iso8859_7(void) +/**************************************************************************** +copy a string from a dos codepage source to a unix char* destination +flags can have: + STR_TERMINATE means the string in src is null terminated +if STR_TERMINATE is set then src_len is ignored +src_len is the length of the source area in bytes +return the number of bytes occupied by the string in src +the resulting string in "dest" is always null terminated +****************************************************************************/ +int pull_ascii(char *dest, const void *src, int dest_len, int src_len, int flags) { - setupmaps(); - -/* MSDOS Code Page 737 -> ISO-8859-7 (Greek-Hellenic) */ - -update_map("\301\200\302\201\303\202\304\203\305\204\306\205\307\206"); -update_map("\310\207\311\210\312\211\313\212\314\213\315\214\316\215\317\216"); -update_map("\320\217\321\220\323\221\324\222\325\223\326\224\327\225"); -update_map("\330\226\331\227"); -update_map("\341\230\342\231\343\232\344\233\345\234\346\235\347\236"); -update_map("\350\237\351\240\352\241\353\242\354\243\355\244\356\245\357\246"); -update_map("\360\247\361\250\362\252\363\251\364\253\365\254\366\255\367\256"); -update_map("\370\257\371\340"); -update_map("\332\364\333\365\334\341\335\342\336\343\337\345"); -update_map("\372\344\373\350\374\346\375\347\376\351"); -update_map("\266\352"); -update_map("\270\353\271\354\272\355\274\356\276\357\277\360"); + int ret; + + if (dest_len == -1) { + dest_len = sizeof(pstring); + } + + if (flags & STR_TERMINATE) src_len = strlen(src)+1; + + ret = convert_string(dos_to_unix, src, src_len, dest, dest_len); + + if (dest_len) dest[MIN(ret, dest_len-1)] = 0; + + return src_len; } -/* Added by Deniz Akkus (akkus@alum.mit.edu) */ +int pull_ascii_pstring(char *dest, const void *src) +{ + return pull_ascii(dest, src, sizeof(pstring), -1, STR_TERMINATE); +} -static void init_iso8859_9(void) +int pull_ascii_fstring(char *dest, const void *src) { - setupmaps(); - - /* MSDOS Code Page 857 -> ISO-8859-9 (Turkish) */ - - update_map("\xa0\xff\xa1\xad\xa2\xbd\xa3\x9c\xa4\xcf\xA5\xbe\xa6\xdd\xa7\xf5"); - update_map("\xa8\xf9\xa9\xb8\xaa\xd1\xab\xae\xac\xaa\xad\xf0\xae\xa9\xaf\xee"); - update_map("\xb0\xf8\xb1\xf1\xb2\xfd\xb3\xfc\xb4\xef\xb5\xe6\xb6\xf4\xb7\xfa"); - update_map("\xb8\xf7\xb9\xfb\xba\xd0\xbb\xaf\xbc\xac\xbd\xab\xbe\xf3\xbf\xa8"); - update_map("\xc0\xb7\xc1\xb5\xc2\xb6\xc3\xc7\xc4\x8e\xc5\x8f\xc6\x92\xc7\x80"); - update_map("\xc8\xd4\xc9\x90\xca\xd2\xcb\xd3\xcc\xde\xcd\xd6\xce\xd7\xcf\xd8"); - update_map("\xd0\xa6\xd1\xa5\xd2\xe3\xd3\xe0\xd4\xe2\xd5\xe5\xd6\x99\xd7\xe8"); - update_map("\xd8\x9d\xd9\xeb\xda\xe9\xdb\xea\xdc\x9a\xdd\x98\xde\x9e\xdf\xe1"); - update_map("\xe0\x85\xe1\xa0\xe2\x83\xe3\xc6\xe4\x84\xe5\x86\xe6\x91\xe7\x87"); - update_map("\xe8\x8a\xe9\x82\xea\x88\xeb\x89\xec\xec\xed\xa1\xee\x8c\xef\x8b"); - update_map("\xf0\xa7\xf1\xa4\xf2\x95\xf3\xa2\xf4\x93\xf5\xe4\xf6\x94\xf7\xf6"); - update_map("\xf8\x9b\xf9\x97\xfa\xa3\xfb\x96\xfc\x81\xfd\x8d\xfe\x9f\xff\xed"); + return pull_ascii(dest, src, sizeof(fstring), -1, STR_TERMINATE); } -/* init for Baltic Rim */ - -static void init_iso8859_13(void) { - - setupmaps(); - - /* MSDOS Code Page 775 -> ISO-8859-13 */ -update_map("\240\377\241\246\242\226\243\234\244\237\245\367\246\247\247\365"); -update_map("\250\235\251\250\252\212\253\256\254\252\255\360\256\251\257\222"); -update_map("\260\370\261\361\262\375\263\374\264\362\265\346\266\364\267\372"); -update_map("\270\233\271\373\272\213\273\257\274\254\275\253\276\363\277\221"); -update_map("\300\265\301\275\302\240\303\200\304\216\305\217\306\267\307\355"); -update_map("\310\266\311\220\312\215\313\270\314\225\315\350\316\241\317\352"); -update_map("\320\276\321\343\322\356\323\340\324\342\325\345\326\231\327\236"); -update_map("\330\306\331\255\332\227\333\307\334\232\335\243\336\317\337\341"); -update_map("\340\320\341\324\342\203\343\207\344\204\345\206\346\322\347\211"); -update_map("\350\321\351\202\352\245\353\323\354\205\355\351\356\214\357\353"); -update_map("\360\325\361\347\362\354\363\242\364\223\365\344\366\224\367\366"); -update_map("\370\326\371\210\372\230\373\327\374\201\375\244\376\330\377\357"); +/**************************************************************************** +copy a string from a char* src to a unicode destination +return the number of bytes occupied by the string in the destination +flags can have: + STR_TERMINATE means include the null termination + STR_UPPER means uppercase in the destination + STR_NOALIGN means don't do alignment +dest_len is the maximum length allowed in the destination. If dest_len +is -1 then no maxiumum is used +****************************************************************************/ +int push_ucs2(const void *base_ptr, void *dest, const char *src, int dest_len, int flags) +{ + int len=0; + int src_len = strlen(src); + pstring tmpbuf; + + /* treat a pstring as "unlimited" length */ + if (dest_len == -1) { + dest_len = sizeof(pstring); + } + + if (flags & STR_UPPER) { + pstrcpy(tmpbuf, src); + strupper(tmpbuf); + src = tmpbuf; + } + + if (flags & STR_TERMINATE) { + src_len++; + } + + if (ucs2_align(base_ptr, dest, flags)) { + *(char *)dest = 0; + dest = (void *)((char *)dest + 1); + if (dest_len) dest_len--; + len++; + } + + len += convert_string(unix_to_ucs2, src, src_len, dest, dest_len); + return len; } -/* Init for russian language (koi8) */ -static void init_koi8_r(void) +/**************************************************************************** +copy a string from a ucs2 source to a unix char* destination +flags can have: + STR_TERMINATE means the string in src is null terminated + STR_NOALIGN means don't try to align +if STR_TERMINATE is set then src_len is ignored +src_len is the length of the source area in bytes +return the number of bytes occupied by the string in src +the resulting string in "dest" is always null terminated +****************************************************************************/ +int pull_ucs2(const void *base_ptr, char *dest, const void *src, int dest_len, int src_len, int flags) { - setupmaps(); - -/* MSDOS Code Page 866 -> KOI8-R */ -update_map("\200\304\201\263\202\332\203\277\204\300\205\331\206\303\207\264"); -update_map("\210\302\211\301\212\305\213\337\214\334\215\333\216\335\217\336"); -update_map("\220\260\221\261\222\262\223\364\224\376\225\371\226\373\227\367"); -update_map("\230\363\231\362\232\377\233\365\234\370\235\375\236\372\237\366"); -update_map("\240\315\241\272\242\325\243\361\244\326\245\311\246\270\247\267"); -update_map("\250\273\251\324\252\323\253\310\254\276\255\275\256\274\257\306"); -update_map("\260\307\261\314\262\265\263\360\264\266\265\271\266\321\267\322"); -update_map("\270\313\271\317\272\320\273\312\274\330\275\327\276\316\277\374"); -update_map("\300\356\301\240\302\241\303\346\304\244\305\245\306\344\307\243"); -update_map("\310\345\311\250\312\251\313\252\314\253\315\254\316\255\317\256"); -update_map("\320\257\321\357\322\340\323\341\324\342\325\343\326\246\327\242"); -update_map("\330\354\331\353\332\247\333\350\334\355\335\351\336\347\337\352"); -update_map("\340\236\341\200\342\201\343\226\344\204\345\205\346\224\347\203"); -update_map("\350\225\351\210\352\211\353\212\354\213\355\214\356\215\357\216"); -update_map("\360\217\361\237\362\220\363\221\364\222\365\223\366\206\367\202"); -update_map("\370\234\371\233\372\207\373\230\374\235\375\231\376\227\377\232"); -} + int ret; + + if (dest_len == -1) { + dest_len = sizeof(pstring); + } + if (ucs2_align(base_ptr, src, flags)) { + src = (const void *)((const char *)src + 1); + if (src_len > 0) src_len--; + } -/* Init for ROMAN-8 (HP-UX) */ + if (flags & STR_TERMINATE) src_len = strlen_w(src)*2+2; -static void init_roman8(void) { + ret = convert_string(ucs2_to_unix, src, src_len, dest, dest_len); + if (dest_len) dest[MIN(ret, dest_len-1)] = 0; - setupmaps(); + return src_len; +} -/* MSDOS Code Page 850 -> ROMAN8 */ -update_map("\240\377\241\267\242\266\243\324\244\322\245\323\246\327\247\330"); -update_map("\250\357\253\371\255\353\256\352\257\234"); -update_map("\260\356\261\355\262\354\263\370\264\200\265\207\266\245\267\244"); -update_map("\270\255\271\250\272\317\273\234\274\276\275\365\276\237\277\275"); -update_map("\300\203\301\210\302\223\303\226\304\240\305\202\306\242\307\243"); -update_map("\310\205\311\212\312\225\313\227\314\204\315\211\316\224\317\201"); -update_map("\320\217\321\214\322\235\323\222\324\206\325\241\326\233\327\221"); -update_map("\330\216\331\215\332\231\333\232\334\220\335\213\336\341\337\342"); -update_map("\340\265\341\307\342\306\343\321\344\320\345\326\346\336\347\340"); -update_map("\350\343\351\345\352\344\355\351\357\230"); -update_map("\360\350\361\347\362\372\363\346\364\364\365\363\366\360\367\254"); -update_map("\370\253\371\246\372\247\373\256\374\376\375\257\376\361"); +int pull_ucs2_pstring(char *dest, const void *src) +{ + return pull_ucs2(NULL, dest, src, sizeof(pstring), -1, STR_TERMINATE); } -/* - * Convert unix to dos - */ -char *unix2dos_format(char *str,BOOL overwrite) +int pull_ucs2_fstring(char *dest, const void *src) { - char *p; - char *dp; - - if (!mapsinited) - initmaps(); - - if (overwrite) { - for (p = str; *p; p++) - *p = unix2dos[(unsigned char)*p]; - return str; - } else { - for (p = str, dp = cvtbuf;*p && (dp - cvtbuf < sizeof(cvtbuf) - 1); p++,dp++) - *dp = unix2dos[(unsigned char)*p]; - *dp = 0; - return cvtbuf; - } + return pull_ucs2(NULL, dest, src, sizeof(fstring), -1, STR_TERMINATE); } -/* - * Convert dos to unix - */ -char *dos2unix_format(char *str, BOOL overwrite) + +/**************************************************************************** +copy a string from a char* src to a unicode or ascii +dos code page destination choosing unicode or ascii based on the +flags in the SMB buffer starting at base_ptr +return the number of bytes occupied by the string in the destination +flags can have: + STR_TERMINATE means include the null termination + STR_UPPER means uppercase in the destination + STR_ASCII use ascii even with unicode packet + STR_NOALIGN means don't do alignment +dest_len is the maximum length allowed in the destination. If dest_len +is -1 then no maxiumum is used +****************************************************************************/ +int push_string(const void *base_ptr, void *dest, const char *src, int dest_len, int flags) { - char *p; - char *dp; - - if (!mapsinited) - initmaps(); - - if (overwrite) { - for (p = str; *p; p++) - *p = dos2unix[(unsigned char)*p]; - return str; - } else { - for (p = str, dp = cvtbuf;*p && (dp - cvtbuf < sizeof(cvtbuf) - 1); p++,dp++) - *dp = dos2unix[(unsigned char)*p]; - *dp = 0; - return cvtbuf; - } + if (!(flags & STR_ASCII) && \ + ((flags & STR_UNICODE || \ + (SVAL(base_ptr, smb_flg2) & FLAGS2_UNICODE_STRINGS)))) { + return push_ucs2(base_ptr, dest, src, dest_len, flags); + } + return push_ascii(dest, src, dest_len, flags); } -/* - * Interpret character set. - */ -void interpret_character_set(char *str, int codepage) +/**************************************************************************** +copy a string from a unicode or ascii source (depending on +the packet flags) to a char* destination +flags can have: + STR_TERMINATE means the string in src is null terminated + STR_UNICODE means to force as unicode + STR_ASCII use ascii even with unicode packet + STR_NOALIGN means don't do alignment +if STR_TERMINATE is set then src_len is ignored +src_len is the length of the source area in bytes +return the number of bytes occupied by the string in src +the resulting string in "dest" is always null terminated +****************************************************************************/ +int pull_string(const void *base_ptr, char *dest, const void *src, int dest_len, int src_len, + int flags) +{ + if (!(flags & STR_ASCII) && \ + ((flags & STR_UNICODE || \ + (SVAL(base_ptr, smb_flg2) & FLAGS2_UNICODE_STRINGS)))) { + return pull_ucs2(base_ptr, dest, src, dest_len, src_len, flags); + } + return pull_ascii(dest, src, dest_len, src_len, flags); +} + +int align_string(const void *base_ptr, const char *p, int flags) { - if (strequal (str, "iso8859-1")) { - init_iso8859_1(codepage); - } else if (strequal (str, "iso8859-2")) { - init_iso8859_2(); - } else if (strequal (str, "iso8859-5")) { - init_iso8859_5(); - } else if (strequal (str, "iso8859-7")) { - init_iso8859_7(); - } else if (strequal (str, "iso8859-9")) { - init_iso8859_9(); - } else if (strequal (str, "iso8859-13")) { - init_iso8859_13(); - } else if (strequal (str, "iso8859-15")) { - init_iso8859_15(codepage); - } else if (strequal (str, "koi8-r")) { - init_koi8_r(); - } else if (strequal (str, "roman8")) { - init_roman8(); - } else { - DEBUG(0,("unrecognized character set %s\n", str)); - } - - load_unix_unicode_map(str); + if (!(flags & STR_ASCII) && \ + ((flags & STR_UNICODE || \ + (SVAL(base_ptr, smb_flg2) & FLAGS2_UNICODE_STRINGS)))) { + return ucs2_align(base_ptr, p, flags); + } + return 0; } diff --git a/source3/lib/charset.c b/source3/lib/charset.c index d699df3e2b..cca5fdd326 100644 --- a/source3/lib/charset.c +++ b/source3/lib/charset.c @@ -111,290 +111,3 @@ char *dos_char_map = xx_dos_char_map; char *upper_char_map = xx_upper_char_map; char *lower_char_map = xx_lower_char_map; -/* - * This code has been extended to deal with ascynchronous mappings - * like MS-DOS Latin US (Code page 437) where things like : - * a acute are capitalized to 'A', but the reverse mapping - * must not hold true. This allows the filename case insensitive - * matching in do_match() to work, as the DOS/Win95/NT client - * uses 'A' as a mask to match against characters like a acute. - * This is the meaning behind the parameters that allow a - * mapping from lower to upper, but not upper to lower. - */ - -static void add_dos_char(int lower, BOOL map_lower_to_upper, - int upper, BOOL map_upper_to_lower) -{ - lower &= 0xff; - upper &= 0xff; - DEBUGADD( 6, ( "Adding chars 0x%x 0x%x (l->u = %s) (u->l = %s)\n", - lower, upper, - map_lower_to_upper ? "True" : "False", - map_upper_to_lower ? "True" : "False" ) ); - if (lower) dos_char_map[lower] = 1; - if (upper) dos_char_map[upper] = 1; - lower_char_map[lower] = (char)lower; /* Define tolower(lower) */ - upper_char_map[upper] = (char)upper; /* Define toupper(upper) */ - if (lower && upper) { - if(map_upper_to_lower) - lower_char_map[upper] = (char)lower; - if(map_lower_to_upper) - upper_char_map[lower] = (char)upper; - } -} - -/**************************************************************************** -initialise the charset arrays -****************************************************************************/ -void charset_initialise(void) -{ - int i; - -#ifdef LC_ALL - /* include <locale.h> in includes.h if available for OS */ - /* we take only standard 7-bit ASCII definitions from ctype */ - setlocale(LC_ALL,"C"); -#endif - - for (i= 0;i<=255;i++) { - dos_char_map[i] = 0; - } - - for (i=0;i<=127;i++) { - if (isalnum(i) || strchr("._^$~!#%&-{}()@'`",(char)i)) - add_dos_char(i,False,0,False); - } - - for (i=0; i<=255; i++) { - char c = (char)i; - upper_char_map[i] = lower_char_map[i] = c; - - /* Some systems have buggy isupper/islower for characters - above 127. Best not to rely on them. */ - if(i < 128) { - if (isupper((int)c)) lower_char_map[i] = tolower(c); - if (islower((int)c)) upper_char_map[i] = toupper(c); - } - } -} - -/**************************************************************************** -load the client codepage. -****************************************************************************/ - -typedef unsigned char (*codepage_p)[4]; - -static codepage_p load_client_codepage( int client_codepage ) -{ - pstring codepage_file_name; - unsigned char buf[8]; - int fd = -1; - SMB_OFF_T size; - codepage_p cp_p = NULL; - SMB_STRUCT_STAT st; - - DEBUG(5, ("load_client_codepage: loading codepage %d.\n", client_codepage)); - - if(strlen(lp_codepagedir()) + 14 > sizeof(codepage_file_name)) - { - DEBUG(0,("load_client_codepage: filename too long to load\n")); - return NULL; - } - - pstrcpy(codepage_file_name, lp_codepagedir()); - pstrcat(codepage_file_name, "/"); - pstrcat(codepage_file_name, "codepage."); - slprintf(&codepage_file_name[strlen(codepage_file_name)], - sizeof(pstring)-(strlen(codepage_file_name)+1)-1, - "%03d", - client_codepage); - - if(sys_stat(codepage_file_name,&st)!=0) - { - DEBUG(0,("load_client_codepage: filename %s does not exist.\n", - codepage_file_name)); - return NULL; - } - - /* Check if it is at least big enough to hold the required - data. Should be 2 byte version, 2 byte codepage, 4 byte length, - plus zero or more bytes of data. Note that the data cannot be more - than 4 * MAXCODEPAGELINES bytes. - */ - size = st.st_size; - - if( size < CODEPAGE_HEADER_SIZE || size > (CODEPAGE_HEADER_SIZE + 4 * MAXCODEPAGELINES)) - { - DEBUG(0,("load_client_codepage: file %s is an incorrect size for a \ -code page file (size=%d).\n", codepage_file_name, (int)size)); - return NULL; - } - - /* Read the first 8 bytes of the codepage file - check - the version number and code page number. All the data - is held in little endian format. - */ - - if((fd = open(codepage_file_name, O_RDONLY)) == -1) - { - DEBUG(0,("load_client_codepage: cannot open file %s. Error was %s\n", - codepage_file_name, strerror(errno))); - return NULL; - } - - if (read(fd, buf, CODEPAGE_HEADER_SIZE)!=CODEPAGE_HEADER_SIZE) - { - DEBUG(0,("load_client_codepage: cannot read header from file %s. Error was %s\n", - codepage_file_name, strerror(errno))); - goto clean_and_exit; - } - - /* Check the version value */ - if(SVAL(buf,CODEPAGE_VERSION_OFFSET) != CODEPAGE_FILE_VERSION_ID) - { - DEBUG(0,("load_client_codepage: filename %s has incorrect version id. \ -Needed %hu, got %hu.\n", - codepage_file_name, (uint16)CODEPAGE_FILE_VERSION_ID, - SVAL(buf,CODEPAGE_VERSION_OFFSET))); - goto clean_and_exit; - } - - /* Check the codepage matches */ - if(SVAL(buf,CODEPAGE_CLIENT_CODEPAGE_OFFSET) != (uint16)client_codepage) - { - DEBUG(0,("load_client_codepage: filename %s has incorrect codepage. \ -Needed %hu, got %hu.\n", - codepage_file_name, (uint16)client_codepage, - SVAL(buf,CODEPAGE_CLIENT_CODEPAGE_OFFSET))); - goto clean_and_exit; - } - - /* Check the length is correct. */ - if(IVAL(buf,CODEPAGE_LENGTH_OFFSET) != (size - CODEPAGE_HEADER_SIZE)) - { - DEBUG(0,("load_client_codepage: filename %s has incorrect size headers. \ -Needed %u, got %u.\n", codepage_file_name, (uint32)(size - CODEPAGE_HEADER_SIZE), - IVAL(buf,CODEPAGE_LENGTH_OFFSET))); - goto clean_and_exit; - } - - size -= CODEPAGE_HEADER_SIZE; /* Remove header */ - - /* Make sure the size is a multiple of 4. */ - if((size % 4 ) != 0) - { - DEBUG(0,("load_client_codepage: filename %s has a codepage size not a \ -multiple of 4.\n", codepage_file_name)); - goto clean_and_exit; - } - - /* Allocate space for the code page file and read it all in. */ - if((cp_p = (codepage_p)malloc( size + 4 )) == NULL) - { - DEBUG(0,("load_client_codepage: malloc fail.\n")); - goto clean_and_exit; - } - - if(read(fd, (char *)cp_p, size)!=size) - { - DEBUG(0,("load_client_codepage: read fail on file %s. Error was %s.\n", - codepage_file_name, strerror(errno))); - goto clean_and_exit; - } - - /* Ensure array is correctly terminated. */ - memset(((char *)cp_p) + size, '\0', 4); - - close(fd); - return cp_p; - -clean_and_exit: - - /* pseudo destructor :-) */ - - if(fd != -1) - close(fd); - if(cp_p) - free((char *)cp_p); - return NULL; -} - -/**************************************************************************** - Initialise the client codepage. -****************************************************************************/ - -void codepage_initialise(int client_codepage) -{ - int i; - static codepage_p cp = NULL; - - if(cp != NULL) - { - DEBUG(6, - ("codepage_initialise: called twice - ignoring second client code page = %d\n", - client_codepage)); - return; - } - - DEBUG(6,("codepage_initialise: client code page = %d\n", client_codepage)); - - /* - * Known client codepages - these can be added to. - */ - cp = load_client_codepage( client_codepage ); - - if(cp == NULL) - { -#ifdef KANJI - DEBUG(6,("codepage_initialise: loading dynamic codepage file %s/codepage.%d \ -for code page %d failed. Using default client codepage 932\n", - lp_codepagedir(), client_codepage, client_codepage)); - cp = cp_932; - client_codepage = KANJI_CODEPAGE; -#else /* KANJI */ - DEBUG(6,("codepage_initialise: loading dynamic codepage file %s/codepage.%d \ -for code page %d failed. Using default client codepage 850\n", - lp_codepagedir(), client_codepage, client_codepage)); - cp = cp_850; - client_codepage = MSDOS_LATIN_1_CODEPAGE; -#endif /* KANJI */ - } - - /* - * Setup the function pointers for the loaded codepage. - */ - initialize_multibyte_vectors( client_codepage ); - - if(cp) - { - for(i = 0; !((cp[i][0] == '\0') && (cp[i][1] == '\0')); i++) - add_dos_char(cp[i][0], (BOOL)cp[i][2], cp[i][1], (BOOL)cp[i][3]); - } - - /* Try and load the unicode map. */ - load_dos_unicode_map(client_codepage); -} - -/******************************************************************* -add characters depending on a string passed by the user -********************************************************************/ -void add_char_string(char *s) -{ - char *extra_chars = (char *)strdup(s); - char *t; - if (!extra_chars) return; - - for (t=strtok(extra_chars," \t\r\n"); t; t=strtok(NULL," \t\r\n")) { - char c1=0,c2=0; - int i1=0,i2=0; - if (isdigit((unsigned char)*t) || (*t)=='-') { - sscanf(t,"%i:%i",&i1,&i2); - add_dos_char(i1,True,i2,True); - } else { - sscanf(t,"%c:%c",&c1,&c2); - add_dos_char((unsigned char)c1,True,(unsigned char)c2, True); - } - } - - free(extra_chars); -} diff --git a/source3/lib/cmd_interp.c b/source3/lib/cmd_interp.c index 20812d3f9a..ef6f94bd49 100644 --- a/source3/lib/cmd_interp.c +++ b/source3/lib/cmd_interp.c @@ -1293,8 +1293,6 @@ int command_main(int argc, char *argv[]) DEBUGLEVEL = 2; - charset_initialise(); - /* add in the internal command set and the various client RPC groups--spoolss, lsa, etc... */ add_command_set(general_commands); @@ -1357,8 +1355,6 @@ int command_main(int argc, char *argv[]) cmd_set_options &= ~CMD_USER; cmd_set_options &= ~CMD_PASS; - codepage_initialise(lp_client_code_page()); - /* parse the command line args init the first connection if possible process a command if passed in on the command line */ diff --git a/source3/lib/doscalls.c b/source3/lib/doscalls.c deleted file mode 100644 index 8d0071dde6..0000000000 --- a/source3/lib/doscalls.c +++ /dev/null @@ -1,345 +0,0 @@ -/* - Unix SMB/Netbios implementation. - Version 1.9. - Samba system utilities - Copyright (C) Jeremy Allison 1992-1998 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "includes.h" - -/* - * Wrappers for calls that need to translate to - * DOS/Windows semantics. Note that the pathnames - * in all these functions referred to as 'DOS' names - * are actually in UNIX path format (ie. '/' instead of - * '\' directory separators etc.), but the codepage they - * are in is still the client codepage, hence the 'DOS' - * name. - */ - -extern int DEBUGLEVEL; - -#if 0 /* Use vfs_unlink. */ -/******************************************************************* - Unlink wrapper that calls dos_to_unix. -********************************************************************/ - -int dos_unlink(char *fname) -{ - return(unlink(dos_to_unix(fname,False))); -} -#endif - -/******************************************************************* - Open() wrapper that calls dos_to_unix. -********************************************************************/ - -int dos_open(char *fname,int flags,mode_t mode) -{ - return(sys_open(dos_to_unix(fname,False),flags,mode)); -} - -/******************************************************************* - Opendir() wrapper that calls dos_to_unix. Should use the - vfs_ops->opendir() function instead. -********************************************************************/ - -#if 0 -DIR *dos_opendir(char *dname) -{ - return(opendir(dos_to_unix(dname,False))); -} -#endif - -/******************************************************************* - Readdirname() wrapper that calls unix_to_dos. Should use the - vfs_readdirname() function instead. -********************************************************************/ - -#if 0 -char *dos_readdirname(DIR *p) -{ - char *dname = readdirname(p); - - if (!dname) - return(NULL); - - unix_to_dos(dname, True); - return(dname); -} -#endif - -/******************************************************************* - A chown() wrapper that calls dos_to_unix. -********************************************************************/ - -#if 0 /* Use vfs_chown. */ -int dos_chown(char *fname, uid_t uid, gid_t gid) -{ - return(sys_chown(dos_to_unix(fname,False),uid,gid)); -} -#endif - -/******************************************************************* - A stat() wrapper that calls dos_to_unix. -********************************************************************/ - -int dos_stat(char *fname,SMB_STRUCT_STAT *sbuf) -{ - return(sys_stat(dos_to_unix(fname,False),sbuf)); -} - -/******************************************************************* - An lstat() that calls dos_to_unix. -********************************************************************/ - -int dos_lstat(char *fname,SMB_STRUCT_STAT *sbuf) -{ - return(sys_lstat(dos_to_unix(fname,False),sbuf)); -} - -#if 0 /* VFS */ -/******************************************************************* - Mkdir() that calls dos_to_unix. - Cope with UNIXes that don't allow high order mode bits on mkdir. - Patch from gcarter@lanier.com. - Don't use this call unless you really want to access a file on - disk. Use the vfs_ops.mkdir() function instead. -********************************************************************/ - -int dos_mkdir(char *dname,mode_t mode) -{ - int ret = mkdir(dos_to_unix(dname,False),mode); - if(!ret) - return(dos_chmod(dname,mode)); - else - return ret; -} -#endif - -/******************************************************************* - Rmdir() - call dos_to_unix. -********************************************************************/ - -int dos_rmdir(char *dname) -{ - return(rmdir(dos_to_unix(dname,False))); -} - -#if 0 /* VFS */ -/******************************************************************* - chdir() - call dos_to_unix. -********************************************************************/ - -int dos_chdir(char *dname) -{ - return(chdir(dos_to_unix(dname,False))); -} -#endif - -/******************************************************************* - Utime() - call dos_to_unix. -********************************************************************/ - -int dos_utime(char *fname,struct utimbuf *times) -{ - /* if the modtime is 0 or -1 then ignore the call and - return success */ - if (times->modtime == (time_t)0 || times->modtime == (time_t)-1) - return 0; - - /* if the access time is 0 or -1 then set it to the modtime */ - if (times->actime == (time_t)0 || times->actime == (time_t)-1) - times->actime = times->modtime; - - return(utime(dos_to_unix(fname,False),times)); -} - -/********************************************************* - For rename across filesystems Patch from Warren Birnbaum - <warrenb@hpcvscdp.cv.hp.com> -**********************************************************/ - -int copy_reg(char *source, const char *dest) -{ - SMB_STRUCT_STAT source_stats; - int ifd; - int ofd; - char *buf; - int len; /* Number of bytes read into `buf'. */ - - sys_lstat (source, &source_stats); - if (!S_ISREG (source_stats.st_mode)) - return 1; - - if (unlink (dest) && errno != ENOENT) - return 1; - - if((ifd = sys_open (source, O_RDONLY, 0)) < 0) - return 1; - - if((ofd = sys_open (dest, O_WRONLY | O_CREAT | O_TRUNC, 0600)) < 0 ) - { - close (ifd); - return 1; - } - - if((buf = malloc( COPYBUF_SIZE )) == NULL) - { - close (ifd); - close (ofd); - unlink (dest); - return 1; - } - - while ((len = read(ifd, buf, COPYBUF_SIZE)) > 0) - { - if (write_data(ofd, buf, len) < 0) - { - close (ifd); - close (ofd); - unlink (dest); - free(buf); - return 1; - } - } - free(buf); - if (len < 0) - { - close (ifd); - close (ofd); - unlink (dest); - return 1; - } - - if (close (ifd) < 0) - { - close (ofd); - return 1; - } - if (close (ofd) < 0) - return 1; - - /* chown turns off set[ug]id bits for non-root, - so do the chmod last. */ - - /* Try to copy the old file's modtime and access time. */ - { - struct utimbuf tv; - - tv.actime = source_stats.st_atime; - tv.modtime = source_stats.st_mtime; - if (utime (dest, &tv)) - return 1; - } - - /* Try to preserve ownership. For non-root it might fail, but that's ok. - But root probably wants to know, e.g. if NFS disallows it. */ - if (chown (dest, source_stats.st_uid, source_stats.st_gid) - && (errno != EPERM)) - return 1; - - if (chmod (dest, source_stats.st_mode & 07777)) - return 1; - - unlink (source); - return 0; -} - -/******************************************************************* - Rename() - call dos_to_unix. -********************************************************************/ - -int dos_rename(char *from, char *to) -{ - int rcode; - pstring zfrom, zto; - - pstrcpy (zfrom, dos_to_unix (from, False)); - pstrcpy (zto, dos_to_unix (to, False)); - rcode = rename (zfrom, zto); - - if (errno == EXDEV) - { - /* Rename across filesystems needed. */ - rcode = copy_reg (zfrom, zto); - } - return rcode; -} - -/******************************************************************* - Chmod - call dos_to_unix. -********************************************************************/ - -int dos_chmod(char *fname,mode_t mode) -{ - return(chmod(dos_to_unix(fname,False),mode)); -} - -#if 0 /* VFS */ -/******************************************************************* - Getwd - takes a UNIX directory name and returns the name - in dos format. -********************************************************************/ - -char *dos_getwd(char *unix_path) -{ - char *wd; - wd = sys_getwd(unix_path); - if (wd) - unix_to_dos(wd, True); - return wd; -} -#endif /* VFS */ - -/******************************************************************* - Check if a DOS file exists. Use vfs_file_exist function instead. -********************************************************************/ - -#if 0 -BOOL dos_file_exist(char *fname,SMB_STRUCT_STAT *sbuf) -{ - return file_exist(dos_to_unix(fname, False), sbuf); -} -#endif - -/******************************************************************* - Check if a DOS directory exists. -********************************************************************/ - -BOOL dos_directory_exist(char *dname,SMB_STRUCT_STAT *st) -{ - return directory_exist(dos_to_unix(dname, False), st); -} - -/******************************************************************* - Return the modtime of a DOS pathname. -********************************************************************/ - -time_t dos_file_modtime(char *fname) -{ - return file_modtime(dos_to_unix(fname, False)); -} - -/******************************************************************* - Return the file size of a DOS pathname. -********************************************************************/ - -SMB_OFF_T dos_file_size(char *file_name) -{ - return get_file_size(dos_to_unix(file_name, False)); -} diff --git a/source3/lib/iconv.c b/source3/lib/iconv.c new file mode 100644 index 0000000000..a22c84997d --- /dev/null +++ b/source3/lib/iconv.c @@ -0,0 +1,346 @@ +/* + Unix SMB/Netbios implementation. + Version 3.0 + minimal iconv implementation + Copyright (C) Andrew Tridgell 2001 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" + +static size_t ascii_pull(char **, size_t *, char **, size_t *); +static size_t ascii_push(char **, size_t *, char **, size_t *); +static size_t weird_pull(char **, size_t *, char **, size_t *); +static size_t weird_push(char **, size_t *, char **, size_t *); +static size_t iconv_copy(char **, size_t *, char **, size_t *); + +/* + for each charset we have a function that pulls from that charset to + a ucs2 buffer, and a function that pushes to a ucs2 buffer +*/ +static struct { + char *name; + size_t (*pull)(char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft); + size_t (*push)(char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft); +} charsets[] = { + {"UCS2", iconv_copy, iconv_copy}, + {"ASCII", ascii_pull, ascii_push}, + {"WEIRD", weird_pull, weird_push}, + {NULL, NULL, NULL} +}; + +/* + this is a simple portable iconv() implementaion. It only knows about + a very small number of character sets - just enough that Samba works + on systems that don't have iconv + */ +size_t smb_iconv(smb_iconv_t cd, + char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft) +{ + char cvtbuf[2048]; + char *bufp = cvtbuf; + size_t bufsize; + +#ifdef HAVE_NATIVE_ICONV + if (cd->cd) { + return iconv(cd->cd, inbuf, inbytesleft, outbuf, outbytesleft); + } +#endif + + if (!inbuf || ! *inbuf || !outbuf || ! *outbuf) return 0; + + /* in most cases we can go direct */ + if (cd->direct) { + return cd->direct(inbuf, inbytesleft, outbuf, outbytesleft); + } + + /* otherwise we have to do it chunks at a time */ + while (*inbytesleft > 0) { + bufp = cvtbuf; + bufsize = sizeof(cvtbuf); + if (cd->pull(inbuf, inbytesleft, &bufp, &bufsize) == -1 && + errno != E2BIG) return -1; + + bufp = cvtbuf; + bufsize = sizeof(cvtbuf) - bufsize; + if (cd->push(&bufp, &bufsize, outbuf, outbytesleft) == -1) return -1; + } + + return 0; +} + +/* + simple iconv_open() wrapper + */ +smb_iconv_t smb_iconv_open(const char *tocode, const char *fromcode) +{ + smb_iconv_t ret; + int from, to; +#ifdef HAVE_NATIVE_ICONV + iconv_t cd = NULL; +#endif + + for (from=0; charsets[from].name; from++) { + if (strcasecmp(charsets[from].name, fromcode) == 0) break; + } + for (to=0; charsets[to].name; to++) { + if (strcasecmp(charsets[to].name, tocode) == 0) break; + } + + if (!charsets[from].name || !charsets[to].name) { +#ifdef HAVE_NATIVE_ICONV + cd = iconv_open(tocode, fromcode); + if (!cd) +#endif + { + errno = EINVAL; + return (smb_iconv_t)-1; + } + } + + ret = (smb_iconv_t)malloc(sizeof(*ret)); + if (!ret) { + errno = ENOMEM; + return (smb_iconv_t)-1; + } + memset(ret, 0, sizeof(*ret)); + +#ifdef HAVE_NATIVE_ICONV + /* see if we wil be using the native iconv */ + if (cd) { + ret->cd = cd; + return ret; + } +#endif + + /* check for the simplest null conversion */ + if (from == to) { + ret->direct = iconv_copy; + return ret; + } + + /* check for conversion to/from ucs2 */ + if (from == 0) { + ret->direct = charsets[to].push; + return ret; + } + if (to == 0) { + ret->direct = charsets[from].pull; + return ret; + } + + /* the general case has to go via a buffer */ + ret->pull = charsets[from].pull; + ret->push = charsets[to].push; + return ret; +} + +/* + simple iconv_close() wrapper +*/ +int smb_iconv_close (smb_iconv_t cd) +{ +#ifdef HAVE_NATIVE_ICONV + if (cd->cd) { + iconv_close(cd->cd); + } +#endif + memset(cd, 0, sizeof(*cd)); + free(cd); + return 0; +} + + +/********************************************************************** + the following functions implement the builtin character sets in Samba + and also the "test" character sets that are designed to test + multi-byte character set support for english users +***********************************************************************/ + +static size_t ascii_pull(char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft) +{ + while (*inbytesleft >= 1 && *outbytesleft >= 2) { + (*outbuf)[0] = (*inbuf)[0]; + (*outbuf)[1] = 0; + (*inbytesleft) -= 1; + (*outbytesleft) -= 2; + (*inbuf) += 1; + (*outbuf) += 2; + } + + if (*inbytesleft > 0) { + errno = E2BIG; + return -1; + } + + return 0; +} + +static size_t ascii_push(char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft) +{ + int ir_count=0; + + while (*inbytesleft >= 2 && *outbytesleft >= 1) { + (*outbuf)[0] = (*inbuf)[0]; + if ((*inbuf)[1]) ir_count++; + (*inbytesleft) -= 2; + (*outbytesleft) -= 1; + (*inbuf) += 2; + (*outbuf) += 1; + } + + if (*inbytesleft == 1) { + errno = EINVAL; + return -1; + } + + if (*inbytesleft > 1) { + errno = E2BIG; + return -1; + } + + return ir_count; +} + + +/* the "weird" character set is very useful for testing multi-byte + support and finding bugs. Don't use on a production system! +*/ +static struct { + char from; + char *to; + int len; +} weird_table[] = { + {'q', "^q^", 3}, + {'Q', "^Q^", 3}, + {'x', "\\.q\\.", 5}, + {'X', "\\.Z\\.", 5}, + {0, NULL} +}; + +static size_t weird_pull(char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft) +{ + while (*inbytesleft >= 1 && *outbytesleft >= 2) { + int i; + for (i=0;weird_table[i].from;i++) { + if (strncmp((*inbuf), + weird_table[i].to, + weird_table[i].len) == 0) { + if (*inbytesleft < weird_table[i].len) { + DEBUG(0,("ERROR: truncated weird string\n")); + smb_panic(__FUNCTION__); + + } else { + (*outbuf)[0] = weird_table[i].from; + (*outbuf)[1] = 0; + (*inbytesleft) -= weird_table[i].len; + (*outbytesleft) -= 2; + (*inbuf) += weird_table[i].len; + (*outbuf) += 2; + goto next; + } + } + } + (*outbuf)[0] = (*inbuf)[0]; + (*outbuf)[1] = 0; + (*inbytesleft) -= 1; + (*outbytesleft) -= 2; + (*inbuf) += 1; + (*outbuf) += 2; + next: + } + + if (*inbytesleft > 0) { + errno = E2BIG; + return -1; + } + + return 0; +} + +static size_t weird_push(char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft) +{ + int ir_count=0; + + while (*inbytesleft >= 2 && *outbytesleft >= 1) { + int i; + for (i=0;weird_table[i].from;i++) { + if ((*inbuf)[0] == weird_table[i].from && + (*inbuf)[1] == 0) { + if (*outbytesleft < weird_table[i].len) { + DEBUG(0,("No room for weird character\n")); + smb_panic(__FUNCTION__); + } else { + memcpy(*outbuf, weird_table[i].to, + weird_table[i].len); + (*inbytesleft) -= 2; + (*outbytesleft) -= weird_table[i].len; + (*inbuf) += 2; + (*outbuf) += weird_table[i].len; + goto next; + } + } + } + (*outbuf)[0] = (*inbuf)[0]; + if ((*inbuf)[1]) ir_count++; + (*inbytesleft) -= 2; + (*outbytesleft) -= 1; + (*inbuf) += 2; + (*outbuf) += 1; + next: + } + + if (*inbytesleft == 1) { + errno = EINVAL; + return -1; + } + + if (*inbytesleft > 1) { + errno = E2BIG; + return -1; + } + + return ir_count; +} + +static size_t iconv_copy(char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft) +{ + int n; + + n = MIN(*inbytesleft, *outbytesleft); + + memmove(*outbuf, *inbuf, n); + + (*inbytesleft) -= n; + (*outbytesleft) -= n; + (*inbuf) += n; + (*outbuf) += n; + + if (*inbytesleft > 0) { + errno = E2BIG; + return -1; + } + + return 0; +} diff --git a/source3/lib/kanji.c b/source3/lib/kanji.c deleted file mode 100644 index 39e9933842..0000000000 --- a/source3/lib/kanji.c +++ /dev/null @@ -1,1691 +0,0 @@ -/* - Unix SMB/Netbios implementation. - Version 1.9. - Kanji Extensions - Copyright (C) Andrew Tridgell 1992-1998 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - Adding for Japanese language by <fujita@ainix.isac.co.jp> 1994.9.5 - and extend coding system to EUC/SJIS/JIS/HEX at 1994.10.11 - and add all jis codes sequence type at 1995.8.16 - Notes: Hexadecimal code by <ohki@gssm.otuka.tsukuba.ac.jp> - Adding features about Machine dependent codes and User Defined Codes - by Hiroshi MIURA <miura@samba.gr.jp> 2000.3.19 -*/ - -#define _KANJI_C_ -#include "includes.h" - -/* - * Function pointers that get overridden when multi-byte code pages - * are loaded. - */ - -const char *(*multibyte_strchr)(const char *, int ) = (const char *(*)(const char *, int )) strchr; -const char *(*multibyte_strrchr)(const char *, int ) = (const char *(*)(const char *, int )) strrchr; -const char *(*multibyte_strstr)(const char *, const char *) = (const char *(*)(const char *, const char *)) strstr; -char *(*multibyte_strtok)(char *, const char *) = (char *(*)(char *, const char *)) strtok; - -/* - * Kanji is treated differently here due to historical accident of - * it being the first non-English codepage added to Samba. - * The define 'KANJI' is being overloaded to mean 'use kanji codepage - * by default' and also 'this is the filename-to-disk conversion - * method to use'. This really should be removed and all control - * over this left in the smb.conf parameters 'client codepage' - * and 'coding system'. - */ - -#ifndef KANJI - -/* - * Set the default conversion to be the functions in - * charcnv.c. - */ - -static size_t skip_non_multibyte_char(char); -static BOOL not_multibyte_char_1(char); - -char *(*_dos_to_unix)(char *, BOOL) = dos2unix_format; -char *(*_unix_to_dos)(char *, BOOL) = unix2dos_format; -size_t (*_skip_multibyte_char)(char) = skip_non_multibyte_char; -BOOL (*is_multibyte_char_1)(char) = not_multibyte_char_1; - -#else /* KANJI */ - -/* - * Set the default conversion to be the function - * sj_to_sj in this file. - */ - -static char *sj_to_sj(char *from, BOOL overwrite); -static size_t skip_kanji_multibyte_char(char); -static BOOL is_kanji_multibyte_char_1(char); - -char *(*_dos_to_unix)(char *, BOOL) = sj_to_sj; -char *(*_unix_to_dos)(char *, BOOL) = sj_to_sj; -size_t (*_skip_multibyte_char)(char) = skip_kanji_multibyte_char; -int (*is_multibyte_char_1)(char) = is_kanji_multibyte_char_1; - -#endif /* KANJI */ - -BOOL global_is_multibyte_codepage = False; - -/* jis si/so sequence */ -static char jis_kso = JIS_KSO; -static char jis_ksi = JIS_KSI; -static char hex_tag = HEXTAG; - -/******************************************************************* - SHIFT JIS functions -********************************************************************/ - -/******************************************************************* - search token from S1 separated any char of S2 - S1 contains SHIFT JIS chars. -********************************************************************/ - -static char *sj_strtok(char *s1, const char *s2) -{ - static char *s = NULL; - char *q; - if (!s1) { - if (!s) { - return NULL; - } - s1 = s; - } - for (q = s1; *s1; ) { - if (is_shift_jis (*s1)) { - s1 += 2; - } else if (is_kana (*s1)) { - s1++; - } else { - char *p = strchr (s2, *s1); - if (p) { - if (s1 != q) { - s = s1 + 1; - *s1 = '\0'; - return q; - } - q = s1 + 1; - } - s1++; - } - } - s = NULL; - if (*q) { - return q; - } - return NULL; -} - -/******************************************************************* - search string S2 from S1 - S1 contains SHIFT JIS chars. -********************************************************************/ - -static const char *sj_strstr(const char *s1, const char *s2) -{ - size_t len = strlen (s2); - if (!*s2) - return (const char *) s1; - for (;*s1;) { - if (*s1 == *s2) { - if (strncmp (s1, s2, len) == 0) - return (const char *) s1; - } - if (is_shift_jis (*s1)) { - s1 += 2; - } else { - s1++; - } - } - return NULL; -} - -/******************************************************************* - Search char C from beginning of S. - S contains SHIFT JIS chars. -********************************************************************/ - -static const char *sj_strchr (const char *s, int c) -{ - for (; *s; ) { - if (*s == c) - return (const char *) s; - if (is_shift_jis (*s)) { - s += 2; - } else { - s++; - } - } - return NULL; -} - -/******************************************************************* - Search char C end of S. - S contains SHIFT JIS chars. -********************************************************************/ - -static const char *sj_strrchr(const char *s, int c) -{ - const char *q; - - for (q = 0; *s; ) { - if (*s == c) { - q = (const char *) s; - } - if (is_shift_jis (*s)) { - s += 2; - } else { - s++; - } - } - return q; -} - -/******************************************************************* - Kanji multibyte char skip function. -*******************************************************************/ - -static size_t skip_kanji_multibyte_char(char c) -{ - if(is_shift_jis(c)) { - return 2; - } else if (is_kana(c)) { - return 1; - } - return 0; -} - -/******************************************************************* - Kanji multibyte char identification. -*******************************************************************/ - -static BOOL is_kanji_multibyte_char_1(char c) -{ - return is_shift_jis(c); -} - -/******************************************************************* - The following functions are the only ones needed to do multibyte - support for Hangul, Big5 and Simplified Chinese. Most of the - real work for these codepages is done in the generic multibyte - functions. The only reason these functions are needed at all - is that the is_xxx(c) calls are really preprocessor macros. -********************************************************************/ - -/******************************************************************* - Hangul (Korean - code page 949) function. -********************************************************************/ - -static BOOL hangul_is_multibyte_char_1(char c) -{ - return is_hangul(c); -} - -/******************************************************************* - Big5 Traditional Chinese (code page 950) function. -********************************************************************/ - -static BOOL big5_is_multibyte_char_1(char c) -{ - return is_big5_c1(c); -} - -/******************************************************************* - Simplified Chinese (code page 936) function. -********************************************************************/ - -static BOOL simpch_is_multibyte_char_1(char c) -{ - return is_simpch_c1(c); -} - -/******************************************************************* - Generic multibyte functions - used by Hangul, Big5 and Simplified - Chinese codepages. -********************************************************************/ - -/******************************************************************* - search token from S1 separated any char of S2 - S1 contains generic multibyte chars. -********************************************************************/ - -static char *generic_multibyte_strtok(char *s1, const char *s2) -{ - static char *s = NULL; - char *q; - if (!s1) { - if (!s) { - return NULL; - } - s1 = s; - } - for (q = s1; *s1; ) { - if ((*is_multibyte_char_1)(*s1)) { - s1 += 2; - } else { - char *p = strchr (s2, *s1); - if (p) { - if (s1 != q) { - s = s1 + 1; - *s1 = '\0'; - return q; - } - q = s1 + 1; - } - s1++; - } - } - s = NULL; - if (*q) { - return q; - } - return NULL; -} - -/******************************************************************* - search string S2 from S1 - S1 contains generic multibyte chars. -********************************************************************/ - -static const char *generic_multibyte_strstr(const char *s1, const char *s2) -{ - size_t len = strlen (s2); - if (!*s2) - return (const char *) s1; - for (;*s1;) { - if (*s1 == *s2) { - if (strncmp (s1, s2, len) == 0) - return (const char *) s1; - } - if ((*is_multibyte_char_1)(*s1)) { - s1 += 2; - } else { - s1++; - } - } - return NULL; -} - -/******************************************************************* - Search char C from beginning of S. - S contains generic multibyte chars. -********************************************************************/ - -static const char *generic_multibyte_strchr(const char *s, int c) -{ - for (; *s; ) { - if (*s == c) - return (const char *) s; - if ((*is_multibyte_char_1)(*s)) { - s += 2; - } else { - s++; - } - } - return NULL; -} - -/******************************************************************* - Search char C end of S. - S contains generic multibyte chars. -********************************************************************/ - -static const char *generic_multibyte_strrchr(const char *s, int c) -{ - const char *q; - - for (q = 0; *s; ) { - if (*s == c) { - q = (const char *) s; - } - if ((*is_multibyte_char_1)(*s)) { - s += 2; - } else { - s++; - } - } - return q; -} - -/******************************************************************* - Generic multibyte char skip function. -*******************************************************************/ - -static size_t skip_generic_multibyte_char(char c) -{ - if( (*is_multibyte_char_1)(c)) { - return 2; - } - return 0; -} - -/******************************************************************* - Code conversion -********************************************************************/ - -/* convesion buffer */ -static char cvtbuf[2*sizeof(pstring)]; - -/******************************************************************* - EUC <-> SJIS -********************************************************************/ - -static int euc2sjis (int hi, int lo) -{ - int w; - int maxidx = SJISREVTBLSIZ; - int minidx = 0; - int i = 2; - - if (hi & 1) { - hi = hi / 2 + (hi < 0xdf ? 0x31 : 0x71); - w = (hi << 8) | (lo - (lo >= 0xe0 ? 0x60 : 0x61)); - } else { - hi = hi / 2 + (hi < 0xdf ? 0x30 : 0x70); - w = (hi << 8) | (lo - 2); - } - if ( (0x87 < hi ) && (hi < 0xed ) ) { - return w; - } - while ( maxidx >= minidx ) { - if ( sjisrev[i].start > w ) { - maxidx = i-1; - } else if ( w > sjisrev[i].end ) { - minidx = i+1; - } else { - w -= sjisrev[i].start; - w += sjisrev[i].rstart; - break; - } - i = (int)( minidx + (maxidx - minidx) % 2 ); - } - return w; -} - -static int sjis2euc (int hi, int lo) -{ - int minidx = 0; - int maxidx = SJISCONVTBLSIZ -1; /* max index 1 less than number of entries */ - int i = ( 0 + SJISCONVTBLSIZ ) % 2; - int w = (int)((hi << 8) | lo); - - if ( (sjisconv[0].start < w) && (w < sjisconv[SJISCONVTBLSIZ-1].end) ) { - while (maxidx >= minidx) { - if ( sjisconv[i].start > w ) { - maxidx = i-1; - } else if (w > sjisconv[i].end) { - minidx = i+1; - } else { - w -= sjisconv[i].start; - w += sjisconv[i].rstart; - break; - } - i = (int)( minidx + (maxidx-minidx)%2 ); - } - hi = (int) ((w >> 8) & 0xff); - lo = (int) (w & 0xff); - } - if (hi >= 0xf0) { - hi = GETAHI; - lo = GETALO; - } - if (lo >= 0x9f) - return ((hi * 2 - (hi >= 0xe0 ? 0xe0 : 0x60)) << 8) | (lo + 2); - else - return ((hi * 2 - (hi >= 0xe0 ? 0xe1 : 0x61)) << 8) | - (lo + (lo >= 0x7f ? 0x60 : 0x61)); -} - -/******************************************************************* - Convert FROM contain SHIFT JIS codes to EUC codes - return converted buffer -********************************************************************/ - -static char *sj_to_euc(char *from, BOOL overwrite) -{ - char *out; - char *save; - - save = (char *) from; - for (out = cvtbuf; *from && (out - cvtbuf < sizeof(cvtbuf)-3);) { - if (is_shift_jis (*from)) { - int code = sjis2euc ((int) from[0] & 0xff, (int) from[1] & 0xff); - *out++ = (code >> 8) & 0xff; - *out++ = code & 0xff; - from += 2; - } else if (is_kana (*from)) { - *out++ = (char)euc_kana; - *out++ = *from++; - } else { - *out++ = *from++; - } - } - *out = 0; - if (overwrite) { - pstrcpy((char *) save, (char *) cvtbuf); - return (char *) save; - } else { - return cvtbuf; - } -} - -/******************************************************************* - Convert FROM contain EUC codes to SHIFT JIS codes - return converted buffer -********************************************************************/ - -static char *euc_to_sj(char *from, BOOL overwrite) -{ - char *out; - char *save; - - save = (char *) from; - for (out = cvtbuf; *from && (out - cvtbuf < sizeof(cvtbuf)-3); ) { - if (is_euc (*from)) { - int code = euc2sjis ((int) from[0] & 0xff, (int) from[1] & 0xff); - *out++ = (code >> 8) & 0xff; - *out++ = code & 0xff; - from += 2; - } else if (is_euc_kana (*from)) { - *out++ = from[1]; - from += 2; - } else { - *out++ = *from++; - } - } - *out = 0; - - if (overwrite) { - pstrcpy(save, (char *) cvtbuf); - return save; - } else { - return cvtbuf; - } -} - -/******************************************************************* - EUC3 <-> SJIS -********************************************************************/ -static int sjis3euc (int hi, int lo, int *len) -{ - int i,w; - int minidx; - int maxidx; - - w = (int)((hi << 8) | lo); - - /* no sjis */ - if ( ( 0x40 >= lo ) && (lo >= 0xfc) && (lo == 0x7f )) { - w = (GETAHI << 8) | GETALO; - - /* IBM Extended Kanji */ - } else if (( w == 0xfa54 )||( w == 0x81ca )) { - *len = 2; - return (0xa2cc); - - } else if (( w == 0xfa5b )||( w == 0x81e6)) { - *len = 2; - return (0xa2e8); - - } else if (( 0xfa <= hi ) && ( hi <= 0xfc ) ) { - i = w - 0xfa40 - ( hi - 0xfa )*( 0xfb40 - 0xfafc) - ((lo < 0x7f)? 0 : 1 ); - if ( i <= EUC3CONVTBLSIZ ){ - *len = 3; - return euc3conv[i]; - } - -/* NEC selected IBM Extend Kanji */ - /* there are 3 code that is not good for conv */ - } else if (( 0x8754 <= w ) && ( w <= 0x878a)) { - minidx = 0; - maxidx = EUC3CONV2TBLSIZ; - i = minidx + (maxidx - minidx) % 2; - while ( maxidx >= minidx ) { - if ( euc3conv2[i].sjis > w ) { - maxidx = i-1; - } else if ( w > euc3conv2[i].sjis ) { - minidx = i+1; - } else { - *len = 3; - return (euc3conv2[i].euc); - } - i = (int)( minidx + (maxidx - minidx) % 2 ); - } - /* else normal EUC */ - - } else if (( w == 0xeef9 ) || ( w == 0x81ca )) { - *len = 2; - return (0xa2cc); - - } else if (( 0xed <= hi ) && ( hi <= 0xef )) { - minidx = 0; - maxidx = SJISREVTBLSIZ; - i = 10; - while ( maxidx >= minidx ) { - if ( sjisrev[i].start > w ) { - maxidx = i-1; - } else if ( w > sjisrev[i].end ) { - minidx = i+1; - } else { - w -= sjisrev[i].start; - w += sjisrev[i].rstart; - break; - } - i = (int)( minidx + (maxidx - minidx) % 2 ); - } - if ( w >= 0xfa40 ) { - i = w - 0xfa40 - ( hi - 0xfa )*( 0xfb40 - 0xfafc) - ((lo < 0x7f)? 0 : 1 ); - if ( i <= EUC3CONVTBLSIZ ){ - *len = 3; - return euc3conv[i]; - } else { - w = (GETAHI << 8) | GETALO; - } - } - /* else normal EUC */ - -/* UDC half low*/ -/* this area maps to the G2 UDC area: 0xf5a1 -- 0xfefe */ - } else if ((0xf0 <= hi) && (hi <= 0xf4)) { - *len = 2; - if (lo >= 0x9f) { - return (((hi * 2 - 0xea) << 8) | (lo + 2)); - } else { - return (((hi * 2 - 0xeb) << 8) | (lo + (lo >=0x7f ? 0x60: 0x61 ))); - } - -/* UDC half high*/ -/* this area maps to the G3 UDC area: 0xf8f5a1 -- 0xf8fefe */ - } else if ((0xf5 <= hi) && (hi <= 0xf9)) { - *len = 3; - if (lo >= 0x9f) { - return (((hi*2 - 0xf4) << 8) | (lo + 2)); - } else { - return (((hi*2 - 0xf5) << 8) | (lo + (lo >= 0x7f ? 0x60: 0x61 ))); - } - /* ....checked all special case */ - } - - /* These Normal 2 byte EUC */ - *len = 2; - hi = (int) ((w >> 8) & 0xff); - lo = (int) (w & 0xff); - - if (hi >= 0xf0) { /* Check range */ - hi = GETAHI; - lo = GETALO; - } - - if (lo >= 0x9f) - return ((hi * 2 - (hi >= 0xe0 ? 0xe0 : 0x60)) << 8) | (lo + 2); - else - return ((hi * 2 - (hi >= 0xe0 ? 0xe1 : 0x61)) << 8) | - (lo + (lo >= 0x7f ? 0x60 : 0x61)); -} - -static int euc3sjis (int hi, int lo, BOOL is_3byte) -{ - int w; - - w = (int)((hi << 8) | lo); - if (is_3byte) { - if (( 0xf5 <= hi) && ( hi <= 0xfe)) { - /* UDC half high*/ - /* this area maps to the G3 UDC area */ - /* 0xf8f5a1 -- 0xf8fefe --> 0xf540 -- 0xf9fc */ - if (hi & 1) { - return (((hi / 2 + 0x7b) << 8) | (lo - (lo >= 0xe0 ? 0x60 : 0x61))); - } else { - return (((hi / 2 + 0x7a) << 8) | (lo - 2)); - } - } else { - /* Using map table */ - int minidx = 0; - int maxidx = EUC3REVTBLSIZ; - int i = minidx + (maxidx - minidx) % 2; - - while ( maxidx >= minidx ) { - if (euc3rev[i].euc > w) { - maxidx = i-1; - } else if (euc3rev[i].euc < w) { - minidx = i+1; - } else { - return (euc3rev[i].sjis); - } - i = (int)( minidx + ( maxidx - minidx ) % 2); - } - return ((GETAHI << 8 ) | GETALO); - } - } else { /* is_2byte */ - if ((0xf5 <= hi) && (hi <= 0xfe)) { - /* UDC half low*/ - /* this area maps to the G2 UDC area */ - /* 0xf5a1 -- 0xfefe --> 0xf040 -- 0xf4fc */ - if (hi & 1) { - return (((hi / 2 + 0x76) << 8) | (lo - (lo >= 0xe0 ? 0x60 : 0x61))); - } else { - return (((hi / 2 + 0x75) << 8) | (lo - 2)); - } - } else { /* Normal EUC */ - if (hi & 1) { - hi = hi / 2 + (hi < 0xdf ? 0x31 : 0x71); - return ((hi << 8) | (lo - (lo >= 0xe0 ? 0x60 : 0x61))); - } else { - hi = hi / 2 + (hi < 0xdf ? 0x30 : 0x70); - return ((hi << 8) | (lo - 2)); - } - } - } -} - -/******************************************************************* - Convert FROM contain SHIFT JIS codes to EUC codes (with SS2) - return converted buffer -********************************************************************/ - -static char *sj_to_euc3(char *from, BOOL overwrite) -{ - char *out; - char *save; - int len; - - save = (char *) from; - for (out = cvtbuf; *from && (out - cvtbuf < sizeof(cvtbuf)-4);) { - if (is_shift_jis (*from)) { - int code = sjis3euc ((int) from[0] & 0xff, (int) from[1] & 0xff, &len); - if (len == 3) { - *out++ = (char)euc_sup; - } - *out++ = (code >> 8) & 0xff; - *out++ = code & 0xff; - from += 2; - } else if (is_kana (*from)) { - *out++ = (char)euc_kana; - *out++ = *from++; - } else { - *out++ = *from++; - } - } - *out = 0; - if (overwrite) { - pstrcpy((char *) save, (char *) cvtbuf); - return (char *) save; - } else { - return cvtbuf; - } -} - -/******************************************************************* - Convert FROM contain EUC codes (with Sup-Kanji) to SHIFT JIS codes - return converted buffer -********************************************************************/ -static char *euc3_to_sj(char *from, BOOL overwrite) -{ - char *out; - char *save; - - save = (char *) from; - for (out = cvtbuf; *from && (out - cvtbuf < sizeof(cvtbuf)-3); ) { - if (is_euc_sup (*from)) { - int code = euc3sjis((int) from[1] & 0xff, (int) from[2] & 0xff, True); - *out++ = (code >> 8) & 0xff; - *out++ = code & 0xff; - from += 3; - } else if (is_euc (*from)) { - int code = euc3sjis ((int) from[0] & 0xff, (int) from[1] & 0xff,False); - *out++ = (code >> 8) & 0xff; - *out++ = code & 0xff; - from += 2; - } else if (is_euc_kana (*from)) { - *out++ = from[1]; - from += 2; - } else { - *out++ = *from++; - } - } - *out = 0; - - if (overwrite) { - pstrcpy(save, (char *) cvtbuf); - return save; - } else { - return cvtbuf; - } -} - -/******************************************************************* - JIS7,JIS8,JUNET <-> SJIS -********************************************************************/ - -static int sjis2jis(int hi, int lo) -{ - int minidx = 0; - int maxidx = SJISCONVTBLSIZ -1; /* max index 1 less than number of entries */ - int i = (0 + SJISCONVTBLSIZ) % 2; - int w = (int)((hi << 8) | lo); - - if ((sjisconv[0].start < w) && (w < sjisconv[SJISCONVTBLSIZ-1].end)) { - while (maxidx >= minidx) { - if (sjisconv[i].start > w) { - maxidx = i-1; - } else if (w > sjisconv[i].end) { - minidx = i+1; - } else { - w -= sjisconv[i].start; - w += sjisconv[i].rstart; - break; - } - i = (int)( minidx + (maxidx-minidx) %2 ); - } - hi = (int) ((w >> 8) & 0xff); - lo = (int) (w & 0xff); - } - if (hi >= 0xf0) { - hi = GETAHI; - lo = GETALO; - } - if (lo >= 0x9f) - return ((hi * 2 - (hi >= 0xe0 ? 0x160 : 0xe0)) << 8) | (lo - 0x7e); - else - return ((hi * 2 - (hi >= 0xe0 ? 0x161 : 0xe1)) << 8) | - (lo - (lo >= 0x7f ? 0x20 : 0x1f)); -} - -static int jis2sjis(int hi, int lo) -{ - int w; - int minidx = 0; - int maxidx = SJISREVTBLSIZ; - int i = 2; - - if (hi & 1) { - hi = hi / 2 + (hi < 0x5f ? 0x71 : 0xb1); - w = (hi << 8) | (lo + (lo >= 0x60 ? 0x20 : 0x1f)); - } else { - hi = hi / 2 + (hi < 0x5f ? 0x70 : 0xb0); - w = (hi << 8) | (lo + 0x7e); - } - - if (( 0x87 < hi ) && ( hi < 0xed )) { - return w; - } - while (maxidx >= minidx) { - if (sjisrev[i].start > w) { - maxidx = i-1; - } else if (w > sjisrev[i].end) { - minidx = i+1; - } else { - w -= sjisrev[i].start; - w += sjisrev[i].rstart; - break; - } - i = (int)( minidx + (maxidx-minidx) %2 ); - } - return w; -} - -/******************************************************************* - Convert FROM contain JIS codes to SHIFT JIS codes - return converted buffer -********************************************************************/ - -static char *jis8_to_sj(char *from, BOOL overwrite) -{ - char *out; - int shifted; - char *save; - - shifted = _KJ_ROMAN; - save = (char *) from; - for (out = cvtbuf; *from && (out - cvtbuf < sizeof(cvtbuf)-3);) { - if (is_esc (*from)) { - if (is_so1 (from[1]) && is_so2 (from[2])) { - shifted = _KJ_KANJI; - from += 3; - } else if (is_si1 (from[1]) && is_si2 (from[2])) { - shifted = _KJ_ROMAN; - from += 3; - } else { /* sequence error */ - goto normal; - } - } else { - -normal: - - switch (shifted) { - default: - case _KJ_ROMAN: - *out++ = *from++; - break; - case _KJ_KANJI: - { - int code = jis2sjis ((int) from[0] & 0xff, (int) from[1] & 0xff); - *out++ = (code >> 8) & 0xff; - *out++ = code; - from += 2; - break; - } - } - } - } - - *out = 0; - if (overwrite) { - pstrcpy (save, (char *) cvtbuf); - return save; - } else { - return cvtbuf; - } -} - -/******************************************************************* - Convert FROM contain SHIFT JIS codes to JIS codes - return converted buffer -********************************************************************/ - -static char *sj_to_jis8(char *from, BOOL overwrite) -{ - char *out; - int shifted; - char *save; - - shifted = _KJ_ROMAN; - save = (char *) from; - for (out = cvtbuf; *from && (out - cvtbuf < sizeof(cvtbuf)-4); ) { - if (is_shift_jis (*from)) { - int code; - switch (shifted) { - case _KJ_ROMAN: /* to KANJI */ - *out++ = jis_esc; - *out++ = jis_so1; - *out++ = jis_kso; - shifted = _KJ_KANJI; - break; - } - code = sjis2jis ((int) from[0] & 0xff, (int) from[1] & 0xff); - *out++ = (code >> 8) & 0xff; - *out++ = code; - from += 2; - } else { - switch (shifted) { - case _KJ_KANJI: /* to ROMAN/KANA */ - *out++ = jis_esc; - *out++ = jis_si1; - *out++ = jis_ksi; - shifted = _KJ_ROMAN; - break; - } - *out++ = *from++; - } - } - - switch (shifted) { - case _KJ_KANJI: /* to ROMAN/KANA */ - *out++ = jis_esc; - *out++ = jis_si1; - *out++ = jis_ksi; - shifted = _KJ_ROMAN; - break; - } - *out = 0; - if (overwrite) { - pstrcpy (save, (char *) cvtbuf); - return save; - } else { - return cvtbuf; - } -} - -/******************************************************************* - Convert FROM contain 7 bits JIS codes to SHIFT JIS codes - return converted buffer -********************************************************************/ -static char *jis7_to_sj(char *from, BOOL overwrite) -{ - char *out; - int shifted; - char *save; - - shifted = _KJ_ROMAN; - save = (char *) from; - for (out = cvtbuf; *from && (out - cvtbuf < sizeof(cvtbuf)-3);) { - if (is_esc (*from)) { - if (is_so1 (from[1]) && is_so2 (from[2])) { - shifted = _KJ_KANJI; - from += 3; - } else if (is_si1 (from[1]) && is_si2 (from[2])) { - shifted = _KJ_ROMAN; - from += 3; - } else { /* sequence error */ - goto normal; - } - } else if (is_so (*from)) { - shifted = _KJ_KANA; /* to KANA */ - from++; - } else if (is_si (*from)) { - shifted = _KJ_ROMAN; /* to ROMAN */ - from++; - } else { - normal: - switch (shifted) { - default: - case _KJ_ROMAN: - *out++ = *from++; - break; - case _KJ_KANJI: - { - int code = jis2sjis ((int) from[0] & 0xff, (int) from[1] & 0xff); - *out++ = (code >> 8) & 0xff; - *out++ = code; - from += 2; - } - break; - case _KJ_KANA: - *out++ = ((int) from[0]) + 0x80; - break; - } - } - } - *out = 0; - if (overwrite) { - pstrcpy (save, (char *) cvtbuf); - return save; - } else { - return cvtbuf; - } -} - -/******************************************************************* - Convert FROM contain SHIFT JIS codes to 7 bits JIS codes - return converted buffer -********************************************************************/ -static char *sj_to_jis7(char *from, BOOL overwrite) -{ - char *out; - int shifted; - char *save; - - shifted = _KJ_ROMAN; - save = (char *) from; - for (out = cvtbuf; *from && (out - cvtbuf < sizeof(cvtbuf)-4); ) { - if (is_shift_jis (*from)) { - int code; - switch (shifted) { - case _KJ_KANA: - *out++ = jis_si; /* to ROMAN and through down */ - case _KJ_ROMAN: /* to KANJI */ - *out++ = jis_esc; - *out++ = jis_so1; - *out++ = jis_kso; - shifted = _KJ_KANJI; - break; - } - code = sjis2jis ((int) from[0] & 0xff, (int) from[1] & 0xff); - *out++ = (code >> 8) & 0xff; - *out++ = code; - from += 2; - } else if (is_kana (from[0])) { - switch (shifted) { - case _KJ_KANJI: /* to ROMAN */ - *out++ = jis_esc; - *out++ = jis_si1; - *out++ = jis_ksi; - case _KJ_ROMAN: /* to KANA */ - *out++ = jis_so; - shifted = _KJ_KANA; - break; - } - *out++ = ((int) *from++) - 0x80; - } else { - switch (shifted) { - case _KJ_KANA: - *out++ = jis_si; /* to ROMAN */ - shifted = _KJ_ROMAN; - break; - case _KJ_KANJI: /* to ROMAN */ - *out++ = jis_esc; - *out++ = jis_si1; - *out++ = jis_ksi; - shifted = _KJ_ROMAN; - break; - } - *out++ = *from++; - } - } - switch (shifted) { - case _KJ_KANA: - *out++ = jis_si; /* to ROMAN */ - break; - case _KJ_KANJI: /* to ROMAN */ - *out++ = jis_esc; - *out++ = jis_si1; - *out++ = jis_ksi; - break; - } - *out = 0; - if (overwrite) { - pstrcpy (save, (char *) cvtbuf); - return save; - } else { - return cvtbuf; - } -} - -/******************************************************************* - Convert FROM contain 7 bits JIS(junet) codes to SHIFT JIS codes - return converted buffer -********************************************************************/ - -static char *junet_to_sj(char *from, BOOL overwrite) -{ - char *out; - int shifted; - char *save; - - shifted = _KJ_ROMAN; - save = (char *) from; - for (out = cvtbuf; *from && (out - cvtbuf < sizeof(cvtbuf)-3);) { - if (is_esc (*from)) { - if (is_so1 (from[1]) && is_so2 (from[2])) { - shifted = _KJ_KANJI; - from += 3; - } else if (is_si1 (from[1]) && is_si2 (from[2])) { - shifted = _KJ_ROMAN; - from += 3; - } else if (is_juk1(from[1]) && is_juk2 (from[2])) { - shifted = _KJ_KANA; - from += 3; - } else { /* sequence error */ - goto normal; - } - } else { - normal: - switch (shifted) { - default: - case _KJ_ROMAN: - *out++ = *from++; - break; - case _KJ_KANJI: - { - int code = jis2sjis ((int) from[0] & 0xff, (int) from[1] & 0xff); - *out++ = (code >> 8) & 0xff; - *out++ = code; - from += 2; - } - break; - case _KJ_KANA: - *out++ = ((int) from[0]) + 0x80; - break; - } - } - } - *out = 0; - if (overwrite) { - pstrcpy (save, (char *) cvtbuf); - return save; - } else { - return cvtbuf; - } -} - -/******************************************************************* - Convert FROM contain SHIFT JIS codes to 7 bits JIS(junet) codes - return converted buffer -********************************************************************/ -static char *sj_to_junet(char *from, BOOL overwrite) -{ - char *out; - int shifted; - char *save; - - shifted = _KJ_ROMAN; - save = (char *) from; - for (out = cvtbuf; *from && (out - cvtbuf < sizeof(cvtbuf)-4); ) { - if (is_shift_jis (*from)) { - int code; - switch (shifted) { - case _KJ_KANA: - case _KJ_ROMAN: /* to KANJI */ - *out++ = jis_esc; - *out++ = jis_so1; - *out++ = jis_so2; - shifted = _KJ_KANJI; - break; - } - code = sjis2jis ((int) from[0] & 0xff, (int) from[1] & 0xff); - *out++ = (code >> 8) & 0xff; - *out++ = code; - from += 2; - } else if (is_kana (from[0])) { - switch (shifted) { - case _KJ_KANJI: /* to ROMAN */ - case _KJ_ROMAN: /* to KANA */ - *out++ = jis_esc; - *out++ = junet_kana1; - *out++ = junet_kana2; - shifted = _KJ_KANA; - break; - } - *out++ = ((int) *from++) - 0x80; - } else { - switch (shifted) { - case _KJ_KANA: - case _KJ_KANJI: /* to ROMAN */ - *out++ = jis_esc; - *out++ = jis_si1; - *out++ = jis_si2; - shifted = _KJ_ROMAN; - break; - } - *out++ = *from++; - } - } - switch (shifted) { - case _KJ_KANA: - case _KJ_KANJI: /* to ROMAN */ - *out++ = jis_esc; - *out++ = jis_si1; - *out++ = jis_si2; - break; - } - *out = 0; - if (overwrite) { - pstrcpy (save, (char *) cvtbuf); - return save; - } else { - return cvtbuf; - } -} - -/******************************************************************* - HEX <-> SJIS -********************************************************************/ -/* ":xx" -> a byte */ -static char *hex_to_sj(char *from, BOOL overwrite) -{ - char *sp, *dp; - - sp = (char *) from; - dp = cvtbuf; - while (*sp && (dp - cvtbuf < sizeof(cvtbuf)-3)) { - if (*sp == hex_tag && isxdigit((int)sp[1]) && isxdigit((int)sp[2])) { - *dp++ = (hex2bin (sp[1])<<4) | (hex2bin (sp[2])); - sp += 3; - } else - *dp++ = *sp++; - } - *dp = '\0'; - if (overwrite) { - pstrcpy ((char *) from, (char *) cvtbuf); - return (char *) from; - } else { - return cvtbuf; - } -} - -/******************************************************************* - kanji/kana -> ":xx" -********************************************************************/ -static char *sj_to_hex(char *from, BOOL overwrite) -{ - unsigned char *sp, *dp; - - sp = (unsigned char*) from; - dp = (unsigned char*) cvtbuf; - while (*sp && (((char *)dp)- cvtbuf < sizeof(cvtbuf)-7)) { - if (is_kana(*sp)) { - *dp++ = hex_tag; - *dp++ = bin2hex (((*sp)>>4)&0x0f); - *dp++ = bin2hex ((*sp)&0x0f); - sp++; - } else if (is_shift_jis (*sp) && is_shift_jis2 (sp[1])) { - *dp++ = hex_tag; - *dp++ = bin2hex (((*sp)>>4)&0x0f); - *dp++ = bin2hex ((*sp)&0x0f); - sp++; - *dp++ = hex_tag; - *dp++ = bin2hex (((*sp)>>4)&0x0f); - *dp++ = bin2hex ((*sp)&0x0f); - sp++; - } else - *dp++ = *sp++; - } - *dp = '\0'; - if (overwrite) { - pstrcpy ((char *) from, (char *) cvtbuf); - return (char *) from; - } else { - return cvtbuf; - } -} - -/******************************************************************* - CAP <-> SJIS -********************************************************************/ -/* ":xx" CAP -> a byte */ -static char *cap_to_sj(char *from, BOOL overwrite) -{ - char *sp, *dp; - - sp = (char *) from; - dp = cvtbuf; - while (*sp && (dp- cvtbuf < sizeof(cvtbuf)-2)) { - /* - * The only change between this and hex_to_sj is here. sj_to_cap only - * translates characters greater or equal to 0x80 - make sure that here - * we only do the reverse (that's why the strchr is used rather than - * isxdigit. Based on fix from ado@elsie.nci.nih.gov (Arthur David Olson). - */ - if (*sp == hex_tag && (strchr ("89abcdefABCDEF", sp[1]) != NULL) && isxdigit((int)sp[2])) { - *dp++ = (hex2bin (sp[1])<<4) | (hex2bin (sp[2])); - sp += 3; - } else - *dp++ = *sp++; - } - *dp = '\0'; - if (overwrite) { - pstrcpy ((char *) from, (char *) cvtbuf); - return (char *) from; - } else { - return cvtbuf; - } -} - -/******************************************************************* - kanji/kana -> ":xx" - CAP format. -********************************************************************/ -static char *sj_to_cap(char *from, BOOL overwrite) -{ - unsigned char *sp, *dp; - - sp = (unsigned char*) from; - dp = (unsigned char*) cvtbuf; - while (*sp && (((char *)dp) - cvtbuf < sizeof(cvtbuf)-4)) { - if (*sp >= 0x80) { - *dp++ = hex_tag; - *dp++ = bin2hex (((*sp)>>4)&0x0f); - *dp++ = bin2hex ((*sp)&0x0f); - sp++; - } else { - *dp++ = *sp++; - } - } - *dp = '\0'; - if (overwrite) { - pstrcpy ((char *) from, (char *) cvtbuf); - return (char *) from; - } else { - return cvtbuf; - } -} - -/******************************************************************* - sj to sj -********************************************************************/ -static char *sj_to_sj(char *from, BOOL overwrite) -{ - if (!overwrite) { - pstrcpy (cvtbuf, (char *) from); - return cvtbuf; - } else { - return (char *) from; - } -} - -/******************************************************************* - cp to utf8 -********************************************************************/ -static char *cp_to_utf8(char *from, BOOL overwrite) -{ - unsigned char *dst; - unsigned char *src; - smb_ucs2_t val; - int w; - size_t len; - - src = (unsigned char *)from; - dst = (unsigned char *)cvtbuf; - while (*src && (((char *)dst - cvtbuf) < sizeof(cvtbuf)-4)) { - len = _skip_multibyte_char(*src); - if ( len == 2 ) { - w = (int)(*src++ & 0xff); - w = (int)((w << 8)|(*src++ & 0xff)); - } else { - w = (int)(*src++ & 0xff); - } - val = doscp2ucs2(w); - - if ( val <= 0x7f ) { - *dst++ = (char)(val & 0xff); - } else if ( val <= 0x7ff ){ - *dst++ = (char)( 0xc0 | ((val >> 6) & 0xff)); - *dst++ = (char)( 0x80 | ( val & 0x3f )); - } else { - *dst++ = (char)( 0xe0 | ((val >> 12) & 0x0f)); - *dst++ = (char)( 0x80 | ((val >> 6) & 0x3f)); - *dst++ = (char)( 0x80 | (val & 0x3f)); - } - - } - *dst++='\0'; - if (overwrite) { - pstrcpy ((char *) from, (char *) cvtbuf); - return (char *) from; - } else { - return cvtbuf; - } -} - -/******************************************************************* - utf8 to cp -********************************************************************/ -static char *utf8_to_cp(char *from, BOOL overwrite) -{ - unsigned char *src; - unsigned char *dst; - smb_ucs2_t val; - int w; - - src = (unsigned char *)from; - dst = (unsigned char *)cvtbuf; - - while (*src && ((char *)dst - cvtbuf < sizeof(cvtbuf)-4)) { - val = (*src++ & 0xff); - if (val < 0x80) { - *dst++ = (char)(val & 0x7f); - } else if ((0xc0 <= val) && (val <= 0xdf) - && (0x80 <= *src) && (*src <= 0xbf)) { - w = ucs2doscp( ((val & 31) << 6) | ((*src++) & 63 )); - *dst++ = (char)((w >> 8) & 0xff); - *dst++ = (char)(w & 0xff); - } else { - val = (val & 0x0f) << 12; - val |= ((*src++ & 0x3f) << 6); - val |= (*src++ & 0x3f); - w = ucs2doscp(val); - *dst++ = (char)((w >> 8) & 0xff); - *dst++ = (char)(w & 0xff); - } - } - *dst++='\0'; - if (overwrite) { - pstrcpy ((char *) from, (char *) cvtbuf); - return (char *) from; - } else { - return cvtbuf; - } -} - -/************************************************************************ - conversion: - _dos_to_unix _unix_to_dos -************************************************************************/ - -static void setup_string_function(int codes) -{ - switch (codes) { - default: - _dos_to_unix = dos2unix_format; - _unix_to_dos = unix2dos_format; - break; - - case SJIS_CODE: - _dos_to_unix = sj_to_sj; - _unix_to_dos = sj_to_sj; - break; - - case EUC_CODE: - _dos_to_unix = sj_to_euc; - _unix_to_dos = euc_to_sj; - break; - - case JIS7_CODE: - _dos_to_unix = sj_to_jis7; - _unix_to_dos = jis7_to_sj; - break; - - case JIS8_CODE: - _dos_to_unix = sj_to_jis8; - _unix_to_dos = jis8_to_sj; - break; - - case JUNET_CODE: - _dos_to_unix = sj_to_junet; - _unix_to_dos = junet_to_sj; - break; - - case HEX_CODE: - _dos_to_unix = sj_to_hex; - _unix_to_dos = hex_to_sj; - break; - - case CAP_CODE: - _dos_to_unix = sj_to_cap; - _unix_to_dos = cap_to_sj; - break; - case UTF8_CODE: - _dos_to_unix = cp_to_utf8; - _unix_to_dos = utf8_to_cp; - break; - case EUC3_CODE: - _dos_to_unix = sj_to_euc3; - _unix_to_dos = euc3_to_sj; - break; - } -} - -/************************************************************************ - Interpret coding system. -************************************************************************/ - -void interpret_coding_system(char *str) -{ - int codes = UNKNOWN_CODE; - - if (strequal (str, "sjis")) { - codes = SJIS_CODE; - } else if (strequal (str, "euc")) { - codes = EUC_CODE; - } else if (strequal (str, "cap")) { - codes = CAP_CODE; - hex_tag = HEXTAG; - } else if (strequal (str, "hex")) { - codes = HEX_CODE; - hex_tag = HEXTAG; - } else if (!strncasecmp (str, "hex", 3)) { - codes = HEX_CODE; - hex_tag = (str[3] ? str[3] : HEXTAG); - } else if (strequal (str, "j8bb")) { - codes = JIS8_CODE; - jis_kso = 'B'; - jis_ksi = 'B'; - } else if (strequal (str, "j8bj") || strequal (str, "jis8")) { - codes = JIS8_CODE; - jis_kso = 'B'; - jis_ksi = 'J'; - } else if (strequal (str, "j8bh")) { - codes = JIS8_CODE; - jis_kso = 'B'; - jis_ksi = 'H'; - } else if (strequal (str, "j8@b")) { - codes = JIS8_CODE; - jis_kso = '@'; - jis_ksi = 'B'; - } else if (strequal (str, "j8@j")) { - codes = JIS8_CODE; - jis_kso = '@'; - jis_ksi = 'J'; - } else if (strequal (str, "j8@h")) { - codes = JIS8_CODE; - jis_kso = '@'; - jis_ksi = 'H'; - } else if (strequal (str, "j7bb")) { - codes = JIS7_CODE; - jis_kso = 'B'; - jis_ksi = 'B'; - } else if (strequal (str, "j7bj") || strequal (str, "jis7")) { - codes = JIS7_CODE; - jis_kso = 'B'; - jis_ksi = 'J'; - } else if (strequal (str, "j7bh")) { - codes = JIS7_CODE; - jis_kso = 'B'; - jis_ksi = 'H'; - } else if (strequal (str, "j7@b")) { - codes = JIS7_CODE; - jis_kso = '@'; - jis_ksi = 'B'; - } else if (strequal (str, "j7@j")) { - codes = JIS7_CODE; - jis_kso = '@'; - jis_ksi = 'J'; - } else if (strequal (str, "j7@h")) { - codes = JIS7_CODE; - jis_kso = '@'; - jis_ksi = 'H'; - } else if (strequal (str, "jubb")) { - codes = JUNET_CODE; - jis_kso = 'B'; - jis_ksi = 'B'; - } else if (strequal (str, "jubj") || strequal (str, "junet")) { - codes = JUNET_CODE; - jis_kso = 'B'; - jis_ksi = 'J'; - } else if (strequal (str, "jubh")) { - codes = JUNET_CODE; - jis_kso = 'B'; - jis_ksi = 'H'; - } else if (strequal (str, "ju@b")) { - codes = JUNET_CODE; - jis_kso = '@'; - jis_ksi = 'B'; - } else if (strequal (str, "ju@j")) { - codes = JUNET_CODE; - jis_kso = '@'; - jis_ksi = 'J'; - } else if (strequal (str, "ju@h")) { - codes = JUNET_CODE; - jis_kso = '@'; - jis_ksi = 'H'; - } else if (strequal (str, "utf8")) { - codes = UTF8_CODE; - } else if (strequal (str, "euc3")) { - codes = EUC3_CODE; - } - setup_string_function (codes); -} - -/******************************************************************* - Non multibyte char function. -*******************************************************************/ - -static size_t skip_non_multibyte_char(char c) -{ - return 0; -} - -/******************************************************************* - Function that always says a character isn't multibyte. -*******************************************************************/ - -static BOOL not_multibyte_char_1(char c) -{ - return False; -} - -/******************************************************************* - Setup the function pointers for the functions that are replaced - when multi-byte codepages are used. - - The dos_to_unix and unix_to_dos function pointers are only - replaced by setup_string_function called by interpret_coding_system - above. -*******************************************************************/ - -void initialize_multibyte_vectors( int client_codepage) -{ - switch( client_codepage ) - { - case KANJI_CODEPAGE: - multibyte_strchr = sj_strchr; - multibyte_strrchr = sj_strrchr; - multibyte_strstr = sj_strstr; - multibyte_strtok = sj_strtok; - _skip_multibyte_char = skip_kanji_multibyte_char; - is_multibyte_char_1 = is_kanji_multibyte_char_1; - global_is_multibyte_codepage = True; - break; - case HANGUL_CODEPAGE: - multibyte_strchr = generic_multibyte_strchr; - multibyte_strrchr = generic_multibyte_strrchr; - multibyte_strstr = generic_multibyte_strstr; - multibyte_strtok = generic_multibyte_strtok; - _skip_multibyte_char = skip_generic_multibyte_char; - is_multibyte_char_1 = hangul_is_multibyte_char_1; - global_is_multibyte_codepage = True; - break; - case BIG5_CODEPAGE: - multibyte_strchr = generic_multibyte_strchr; - multibyte_strrchr = generic_multibyte_strrchr; - multibyte_strstr = generic_multibyte_strstr; - multibyte_strtok = generic_multibyte_strtok; - _skip_multibyte_char = skip_generic_multibyte_char; - is_multibyte_char_1 = big5_is_multibyte_char_1; - global_is_multibyte_codepage = True; - break; - case SIMPLIFIED_CHINESE_CODEPAGE: - multibyte_strchr = generic_multibyte_strchr; - multibyte_strrchr = generic_multibyte_strrchr; - multibyte_strstr = generic_multibyte_strstr; - multibyte_strtok = generic_multibyte_strtok; - _skip_multibyte_char = skip_generic_multibyte_char; - is_multibyte_char_1 = simpch_is_multibyte_char_1; - global_is_multibyte_codepage = True; - break; - /* - * Single char size code page. - */ - default: - multibyte_strchr = (const char *(*)(const char *, int )) strchr; - multibyte_strrchr = (const char *(*)(const char *, int )) strrchr; - multibyte_strstr = (const char *(*)(const char *, const char *)) strstr; - multibyte_strtok = (char *(*)(char *, const char *)) strtok; - _skip_multibyte_char = skip_non_multibyte_char; - is_multibyte_char_1 = not_multibyte_char_1; - global_is_multibyte_codepage = False; - break; - } -} -/* ******************************************************* - function(s) for "dynamic" encoding of SWAT output. - in this version, only dos_to_dos, dos_to_unix, unix_to_dos - are used for bug fix. conversion to web encoding - (to catalog file encoding) is not needed because - they are using same character codes. - **************************************************** */ -static char *no_conversion(char *str, BOOL bOverwrite) -{ - static pstring temp; - if(bOverwrite) - return str; - pstrcpy(temp, str); - return temp; -} -char *(*_dos_to_dos)(char *, BOOL) = no_conversion; diff --git a/source3/lib/ms_fnmatch.c b/source3/lib/ms_fnmatch.c index 72f61c021c..39b3e0013c 100644 --- a/source3/lib/ms_fnmatch.c +++ b/source3/lib/ms_fnmatch.c @@ -31,37 +31,37 @@ #include "includes.h" #endif - - /* bugger. we need a separate wildcard routine for older versions of the protocol. This is not yet perfect, but its a lot - better thaan what we had */ -static int ms_fnmatch_lanman_core(const char *pattern, const char *string) + better than what we had */ +static int ms_fnmatch_lanman_core(const smb_ucs2_t *pattern, + const smb_ucs2_t *string) { - const char *p = pattern, *n = string; - char c; + const smb_ucs2_t *p = pattern, *n = string; + smb_ucs2_t c; - if (strcmp(p,"?")==0 && strcmp(n,".")==0) goto match; + if (strcmp_wa(p, "?")==0 && strcmp_wa(n, ".")) goto match; while ((c = *p++)) { switch (c) { - case '.': + case UCS2_CHAR('.'): if (! *n) goto next; - /* if (! *n && ! *p) goto match; */ - if (*n != '.') goto nomatch; + if (*n != UCS2_CHAR('.')) goto nomatch; n++; break; - case '?': + case UCS2_CHAR('?'): if (! *n) goto next; - if ((*n == '.' && n[1] != '.') || ! *n) goto next; + if ((*n == UCS2_CHAR('.') && + n[1] != UCS2_CHAR('.')) || ! *n) + goto next; n++; break; - case '>': + case UCS2_CHAR('>'): if (! *n) goto next; - if (n[0] == '.') { + if (n[0] == UCS2_CHAR('.')) { if (! n[1] && ms_fnmatch_lanman_core(p, n+1) == 0) goto match; if (ms_fnmatch_lanman_core(p, n) == 0) goto match; goto nomatch; @@ -69,7 +69,7 @@ static int ms_fnmatch_lanman_core(const char *pattern, const char *string) n++; break; - case '*': + case UCS2_CHAR('*'): if (! *n) goto next; if (! *p) goto match; for (; *n; n++) { @@ -77,19 +77,20 @@ static int ms_fnmatch_lanman_core(const char *pattern, const char *string) } break; - case '<': + case UCS2_CHAR('<'): for (; *n; n++) { if (ms_fnmatch_lanman_core(p, n) == 0) goto match; - if (*n == '.' && !strchr(n+1,'.')) { + if (*n == UCS2_CHAR('.') && + !strchr_w(n+1,UCS2_CHAR('.'))) { n++; break; } } break; - case '"': + case UCS2_CHAR('"'): if (*n == 0 && ms_fnmatch_lanman_core(p, n) == 0) goto match; - if (*n != '.') goto nomatch; + if (*n != UCS2_CHAR('.')) goto nomatch; n++; break; @@ -118,16 +119,19 @@ next: return 0; } -static int ms_fnmatch_lanman1(const char *pattern, const char *string) +static int ms_fnmatch_lanman1(const smb_ucs2_t *pattern, const smb_ucs2_t *string) { - if (!strpbrk(pattern, "?*<>\"")) { - if (strcmp(string,"..") == 0) string = "."; - return strcasecmp(pattern, string); + if (!strpbrk_wa(pattern, "?*<>\"")) { + smb_ucs2_t s[] = {UCS2_CHAR('.'), 0}; + if (strcmp_wa(string,"..") == 0) string = s; + return strcasecmp_w(pattern, string); } - if (strcmp(string,"..") == 0 || strcmp(string,".") == 0) { - return ms_fnmatch_lanman_core(pattern, "..") && - ms_fnmatch_lanman_core(pattern, "."); + if (strcmp_wa(string,"..") == 0 || strcmp_wa(string,".") == 0) { + smb_ucs2_t dot[] = {UCS2_CHAR('.'), 0}; + smb_ucs2_t dotdot[] = {UCS2_CHAR('.'), UCS2_CHAR('.'), 0}; + return ms_fnmatch_lanman_core(pattern, dotdot) && + ms_fnmatch_lanman_core(pattern, dot); } return ms_fnmatch_lanman_core(pattern, string); @@ -142,10 +146,10 @@ static int ms_fnmatch_lanman1(const char *pattern, const char *string) Returns 0 on match, -1 on fail. */ -int ms_fnmatch(const char *pattern, const char *string) +static int ms_fnmatch_w(const smb_ucs2_t *pattern, const smb_ucs2_t *string) { - const char *p = pattern, *n = string; - char c; + const smb_ucs2_t *p = pattern, *n = string; + smb_ucs2_t c; extern int Protocol; if (Protocol <= PROTOCOL_LANMAN2) { @@ -154,40 +158,40 @@ int ms_fnmatch(const char *pattern, const char *string) while ((c = *p++)) { switch (c) { - case '?': + case UCS2_CHAR('?'): if (! *n) return -1; n++; break; - case '>': - if (n[0] == '.') { - if (! n[1] && ms_fnmatch(p, n+1) == 0) return 0; - if (ms_fnmatch(p, n) == 0) return 0; + case UCS2_CHAR('>'): + if (n[0] == UCS2_CHAR('.')) { + if (! n[1] && ms_fnmatch_w(p, n+1) == 0) return 0; + if (ms_fnmatch_w(p, n) == 0) return 0; return -1; } - if (! *n) return ms_fnmatch(p, n); + if (! *n) return ms_fnmatch_w(p, n); n++; break; - case '*': + case UCS2_CHAR('*'): for (; *n; n++) { - if (ms_fnmatch(p, n) == 0) return 0; + if (ms_fnmatch_w(p, n) == 0) return 0; } break; - case '<': + case UCS2_CHAR('<'): for (; *n; n++) { - if (ms_fnmatch(p, n) == 0) return 0; - if (*n == '.' && !strchr(n+1,'.')) { + if (ms_fnmatch_w(p, n) == 0) return 0; + if (*n == UCS2_CHAR('.') && !strchr_wa(n+1,'.')) { n++; break; } } break; - case '"': - if (*n == 0 && ms_fnmatch(p, n) == 0) return 0; - if (*n != '.') return -1; + case UCS2_CHAR('"'): + if (*n == 0 && ms_fnmatch_w(p, n) == 0) return 0; + if (*n != UCS2_CHAR('.')) return -1; n++; break; @@ -203,57 +207,12 @@ int ms_fnmatch(const char *pattern, const char *string) } -#if FNMATCH_TEST - -static int match_one(char *pattern, char *file) +int ms_fnmatch(const char *pattern, const char *string) { - if (strcmp(file,"..") == 0) file = "."; - if (strcmp(pattern,".") == 0) return -1; - - return ms_fnmatch(pattern, file); -} + wpstring p, s; -static char *match_test(char *pattern, char *file, char *short_name) -{ - static char ret[4]; - strncpy(ret, "---", 3); - - if (match_one(pattern, ".") == 0) ret[0] = '+'; - if (match_one(pattern, "..") == 0) ret[1] = '+'; - if (match_one(pattern, file) == 0 || - (*short_name && match_one(pattern, short_name)==0)) ret[2] = '+'; - return ret; -} + pstrcpy_wa(p, pattern); + pstrcpy_wa(s, string); - int main(int argc, char *argv[]) -{ - int ret; - char ans[4], mask[100], file[100], mfile[100]; - char *ans2; - int n, i=0; - char line[200]; - - if (argc == 3) { - ret = ms_fnmatch(argv[1], argv[2]); - if (ret == 0) - printf("YES\n"); - else printf("NO\n"); - return ret; - } - mfile[0] = 0; - - while (fgets(line, sizeof(line)-1, stdin)) { - n = sscanf(line, "%3s %s %s %s\n", ans, mask, file, mfile); - if (n < 3) continue; - ans2 = match_test(mask, file, mfile); - if (strcmp(ans2, ans)) { - printf("%s %s %d mask=[%s] file=[%s] mfile=[%s]\n", - ans, ans2, i, mask, file, mfile); - } - i++; - mfile[0] = 0; - } - return 0; + return ms_fnmatch_w(p, s); } -#endif /* FNMATCH_TEST */ - diff --git a/source3/lib/sysacls.c b/source3/lib/sysacls.c index 0770a8856a..bdf18b52fc 100644 --- a/source3/lib/sysacls.c +++ b/source3/lib/sysacls.c @@ -161,7 +161,7 @@ int sys_acl_valid( SMB_ACL_T theacl ) return acl_valid(theacl); } -int sys_acl_set_file( const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) +int sys_acl_set_file(const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl) { return acl_set_file(name, acltype, theacl); } diff --git a/source3/lib/system.c b/source3/lib/system.c index a402af77c9..8d4a872f14 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -727,176 +727,6 @@ struct passwd *sys_getpwuid(uid_t uid) } /************************************************************************** - The following are the UNICODE versions of *all* system interface functions - called within Samba. Ok, ok, the exceptions are the gethostbyXX calls, - which currently are left as ascii as they are not used other than in name - resolution. -****************************************************************************/ - -/************************************************************************** - Wide stat. Just narrow and call sys_xxx. -****************************************************************************/ - -int wsys_stat(const smb_ucs2_t *wfname,SMB_STRUCT_STAT *sbuf) -{ - pstring fname; - return sys_stat(unicode_to_unix(fname,wfname,sizeof(fname)), sbuf); -} - -/************************************************************************** - Wide lstat. Just narrow and call sys_xxx. -****************************************************************************/ - -int wsys_lstat(const smb_ucs2_t *wfname,SMB_STRUCT_STAT *sbuf) -{ - pstring fname; - return sys_lstat(unicode_to_unix(fname,wfname,sizeof(fname)), sbuf); -} - -/************************************************************************** - Wide creat. Just narrow and call sys_xxx. -****************************************************************************/ - -int wsys_creat(const smb_ucs2_t *wfname, mode_t mode) -{ - pstring fname; - return sys_creat(unicode_to_unix(fname,wfname,sizeof(fname)), mode); -} - -/************************************************************************** - Wide open. Just narrow and call sys_xxx. -****************************************************************************/ - -int wsys_open(const smb_ucs2_t *wfname, int oflag, mode_t mode) -{ - pstring fname; - return sys_open(unicode_to_unix(fname,wfname,sizeof(fname)), oflag, mode); -} - -/************************************************************************** - Wide fopen. Just narrow and call sys_xxx. -****************************************************************************/ - -FILE *wsys_fopen(const smb_ucs2_t *wfname, const char *type) -{ - pstring fname; - return sys_fopen(unicode_to_unix(fname,wfname,sizeof(fname)), type); -} - -/************************************************************************** - Wide opendir. Just narrow and call sys_xxx. -****************************************************************************/ - -DIR *wsys_opendir(const smb_ucs2_t *wfname) -{ - pstring fname; - return opendir(unicode_to_unix(fname,wfname,sizeof(fname))); -} - -/************************************************************************** - Wide readdir. Return a structure pointer containing a wide filename. -****************************************************************************/ - -SMB_STRUCT_WDIRENT *wsys_readdir(DIR *dirp) -{ - static SMB_STRUCT_WDIRENT retval; - SMB_STRUCT_DIRENT *dirval = sys_readdir(dirp); - - if(!dirval) - return NULL; - - /* - * The only POSIX defined member of this struct is d_name. - */ - - unix_to_unicode(retval.d_name,dirval->d_name,sizeof(retval.d_name)); - - return &retval; -} - -/************************************************************************** - Wide getwd. Call sys_xxx and widen. Assumes s points to a wpstring. -****************************************************************************/ - -smb_ucs2_t *wsys_getwd(smb_ucs2_t *s) -{ - pstring fname; - char *p = sys_getwd(fname); - - if(!p) - return NULL; - - return unix_to_unicode(s, p, sizeof(wpstring)); -} - -/************************************************************************** - Wide chown. Just narrow and call sys_xxx. -****************************************************************************/ - -int wsys_chown(const smb_ucs2_t *wfname, uid_t uid, gid_t gid) -{ - pstring fname; - return chown(unicode_to_unix(fname,wfname,sizeof(fname)), uid, gid); -} - -/************************************************************************** - Wide chroot. Just narrow and call sys_xxx. -****************************************************************************/ - -int wsys_chroot(const smb_ucs2_t *wfname) -{ - pstring fname; - return chroot(unicode_to_unix(fname,wfname,sizeof(fname))); -} - -/************************************************************************** - Wide getpwnam. Return a structure pointer containing wide names. -****************************************************************************/ - -SMB_STRUCT_WPASSWD *wsys_getpwnam(const smb_ucs2_t *wname) -{ - static SMB_STRUCT_WPASSWD retval; - fstring name; - struct passwd *pwret = sys_getpwnam(unicode_to_unix(name,wname,sizeof(name))); - - if(!pwret) - return NULL; - - unix_to_unicode(retval.pw_name, pwret->pw_name, sizeof(retval.pw_name)); - retval.pw_passwd = pwret->pw_passwd; - retval.pw_uid = pwret->pw_uid; - retval.pw_gid = pwret->pw_gid; - unix_to_unicode(retval.pw_gecos, pwret->pw_gecos, sizeof(retval.pw_gecos)); - unix_to_unicode(retval.pw_dir, pwret->pw_dir, sizeof(retval.pw_dir)); - unix_to_unicode(retval.pw_shell, pwret->pw_shell, sizeof(retval.pw_shell)); - - return &retval; -} - -/************************************************************************** - Wide getpwuid. Return a structure pointer containing wide names. -****************************************************************************/ - -SMB_STRUCT_WPASSWD *wsys_getpwuid(uid_t uid) -{ - static SMB_STRUCT_WPASSWD retval; - struct passwd *pwret = sys_getpwuid(uid); - - if(!pwret) - return NULL; - - unix_to_unicode(retval.pw_name, pwret->pw_name, sizeof(retval.pw_name)); - retval.pw_passwd = pwret->pw_passwd; - retval.pw_uid = pwret->pw_uid; - retval.pw_gid = pwret->pw_gid; - unix_to_unicode(retval.pw_gecos, pwret->pw_gecos, sizeof(retval.pw_gecos)); - unix_to_unicode(retval.pw_dir, pwret->pw_dir, sizeof(retval.pw_dir)); - unix_to_unicode(retval.pw_shell, pwret->pw_shell, sizeof(retval.pw_shell)); - - return &retval; -} - -/************************************************************************** Extract a command into an arg list. Uses a static pstring for storage. Caller frees returned arg list (which contains pointers into the static pstring). ****************************************************************************/ diff --git a/source3/lib/util.c b/source3/lib/util.c index 2e2c887b93..a8ef69e559 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -195,21 +195,6 @@ BOOL file_exist(char *fname,SMB_STRUCT_STAT *sbuf) } /******************************************************************* - rename a unix file -********************************************************************/ -int file_rename(char *from, char *to) -{ - int rcode = rename (from, to); - - if (errno == EXDEV) - { - /* Rename across filesystems needed. */ - rcode = copy_reg (from, to); - } - return rcode; -} - -/******************************************************************* check a files mod time ********************************************************************/ time_t file_modtime(char *fname) @@ -790,7 +775,7 @@ BOOL is_ipaddress(const char *str) interpret an internet address or name into an IP address in 4 byte form ****************************************************************************/ -uint32 interpret_addr(char *str) +uint32 interpret_addr(const char *str) { struct hostent *hp; uint32 res; @@ -823,7 +808,7 @@ uint32 interpret_addr(char *str) /******************************************************************* a convenient addition to interpret_addr() ******************************************************************/ -struct in_addr *interpret_addr2(char *str) +struct in_addr *interpret_addr2(const char *str) { static struct in_addr ret; uint32 a = interpret_addr(str); diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c index 4e2adc97bc..7dc25a8dae 100644 --- a/source3/lib/util_file.c +++ b/source3/lib/util_file.c @@ -417,7 +417,7 @@ char *file_load(char *fname, size_t *size) /**************************************************************************** parse a buffer into lines ****************************************************************************/ -static char **file_lines_parse(char *p, size_t size, int *numlines, BOOL convert) +static char **file_lines_parse(char *p, size_t size, int *numlines) { int i; char *s, **ret; @@ -446,21 +446,15 @@ static char **file_lines_parse(char *p, size_t size, int *numlines, BOOL convert if (s[0] == '\r') s[0] = 0; } - if (convert) { - for (i = 0; ret[i]; i++) - unix_to_dos(ret[i], True); - } - return ret; } /**************************************************************************** load a file into memory and return an array of pointers to lines in the file -must be freed with file_lines_free(). If convert is true calls unix_to_dos on -the list. +must be freed with file_lines_free(). ****************************************************************************/ -char **file_lines_load(char *fname, int *numlines, BOOL convert) +char **file_lines_load(char *fname, int *numlines) { char *p; size_t size; @@ -468,7 +462,7 @@ char **file_lines_load(char *fname, int *numlines, BOOL convert) p = file_load(fname, &size); if (!p) return NULL; - return file_lines_parse(p, size, numlines, convert); + return file_lines_parse(p, size, numlines); } /**************************************************************************** @@ -476,7 +470,7 @@ load a fd into memory and return an array of pointers to lines in the file must be freed with file_lines_free(). If convert is true calls unix_to_dos on the list. ****************************************************************************/ -char **fd_lines_load(int fd, int *numlines, BOOL convert) +char **fd_lines_load(int fd, int *numlines) { char *p; size_t size; @@ -484,16 +478,15 @@ char **fd_lines_load(int fd, int *numlines, BOOL convert) p = fd_load(fd, &size); if (!p) return NULL; - return file_lines_parse(p, size, numlines, convert); + return file_lines_parse(p, size, numlines); } /**************************************************************************** load a pipe into memory and return an array of pointers to lines in the data -must be freed with file_lines_free(). If convert is true calls unix_to_dos on -the list. +must be freed with file_lines_free(). ****************************************************************************/ -char **file_lines_pload(char *syscmd, int *numlines, BOOL convert) +char **file_lines_pload(char *syscmd, int *numlines) { char *p; size_t size; @@ -501,7 +494,7 @@ char **file_lines_pload(char *syscmd, int *numlines, BOOL convert) p = file_pload(syscmd, &size); if (!p) return NULL; - return file_lines_parse(p, size, numlines, convert); + return file_lines_parse(p, size, numlines); } /**************************************************************************** diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index d52ff82b10..8ff3e23443 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -1,8 +1,8 @@ /* Unix SMB/Netbios implementation. - Version 1.9. + Version 3.0 Samba utility functions - Copyright (C) Andrew Tridgell 1992-1998 + Copyright (C) Andrew Tridgell 1992-2001 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -83,6 +83,8 @@ BOOL next_token_nr(char **ptr,char *buff,char *sep, size_t bufsize) return ret; } +static uint16 tmpbuf[sizeof(pstring)]; + void set_first_token(char *ptr) { last_ptr = ptr; @@ -126,78 +128,15 @@ char **toktocliplist(int *ctok, char *sep) return ret; } - /******************************************************************* case insensitive string compararison ********************************************************************/ int StrCaseCmp(const char *s, const char *t) { - /* compare until we run out of string, either t or s, or find a difference */ - /* We *must* use toupper rather than tolower here due to the - asynchronous upper to lower mapping. - */ -#if !defined(KANJI_WIN95_COMPATIBILITY) - /* - * For completeness we should put in equivalent code for code pages - * 949 (Korean hangul) and 950 (Big5 Traditional Chinese) here - but - * doubt anyone wants Samba to behave differently from Win95 and WinNT - * here. They both treat full width ascii characters as case senstive - * filenames (ie. they don't do the work we do here). - * JRA. - */ - - if(lp_client_code_page() == KANJI_CODEPAGE) - { - /* Win95 treats full width ascii characters as case sensitive. */ - int diff; - for (;;) - { - if (!*s || !*t) - return toupper (*s) - toupper (*t); - else if (is_sj_alph (*s) && is_sj_alph (*t)) - { - diff = sj_toupper2 (*(s+1)) - sj_toupper2 (*(t+1)); - if (diff) - return diff; - s += 2; - t += 2; - } - else if (is_shift_jis (*s) && is_shift_jis (*t)) - { - diff = ((int) (unsigned char) *s) - ((int) (unsigned char) *t); - if (diff) - return diff; - diff = ((int) (unsigned char) *(s+1)) - ((int) (unsigned char) *(t+1)); - if (diff) - return diff; - s += 2; - t += 2; - } - else if (is_shift_jis (*s)) - return 1; - else if (is_shift_jis (*t)) - return -1; - else - { - diff = toupper (*s) - toupper (*t); - if (diff) - return diff; - s++; - t++; - } - } - } - else -#endif /* KANJI_WIN95_COMPATIBILITY */ - { - while (*s && *t && toupper(*s) == toupper(*t)) - { - s++; - t++; - } - - return(toupper(*s) - toupper(*t)); - } + pstring buf1, buf2; + unix_strlower(s, strlen(s)+1, buf1, sizeof(buf1)); + unix_strlower(t, strlen(t)+1, buf2, sizeof(buf2)); + return strcmp(buf1,buf2); } /******************************************************************* @@ -205,83 +144,10 @@ int StrCaseCmp(const char *s, const char *t) ********************************************************************/ int StrnCaseCmp(const char *s, const char *t, size_t n) { - /* compare until we run out of string, either t or s, or chars */ - /* We *must* use toupper rather than tolower here due to the - asynchronous upper to lower mapping. - */ -#if !defined(KANJI_WIN95_COMPATIBILITY) - /* - * For completeness we should put in equivalent code for code pages - * 949 (Korean hangul) and 950 (Big5 Traditional Chinese) here - but - * doubt anyone wants Samba to behave differently from Win95 and WinNT - * here. They both treat full width ascii characters as case senstive - * filenames (ie. they don't do the work we do here). - * JRA. - */ - - if(lp_client_code_page() == KANJI_CODEPAGE) - { - /* Win95 treats full width ascii characters as case sensitive. */ - int diff; - for (;n > 0;) - { - if (!*s || !*t) - return toupper (*s) - toupper (*t); - else if (is_sj_alph (*s) && is_sj_alph (*t)) - { - diff = sj_toupper2 (*(s+1)) - sj_toupper2 (*(t+1)); - if (diff) - return diff; - s += 2; - t += 2; - n -= 2; - } - else if (is_shift_jis (*s) && is_shift_jis (*t)) - { - diff = ((int) (unsigned char) *s) - ((int) (unsigned char) *t); - if (diff) - return diff; - diff = ((int) (unsigned char) *(s+1)) - ((int) (unsigned char) *(t+1)); - if (diff) - return diff; - s += 2; - t += 2; - n -= 2; - } - else if (is_shift_jis (*s)) - return 1; - else if (is_shift_jis (*t)) - return -1; - else - { - diff = toupper (*s) - toupper (*t); - if (diff) - return diff; - s++; - t++; - n--; - } - } - return 0; - } - else -#endif /* KANJI_WIN95_COMPATIBILITY */ - { - while (n && *s && *t && toupper(*s) == toupper(*t)) - { - s++; - t++; - n--; - } - - /* not run out of chars - strings are different lengths */ - if (n) - return(toupper(*s) - toupper(*t)); - - /* identical up to where we run out of chars, - and strings are same length */ - return(0); - } + pstring buf1, buf2; + unix_strlower(s, strlen(s)+1, buf1, sizeof(buf1)); + unix_strlower(t, strlen(t)+1, buf2, sizeof(buf2)); + return strncmp(buf1,buf2,n); } /******************************************************************* @@ -349,112 +215,6 @@ int strwicmp(char *psz1, char *psz2) /******************************************************************* - convert a string to lower case -********************************************************************/ -void strlower(char *s) -{ - while (*s) - { -#if !defined(KANJI_WIN95_COMPATIBILITY) - /* - * For completeness we should put in equivalent code for code pages - * 949 (Korean hangul) and 950 (Big5 Traditional Chinese) here - but - * doubt anyone wants Samba to behave differently from Win95 and WinNT - * here. They both treat full width ascii characters as case senstive - * filenames (ie. they don't do the work we do here). - * JRA. - */ - - if(lp_client_code_page() == KANJI_CODEPAGE) - { - /* Win95 treats full width ascii characters as case sensitive. */ - if (is_shift_jis (*s)) - { - if (is_sj_upper (s[0], s[1])) - s[1] = sj_tolower2 (s[1]); - s += 2; - } - else if (is_kana (*s)) - { - s++; - } - else - { - if (isupper(*s)) - *s = tolower(*s); - s++; - } - } - else -#endif /* KANJI_WIN95_COMPATIBILITY */ - { - size_t skip = get_character_len( *s ); - if( skip != 0 ) - s += skip; - else - { - if (isupper(*s)) - *s = tolower(*s); - s++; - } - } - } -} - -/******************************************************************* - convert a string to upper case -********************************************************************/ -void strupper(char *s) -{ - while (*s) - { -#if !defined(KANJI_WIN95_COMPATIBILITY) - /* - * For completeness we should put in equivalent code for code pages - * 949 (Korean hangul) and 950 (Big5 Traditional Chinese) here - but - * doubt anyone wants Samba to behave differently from Win95 and WinNT - * here. They both treat full width ascii characters as case senstive - * filenames (ie. they don't do the work we do here). - * JRA. - */ - - if(lp_client_code_page() == KANJI_CODEPAGE) - { - /* Win95 treats full width ascii characters as case sensitive. */ - if (is_shift_jis (*s)) - { - if (is_sj_lower (s[0], s[1])) - s[1] = sj_toupper2 (s[1]); - s += 2; - } - else if (is_kana (*s)) - { - s++; - } - else - { - if (islower(*s)) - *s = toupper(*s); - s++; - } - } - else -#endif /* KANJI_WIN95_COMPATIBILITY */ - { - size_t skip = get_character_len( *s ); - if( skip != 0 ) - s += skip; - else - { - if (islower(*s)) - *s = toupper(*s); - s++; - } - } - } -} - -/******************************************************************* convert a string to "normal" form ********************************************************************/ void strnorm(char *s) @@ -471,44 +231,26 @@ check if a string is in "normal" case ********************************************************************/ BOOL strisnormal(char *s) { - extern int case_default; - if (case_default == CASE_UPPER) - return(!strhaslower(s)); - - return(!strhasupper(s)); + extern int case_default; + if (case_default == CASE_UPPER) + return(!strhaslower(s)); + + return(!strhasupper(s)); } /**************************************************************************** string replace + NOTE: oldc and newc must be 7 bit characters ****************************************************************************/ void string_replace(char *s,char oldc,char newc) { - size_t skip; - - /* - * sbcs optimization. - */ - if(!global_is_multibyte_codepage) { - while (*s) { - if (oldc == *s) - *s = newc; - s++; - } - } else { - while (*s) - { - skip = get_character_len( *s ); - if( skip != 0 ) - s += skip; - else - { - if (oldc == *s) - *s = newc; - s++; - } - } - } + smb_ucs2_t *ptr; + push_ucs2(NULL, tmpbuf,s, sizeof(tmpbuf), STR_TERMINATE); + for(ptr=tmpbuf;*ptr;ptr++) { + if(*ptr==UCS2_CHAR(oldc)) *ptr = UCS2_CHAR(newc); + } + pull_ucs2(NULL, s, tmpbuf, -1, sizeof(tmpbuf), STR_TERMINATE); } @@ -517,35 +259,20 @@ skip past some strings in a buffer ********************************************************************/ char *skip_string(char *buf,size_t n) { - while (n--) - buf += strlen(buf) + 1; - return(buf); + while (n--) + buf += strlen(buf) + 1; + return(buf); } /******************************************************************* Count the number of characters in a string. Normally this will be the same as the number of bytes in a string for single byte strings, but will be different for multibyte. - 16.oct.98, jdblair@cobaltnet.com. ********************************************************************/ - size_t str_charnum(const char *s) { - size_t len = 0; - - /* - * sbcs optimization. - */ - if(!global_is_multibyte_codepage) { - return strlen(s); - } else { - while (*s != '\0') { - int skip = get_character_len(*s); - s += (skip ? skip : 1); - len++; - } - } - return len; + push_ucs2(NULL, tmpbuf,s, sizeof(tmpbuf), STR_TERMINATE); + return strlen_w(tmpbuf); } /******************************************************************* @@ -554,110 +281,36 @@ trim the specified elements off the front and back of a string BOOL trim_string(char *s,const char *front,const char *back) { - BOOL ret = False; - size_t s_len; - size_t front_len; - size_t back_len; - char *sP; + BOOL ret = False; + size_t front_len; + size_t back_len; + size_t len; /* Ignore null or empty strings. */ + if (!s || (s[0] == '\0')) + return False; - if ( !s || (s[0] == '\0')) - return False; - - sP = s; - s_len = strlen( s ) + 1; - front_len = (front) ? strlen( front ) + 1 : 0; - back_len = (back) ? strlen( back ) + 1 : 0; - - /* - * remove "front" string from given "s", if it matches front part, - * repeatedly. - */ - if ( front && front_len > 1 ) { - while (( s_len >= front_len )&& - ( memcmp( sP, front, front_len - 1 )) == 0 ) { - ret = True; - sP += ( front_len - 1 ); - s_len -= ( front_len - 1 ); - } - } + front_len = front? strlen(front) : 0; + back_len = back? strlen(back) : 0; - /* - * we'll memmove sP to s later, after we're done with - * back part removal, for minimizing copy. - */ - - - /* - * We split out the multibyte code page - * case here for speed purposes. Under a - * multibyte code page we need to walk the - * string forwards only and multiple times. - * Thanks to John Blair for finding this - * one. JRA. - */ - /* - * This JRA's comment is partly correct, but partly wrong. - * You can always check from "end" part, and if it did not match, - * it means there is no possibility of finding one. - * If you found matching point, mark them, then look from front - * if marking point suits multi-byte string rule. - * Kenichi Okuyama. - */ - - if ( back && back_len > 1 && s_len >= back_len) { - char *bP = sP + s_len - back_len; - long b_len = s_len; - - while (( b_len >= back_len )&& - ( memcmp( bP, back, back_len - 1 ) == 0 )) { - bP -= ( back_len - 1 ); - b_len -= ( back_len - 1 ); - } + len = strlen(s); - /* - * You're here, means you ether have found match multiple times, - * or you found none. If you've found match, then bP should be - * moving. - */ - if ( bP != sP + s_len - back_len ) { - bP += ( back_len - 1 ); /* slide bP to first matching point. */ - - if( !global_is_multibyte_codepage ) { - /* simply terminate */ - (*bP) = '\0'; - s_len = b_len; - ret = True; - } else { - /* trace string from start. */ - char *cP = sP; - while ( cP < sP + s_len - back_len ) { - size_t skip; - skip = skip_multibyte_char( *cP ); - cP += ( skip ? skip : 1 ); - if ( cP == bP ) { - /* you found the match */ - (*bP) = '\0'; - ret = True; - s_len = b_len; - break; - } - while (( cP > bP )&&( bP < sP + s_len - back_len )) { - bP += ( back_len - 1 ); - b_len += ( back_len - 1 ); - } - } - } - } - } - - /* if front found matching point */ - if ( sP != s ) { - /* slide string to buffer top */ - memmove( s, sP, s_len ); - } - return ret; + if (front_len) { + while (len && strncmp(s, front, front_len)==0) { + memcpy(s, s+front_len, (len-front_len)+1); + len -= front_len; + ret=True; + } + } + + if (back_len) { + while (strncmp(s+len-back_len,back,back_len)==0) { + s[len-back_len]='\0'; + len -= back_len; + ret=True; + } + } + return ret; } @@ -666,46 +319,11 @@ does a string have any uppercase chars in it? ****************************************************************************/ BOOL strhasupper(const char *s) { - while (*s) - { -#if !defined(KANJI_WIN95_COMPATIBILITY) - /* - * For completeness we should put in equivalent code for code pages - * 949 (Korean hangul) and 950 (Big5 Traditional Chinese) here - but - * doubt anyone wants Samba to behave differently from Win95 and WinNT - * here. They both treat full width ascii characters as case senstive - * filenames (ie. they don't do the work we do here). - * JRA. - */ - - if(lp_client_code_page() == KANJI_CODEPAGE) - { - /* Win95 treats full width ascii characters as case sensitive. */ - if (is_shift_jis (*s)) - s += 2; - else if (is_kana (*s)) - s++; - else - { - if (isupper(*s)) - return(True); - s++; - } - } - else -#endif /* KANJI_WIN95_COMPATIBILITY */ - { - size_t skip = get_character_len( *s ); - if( skip != 0 ) - s += skip; - else { - if (isupper(*s)) - return(True); - s++; - } - } - } - return(False); + smb_ucs2_t *ptr; + push_ucs2(NULL, tmpbuf,s, sizeof(tmpbuf), STR_TERMINATE); + for(ptr=tmpbuf;*ptr;ptr++) + if(isupper_w(*ptr)) return True; + return(False); } /**************************************************************************** @@ -713,104 +331,23 @@ does a string have any lowercase chars in it? ****************************************************************************/ BOOL strhaslower(const char *s) { - while (*s) - { -#if !defined(KANJI_WIN95_COMPATIBILITY) - /* - * For completeness we should put in equivalent code for code pages - * 949 (Korean hangul) and 950 (Big5 Traditional Chinese) here - but - * doubt anyone wants Samba to behave differently from Win95 and WinNT - * here. They both treat full width ascii characters as case senstive - * filenames (ie. they don't do the work we do here). - * JRA. - */ - - if(lp_client_code_page() == KANJI_CODEPAGE) - { - /* Win95 treats full width ascii characters as case sensitive. */ - if (is_shift_jis (*s)) - { - if (is_sj_upper (s[0], s[1])) - return(True); - if (is_sj_lower (s[0], s[1])) - return (True); - s += 2; - } - else if (is_kana (*s)) - { - s++; - } - else - { - if (islower(*s)) - return(True); - s++; - } - } - else -#endif /* KANJI_WIN95_COMPATIBILITY */ - { - size_t skip = get_character_len( *s ); - if( skip != 0 ) - s += skip; - else { - if (islower(*s)) - return(True); - s++; - } - } - } - return(False); + smb_ucs2_t *ptr; + push_ucs2(NULL, tmpbuf,s, sizeof(tmpbuf), STR_TERMINATE); + for(ptr=tmpbuf;*ptr;ptr++) + if(islower_w(*ptr)) return True; + return(False); } /**************************************************************************** -find the number of chars in a string +find the number of 'c' chars in a string ****************************************************************************/ size_t count_chars(const char *s,char c) { - size_t count=0; - -#if !defined(KANJI_WIN95_COMPATIBILITY) - /* - * For completeness we should put in equivalent code for code pages - * 949 (Korean hangul) and 950 (Big5 Traditional Chinese) here - but - * doubt anyone wants Samba to behave differently from Win95 and WinNT - * here. They both treat full width ascii characters as case senstive - * filenames (ie. they don't do the work we do here). - * JRA. - */ - - if(lp_client_code_page() == KANJI_CODEPAGE) - { - /* Win95 treats full width ascii characters as case sensitive. */ - while (*s) - { - if (is_shift_jis (*s)) - s += 2; - else - { - if (*s == c) - count++; - s++; - } - } - } - else -#endif /* KANJI_WIN95_COMPATIBILITY */ - { - while (*s) - { - size_t skip = get_character_len( *s ); - if( skip != 0 ) - s += skip; - else { - if (*s == c) - count++; - s++; - } - } - } - return(count); + smb_ucs2_t *ptr; + int count; + push_ucs2(NULL, tmpbuf,s, sizeof(tmpbuf), STR_TERMINATE); + for(count=0,ptr=tmpbuf;*ptr;ptr++) if(*ptr==UCS2_CHAR(c)) count++; + return(count); } /******************************************************************* @@ -819,52 +356,15 @@ Return True if a string consists only of one particular character. BOOL str_is_all(const char *s,char c) { - if(s == NULL) - return False; - if(!*s) - return False; - -#if !defined(KANJI_WIN95_COMPATIBILITY) - /* - * For completeness we should put in equivalent code for code pages - * 949 (Korean hangul) and 950 (Big5 Traditional Chinese) here - but - * doubt anyone wants Samba to behave differently from Win95 and WinNT - * here. They both treat full width ascii characters as case senstive - * filenames (ie. they don't do the work we do here). - * JRA. - */ - - if(lp_client_code_page() == KANJI_CODEPAGE) - { - /* Win95 treats full width ascii characters as case sensitive. */ - while (*s) - { - if (is_shift_jis (*s)) - s += 2; - else - { - if (*s != c) - return False; - s++; - } - } - } - else -#endif /* KANJI_WIN95_COMPATIBILITY */ - { - while (*s) - { - size_t skip = get_character_len( *s ); - if( skip != 0 ) - s += skip; - else { - if (*s != c) - return False; - s++; - } - } - } - return True; + smb_ucs2_t *ptr; + + if(s == NULL) return False; + if(!*s) return False; + + push_ucs2(NULL, tmpbuf,s, sizeof(tmpbuf), STR_TERMINATE); + for(ptr=tmpbuf;*ptr;ptr++) if(*ptr!=UCS2_CHAR(c)) return False; + + return True; } /******************************************************************* @@ -874,29 +374,29 @@ include the terminating zero. char *safe_strcpy(char *dest,const char *src, size_t maxlength) { - size_t len; + size_t len; - if (!dest) { - DEBUG(0,("ERROR: NULL dest in safe_strcpy\n")); - return NULL; - } + if (!dest) { + DEBUG(0,("ERROR: NULL dest in safe_strcpy\n")); + return NULL; + } - if (!src) { - *dest = 0; - return dest; - } + if (!src) { + *dest = 0; + return dest; + } - len = strlen(src); + len = strlen(src); - if (len > maxlength) { - DEBUG(0,("ERROR: string overflow by %d in safe_strcpy [%.50s]\n", - (int)(len-maxlength), src)); - len = maxlength; - } + if (len > maxlength) { + DEBUG(0,("ERROR: string overflow by %d in safe_strcpy [%.50s]\n", + (int)(len-maxlength), src)); + len = maxlength; + } - memmove(dest, src, len); - dest[len] = 0; - return dest; + memmove(dest, src, len); + dest[len] = 0; + return dest; } /******************************************************************* @@ -906,29 +406,29 @@ include the terminating zero. char *safe_strcat(char *dest, const char *src, size_t maxlength) { - size_t src_len, dest_len; + size_t src_len, dest_len; - if (!dest) { - DEBUG(0,("ERROR: NULL dest in safe_strcat\n")); - return NULL; - } - - if (!src) { - return dest; - } - - src_len = strlen(src); - dest_len = strlen(dest); + if (!dest) { + DEBUG(0,("ERROR: NULL dest in safe_strcat\n")); + return NULL; + } - if (src_len + dest_len > maxlength) { - DEBUG(0,("ERROR: string overflow by %d in safe_strcat [%.50s]\n", - (int)(src_len + dest_len - maxlength), src)); - src_len = maxlength - dest_len; - } - - memcpy(&dest[dest_len], src, src_len); - dest[dest_len + src_len] = 0; - return dest; + if (!src) { + return dest; + } + + src_len = strlen(src); + dest_len = strlen(dest); + + if (src_len + dest_len > maxlength) { + DEBUG(0,("ERROR: string overflow by %d in safe_strcat [%.50s]\n", + (int)(src_len + dest_len - maxlength), src)); + src_len = maxlength - dest_len; + } + + memcpy(&dest[dest_len], src, src_len); + dest[dest_len + src_len] = 0; + return dest; } /******************************************************************* @@ -979,15 +479,15 @@ char *alpha_strcpy(char *dest, const char *src, const char *other_safe_chars, si char *StrnCpy(char *dest,const char *src,size_t n) { - char *d = dest; - if (!dest) return(NULL); - if (!src) { - *dest = 0; - return(dest); - } - while (n-- && (*d++ = *src++)) ; - *d = 0; - return(dest); + char *d = dest; + if (!dest) return(NULL); + if (!src) { + *dest = 0; + return(dest); + } + while (n-- && (*d++ = *src++)) ; + *d = 0; + return(dest); } /**************************************************************************** @@ -1303,3 +803,57 @@ char *string_truncate(char *s, int length) } return s; } + + +/**************************************************************************** +strchr and strrchr are very hard to do on general multi-byte strings. +we convert via ucs2 for now +****************************************************************************/ +char *strchr_m(const char *s, char c) +{ + wpstring ws; + pstring s2; + smb_ucs2_t *p; + + push_ucs2(NULL, ws, s, sizeof(ws), STR_TERMINATE); + p = strchr_wa(ws, c); + if (!p) return NULL; + *p = 0; + pull_ucs2_pstring(s2, ws); + return (char *)(s+strlen(s2)); +} + +char *strrchr_m(const char *s, char c) +{ + wpstring ws; + pstring s2; + smb_ucs2_t *p; + + push_ucs2(NULL, ws, s, sizeof(ws), STR_TERMINATE); + p = strrchr_wa(ws, c); + if (!p) return NULL; + *p = 0; + pull_ucs2_pstring(s2, ws); + return (char *)(s+strlen(s2)); +} + +/******************************************************************* + convert a string to lower case +********************************************************************/ +void strlower_m(char *s) +{ + /* I assume that lowercased string takes the same number of bytes + * as source string even in UTF-8 encoding. (VIV) */ + unix_strlower(s,strlen(s)+1,s,strlen(s)+1); +} + +/******************************************************************* + convert a string to upper case +********************************************************************/ +void strupper_m(char *s) +{ + /* I assume that lowercased string takes the same number of bytes + * as source string even in multibyte encoding. (VIV) */ + unix_strupper(s,strlen(s)+1,s,strlen(s)+1); +} + diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c index 96aa62a283..1bfcd179f4 100644 --- a/source3/lib/util_unistr.c +++ b/source3/lib/util_unistr.c @@ -1,8 +1,8 @@ /* Unix SMB/Netbios implementation. - Version 1.9. + Version 3.0 Samba utility functions - Copyright (C) Andrew Tridgell 1992-1998 + Copyright (C) Andrew Tridgell 1992-2001 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,11 +31,7 @@ extern int DEBUGLEVEL; * These are dynamically loaded from a unicode translation file. */ -static smb_ucs2_t *doscp_to_ucs2; -static uint16 *ucs2_to_doscp; - -static smb_ucs2_t *unixcp_to_ucs2; -static uint16 *ucs2_to_unixcp; +#define CONV_DEBUGLEVEL 83 #ifndef MAXUNI #define MAXUNI 1024 @@ -54,62 +50,10 @@ static uint16 *ucs2_to_unixcp; size_t dos_PutUniCode(char *dst,const char *src, ssize_t len, BOOL null_terminate) { - size_t ret = 0; - while (*src && (len >= 2)) { - size_t skip = get_character_len(*src); - smb_ucs2_t val = (*src & 0xff); - - /* - * If this is a multibyte character (and all DOS/Windows - * codepages have at maximum 2 byte multibyte characters) - * then work out the index value for the unicode conversion. - */ - - if (skip == 2) - val = ((val << 8) | (src[1] & 0xff)); - - SSVAL(dst,ret,doscp_to_ucs2[val]); - ret += 2; - len -= 2; - if (skip) - src += skip; - else - src++; - } - if (null_terminate) { - SSVAL(dst,ret,0); - ret += 2; - } - return(ret); + return push_ucs2(NULL, dst, src, len, + STR_UNICODE|STR_NOALIGN | (null_terminate?STR_TERMINATE:0)); } -/******************************************************************* - Pull a DOS codepage string out of a UNICODE array. len is in bytes. -********************************************************************/ - -void unistr_to_dos(char *dest, const char *src, size_t len) -{ - char *destend = dest + len; - - while (dest < destend) { - uint16 ucs2_val = SVAL(src,0); - uint16 cp_val = ucs2_to_doscp[ucs2_val]; - - src += 2; - - if (ucs2_val == 0) - break; - - if (cp_val < 256) - *dest++ = (char)cp_val; - else { - *dest++ = (cp_val >> 8) & 0xff; - *dest++ = (cp_val & 0xff); - } - } - - *dest = 0; -} /******************************************************************* Skip past a unicode string, but not more than len. Always move @@ -129,183 +73,48 @@ char *skip_unibuf(char *src, size_t len) return src; } +/* Copy a string from little-endian or big-endian unicode source (depending + * on flags) to internal samba format destination + */ +int rpcstr_pull(char* dest, void *src, int dest_len, int src_len, int flags) +{ + if(dest_len==-1) dest_len=MAXUNI-3; + return pull_ucs2(NULL, dest, src, dest_len, src_len, flags|STR_UNICODE|STR_NOALIGN); +} + +/* Converts a string from internal samba format to unicode + */ +int rpcstr_push(void* dest, const char *src, int dest_len, int flags) +{ + return push_ucs2(NULL, dest, src, dest_len, flags|STR_UNICODE|STR_NOALIGN); +} + /******************************************************************* Return a DOS codepage version of a little-endian unicode string. len is the filename length (ignoring any terminating zero) in uin16 units. Always null terminates. Hack alert: uses fixed buffer(s). ********************************************************************/ - char *dos_unistrn2(uint16 *src, int len) { static char lbufs[8][MAXUNI]; static int nexti; char *lbuf = lbufs[nexti]; - char *p; - nexti = (nexti+1)%8; - - for (p = lbuf; (len > 0) && (p-lbuf < MAXUNI-3) && *src; len--, src++) { - uint16 ucs2_val = SVAL(src,0); - uint16 cp_val = ucs2_to_doscp[ucs2_val]; - - if (cp_val < 256) - *p++ = (char)cp_val; - else { - *p++ = (cp_val >> 8) & 0xff; - *p++ = (cp_val & 0xff); - } - } - - *p = 0; + pull_ucs2(NULL, lbuf, src, MAXUNI-3, len*2, STR_NOALIGN); return lbuf; } -static char lbufs[8][MAXUNI]; -static int nexti; - -/******************************************************************* - Return a DOS codepage version of a little-endian unicode string. - Hack alert: uses fixed buffer(s). -********************************************************************/ - -char *dos_unistr2(uint16 *src) -{ - char *lbuf = lbufs[nexti]; - char *p; - - nexti = (nexti+1)%8; - - for (p = lbuf; (p-lbuf < MAXUNI-3) && *src; src++) { - uint16 ucs2_val = SVAL(src,0); - uint16 cp_val = ucs2_to_doscp[ucs2_val]; - - if (cp_val < 256) - *p++ = (char)cp_val; - else { - *p++ = (cp_val >> 8) & 0xff; - *p++ = (cp_val & 0xff); - } - } - - *p = 0; - return lbuf; -} - -/******************************************************************* -Return a DOS codepage version of a little-endian unicode string -********************************************************************/ - -char *dos_unistr2_to_str(UNISTR2 *str) -{ - char *lbuf = lbufs[nexti]; - char *p; - uint16 *src = str->buffer; - - nexti = (nexti+1)%8; - - for (p = lbuf; (p - lbuf < MAXUNI-3) && (src - str->buffer < str->uni_str_len) && *src; src++) { - uint16 ucs2_val = SVAL(src,0); - uint16 cp_val = ucs2_to_doscp[ucs2_val]; - - if (cp_val < 256) - *p++ = (char)cp_val; - else { - *p++ = (cp_val >> 8) & 0xff; - *p++ = (cp_val & 0xff); - } - } - - *p = 0; - return lbuf; -} - -/******************************************************************* - Put an ASCII string into a UNICODE array (uint16's). - use little-endian ucs2 - ********************************************************************/ -void ascii_to_unistr(uint16 *dest, const char *src, int maxlen) -{ - uint16 *destend = dest + maxlen; - char c; - - while (dest < destend) { - c = *(src++); - if (c == 0) - break; - - SSVAL(dest, 0, c); - dest++; - } - - *dest = 0; -} - -/******************************************************************* - Pull an ASCII string out of a UNICODE array (uint16's). - ********************************************************************/ - -void unistr_to_ascii(char *dest, const uint16 *src, int len) -{ - char *destend = dest + len; - uint16 c; - - if (src == NULL) { - *dest = '\0'; - return; - } - - /* normal code path for a valid 'src' */ - while (dest < destend) { - c = SVAL(src, 0); - src++; - if (c == 0) - break; - - *(dest++) = (char)c; - } - - *dest = 0; - return; -} - /******************************************************************* Convert a (little-endian) UNISTR2 structure to an ASCII string - Warning: this version does DOS codepage. ********************************************************************/ - void unistr2_to_ascii(char *dest, const UNISTR2 *str, size_t maxlen) { - char *p; - uint16 *src; - size_t len; - if (str == NULL) { *dest='\0'; return; } - - src = str->buffer; - len = MIN(str->uni_str_len, maxlen); - - if (len == 0) { - *dest='\0'; - return; - } - - for (p = dest; (p-dest < len) && *src; src++) { - uint16 ucs2_val = SVAL(src,0); - uint16 cp_val = ucs2_to_doscp[ucs2_val]; - - if (cp_val < 256) - *p++ = (char)cp_val; - else { - *p = (cp_val >> 8) & 0xff; - *p++ = (cp_val & 0xff); - } - } - - *p = 0; + pull_ucs2(NULL, dest, str->buffer, maxlen, str->uni_str_len, STR_NOALIGN); } @@ -322,743 +131,6 @@ uint32 buffer2_to_uint32(BUFFER2 *str) } /******************************************************************* -Return a DOS codepage version of a NOTunicode string -********************************************************************/ - -char *dos_buffer2_to_str(BUFFER2 *str) -{ - char *lbuf = lbufs[nexti]; - char *p; - uint16 *src = str->buffer; - - nexti = (nexti+1)%8; - - for (p = lbuf; (p - lbuf < sizeof(str->buffer)-3) && (src - str->buffer < str->buf_len/2) && *src; src++) { - uint16 ucs2_val = SVAL(src,0); - uint16 cp_val = ucs2_to_doscp[ucs2_val]; - - if (cp_val < 256) - *p++ = (char)cp_val; - else { - *p++ = (cp_val >> 8) & 0xff; - *p++ = (cp_val & 0xff); - } - } - - *p = 0; - return lbuf; -} - -/******************************************************************* - Return a dos codepage version of a NOTunicode string -********************************************************************/ - -char *dos_buffer2_to_multistr(BUFFER2 *str) -{ - char *lbuf = lbufs[nexti]; - char *p; - uint16 *src = str->buffer; - - nexti = (nexti+1)%8; - - for (p = lbuf; (p - lbuf < sizeof(str->buffer)-3) && (src - str->buffer < str->buf_len/2); src++) { - if (*src == 0) { - *p++ = ' '; - } else { - uint16 ucs2_val = SVAL(src,0); - uint16 cp_val = ucs2_to_doscp[ucs2_val]; - - if (cp_val < 256) - *p++ = (char)cp_val; - else { - *p++ = (cp_val >> 8) & 0xff; - *p++ = (cp_val & 0xff); - } - } - } - - *p = 0; - return lbuf; -} - -/******************************************************************* - Create a null-terminated unicode string from a null-terminated DOS - codepage string. - Return number of unicode chars copied, excluding the null character. - Unicode strings created are in little-endian format. -********************************************************************/ - -size_t dos_struni2(char *dst, const char *src, size_t max_len) -{ - size_t len = 0; - - if (dst == NULL) - return 0; - - if (src != NULL) { - for (; (len < max_len-2) && *src; len++, dst +=2) { - size_t skip = get_character_len(*src); - smb_ucs2_t val = (*src & 0xff); - - /* - * If this is a multibyte character (and all DOS/Windows - * codepages have at maximum 2 byte multibyte characters) - * then work out the index value for the unicode conversion. - */ - - if (skip == 2) - val = ((val << 8) | (src[1] & 0xff)); - - SSVAL(dst,0,doscp_to_ucs2[val]); - if (skip) - src += skip; - else - src++; - } - } - - SSVAL(dst,0,0); - - return len; -} - -/******************************************************************* - Return a DOS codepage version of a little-endian unicode string. - Hack alert: uses fixed buffer(s). -********************************************************************/ - -char *dos_unistr(char *buf) -{ - char *lbuf = lbufs[nexti]; - uint16 *src = (uint16 *)buf; - char *p; - - nexti = (nexti+1)%8; - - for (p = lbuf; (p-lbuf < MAXUNI-3) && *src; src++) { - uint16 ucs2_val = SVAL(src,0); - uint16 cp_val = ucs2_to_doscp[ucs2_val]; - - if (cp_val < 256) - *p++ = (char)cp_val; - else { - *p++ = (cp_val >> 8) & 0xff; - *p++ = (cp_val & 0xff); - } - } - - *p = 0; - return lbuf; -} - -/******************************************************************* - Strcpy for unicode strings. returns length (in num of wide chars) -********************************************************************/ - -int unistrcpy(char *dst, char *src) -{ - int num_wchars = 0; - uint16 *wsrc = (uint16 *)src; - uint16 *wdst = (uint16 *)dst; - - while (*wsrc) { - *wdst++ = *wsrc++; - num_wchars++; - } - *wdst = 0; - - return num_wchars; -} - -/******************************************************************* - Free any existing maps. -********************************************************************/ - -static void free_maps(smb_ucs2_t **pp_cp_to_ucs2, uint16 **pp_ucs2_to_cp) -{ - /* this handles identity mappings where we share the pointer */ - if (*pp_ucs2_to_cp == *pp_cp_to_ucs2) { - *pp_ucs2_to_cp = NULL; - } - - if (*pp_cp_to_ucs2) { - free(*pp_cp_to_ucs2); - *pp_cp_to_ucs2 = NULL; - } - - if (*pp_ucs2_to_cp) { - free(*pp_ucs2_to_cp); - *pp_ucs2_to_cp = NULL; - } -} - -/******************************************************************* - Build a default (null) codepage to unicode map. -********************************************************************/ - -void default_unicode_map(smb_ucs2_t **pp_cp_to_ucs2, uint16 **pp_ucs2_to_cp) -{ - int i; - - free_maps(pp_cp_to_ucs2, pp_ucs2_to_cp); - - if ((*pp_ucs2_to_cp = (uint16 *)malloc(2*65536)) == NULL) { - DEBUG(0,("default_unicode_map: malloc fail for ucs2_to_cp size %u.\n", 2*65536)); - abort(); - } - - *pp_cp_to_ucs2 = *pp_ucs2_to_cp; /* Default map is an identity. */ - for (i = 0; i < 65536; i++) - (*pp_cp_to_ucs2)[i] = i; -} - -/******************************************************************* - Load a codepage to unicode and vica-versa map. -********************************************************************/ - -BOOL load_unicode_map(const char *codepage, smb_ucs2_t **pp_cp_to_ucs2, uint16 **pp_ucs2_to_cp) -{ - pstring unicode_map_file_name; - FILE *fp = NULL; - SMB_STRUCT_STAT st; - smb_ucs2_t *cp_to_ucs2 = *pp_cp_to_ucs2; - uint16 *ucs2_to_cp = *pp_ucs2_to_cp; - size_t cp_to_ucs2_size; - size_t ucs2_to_cp_size; - size_t i; - size_t size; - char buf[UNICODE_MAP_HEADER_SIZE]; - - DEBUG(5, ("load_unicode_map: loading unicode map for codepage %s.\n", codepage)); - - if (*codepage == '\0') - goto clean_and_exit; - - if(strlen(lp_codepagedir()) + 13 + strlen(codepage) > - sizeof(unicode_map_file_name)) { - DEBUG(0,("load_unicode_map: filename too long to load\n")); - goto clean_and_exit; - } - - pstrcpy(unicode_map_file_name, lp_codepagedir()); - pstrcat(unicode_map_file_name, "/"); - pstrcat(unicode_map_file_name, "unicode_map."); - pstrcat(unicode_map_file_name, codepage); - - if(sys_stat(unicode_map_file_name,&st)!=0) { - DEBUG(0,("load_unicode_map: filename %s does not exist.\n", - unicode_map_file_name)); - goto clean_and_exit; - } - - size = st.st_size; - - if ((size != UNICODE_MAP_HEADER_SIZE + 4*65536) && (size != UNICODE_MAP_HEADER_SIZE +(2*256 + 2*65536))) { - DEBUG(0,("load_unicode_map: file %s is an incorrect size for a \ -unicode map file (size=%d).\n", unicode_map_file_name, (int)size)); - goto clean_and_exit; - } - - if((fp = sys_fopen( unicode_map_file_name, "r")) == NULL) { - DEBUG(0,("load_unicode_map: cannot open file %s. Error was %s\n", - unicode_map_file_name, strerror(errno))); - goto clean_and_exit; - } - - if(fread( buf, 1, UNICODE_MAP_HEADER_SIZE, fp)!=UNICODE_MAP_HEADER_SIZE) { - DEBUG(0,("load_unicode_map: cannot read header from file %s. Error was %s\n", - unicode_map_file_name, strerror(errno))); - goto clean_and_exit; - } - - /* Check the version value */ - if(SVAL(buf,UNICODE_MAP_VERSION_OFFSET) != UNICODE_MAP_FILE_VERSION_ID) { - DEBUG(0,("load_unicode_map: filename %s has incorrect version id. \ -Needed %hu, got %hu.\n", - unicode_map_file_name, (uint16)UNICODE_MAP_FILE_VERSION_ID, - SVAL(buf,UNICODE_MAP_VERSION_OFFSET))); - goto clean_and_exit; - } - - /* Check the codepage value */ - if(!strequal(&buf[UNICODE_MAP_CLIENT_CODEPAGE_OFFSET], codepage)) { - DEBUG(0,("load_unicode_map: codepage %s in file %s is not the same as that \ -requested (%s).\n", &buf[UNICODE_MAP_CLIENT_CODEPAGE_OFFSET], unicode_map_file_name, codepage )); - goto clean_and_exit; - } - - ucs2_to_cp_size = 2*65536; - if (size == UNICODE_MAP_HEADER_SIZE + 4*65536) { - /* - * This is a multibyte code page. - */ - cp_to_ucs2_size = 2*65536; - } else { - /* - * Single byte code page. - */ - cp_to_ucs2_size = 2*256; - } - - /* - * Free any old translation tables. - */ - - free_maps(pp_cp_to_ucs2, pp_ucs2_to_cp); - - if ((cp_to_ucs2 = (smb_ucs2_t *)malloc(cp_to_ucs2_size)) == NULL) { - DEBUG(0,("load_unicode_map: malloc fail for cp_to_ucs2 size %u.\n", cp_to_ucs2_size )); - goto clean_and_exit; - } - - if ((ucs2_to_cp = (uint16 *)malloc(ucs2_to_cp_size)) == NULL) { - DEBUG(0,("load_unicode_map: malloc fail for ucs2_to_cp size %u.\n", ucs2_to_cp_size )); - goto clean_and_exit; - } - - if(fread( (char *)cp_to_ucs2, 1, cp_to_ucs2_size, fp)!=cp_to_ucs2_size) { - DEBUG(0,("load_unicode_map: cannot read cp_to_ucs2 from file %s. Error was %s\n", - unicode_map_file_name, strerror(errno))); - goto clean_and_exit; - } - - if(fread( (char *)ucs2_to_cp, 1, ucs2_to_cp_size, fp)!=ucs2_to_cp_size) { - DEBUG(0,("load_unicode_map: cannot read ucs2_to_cp from file %s. Error was %s\n", - unicode_map_file_name, strerror(errno))); - goto clean_and_exit; - } - - /* - * Now ensure the 16 bit values are in the correct endianness. - */ - - for (i = 0; i < cp_to_ucs2_size/2; i++) - cp_to_ucs2[i] = SVAL(cp_to_ucs2,i*2); - - for (i = 0; i < ucs2_to_cp_size/2; i++) - ucs2_to_cp[i] = SVAL(ucs2_to_cp,i*2); - - fclose(fp); - - *pp_cp_to_ucs2 = cp_to_ucs2; - *pp_ucs2_to_cp = ucs2_to_cp; - - return True; - -clean_and_exit: - - /* pseudo destructor :-) */ - - if(fp != NULL) - fclose(fp); - - free_maps(pp_cp_to_ucs2, pp_ucs2_to_cp); - - default_unicode_map(pp_cp_to_ucs2, pp_ucs2_to_cp); - - return False; -} - -/******************************************************************* - Load a dos codepage to unicode and vica-versa map. -********************************************************************/ - -BOOL load_dos_unicode_map(int codepage) -{ - fstring codepage_str; - - slprintf(codepage_str, sizeof(fstring)-1, "%03d", codepage); - return load_unicode_map(codepage_str, &doscp_to_ucs2, &ucs2_to_doscp); -} - -/******************************************************************* - Load a UNIX codepage to unicode and vica-versa map. -********************************************************************/ - -BOOL load_unix_unicode_map(const char *unix_char_set) -{ - fstring upper_unix_char_set; - - fstrcpy(upper_unix_char_set, unix_char_set); - strupper(upper_unix_char_set); - return load_unicode_map(upper_unix_char_set, &unixcp_to_ucs2, &ucs2_to_unixcp); -} - -/******************************************************************* - The following functions reproduce many of the non-UNICODE standard - string functions in Samba. -********************************************************************/ - -/******************************************************************* - Convert a UNICODE string to multibyte format. Note that the 'src' is in - native byte order, not little endian. Always zero terminates. - dst_len is in bytes. -********************************************************************/ - -static char *unicode_to_multibyte(char *dst, const smb_ucs2_t *src, - size_t dst_len, const uint16 *ucs2_to_cp) -{ - size_t dst_pos; - - for(dst_pos = 0; (dst_pos < dst_len - 1) && *src;) { - smb_ucs2_t val = ucs2_to_cp[*src++]; - if(val < 256) { - dst[dst_pos++] = (char)val; - } else { - - if(dst_pos >= dst_len - 2) - break; - - /* - * A 2 byte value is always written as - * high/low into the buffer stream. - */ - - dst[dst_pos++] = (char)((val >> 8) & 0xff); - dst[dst_pos++] = (char)(val & 0xff); - } - } - - dst[dst_pos] = '\0'; - - return dst; -} - -/******************************************************************* - Convert a multibyte string to UNICODE format. Note that the 'dst' is in - native byte order, not little endian. Always zero terminates. - dst_len is in bytes. -********************************************************************/ - -smb_ucs2_t *multibyte_to_unicode(smb_ucs2_t *dst, const char *src, - size_t dst_len, smb_ucs2_t *cp_to_ucs2) -{ - size_t i; - - dst_len /= sizeof(smb_ucs2_t); /* Convert to smb_ucs2_t units. */ - - for(i = 0; (i < (dst_len - 1)) && src[i];) { - size_t skip = skip_multibyte_char(*src); - smb_ucs2_t val = (*src & 0xff); - - /* - * If this is a multibyte character - * then work out the index value for the unicode conversion. - */ - - if (skip == 2) - val = ((val << 8) | (src[1] & 0xff)); - - dst[i++] = cp_to_ucs2[val]; - if (skip) - src += skip; - else - src++; - } - - dst[i] = 0; - - return dst; -} - -/******************************************************************* - Convert a UNICODE string to multibyte format. Note that the 'src' is in - native byte order, not little endian. Always zero terminates. - This function may be replaced if the MB codepage format is an - encoded one (ie. utf8, hex). See the code in lib/kanji.c - for details. dst_len is in bytes. -********************************************************************/ - -char *unicode_to_unix(char *dst, const smb_ucs2_t *src, size_t dst_len) -{ - return unicode_to_multibyte(dst, src, dst_len, ucs2_to_unixcp); -} - -/******************************************************************* - Convert a UNIX string to UNICODE format. Note that the 'dst' is in - native byte order, not little endian. Always zero terminates. - This function may be replaced if the UNIX codepage format is a - multi-byte one (ie. JIS, SJIS or utf8). See the code in lib/kanji.c - for details. dst_len is in bytes, not ucs2 units. -********************************************************************/ - -smb_ucs2_t *unix_to_unicode(smb_ucs2_t *dst, const char *src, size_t dst_len) -{ - return multibyte_to_unicode(dst, src, dst_len, unixcp_to_ucs2); -} - -/******************************************************************* - Convert a UNICODE string to DOS format. Note that the 'src' is in - native byte order, not little endian. Always zero terminates. - dst_len is in bytes. -********************************************************************/ - -char *unicode_to_dos(char *dst, const smb_ucs2_t *src, size_t dst_len) -{ - return unicode_to_multibyte(dst, src, dst_len, ucs2_to_doscp); -} - -/******************************************************************* - Convert a single UNICODE character to DOS codepage. Returns the - number of bytes in the DOS codepage character. -********************************************************************/ - -size_t unicode_to_dos_char(char *dst, const smb_ucs2_t src) -{ - smb_ucs2_t val = ucs2_to_doscp[src]; - if(val < 256) { - *dst = (char)val; - return (size_t)1; - } - /* - * A 2 byte value is always written as - * high/low into the buffer stream. - */ - - dst[0] = (char)((val >> 8) & 0xff); - dst[1] = (char)(val & 0xff); - return (size_t)2; -} - -/******************************************************************* - Convert a DOS string to UNICODE format. Note that the 'dst' is in - native byte order, not little endian. Always zero terminates. - This function may be replaced if the DOS codepage format is a - multi-byte one (ie. JIS, SJIS or utf8). See the code in lib/kanji.c - for details. dst_len is in bytes, not ucs2 units. -********************************************************************/ - -smb_ucs2_t *dos_to_unicode(smb_ucs2_t *dst, const char *src, size_t dst_len) -{ - return multibyte_to_unicode(dst, src, dst_len, doscp_to_ucs2); -} - -/******************************************************************* - Count the number of characters in a smb_ucs2_t string. -********************************************************************/ - -size_t strlen_w(const smb_ucs2_t *src) -{ - size_t len; - - for(len = 0; *src++; len++) - ; - - return len; -} - -/******************************************************************* - Safe wstring copy into a known length string. maxlength includes - the terminating zero. maxlength is in ucs2 units. -********************************************************************/ - -smb_ucs2_t *safe_strcpy_w(smb_ucs2_t *dest,const smb_ucs2_t *src, size_t maxlength) -{ - size_t ucs2_len; - - if (!dest) { - DEBUG(0,("ERROR: NULL dest in safe_strcpy_w\n")); - return NULL; - } - - if (!src) { - *dest = 0; - return dest; - } - - maxlength /= sizeof(smb_ucs2_t); - - ucs2_len = strlen_w(src); - - if (ucs2_len >= maxlength) { - fstring out; - DEBUG(0,("ERROR: string overflow by %u bytes in safe_strcpy_w [%.50s]\n", - (unsigned int)((ucs2_len-maxlength)*sizeof(smb_ucs2_t)), - unicode_to_unix(out,src,sizeof(out))) ); - ucs2_len = maxlength - 1; - } - - memcpy(dest, src, ucs2_len*sizeof(smb_ucs2_t)); - dest[ucs2_len] = 0; - return dest; -} - -/******************************************************************* - Safe string cat into a string. maxlength includes the terminating zero. - maxlength is in ucs2 units. -********************************************************************/ - -smb_ucs2_t *safe_strcat_w(smb_ucs2_t *dest, const smb_ucs2_t *src, size_t maxlength) -{ - size_t ucs2_src_len, ucs2_dest_len; - - if (!dest) { - DEBUG(0,("ERROR: NULL dest in safe_strcat_w\n")); - return NULL; - } - - if (!src) - return dest; - - ucs2_src_len = strlen_w(src); - ucs2_dest_len = strlen_w(dest); - - if (ucs2_src_len + ucs2_dest_len >= maxlength) { - fstring out; - int new_len = maxlength - ucs2_dest_len - 1; - DEBUG(0,("ERROR: string overflow by %u characters in safe_strcat_w [%.50s]\n", - (unsigned int)(sizeof(smb_ucs2_t)*(ucs2_src_len + ucs2_dest_len - maxlength)), - unicode_to_unix(out,src,sizeof(out))) ); - ucs2_src_len = (size_t)(new_len > 0 ? new_len : 0); - } - - memcpy(&dest[ucs2_dest_len], src, ucs2_src_len*sizeof(smb_ucs2_t)); - dest[ucs2_dest_len + ucs2_src_len] = 0; - return dest; -} - -/******************************************************************* - Compare the two strings s1 and s2. -********************************************************************/ - -int strcmp_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2) -{ - smb_ucs2_t c1, c2; - - for (;;) { - c1 = *s1++; - c2 = *s2++; - - if (c1 != c2) - return c1 - c2; - - if (c1 == 0) - break; - } - return 0; -} - -/******************************************************************* - Compare the first n characters of s1 to s2. len is in ucs2 units. -********************************************************************/ - -int strncmp_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2, size_t len) -{ - smb_ucs2_t c1, c2; - - for (; len != 0; --len) { - c1 = *s1++; - c2 = *s2++; - - if (c1 != c2) - return c1 - c2; - - if (c1 == 0) - break; - - } - return 0; -} - -/******************************************************************* - Search string s2 from s1. -********************************************************************/ - -smb_ucs2_t *strstr_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2) -{ - size_t len = strlen_w(s2); - - if (!*s2) - return (smb_ucs2_t *)s1; - - for(;*s1; s1++) { - if (*s1 == *s2) { - if (strncmp_w(s1, s2, len) == 0) - return (smb_ucs2_t *)s1; - } - } - return NULL; -} - -/******************************************************************* - Search for ucs2 char c from the beginning of s. -********************************************************************/ - -smb_ucs2_t *strchr_w(const smb_ucs2_t *s, smb_ucs2_t c) -{ - do { - if (*s == c) - return (smb_ucs2_t *)s; - } while (*s++); - - return NULL; -} - -/******************************************************************* - Search for ucs2 char c from the end of s. -********************************************************************/ - -smb_ucs2_t *strrchr_w(const smb_ucs2_t *s, smb_ucs2_t c) -{ - smb_ucs2_t *retval = 0; - - do { - if (*s == c) - retval = (smb_ucs2_t *)s; - } while (*s++); - - return retval; -} - -/******************************************************************* - Search token from s1 separated by any ucs2 char of s2. -********************************************************************/ - -smb_ucs2_t *strtok_w(smb_ucs2_t *s1, const smb_ucs2_t *s2) -{ - static smb_ucs2_t *s = NULL; - smb_ucs2_t *q; - - if (!s1) { - if (!s) - return NULL; - s1 = s; - } - - for (q = s1; *s1; s1++) { - smb_ucs2_t *p = strchr_w(s2, *s1); - if (p) { - if (s1 != q) { - s = s1 + 1; - *s1 = '\0'; - return q; - } - q = s1 + 1; - } - } - - s = NULL; - if (*q) - return q; - - return NULL; -} - -/******************************************************************* - Duplicate a ucs2 string. -********************************************************************/ - -smb_ucs2_t *strdup_w(const smb_ucs2_t *s) -{ - size_t newlen = (strlen_w(s)+1)*sizeof(smb_ucs2_t); - smb_ucs2_t *newstr = (smb_ucs2_t *)malloc(newlen); - if (newstr == NULL) - return NULL; - safe_strcpy_w(newstr, s, newlen); - return newstr; -} - -/******************************************************************* Mapping tables for UNICODE character. Allows toupper/tolower and isXXX functions to work. @@ -1125,33 +197,6 @@ int islower_w( smb_ucs2_t val) } /******************************************************************* - Is a digit wchar. -********************************************************************/ - -int isdigit_w( smb_ucs2_t val) -{ - return (map_table_flags(val) & UNI_DIGIT); -} - -/******************************************************************* - Is a hex digit wchar. -********************************************************************/ - -int isxdigit_w( smb_ucs2_t val) -{ - return (map_table_flags(val) & UNI_XDIGIT); -} - -/******************************************************************* - Is a space wchar. -********************************************************************/ - -int isspace_w( smb_ucs2_t val) -{ - return (map_table_flags(val) & UNI_SPACE); -} - -/******************************************************************* Convert a wchar to upper case. ********************************************************************/ @@ -1170,102 +215,33 @@ smb_ucs2_t tolower_w( smb_ucs2_t val ) } /******************************************************************* - Case insensitive string compararison. + Count the number of characters in a smb_ucs2_t string. ********************************************************************/ - -int StrCaseCmp_w(const smb_ucs2_t *s, const smb_ucs2_t *t) +size_t strlen_w(const smb_ucs2_t *src) { - /* - * Compare until we run out of string, either t or s, or find a difference. - */ + size_t len; - while (*s && *t && toupper_w(*s) == toupper_w(*t)) { - s++; - t++; - } + for(len = 0; *src++; len++) ; - return(toupper_w(*s) - toupper_w(*t)); + return len; } /******************************************************************* - Case insensitive string compararison, length limited. - n is in ucs2 units. +wide strchr() ********************************************************************/ - -int StrnCaseCmp_w(const smb_ucs2_t *s, const smb_ucs2_t *t, size_t n) +smb_ucs2_t *strchr_w(const smb_ucs2_t *s, smb_ucs2_t c) { - /* - * Compare until we run out of string, either t or s, or chars. - */ - - while (n && *s && *t && toupper_w(*s) == toupper_w(*t)) { + while (*s != 0) { + if (c == *s) return (smb_ucs2_t *)s; s++; - t++; - n--; } - - /* - * Not run out of chars - strings are different lengths. - */ - - if (n) - return(toupper_w(*s) - toupper_w(*t)); - - /* - * Identical up to where we run out of chars, - * and strings are same length. - */ - - return(0); -} - -/******************************************************************* - Compare 2 strings. -********************************************************************/ - -BOOL strequal_w(const smb_ucs2_t *s1, const smb_ucs2_t *s2) -{ - if (s1 == s2) - return(True); - if (!s1 || !s2) - return(False); - - return(StrCaseCmp_w(s1,s2)==0); + return NULL; } -/******************************************************************* - Compare 2 strings up to and including the nth char. n is in ucs2 - units. -******************************************************************/ - -BOOL strnequal_w(const smb_ucs2_t *s1,const smb_ucs2_t *s2,size_t n) -{ - if (s1 == s2) - return(True); - if (!s1 || !s2 || !n) - return(False); - - return(StrnCaseCmp_w(s1,s2,n)==0); -} - -/******************************************************************* - Compare 2 strings (case sensitive). -********************************************************************/ - -BOOL strcsequal_w(const smb_ucs2_t *s1,const smb_ucs2_t *s2) -{ - if (s1 == s2) - return(True); - if (!s1 || !s2) - return(False); - - return(strcmp_w(s1,s2)==0); -} /******************************************************************* Convert a string to lower case. ********************************************************************/ - void strlower_w(smb_ucs2_t *s) { while (*s) { @@ -1278,7 +254,6 @@ void strlower_w(smb_ucs2_t *s) /******************************************************************* Convert a string to upper case. ********************************************************************/ - void strupper_w(smb_ucs2_t *s) { while (*s) { @@ -1289,547 +264,70 @@ void strupper_w(smb_ucs2_t *s) } /******************************************************************* - Convert a string to "normal" form. -********************************************************************/ - -void strnorm_w(smb_ucs2_t *s) -{ - extern int case_default; - if (case_default == CASE_UPPER) - strupper_w(s); - else - strlower_w(s); -} - -/******************************************************************* - Check if a string is in "normal" case. +case insensitive string comparison ********************************************************************/ - -BOOL strisnormal_w(smb_ucs2_t *s) +int strcasecmp_w(const smb_ucs2_t *a, const smb_ucs2_t *b) { - extern int case_default; - if (case_default == CASE_UPPER) - return(!strhaslower_w(s)); - - return(!strhasupper_w(s)); + while (*b && tolower_w(*a) == tolower_w(*b)) { a++; b++; } + return (tolower_w(*a) - tolower_w(*b)); } -/**************************************************************************** - String replace. -****************************************************************************/ -void string_replace_w(smb_ucs2_t *s, smb_ucs2_t oldc, smb_ucs2_t newc) -{ - while (*s) { - if (oldc == *s) - *s = newc; - s++; - } -} - -/******************************************************************* - Skip past some strings in a buffer. n is in bytes. -********************************************************************/ - -smb_ucs2_t *skip_string_w(smb_ucs2_t *buf,size_t n) -{ - while (n--) - buf += (strlen_w(buf)*sizeof(smb_ucs2_t)) + 1; - return(buf); -} - -/******************************************************************* - Count the number of characters in a string. Same as strlen_w in - smb_ucs2_t string units. -********************************************************************/ +/* + The *_wa() functions take a combination of 7 bit ascii + and wide characters They are used so that you can use string + functions combining C string constants with ucs2 strings -size_t str_charnum_w(const smb_ucs2_t *s) -{ - return strlen_w(s); -} + The char* arguments must NOT be multibyte - to be completely sure + of this only pass string constants */ -/******************************************************************* - Trim the specified elements off the front and back of a string. -********************************************************************/ -BOOL trim_string_w(smb_ucs2_t *s,const smb_ucs2_t *front,const smb_ucs2_t *back) +void pstrcpy_wa(smb_ucs2_t *dest, const char *src) { - BOOL ret = False; - size_t front_len = (front && *front) ? strlen_w(front) : 0; - size_t back_len = (back && *back) ? strlen_w(back) : 0; - size_t s_len; - - while (front_len && strncmp_w(s, front, front_len) == 0) { - smb_ucs2_t *p = s; - ret = True; - - while (1) { - if (!(*p = p[front_len])) - break; - p++; - } - } - - if(back_len) { - s_len = strlen_w(s); - while ((s_len >= back_len) && - (strncmp_w(s + s_len - back_len, back, back_len)==0)) { - ret = True; - s[s_len - back_len] = 0; - s_len = strlen_w(s); - } + int i; + for (i=0;i<PSTRING_LEN;i++) { + dest[i] = UCS2_CHAR(src[i]); + if (src[i] == 0) return; } - - return(ret); } -/**************************************************************************** - Does a string have any uppercase chars in it ? -****************************************************************************/ - -BOOL strhasupper_w(const smb_ucs2_t *s) +int strcmp_wa(const smb_ucs2_t *a, const char *b) { - while (*s) { - if (isupper_w(*s)) - return(True); - s++; - } - return(False); + while (*b && *a == UCS2_CHAR(*b)) { a++; b++; } + return (*a - UCS2_CHAR(*b)); } -/**************************************************************************** - Does a string have any lowercase chars in it ? -****************************************************************************/ - -BOOL strhaslower_w(const smb_ucs2_t *s) +smb_ucs2_t *strchr_wa(const smb_ucs2_t *s, char c) { - while (*s) { - if (islower(*s)) - return(True); + while (*s != 0) { + if (UCS2_CHAR(c) == *s) return (smb_ucs2_t *)s; s++; } - return(False); + return NULL; } -/**************************************************************************** - Find the number of 'c' chars in a string. -****************************************************************************/ - -size_t count_chars_w(const smb_ucs2_t *s,smb_ucs2_t c) +smb_ucs2_t *strrchr_wa(const smb_ucs2_t *s, char c) { - size_t count=0; - - while (*s) { - if (*s == c) - count++; - s++; + const smb_ucs2_t *p = s; + int len = strlen_w(s); + if (len == 0) return NULL; + p += (len-1); + while (p != s) { + if (UCS2_CHAR(c) == *p) return (smb_ucs2_t *)p; + p--; } - return(count); + return NULL; } -/******************************************************************* - Return True if a string consists only of one particular character. -********************************************************************/ - -BOOL str_is_all_w(const smb_ucs2_t *s,smb_ucs2_t c) +smb_ucs2_t *strpbrk_wa(const smb_ucs2_t *s, const char *p) { - if(s == NULL) - return False; - if(!*s) - return False; - - while (*s) { - if (*s != c) - return False; + while (*s != 0) { + int i; + for (i=0; p[i] && *s != UCS2_CHAR(p[i]); i++) + ; + if (p[i]) return (smb_ucs2_t *)s; s++; } - return True; -} - -/******************************************************************* - Paranoid strcpy into a buffer of given length (includes terminating - zero. Strips out all but 'a-Z0-9' and replaces with '_'. Deliberately - does *NOT* check for multibyte characters. Don't change it ! - maxlength is in ucs2 units. -********************************************************************/ - -smb_ucs2_t *alpha_strcpy_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const smb_ucs2_t *other_safe_chars, size_t maxlength) -{ - size_t len, i; - smb_ucs2_t nullstr_w = (smb_ucs2_t)0; - - if (!dest) { - DEBUG(0,("ERROR: NULL dest in alpha_strcpy_w\n")); - return NULL; - } - - if (!src) { - *dest = 0; - return dest; - } - - len = strlen_w(src); - if (len >= maxlength) - len = maxlength - 1; - - if (!other_safe_chars) - other_safe_chars = &nullstr_w; - - for(i = 0; i < len; i++) { - smb_ucs2_t val = src[i]; - if(isupper_w(val) ||islower_w(val) || isdigit_w(val) || strchr_w(other_safe_chars, val)) - dest[i] = src[i]; - else - dest[i] = (smb_ucs2_t)'_'; - } - - dest[i] = 0; - - return dest; -} - -/**************************************************************************** - Like strncpy but always null terminates. Make sure there is room ! - The variable n should always be one less than the available size and is in - ucs2 units. -****************************************************************************/ - -smb_ucs2_t *StrnCpy_w(smb_ucs2_t *dest,const smb_ucs2_t *src,size_t n) -{ - smb_ucs2_t *d = dest; - if (!dest) - return(NULL); - if (!src) { - *dest = 0; - return(dest); - } - - while (n-- && (*d++ = *src++)) - ; - *d = 0; - return(dest); -} - -/**************************************************************************** - Like strncpy but copies up to the character marker. Always null terminates. - returns a pointer to the character marker in the source string (src). - n is in ucs2 units. -****************************************************************************/ - -smb_ucs2_t *strncpyn_w(smb_ucs2_t *dest, const smb_ucs2_t *src,size_t n, smb_ucs2_t c) -{ - smb_ucs2_t *p; - size_t str_len; - - p = strchr_w(src, c); - if (p == NULL) { - fstring cval; - smb_ucs2_t mbcval[2]; - mbcval[0] = c; - mbcval[1] = 0; - DEBUG(5, ("strncpyn_w: separator character (%s) not found\n", - unicode_to_unix(cval,mbcval,sizeof(cval)) )); - return NULL; - } - - str_len = PTR_DIFF(p, src) + 1; - safe_strcpy_w(dest, src, MIN(n, str_len)); - - return p; -} - -/************************************************************* - Routine to get hex characters and turn them into a 16 byte array. - The array can be variable length, and any non-hex-numeric - characters are skipped. "0xnn" or "0Xnn" is specially catered - for. len is in bytes. - Valid examples: "0A5D15"; "0x15, 0x49, 0xa2"; "59\ta9\te3\n" -**************************************************************/ - -static smb_ucs2_t hexprefix[] = { (smb_ucs2_t)'0', (smb_ucs2_t)'x', 0 }; -static smb_ucs2_t hexchars[] = { (smb_ucs2_t)'0', (smb_ucs2_t)'1', (smb_ucs2_t)'2', (smb_ucs2_t)'3', - (smb_ucs2_t)'4', (smb_ucs2_t)'5', (smb_ucs2_t)'6', (smb_ucs2_t)'7', - (smb_ucs2_t)'8', (smb_ucs2_t)'9', (smb_ucs2_t)'A', (smb_ucs2_t)'B', - (smb_ucs2_t)'C', (smb_ucs2_t)'D', (smb_ucs2_t)'E', (smb_ucs2_t)'F', 0 }; - -size_t strhex_to_str_w(char *p, size_t len, const smb_ucs2_t *strhex) -{ - size_t i; - size_t num_chars = 0; - unsigned char lonybble, hinybble; - smb_ucs2_t *p1 = NULL, *p2 = NULL; - - /* - * Convert to smb_ucs2_t units. - */ - - len /= sizeof(smb_ucs2_t); - - for (i = 0; i < len && strhex[i] != 0; i++) { - if (strnequal_w(hexchars, hexprefix, 2)) { - i++; /* skip two chars */ - continue; - } - - if (!(p1 = strchr_w(hexchars, toupper_w(strhex[i])))) - break; - - i++; /* next hex digit */ - - if (!(p2 = strchr_w(hexchars, toupper_w(strhex[i])))) - break; - - /* get the two nybbles */ - hinybble = (PTR_DIFF(p1, hexchars)/sizeof(smb_ucs2_t)); - lonybble = (PTR_DIFF(p2, hexchars)/sizeof(smb_ucs2_t)); - - p[num_chars] = (hinybble << 4) | lonybble; - num_chars++; - - p1 = NULL; - p2 = NULL; - } - return num_chars; -} - - -/* This is used to prevent lots of mallocs of size 2 */ -static smb_ucs2_t *null_string = NULL; - -/**************************************************************************** - Set a string value, allocing the space for the string. -****************************************************************************/ - -BOOL string_init_w(smb_ucs2_t **dest,const smb_ucs2_t *src) -{ - size_t l; - - if (!null_string) { - if((null_string = (smb_ucs2_t *)malloc(sizeof(smb_ucs2_t))) == NULL) { - DEBUG(0,("string_init_w: malloc fail for null_string.\n")); - return False; - } - *null_string = 0; - } - - if (!src) - src = null_string; - - l = strlen_w(src); - - if (l == 0) - *dest = null_string; - else { - (*dest) = (smb_ucs2_t *)malloc(sizeof(smb_ucs2_t)*(l+1)); - if ((*dest) == NULL) { - DEBUG(0,("Out of memory in string_init_w\n")); - return False; - } - - wpstrcpy(*dest,src); - } - return(True); -} - -/**************************************************************************** - Free a string value. -****************************************************************************/ - -void string_free_w(smb_ucs2_t **s) -{ - if (!s || !(*s)) - return; - if (*s == null_string) - *s = NULL; - if (*s) - free((char *)*s); - *s = NULL; -} - -/**************************************************************************** - Set a string value, allocing the space for the string, and deallocating any - existing space. -****************************************************************************/ - -BOOL string_set_w(smb_ucs2_t **dest,const smb_ucs2_t *src) -{ - string_free_w(dest); - - return(string_init_w(dest,src)); -} - -/**************************************************************************** - Substitute a string for a pattern in another string. Make sure there is - enough room ! - - This routine looks for pattern in s and replaces it with - insert. It may do multiple replacements. - - Any of " ; ' $ or ` in the insert string are replaced with _ - if len==0 then no length check is performed - len is in ucs2 units. -****************************************************************************/ - -void string_sub_w(smb_ucs2_t *s,const smb_ucs2_t *pattern,const smb_ucs2_t *insert, size_t len) -{ - smb_ucs2_t *p; - ssize_t ls,lp,li, i; - - if (!insert || !pattern || !s) - return; - - ls = (ssize_t)strlen_w(s); - lp = (ssize_t)strlen_w(pattern); - li = (ssize_t)strlen_w(insert); - - if (!*pattern) - return; - - while (lp <= ls && (p = strstr_w(s,pattern))) { - if (len && (ls + (li-lp) >= len)) { - fstring out; - DEBUG(0,("ERROR: string overflow by %d in string_sub_w(%.50s, %d)\n", - (int)(sizeof(smb_ucs2_t)*(ls + (li-lp) - len)), - unicode_to_unix(out,pattern,sizeof(out)), (int)len*sizeof(smb_ucs2_t))); - break; - } - if (li != lp) - memmove(p+li,p+lp,sizeof(smb_ucs2_t)*(strlen_w(p+lp)+1)); - - for (i=0;i<li;i++) { - switch (insert[i]) { - case (smb_ucs2_t)'`': - case (smb_ucs2_t)'"': - case (smb_ucs2_t)'\'': - case (smb_ucs2_t)';': - case (smb_ucs2_t)'$': - case (smb_ucs2_t)'%': - case (smb_ucs2_t)'\r': - case (smb_ucs2_t)'\n': - p[i] = (smb_ucs2_t)'_'; - break; - default: - p[i] = insert[i]; - } - } - s = p + li; - ls += (li-lp); - } -} - -void fstring_sub_w(smb_ucs2_t *s,const smb_ucs2_t *pattern,const smb_ucs2_t *insert) -{ - string_sub_w(s, pattern, insert, sizeof(wfstring)); -} - -void pstring_sub_w(smb_ucs2_t *s,const smb_ucs2_t *pattern,smb_ucs2_t *insert) -{ - string_sub_w(s, pattern, insert, sizeof(wpstring)); -} - -/**************************************************************************** - Similar to string_sub() but allows for any character to be substituted. - Use with caution ! - if len==0 then no length check is performed. -****************************************************************************/ - -void all_string_sub_w(smb_ucs2_t *s,const smb_ucs2_t *pattern,const smb_ucs2_t *insert, size_t len) -{ - smb_ucs2_t *p; - ssize_t ls,lp,li; - - if (!insert || !pattern || !s) - return; - - ls = (ssize_t)strlen_w(s); - lp = (ssize_t)strlen_w(pattern); - li = (ssize_t)strlen_w(insert); - - if (!*pattern) - return; - - while (lp <= ls && (p = strstr_w(s,pattern))) { - if (len && (ls + (li-lp) >= len)) { - fstring out; - DEBUG(0,("ERROR: string overflow by %d in all_string_sub_w(%.50s, %d)\n", - (int)(sizeof(smb_ucs2_t)*(ls + (li-lp) - len)), - unicode_to_unix(out,pattern,sizeof(out)), (int)len*sizeof(smb_ucs2_t))); - break; - } - if (li != lp) - memmove(p+li,p+lp,sizeof(smb_ucs2_t)*(strlen_w(p+lp)+1)); - - memcpy(p, insert, li*sizeof(smb_ucs2_t)); - s = p + li; - ls += (li-lp); - } -} - -/**************************************************************************** - Splits out the front and back at a separator. -****************************************************************************/ - -void split_at_last_component_w(smb_ucs2_t *path, smb_ucs2_t *front, smb_ucs2_t sep, smb_ucs2_t *back) -{ - smb_ucs2_t *p = strrchr_w(path, sep); - - if (p != NULL) - *p = 0; - - if (front != NULL) - wpstrcpy(front, path); - - if (p != NULL) { - if (back != NULL) - wpstrcpy(back, p+1); - *p = (smb_ucs2_t)'\\'; - } else { - if (back != NULL) - back[0] = 0; - } -} - - -/**************************************************************************** - Write an octal as a string. -****************************************************************************/ - -smb_ucs2_t *octal_string_w(int i) -{ - static smb_ucs2_t wret[64]; - char ret[64]; - - if (i == -1) - slprintf(ret, sizeof(ret)-1, "-1"); - else - slprintf(ret, sizeof(ret)-1, "0%o", i); - return unix_to_unicode(wret, ret, sizeof(wret)); -} - - -/**************************************************************************** - Truncate a string at a specified length. - length is in ucs2 units. -****************************************************************************/ - -smb_ucs2_t *string_truncate_w(smb_ucs2_t *s, size_t length) -{ - if (s && strlen_w(s) > length) - s[length] = 0; - - return s; -} - -/****************************************************************** - functions for UTF8 support (using in kanji.c) - ******************************************************************/ -smb_ucs2_t doscp2ucs2(int w) -{ - return ((smb_ucs2_t)doscp_to_ucs2[w]); -} - -int ucs2doscp(smb_ucs2_t w) -{ - return ((int)ucs2_to_doscp[w]); + return NULL; } diff --git a/source3/libsmb/cli_lsarpc.c b/source3/libsmb/cli_lsarpc.c index 88f0dff225..61afeb7f38 100644 --- a/source3/libsmb/cli_lsarpc.c +++ b/source3/libsmb/cli_lsarpc.c @@ -268,11 +268,8 @@ uint32 cli_lsa_lookup_sids(struct cli_state *cli, TALLOC_CTX *mem_ctx, /* Translate optimised name through domain index array */ if (dom_idx != 0xffffffff) { - unistr2_to_ascii(dom_name, - &ref.ref_dom[dom_idx].uni_dom_name, - sizeof(dom_name)- 1); - unistr2_to_ascii(name, &t_names.uni_name[i], - sizeof(name) - 1); + pull_ascii_fstring(dom_name, &ref.ref_dom[dom_idx].uni_dom_name); + pull_ascii_fstring(name, &t_names.uni_name[i]); slprintf(full_name, sizeof(full_name) - 1, "%s%s%s", dom_name, dom_name[0] ? diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index 67eef52583..7ec0627682 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -26,7 +26,7 @@ static struct { int prot; - char *name; + const char *name; } prots[] = { @@ -84,8 +84,7 @@ BOOL cli_session_setup(struct cli_state *cli, */ passlen = 24; ntpasslen = 24; - fstrcpy(pword, pass); - unix_to_dos(pword,True); + clistr_push(cli, pword, pass, -1, STR_TERMINATE); fstrcpy(ntpword, ntpass);; SMBencrypt((uchar *)pword,(uchar *)cli->cryptkey,(uchar *)pword); SMBNTencrypt((uchar *)ntpword,(uchar *)cli->cryptkey,(uchar *)ntpword); @@ -104,7 +103,7 @@ BOOL cli_session_setup(struct cli_state *cli, /* * Plaintext mode needed, assume plaintext supplied. */ - passlen = clistr_push(cli, pword, pass, -1, STR_CONVERT|STR_TERMINATE); + passlen = clistr_push(cli, pword, pass, -1, STR_TERMINATE); fstrcpy(ntpword, ""); ntpasslen = 0; } @@ -136,7 +135,7 @@ BOOL cli_session_setup(struct cli_state *cli, p = smb_buf(cli->outbuf); memcpy(p,pword,passlen); p += passlen; - p += clistr_push(cli, p, user, -1, STR_CONVERT|STR_UPPER|STR_TERMINATE); + p += clistr_push(cli, p, user, -1, STR_UPPER|STR_TERMINATE); cli_setup_bcc(cli, p); } else @@ -167,10 +166,10 @@ BOOL cli_session_setup(struct cli_state *cli, p += SVAL(cli->outbuf,smb_vwv7); memcpy(p,ntpword,ntpasslen); p += SVAL(cli->outbuf,smb_vwv8); - p += clistr_push(cli, p, user, -1, STR_CONVERT|STR_TERMINATE|STR_UPPER); - p += clistr_push(cli, p, workgroup, -1, STR_CONVERT|STR_TERMINATE|STR_UPPER); - p += clistr_push(cli, p, "Unix", -1, STR_CONVERT|STR_TERMINATE); - p += clistr_push(cli, p, "Samba", -1, STR_CONVERT|STR_TERMINATE); + p += clistr_push(cli, p, user, -1, STR_TERMINATE|STR_UPPER); + p += clistr_push(cli, p, workgroup, -1, STR_TERMINATE|STR_UPPER); + p += clistr_push(cli, p, "Unix", -1, STR_TERMINATE); + p += clistr_push(cli, p, "Samba", -1, STR_TERMINATE); cli_setup_bcc(cli, p); } @@ -193,9 +192,9 @@ BOOL cli_session_setup(struct cli_state *cli, * info. */ char *q = smb_buf(cli->inbuf); - q += clistr_pull(cli, cli->server_os, q, sizeof(fstring), -1, STR_TERMINATE|STR_CONVERT); - q += clistr_pull(cli, cli->server_type, q, sizeof(fstring), -1, STR_TERMINATE|STR_CONVERT); - q += clistr_pull(cli, cli->server_domain, q, sizeof(fstring), -1, STR_TERMINATE|STR_CONVERT); + q += clistr_pull(cli, cli->server_os, q, sizeof(fstring), -1, STR_TERMINATE); + q += clistr_pull(cli, cli->server_type, q, sizeof(fstring), -1, STR_TERMINATE); + q += clistr_pull(cli, cli->server_domain, q, sizeof(fstring), -1, STR_TERMINATE); } fstrcpy(cli->user_name, user); @@ -227,7 +226,7 @@ BOOL cli_ulogoff(struct cli_state *cli) send a tconX ****************************************************************************/ BOOL cli_send_tconX(struct cli_state *cli, - char *share, char *dev, char *pass, int passlen) + const char *share, const char *dev, const char *pass, int passlen) { fstring fullshare, pword, dos_pword; char *p; @@ -247,15 +246,15 @@ BOOL cli_send_tconX(struct cli_state *cli, * Non-encrypted passwords - convert to DOS codepage before encryption. */ passlen = 24; - fstrcpy(dos_pword,pass); - unix_to_dos(dos_pword,True); + clistr_push(cli, dos_pword, pass, -1, STR_TERMINATE); + SMBencrypt((uchar *)dos_pword,(uchar *)cli->cryptkey,(uchar *)pword); } else { if((cli->sec_mode & 3) == 0) { /* * Non-encrypted passwords - convert to DOS codepage before using. */ - passlen = clistr_push(cli, pword, pass, -1, STR_CONVERT|STR_TERMINATE); + passlen = clistr_push(cli, pword, pass, -1, STR_TERMINATE); } else { memcpy(pword, pass, passlen); } @@ -263,8 +262,6 @@ BOOL cli_send_tconX(struct cli_state *cli, slprintf(fullshare, sizeof(fullshare)-1, "\\\\%s\\%s", cli->desthost, share); - unix_to_dos(fullshare, True); - strupper(fullshare); set_message(cli->outbuf,4, 0, True); CVAL(cli->outbuf,smb_com) = SMBtconX; @@ -276,7 +273,7 @@ BOOL cli_send_tconX(struct cli_state *cli, p = smb_buf(cli->outbuf); memcpy(p,pword,passlen); p += passlen; - p += clistr_push(cli, p, fullshare, -1, STR_CONVERT | STR_TERMINATE); + p += clistr_push(cli, p, fullshare, -1, STR_TERMINATE |STR_UPPER); fstrcpy(p, dev); p += strlen(dev)+1; cli_setup_bcc(cli, p); @@ -294,7 +291,7 @@ BOOL cli_send_tconX(struct cli_state *cli, fstrcpy(cli->dev, "A:"); if (cli->protocol >= PROTOCOL_NT1) { - clistr_pull(cli, cli->dev, smb_buf(cli->inbuf), sizeof(fstring), -1, STR_TERMINATE | STR_CONVERT); + clistr_pull(cli, cli->dev, smb_buf(cli->inbuf), sizeof(fstring), -1, STR_TERMINATE); } if (strcasecmp(share,"IPC$")==0) { @@ -350,9 +347,7 @@ void cli_negprot_send(struct cli_state *cli) prots[numprots].name && prots[numprots].prot<=cli->protocol; numprots++) { *p++ = 2; - pstrcpy(p,prots[numprots].name); - unix_to_dos(p,True); - p += strlen(p) + 1; + p += clistr_push(cli, p, prots[numprots].name, -1, STR_TERMINATE); } CVAL(cli->outbuf,smb_com) = SMBnegprot; @@ -389,9 +384,7 @@ BOOL cli_negprot(struct cli_state *cli) prots[numprots].name && prots[numprots].prot<=cli->protocol; numprots++) { *p++ = 2; - pstrcpy(p,prots[numprots].name); - unix_to_dos(p,True); - p += strlen(p) + 1; + p += clistr_push(cli, p, prots[numprots].name, -1, STR_TERMINATE); } CVAL(cli->outbuf,smb_com) = SMBnegprot; @@ -433,7 +426,7 @@ BOOL cli_negprot(struct cli_state *cli) if (smb_buflen(cli->inbuf) > 8) { clistr_pull(cli, cli->server_domain, smb_buf(cli->inbuf)+8, sizeof(cli->server_domain), - smb_buflen(cli->inbuf)-8, STR_CONVERT|STR_UNICODE|STR_NOALIGN); + smb_buflen(cli->inbuf)-8, STR_UNICODE|STR_NOALIGN); } } else if (cli->protocol >= PROTOCOL_LANMAN1) { cli->sec_mode = SVAL(cli->inbuf,smb_vwv1); @@ -762,9 +755,9 @@ BOOL cli_establish_connection(struct cli_state *cli, if (*cli->server_domain || *cli->server_os || *cli->server_type) { DEBUG(1,("Domain=[%s] OS=[%s] Server=[%s]\n", - cli->server_domain, - cli->server_os, - cli->server_type)); + cli->server_domain, + cli->server_os, + cli->server_type)); } if (do_tcon) diff --git a/source3/libsmb/clierror.c b/source3/libsmb/clierror.c index 77e2be805b..f533eabb0b 100644 --- a/source3/libsmb/clierror.c +++ b/source3/libsmb/clierror.c @@ -120,7 +120,7 @@ char *cli_errstr(struct cli_state *cli) { if (rap_errmap[i].err == cli->rap_error) { - fstrcpy( error_message, rap_errmap[i].message); + fstrcpy(error_message, rap_errmap[i].message); break; } } diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 2c4eef9bbe..215c500c30 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -44,10 +44,10 @@ BOOL cli_rename(struct cli_state *cli, char *fname_src, char *fname_dst) p = smb_buf(cli->outbuf); *p++ = 4; p += clistr_push(cli, p, fname_src, -1, - STR_TERMINATE | STR_CONVERT); + STR_TERMINATE); *p++ = 4; p += clistr_push(cli, p, fname_dst, -1, - STR_TERMINATE | STR_CONVERT); + STR_TERMINATE); cli_setup_bcc(cli, p); @@ -83,7 +83,7 @@ BOOL cli_unlink(struct cli_state *cli, char *fname) p = smb_buf(cli->outbuf); *p++ = 4; - p += clistr_push(cli, p, fname, -1, STR_TERMINATE | STR_CONVERT); + p += clistr_push(cli, p, fname, -1, STR_TERMINATE); cli_setup_bcc(cli, p); cli_send_smb(cli); @@ -116,7 +116,7 @@ BOOL cli_mkdir(struct cli_state *cli, char *dname) p = smb_buf(cli->outbuf); *p++ = 4; - p += clistr_push(cli, p, dname, -1, STR_CONVERT|STR_TERMINATE); + p += clistr_push(cli, p, dname, -1, 0); cli_setup_bcc(cli, p); @@ -150,7 +150,7 @@ BOOL cli_rmdir(struct cli_state *cli, char *dname) p = smb_buf(cli->outbuf); *p++ = 4; - p += clistr_push(cli, p, dname, -1, STR_TERMINATE|STR_CONVERT); + p += clistr_push(cli, p, dname, -1, STR_TERMINATE); cli_setup_bcc(cli, p); @@ -243,8 +243,8 @@ int cli_nt_create_full(struct cli_state *cli, char *fname, uint32 DesiredAccess, p = smb_buf(cli->outbuf); /* this alignment and termination is critical for netapp filers. Don't change */ - p += clistr_align_out(cli, p, STR_CONVERT); - len = clistr_push(cli, p, fname, -1, STR_CONVERT); + p += clistr_align_out(cli, p, 0); + len = clistr_push(cli, p, fname, -1, 0); p += len; SSVAL(cli->outbuf,smb_ntcreate_NameLength, len); /* sigh. this copes with broken netapp filer behaviour */ @@ -336,7 +336,7 @@ int cli_open(struct cli_state *cli, char *fname, int flags, int share_mode) } p = smb_buf(cli->outbuf); - p += clistr_push(cli, p, fname, -1, STR_TERMINATE | STR_CONVERT); + p += clistr_push(cli, p, fname, -1, STR_TERMINATE); cli_setup_bcc(cli, p); @@ -648,7 +648,7 @@ BOOL cli_getatr(struct cli_state *cli, char *fname, p = smb_buf(cli->outbuf); *p++ = 4; - p += clistr_push(cli, p, fname, -1, STR_TERMINATE | STR_CONVERT); + p += clistr_push(cli, p, fname, -1, STR_TERMINATE); cli_setup_bcc(cli, p); @@ -699,7 +699,7 @@ BOOL cli_setatr(struct cli_state *cli, char *fname, uint16 attr, time_t t) p = smb_buf(cli->outbuf); *p++ = 4; - p += clistr_push(cli, p, fname, -1, STR_TERMINATE | STR_CONVERT); + p += clistr_push(cli, p, fname, -1, STR_TERMINATE); *p++ = 4; cli_setup_bcc(cli, p); @@ -736,7 +736,7 @@ BOOL cli_chkpath(struct cli_state *cli, char *path) cli_setup_packet(cli); p = smb_buf(cli->outbuf); *p++ = 4; - p += clistr_push(cli, p, path2, -1, STR_TERMINATE | STR_CONVERT); + p += clistr_push(cli, p, path2, -1, STR_TERMINATE); cli_setup_bcc(cli, p); @@ -796,7 +796,7 @@ int cli_ctemp(struct cli_state *cli, char *path, char **tmp_path) p = smb_buf(cli->outbuf); *p++ = 4; - p += clistr_push(cli, p, path, -1, STR_TERMINATE | STR_CONVERT); + p += clistr_push(cli, p, path, -1, STR_TERMINATE); cli_setup_bcc(cli, p); @@ -812,7 +812,7 @@ int cli_ctemp(struct cli_state *cli, char *path, char **tmp_path) if (tmp_path) { pstring path2; clistr_pull(cli, path2, smb_buf(cli->inbuf)+1, - sizeof(path2), -1, STR_TERMINATE | STR_CONVERT); + sizeof(path2), -1, STR_TERMINATE); *tmp_path = strdup(path2); } diff --git a/source3/libsmb/clilist.c b/source3/libsmb/clilist.c index 9080a9c221..b08cc08f01 100644 --- a/source3/libsmb/clilist.c +++ b/source3/libsmb/clilist.c @@ -51,7 +51,7 @@ static int interpret_long_filename(struct cli_state *cli, clistr_pull(cli, finfo->name, p+27, sizeof(finfo->name), -1, - STR_TERMINATE | STR_CONVERT); + STR_TERMINATE); } return(28 + CVAL(p,26)); @@ -66,7 +66,7 @@ static int interpret_long_filename(struct cli_state *cli, clistr_pull(cli, finfo->name, p+31, sizeof(finfo->name), -1, - STR_TERMINATE | STR_CONVERT); + STR_TERMINATE); } return(32 + CVAL(p,30)); @@ -82,7 +82,7 @@ static int interpret_long_filename(struct cli_state *cli, clistr_pull(cli, finfo->name, p+33, sizeof(finfo->name), -1, - STR_TERMINATE | STR_CONVERT); + STR_TERMINATE); } return(SVAL(p,4)+4); @@ -97,7 +97,7 @@ static int interpret_long_filename(struct cli_state *cli, clistr_pull(cli, finfo->name, p+37, sizeof(finfo->name), -1, - STR_TERMINATE | STR_CONVERT); + STR_TERMINATE); } return(SVAL(p,4)+4); @@ -135,7 +135,7 @@ static int interpret_long_filename(struct cli_state *cli, p += 2; { /* stupid NT bugs. grr */ - int flags = STR_CONVERT; + int flags = 0; if (p[1] == 0 && namelen > 1) flags |= STR_UNICODE; clistr_pull(cli, finfo->short_name, p, sizeof(finfo->short_name), @@ -144,8 +144,7 @@ static int interpret_long_filename(struct cli_state *cli, p += 24; /* short name? */ clistr_pull(cli, finfo->name, p, sizeof(finfo->name), - namelen, - STR_CONVERT); + namelen, 0); return(ret); } return(SVAL(p,0)); @@ -203,7 +202,7 @@ int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute, SIVAL(param,8,0); p = param+12; p += clistr_push(cli, param+12, mask, -1, - STR_TERMINATE | STR_CONVERT); + STR_TERMINATE); } else { setup = TRANSACT2_FINDNEXT; SSVAL(param,0,ff_dir_handle); @@ -213,7 +212,7 @@ int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute, SSVAL(param,10,8+4+2); /* continue + resume required + close on end */ p = param+12; p += clistr_push(cli, param+12, mask, -1, - STR_TERMINATE | STR_CONVERT); + STR_TERMINATE); } param_len = PTR_DIFF(p, param); @@ -271,15 +270,13 @@ int cli_list_new(struct cli_state *cli,const char *Mask,uint16 attribute, clistr_pull(cli, mask, p+ff_lastname, sizeof(mask), data_len-ff_lastname, - STR_TERMINATE | - STR_CONVERT); + STR_TERMINATE); break; case 1: clistr_pull(cli, mask, p+ff_lastname+1, sizeof(mask), -1, - STR_TERMINATE | - STR_CONVERT); + STR_TERMINATE); break; } } else { @@ -345,7 +342,7 @@ static int interpret_short_filename(struct cli_state *cli, char *p,file_info *fi finfo->ctime = make_unix_date(p+22); finfo->mtime = finfo->atime = finfo->ctime; finfo->size = IVAL(p,26); - clistr_pull(cli, finfo->name, p+30, sizeof(finfo->name), 12, STR_CONVERT|STR_ASCII); + clistr_pull(cli, finfo->name, p+30, sizeof(finfo->name), 12, STR_ASCII); if (strcmp(finfo->name, "..") && strcmp(finfo->name, ".")) fstrcpy(finfo->short_name,finfo->name); @@ -392,7 +389,7 @@ int cli_list_old(struct cli_state *cli,const char *Mask,uint16 attribute, p = smb_buf(cli->outbuf); *p++ = 4; - p += clistr_push(cli, p, first?mask:"", -1, STR_TERMINATE|STR_CONVERT); + p += clistr_push(cli, p, first?mask:"", -1, STR_TERMINATE); *p++ = 5; if (first) { SSVAL(p,0,0); diff --git a/source3/libsmb/climessage.c b/source3/libsmb/climessage.c index d46986bfd6..e0a308104b 100644 --- a/source3/libsmb/climessage.c +++ b/source3/libsmb/climessage.c @@ -41,11 +41,9 @@ BOOL cli_message_start(struct cli_state *cli, char *host, char *username, p = smb_buf(cli->outbuf); *p++ = 4; - p += clistr_push(cli, p, username, -1, - STR_TERMINATE|STR_CONVERT); + p += clistr_push(cli, p, username, -1, STR_TERMINATE); *p++ = 4; - p += clistr_push(cli, p, host, -1, - STR_TERMINATE|STR_CONVERT); + p += clistr_push(cli, p, host, -1, STR_TERMINATE); cli_setup_bcc(cli, p); diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c index 253d192aba..c16fe2d08d 100644 --- a/source3/libsmb/clirap.c +++ b/source3/libsmb/clirap.c @@ -181,8 +181,8 @@ int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, co char *cmnt = comment_offset?(rdata+comment_offset-converter):""; pstring s1, s2; - pstrcpy(s1, dos_to_unix(sname, False)); - pstrcpy(s2, dos_to_unix(cmnt, False)); + pull_ascii_pstring(s1, sname); + pull_ascii_pstring(s2, cmnt); fn(s1, type, s2, state); } @@ -237,8 +237,7 @@ BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype, SIVAL(p,0,stype); p += 4; - p += clistr_push(cli, p, workgroup, -1, - STR_TERMINATE | STR_CONVERT | STR_ASCII); + p += push_pstring(p, workgroup); if (cli_api(cli, param, PTR_DIFF(p,param), 8, /* params, length, max */ @@ -265,8 +264,8 @@ BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype, stype = IVAL(p,18) & ~SV_TYPE_LOCAL_LIST_ONLY; - pstrcpy(s1, dos_to_unix(sname, False)); - pstrcpy(s2, dos_to_unix(cmnt, False)); + pull_ascii_pstring(s1, sname); + pull_ascii_pstring(s2, cmnt); fn(s1, stype, s2, state); } } @@ -325,13 +324,10 @@ BOOL cli_oem_change_password(struct cli_state *cli, const char *user, const char * use this as the key to make_oem_passwd_hash(). */ memset(upper_case_old_pw, '\0', sizeof(upper_case_old_pw)); - fstrcpy(upper_case_old_pw, old_password); - unix_to_dos(upper_case_old_pw,True); - strupper(upper_case_old_pw); + clistr_push(cli, upper_case_old_pw, old_password, -1,STR_TERMINATE|STR_UPPER); E_P16((uchar *)upper_case_old_pw, old_pw_hash); - pstrcpy(dos_new_password, new_password); - unix_to_dos(dos_new_password, True); + clistr_push(cli, dos_new_password, new_password, -1, STR_TERMINATE); if (!make_oem_passwd_hash( data, dos_new_password, old_pw_hash, False)) return False; @@ -340,9 +336,7 @@ BOOL cli_oem_change_password(struct cli_state *cli, const char *user, const char * Now place the old password hash in the data. */ memset(upper_case_new_pw, '\0', sizeof(upper_case_new_pw)); - fstrcpy(upper_case_new_pw, new_password); - unix_to_dos(upper_case_new_pw,True); - strupper(upper_case_new_pw); + clistr_push(cli, upper_case_new_pw, new_password, -1, STR_TERMINATE|STR_UPPER); E_P16((uchar *)upper_case_new_pw, new_pw_hash); @@ -399,7 +393,7 @@ BOOL cli_qpathinfo(struct cli_state *cli, const char *fname, memset(p, 0, 6); SSVAL(p, 0, SMB_INFO_STANDARD); p += 6; - p += clistr_push(cli, p, fname, sizeof(pstring)-6, STR_TERMINATE | STR_CONVERT); + p += clistr_push(cli, p, fname, sizeof(pstring)-6, STR_TERMINATE); param_len = PTR_DIFF(p, param); @@ -475,7 +469,7 @@ BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname, memset(p, 0, 6); SSVAL(p, 0, SMB_QUERY_FILE_ALL_INFO); p += 6; - p += clistr_push(cli, p, fname, sizeof(pstring)-6, STR_TERMINATE | STR_CONVERT); + p += clistr_push(cli, p, fname, sizeof(pstring)-6, STR_TERMINATE); param_len = PTR_DIFF(p, param); diff --git a/source3/libsmb/clistr.c b/source3/libsmb/clistr.c index 6dd3b751b4..baec3e5da8 100644 --- a/source3/libsmb/clistr.c +++ b/source3/libsmb/clistr.c @@ -19,147 +19,26 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define NO_SYSLOG - #include "includes.h" -#define UNICODE_FLAG(cli, flags) (!(flags & STR_ASCII) && \ - ((flags & STR_UNICODE || \ - (SVAL(cli->outbuf, smb_flg2) & FLAGS2_UNICODE_STRINGS)))) - -/**************************************************************************** -copy a string from a char* src to a unicode or ascii -dos code page destination choosing unicode or ascii based on the -cli->capabilities flag -return the number of bytes occupied by the string in the destination -flags can have: - STR_TERMINATE means include the null termination - STR_CONVERT means convert from unix to dos codepage - STR_UPPER means uppercase in the destination - STR_ASCII use ascii even with unicode servers - STR_NOALIGN means don't do alignment -dest_len is the maximum length allowed in the destination. If dest_len -is -1 then no maxiumum is used -****************************************************************************/ int clistr_push(struct cli_state *cli, void *dest, const char *src, int dest_len, int flags) { - int len=0; - - /* treat a pstring as "unlimited" length */ - if (dest_len == -1) { - dest_len = sizeof(pstring); - } - - if (clistr_align_out(cli, dest, flags)) { - *(char *)dest = 0; - dest = (void *)((char *)dest + 1); - dest_len--; - len++; - } - - if (!UNICODE_FLAG(cli, flags)) { - /* the server doesn't want unicode */ - safe_strcpy(dest, src, dest_len); - len = strlen(dest); - if (flags & STR_TERMINATE) len++; - if (flags & STR_CONVERT) unix_to_dos(dest,True); - if (flags & STR_UPPER) strupper(dest); - return len; - } - - /* the server likes unicode. give it the works */ - if (flags & STR_CONVERT) { - dos_PutUniCode(dest, src, dest_len, flags & STR_TERMINATE); - } else { - ascii_to_unistr(dest, src, dest_len); - } - if (flags & STR_UPPER) { - strupper_w(dest); - } - len += strlen(src)*2; - if (flags & STR_TERMINATE) len += 2; - return len; + return push_string(cli->outbuf, dest, src, dest_len, flags); } -/**************************************************************************** -copy a string from a unicode or ascii source (depending on -cli->capabilities) to a char* destination -flags can have: - STR_CONVERT means convert from dos to unix codepage - STR_TERMINATE means the string in src is null terminated - STR_UNICODE means to force as unicode - STR_NOALIGN means don't do alignment -if STR_TERMINATE is set then src_len is ignored -src_len is the length of the source area in bytes -return the number of bytes occupied by the string in src -****************************************************************************/ -int clistr_pull(struct cli_state *cli, char *dest, const void *src, int dest_len, int src_len, int flags) +int clistr_pull(struct cli_state *cli, char *dest, const void *src, int dest_len, int src_len, + int flags) { - int len; - - if (dest_len == -1) { - dest_len = sizeof(pstring); - } - - if (clistr_align_in(cli, src, flags)) { - src = (const void *)((const char *)src + 1); - if (src_len > 0) src_len--; - } - - if (!UNICODE_FLAG(cli, flags)) { - /* the server doesn't want unicode */ - if (flags & STR_TERMINATE) { - safe_strcpy(dest, src, dest_len); - len = strlen(src)+1; - } else { - if (src_len > dest_len) src_len = dest_len; - len = src_len; - memcpy(dest, src, len); - dest[len] = 0; - } - if (flags & STR_CONVERT) - safe_strcpy(dest,dos_to_unix(dest,False),dest_len); - return len; - } - - if (flags & STR_TERMINATE) { - unistr_to_ascii(dest, src, dest_len); - len = strlen(dest)*2 + 2; - } else { - int i, c; - if (dest_len*2 < src_len) src_len = 2*dest_len; - for (i=0; i < src_len; i += 2) { - c = SVAL(src, i); - *dest++ = c; - } - *dest++ = 0; - len = src_len; - } - if (flags & STR_CONVERT) - safe_strcpy(dest,dos_to_unix(dest,False),dest_len); - return len; + return pull_string(cli->inbuf, dest, src, dest_len, src_len, flags); } -/**************************************************************************** -return an alignment of either 0 or 1 -if unicode is not negotiated then return 0 -otherwise return 1 if offset is off -****************************************************************************/ -static int clistr_align(struct cli_state *cli, char *buf, const void *p, int flags) -{ - if ((flags & STR_NOALIGN) || !UNICODE_FLAG(cli, flags)) return 0; - return PTR_DIFF(p, buf) & 1; -} - int clistr_align_out(struct cli_state *cli, const void *p, int flags) { - return clistr_align(cli, cli->outbuf, p, flags); + return align_string(cli->outbuf, p, flags); } int clistr_align_in(struct cli_state *cli, const void *p, int flags) { - return clistr_align(cli, cli->inbuf, p, flags); + return align_string(cli->inbuf, p, flags); } - - diff --git a/source3/libsmb/clitrans.c b/source3/libsmb/clitrans.c index d21d179126..68583c4199 100644 --- a/source3/libsmb/clitrans.c +++ b/source3/libsmb/clitrans.c @@ -28,7 +28,7 @@ send a SMB trans or trans2 request ****************************************************************************/ BOOL cli_send_trans(struct cli_state *cli, int trans, - char *pipe_name, + const char *pipe_name, int fid, int flags, uint16 *setup, int lsetup, int msetup, char *param, int lparam, int mparam, diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c index bc70dc520b..10444a8ab9 100644 --- a/source3/libsmb/libsmbclient.c +++ b/source3/libsmb/libsmbclient.c @@ -446,8 +446,6 @@ int smbc_init(smbc_get_auth_data_fn fn, int debug) slprintf(my_netbios_name, 16, "smbc%s%d", user, pid); - charset_initialise(); - /* Here we would open the smb.conf file if needed ... */ home = getenv("HOME"); @@ -471,8 +469,6 @@ int smbc_init(smbc_get_auth_data_fn fn, int debug) } - codepage_initialise(lp_client_code_page()); /* Get a codepage */ - reopen_logs(); /* Get logging working ... */ name_register_wins(my_netbios_name, 0); diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index 465198dfad..18bf6f4804 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -182,9 +182,7 @@ BOOL name_status_find(int type, struct in_addr to_ip, char *name) } if (i == count) return False; - StrnCpy(name, status[i].name, 15); - - dos_to_unix(name, True); + pull_ascii(name, status[i].name, 15, 0, STR_TERMINATE); free(status); return True; @@ -1025,7 +1023,8 @@ NT GETDC call, UNICODE, NT domain SID and uncle tom cobbley and all... mailslot_name = bufp; bufp += (strlen(bufp) + 1); bufp = ALIGN2(bufp, buffer); - bufp += dos_PutUniCode(bufp, srcname, sizeof(buffer) - (bufp - buffer) - 1, True); + bufp += push_ucs2(NULL, bufp, srcname, sizeof(buffer) - (bufp - buffer), STR_TERMINATE); + SIVAL(bufp,0,1); SSVAL(bufp,4,0xFFFF); SSVAL(bufp,6,0xFFFF); diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c index 0a6bbe87e2..d3b0e68aef 100644 --- a/source3/libsmb/nmblib.c +++ b/source3/libsmb/nmblib.c @@ -831,9 +831,7 @@ void make_nmb_name( struct nmb_name *n, const char *name, int type) { extern pstring global_scope; memset( (char *)n, '\0', sizeof(struct nmb_name) ); - StrnCpy( n->name, name, 15 ); - unix_to_dos(n->name, True); - strupper( n->name ); + push_ascii(n->name, name, 15, STR_TERMINATE|STR_UPPER); n->name_type = (unsigned int)type & 0xFF; StrnCpy( n->scope, global_scope, 63 ); strupper( n->scope ); diff --git a/source3/libsmb/pwd_cache.c b/source3/libsmb/pwd_cache.c index 420b49ed2e..37a07a0001 100644 --- a/source3/libsmb/pwd_cache.c +++ b/source3/libsmb/pwd_cache.c @@ -145,8 +145,7 @@ void pwd_set_nullpwd(struct pwd_info *pwd) void pwd_set_cleartext(struct pwd_info *pwd, char *clr) { pwd_init(pwd); - fstrcpy(pwd->password, clr); - unix_to_dos(pwd->password,True); + push_ascii_fstring(pwd->password, clr); pwd->cleartext = True; pwd->null_pwd = False; pwd->crypted = False; @@ -157,13 +156,9 @@ void pwd_set_cleartext(struct pwd_info *pwd, char *clr) ****************************************************************************/ void pwd_get_cleartext(struct pwd_info *pwd, char *clr) { - if (pwd->cleartext) - { + if (pwd->cleartext) { fstrcpy(clr, pwd->password); - dos_to_unix(clr, True); - } - else - { + } else { clr[0] = 0; } } @@ -222,8 +217,7 @@ void pwd_make_lm_nt_16(struct pwd_info *pwd, char *clr) pwd_init(pwd); - pstrcpy(dos_passwd, clr); - unix_to_dos(dos_passwd, True); + push_ascii_pstring(dos_passwd, clr); nt_lm_owf_gen(dos_passwd, pwd->smb_nt_pwd, pwd->smb_lm_pwd); pwd->null_pwd = False; diff --git a/source3/libsmb/smbencrypt.c b/source3/libsmb/smbencrypt.c index b9827333d8..4cc8261e66 100644 --- a/source3/libsmb/smbencrypt.c +++ b/source3/libsmb/smbencrypt.c @@ -207,16 +207,8 @@ BOOL make_oem_passwd_hash(char data[516], const char *passwd, uchar old_pw_hash[ * decrypt. JRA. */ generate_random_buffer((unsigned char *)data, 516, False); - if (unicode) - { - /* Note that passwd should be in DOS oem character set. */ - dos_struni2( &data[512 - new_pw_len], passwd, 512); - } - else - { - /* Note that passwd should be in DOS oem character set. */ - fstrcpy( &data[512 - new_pw_len], passwd); - } + push_string(NULL, &data[512 - new_pw_len], passwd, new_pw_len, + STR_NOALIGN | (unicode?STR_UNICODE:STR_ASCII)); SIVAL(data, 512, new_pw_len); #ifdef DEBUG_PASSWORD @@ -236,26 +228,19 @@ BOOL encode_pw_buffer(char buffer[516], const char *new_pass, { generate_random_buffer(buffer, 516, True); - if (nt_pass_set) - { - /* - * nt passwords are in unicode. last char overwrites NULL - * in ascii_to_unibuf, so use SIVAL *afterwards*. - */ + if (nt_pass_set) { new_pw_len *= 2; - ascii_to_unistr((uint16 *)&buffer[512 - new_pw_len], new_pass, - new_pw_len); - } - else - { - memcpy(&buffer[512 - new_pw_len], new_pass, new_pw_len); + push_ucs2(NULL, &buffer[512 - new_pw_len], new_pass, + new_pw_len, 0); + } else { + push_ascii(&buffer[512 - new_pw_len], new_pass, + new_pw_len, 0); } /* * The length of the new password is in the last 4 bytes of * the data buffer. */ - SIVAL(buffer, 512, new_pw_len); return True; @@ -268,8 +253,6 @@ BOOL decode_pw_buffer(char in_buffer[516], char *new_pwrd, int new_pwrd_size, uint32 *new_pw_len, uchar nt_p16[16], uchar p16[16]) { - char *pw; - int uni_pw_len=0; int byte_len=0; char unicode_passwd[514]; @@ -304,9 +287,8 @@ BOOL decode_pw_buffer(char in_buffer[516], char *new_pwrd, return False; } + pull_string(NULL, passwd, &in_buffer[512 - byte_len], -1, byte_len, STR_UNICODE); uni_pw_len = byte_len/2; - pw = dos_unistrn2((uint16 *)(&in_buffer[512 - byte_len]), byte_len); - memcpy(passwd, pw, uni_pw_len); #ifdef DEBUG_PASSWORD DEBUG(100,("nt_lm_owf_gen: passwd: ")); @@ -324,7 +306,7 @@ BOOL decode_pw_buffer(char in_buffer[516], char *new_pwrd, #endif /* Mangle the passwords into Lanman format */ - memcpy(lm_ascii_passwd, passwd, uni_pw_len); + memcpy(lm_ascii_passwd, passwd, byte_len/2); lm_ascii_passwd[14] = '\0'; strupper(lm_ascii_passwd); @@ -338,11 +320,10 @@ BOOL decode_pw_buffer(char in_buffer[516], char *new_pwrd, #endif /* copy the password and it's length to the return buffer */ - *new_pw_len=uni_pw_len; + *new_pw_len = byte_len/2; memcpy(new_pwrd, passwd, uni_pw_len); new_pwrd[uni_pw_len]='\0'; - /* clear out local copy of user's password (just being paranoid). */ ZERO_STRUCT(unicode_passwd); ZERO_STRUCT(lm_ascii_passwd); diff --git a/source3/libsmb/smberr.c b/source3/libsmb/smberr.c index c2d8884d73..924fa76d71 100644 --- a/source3/libsmb/smberr.c +++ b/source3/libsmb/smberr.c @@ -164,10 +164,12 @@ char *smb_errstr(char *inbuf) if (num == err[j].code) { if (DEBUGLEVEL > 0) - slprintf(ret, sizeof(ret) - 1, "%s - %s (%s)",err_classes[i].class, - err[j].name,err[j].message); + slprintf(ret, sizeof(ret) - 1, "%s - %s (%s)", + err_classes[i].class, + err[j].name,err[j].message); else - slprintf(ret, sizeof(ret) - 1, "%s - %s",err_classes[i].class,err[j].name); + slprintf(ret, sizeof(ret) - 1, "%s - %s", + err_classes[i].class,err[j].name); return ret; } } diff --git a/source3/msdfs/msdfs.c b/source3/msdfs/msdfs.c index b2530a3d7f..92f6f1910d 100644 --- a/source3/msdfs/msdfs.c +++ b/source3/msdfs/msdfs.c @@ -234,7 +234,7 @@ BOOL is_msdfs_link(connection_struct* conn, char* path) strlower(path); - if(conn->vfs_ops.lstat(conn,dos_to_unix(path,False),&st) != 0) { + if(conn->vfs_ops.lstat(conn,path,&st) != 0) { DEBUG(5,("is_msdfs_link: %s does not exist.\n",path)); return False; } @@ -271,7 +271,7 @@ BOOL get_referred_path(struct junction_map* junction) DEBUG(5,("get_referred_path: lstat target: %s\n", path)); - if(conn->vfs_ops.lstat(conn,dos_to_unix(path, False),&st) != 0) { + if(conn->vfs_ops.lstat(conn,path,&st) != 0) { DEBUG(5,("get_referred_path: %s does not exist.\n",path)); return False; } @@ -698,7 +698,7 @@ static BOOL form_junctions(int snum, struct junction_map* jn, int* jn_count) jn[cnt].referral_l */ - dirp = conn->vfs_ops.opendir(conn, dos_to_unix(connect_path,False)); + dirp = conn->vfs_ops.opendir(conn, connect_path); if(!dirp) return False; @@ -716,7 +716,7 @@ static BOOL form_junctions(int snum, struct junction_map* jn, int* jn_count) continue; } if(S_ISLNK(st.st_mode)) { - buflen = conn->vfs_ops.readlink(conn, dos_to_unix(pathreal,False), buf, sizeof(fstring)); + buflen = conn->vfs_ops.readlink(conn, pathreal, buf, sizeof(fstring)); buf[buflen] = '\0'; if(parse_symlink(buf, &(jn[cnt].referral_list), &(jn[cnt].referral_count))) { pstrcpy(jn[cnt].service_name, service_name); diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index 8a6bf383d1..ca9d04d768 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -682,8 +682,6 @@ static void usage(char *pname) slprintf(debugf, sizeof(debugf)-1, "%s/log.nmbd", LOGFILEBASE); setup_logging( argv[0], False ); - charset_initialise(); - #ifdef LMHOSTSFILE pstrcpy( host_file, LMHOSTSFILE ); #endif @@ -783,8 +781,6 @@ static void usage(char *pname) if ( !reload_nmbd_services(False) ) return(-1); - codepage_initialise(lp_client_code_page()); - if(!init_structs()) return -1; diff --git a/source3/nmbd/nmbd_processlogon.c b/source3/nmbd/nmbd_processlogon.c index 5e554ceae2..3e4591c0cf 100644 --- a/source3/nmbd/nmbd_processlogon.c +++ b/source3/nmbd/nmbd_processlogon.c @@ -163,7 +163,6 @@ logons are not enabled.\n", inet_ntoa(p->ip) )); q += dos_PutUniCode(q, my_name, sizeof(pstring), True); /* PDC name */ q += dos_PutUniCode(q, global_myworkgroup,sizeof(pstring), True); /* Domain name*/ - SIVAL(q, 0, 1); /* our nt version */ SSVAL(q, 4, 0xffff); /* our lmnttoken */ SSVAL(q, 6, 0xffff); /* our lm20token */ @@ -192,6 +191,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n", case SAMLOGON: { char *q = buf + 2; + fstring asccomp; q += 2; unicomp = q; @@ -236,15 +236,15 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n", * database. If it isn't then we let smbd send an appropriate error. * Let's ignore the SID. */ - - pstrcpy(ascuser, dos_unistr(uniuser)); + pull_ucs2_pstring(ascuser, uniuser); + pull_ucs2_fstring(asccomp, unicomp); DEBUG(3,("process_logon_packet: SAMLOGON user %s\n", ascuser)); fstrcpy(reply_name,"\\\\"); /* Here it wants \\LOGONSERVER. */ fstrcpy(reply_name+2,my_name); DEBUG(3,("process_logon_packet: SAMLOGON request from %s(%s) for %s, returning logon svr %s domain %s code %x token=%x\n", - dos_unistr(unicomp),inet_ntoa(p->ip), ascuser, reply_name, global_myworkgroup, + asccomp,inet_ntoa(p->ip), ascuser, reply_name, global_myworkgroup, SAMLOGON_R ,lmnttoken)); /* Construct reply. */ diff --git a/source3/nmbd/nmbd_sendannounce.c b/source3/nmbd/nmbd_sendannounce.c index 87115a1eb0..eb5839253b 100644 --- a/source3/nmbd/nmbd_sendannounce.c +++ b/source3/nmbd/nmbd_sendannounce.c @@ -80,9 +80,7 @@ to subnet %s\n", work->work_group, subrec->subnet_name)); CVAL(p,0) = work->token; /* (local) Unique workgroup token id. */ p++; - StrnCpy(p,global_myname,15); - strupper(p); - p = skip_string(p,1); + p += push_string(NULL, p+1, global_myname, 15, STR_ASCII|STR_UPPER|STR_TERMINATE); send_mailslot(False, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf), global_myname, 0x0, work->work_group,0x1e, subrec->bcast_ip, @@ -110,8 +108,7 @@ static void send_announcement(struct subnet_record *subrec, int announce_type, CVAL(p,0) = updatecount; SIVAL(p,1,announce_interval*1000); /* Milliseconds - despite the spec. */ - StrnCpy(p+5,server_name,15); - strupper(p+5); + push_string(NULL, p+5, server_name, 15, STR_ASCII|STR_UPPER|STR_TERMINATE); CVAL(p,21) = lp_major_announce_version(); /* Major version. */ CVAL(p,22) = lp_minor_announce_version(); /* Minor version. */ @@ -121,9 +118,7 @@ static void send_announcement(struct subnet_record *subrec, int announce_type, SSVAL(p,27,BROWSER_ELECTION_VERSION); SSVAL(p,29,BROWSER_CONSTANT); /* Browse signature. */ - pstrcpy(p+31,server_comment); - p += 31; - p = skip_string(p,1); + p += 31 + push_string(NULL, p+31, server_comment, -1, STR_ASCII|STR_TERMINATE); send_mailslot(False,BROWSE_MAILSLOT, outbuf, PTR_DIFF(p,outbuf), from_name, 0x0, to_name, to_type, to_ip, subrec->myip, @@ -151,11 +146,13 @@ static void send_lm_announcement(struct subnet_record *subrec, int announce_type SSVAL(p,8,announce_interval); /* In seconds - according to spec. */ p += 10; - StrnCpy(p,server_name,15); + /*StrnCpy(p,server_name,15); strupper(p); p = skip_string(p,1); pstrcpy(p,server_comment); - p = skip_string(p,1); + p = skip_string(p,1);*/ + p += push_string(NULL, p, server_name, 15, STR_ASCII|STR_UPPER|STR_TERMINATE); + p += push_string(NULL, p, server_comment, sizeof(pstring)-15, STR_ASCII|STR_UPPER|STR_TERMINATE); send_mailslot(False,LANMAN_MAILSLOT, outbuf, PTR_DIFF(p,outbuf), from_name, 0x0, to_name, to_type, to_ip, subrec->myip, diff --git a/source3/nmbd/nmbd_synclists.c b/source3/nmbd/nmbd_synclists.c index 23cbc01b88..29462685b0 100644 --- a/source3/nmbd/nmbd_synclists.c +++ b/source3/nmbd/nmbd_synclists.c @@ -103,7 +103,6 @@ static void sync_child(char *name, int nm_type, /* All the cli_XX functions take UNIX character set. */ fstrcpy(unix_workgroup, cli.server_domain?cli.server_domain:workgroup); - dos_to_unix(unix_workgroup, True); /* Fetch a workgroup list. */ cli_NetServerEnum(&cli, unix_workgroup, @@ -113,7 +112,6 @@ static void sync_child(char *name, int nm_type, /* Now fetch a server list. */ if (servers) { fstrcpy(unix_workgroup, workgroup); - dos_to_unix(unix_workgroup, True); cli_NetServerEnum(&cli, unix_workgroup, local?SV_TYPE_LOCAL_LIST_ONLY:SV_TYPE_ALL, callback, NULL); @@ -254,9 +252,6 @@ static void complete_sync(struct sync_record *s) ptr = line; - /* The line is written in UNIX character set. Convert to DOS codepage. */ - unix_to_dos(line,True); - if (!next_token(&ptr,server,NULL,sizeof(server)) || !next_token(&ptr,type_str,NULL, sizeof(type_str)) || !next_token(&ptr,comment,NULL, sizeof(comment))) { diff --git a/source3/nsswitch/wbinfo.c b/source3/nsswitch/wbinfo.c index 237995af7f..9d3568417f 100644 --- a/source3/nsswitch/wbinfo.c +++ b/source3/nsswitch/wbinfo.c @@ -356,14 +356,12 @@ int main(int argc, char **argv) } TimeInit(); - charset_initialise(); if (!lp_load(CONFIGFILE, True, False, False)) { DEBUG(0, ("error opening config file\n")); exit(1); } - codepage_initialise(lp_client_code_page()); load_interfaces(); /* Parse command line options */ diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c index 305c18a8c0..4177d0219a 100644 --- a/source3/nsswitch/winbindd.c +++ b/source3/nsswitch/winbindd.c @@ -700,7 +700,6 @@ int main(int argc, char **argv) } TimeInit(); - charset_initialise(); if (!reload_services_file(False)) { DEBUG(0, ("error opening config file\n")); @@ -711,8 +710,6 @@ int main(int argc, char **argv) DEBUGLEVEL = new_debuglevel; } - codepage_initialise(lp_client_code_page()); - if (!interactive) { become_daemon(); } diff --git a/source3/nsswitch/winbindd_misc.c b/source3/nsswitch/winbindd_misc.c index 182f983efb..163837d1c3 100644 --- a/source3/nsswitch/winbindd_misc.c +++ b/source3/nsswitch/winbindd_misc.c @@ -45,16 +45,12 @@ static char *trust_keystr(char *domain) Routine to get the trust account password for a domain ************************************************************************/ BOOL _get_trust_account_password(char *domain, unsigned char *ret_pwd, - time_t *pass_last_set_time) + time_t *pass_last_set_time) { struct machine_acct_pass *pass; - fstring dos_domain; size_t size; - fstrcpy(dos_domain, domain); - unix_to_dos(dos_domain, True); - - if (!(pass = secrets_fetch(trust_keystr(dos_domain), &size)) || + if (!(pass = secrets_fetch(trust_keystr(domain), &size)) || size != sizeof(*pass)) return False; if (pass_last_set_time) *pass_last_set_time = pass->mod_time; diff --git a/source3/nsswitch/wins.c b/source3/nsswitch/wins.c index ac6d13a64f..bfd1835b4e 100644 --- a/source3/nsswitch/wins.c +++ b/source3/nsswitch/wins.c @@ -77,7 +77,6 @@ struct in_addr *lookup_backend(const char *name, int *count) DEBUGLEVEL = 0; TimeInit(); setup_logging("nss_wins",True); - charset_initialise(); lp_load(CONFIGFILE,True,False,False); load_interfaces(); } diff --git a/source3/pam_smbpass/pam_smb_acct.c b/source3/pam_smbpass/pam_smb_acct.c index af0c21cad5..94a4f22613 100644 --- a/source3/pam_smbpass/pam_smb_acct.c +++ b/source3/pam_smbpass/pam_smb_acct.c @@ -52,7 +52,6 @@ int pam_sm_acct_mgmt( pam_handle_t *pamh, int flags, /* Samba initialization. */ setup_logging( "pam_smbpass", False ); - charset_initialise(); in_client = True; ctrl = set_ctrl( flags, argc, argv ); diff --git a/source3/pam_smbpass/pam_smb_auth.c b/source3/pam_smbpass/pam_smb_auth.c index 0e95a84299..ee4d68dcc3 100644 --- a/source3/pam_smbpass/pam_smb_auth.c +++ b/source3/pam_smbpass/pam_smb_auth.c @@ -73,7 +73,6 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags, /* Samba initialization. */ setup_logging("pam_smbpass",False); - charset_initialise(); in_client = True; ctrl = set_ctrl(flags, argc, argv); diff --git a/source3/pam_smbpass/pam_smb_passwd.c b/source3/pam_smbpass/pam_smb_passwd.c index e1bb8f3704..3a987684f1 100644 --- a/source3/pam_smbpass/pam_smb_passwd.c +++ b/source3/pam_smbpass/pam_smb_passwd.c @@ -99,7 +99,6 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags, /* Samba initialization. */ setup_logging( "pam_smbpass", False ); - charset_initialise(); in_client = True; ctrl = set_ctrl(flags, argc, argv); diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index ba201e33b1..4b89387abf 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -49,22 +49,6 @@ #include "includes.h" -/* Set default coding system for KANJI if none specified in Makefile. */ -/* - * We treat KANJI specially due to historical precedent (it was the - * first non-english codepage added to Samba). With the new dynamic - * codepage support this is not needed anymore. - * - * The define 'KANJI' is being overloaded to mean 'use kanji codepage - * by default' and also 'this is the filename-to-disk conversion - * method to use'. This really should be removed and all control - * over this left in the smb.conf parameters 'client codepage' - * and 'coding system'. - */ -#ifndef KANJI -#define KANJI "sbcs" -#endif /* KANJI */ - BOOL in_client = False; /* Not in the client by default */ BOOL bLoaded = False; @@ -101,6 +85,8 @@ static BOOL defaults_saved = False; */ typedef struct { + char *dos_charset; + char *unix_charset; char *szPrintcapname; char *szEnumPortsCommand; char *szAddPrinterCommand; @@ -123,7 +109,6 @@ typedef struct char *szPassdbModulePath; char *szPasswordServer; char *szSocketOptions; - char *szValidChars; char *szWorkGroup; char *szDomainAdminGroup; char *szDomainGuestGroup; @@ -135,14 +120,11 @@ typedef struct #ifdef USING_GROUPNAME_MAP char *szGroupnameMap; #endif /* USING_GROUPNAME_MAP */ - char *szCharacterSet; - char *szCodePageDir; char *szLogonScript; char *szLogonPath; char *szLogonDrive; char *szLogonHome; char *szWINSserver; - char *szCodingSystem; char **szInterfaces; char *szRemoteAnnounce; char *szRemoteBrowseSync; @@ -207,7 +189,6 @@ typedef struct int ReadSize; int lm_announce; int lm_interval; - int client_code_page; int announce_as; /* This is initialised in init_globals */ int machine_password_timeout; int change_notify_timeout; @@ -526,12 +507,8 @@ static int default_server_announce; #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct)) /* prototypes for the special type handlers */ -static BOOL handle_valid_chars(char *pszParmValue, char **ptr); static BOOL handle_include(char *pszParmValue, char **ptr); static BOOL handle_copy(char *pszParmValue, char **ptr); -static BOOL handle_character_set(char *pszParmValue, char **ptr); -static BOOL handle_coding_system(char *pszParmValue, char **ptr); -static BOOL handle_client_code_page(char *pszParmValue, char **ptr); static BOOL handle_vfs_object(char *pszParmValue, char **ptr); static BOOL handle_source_env(char *pszParmValue, char **ptr); static BOOL handle_netbios_name(char *pszParmValue, char **ptr); @@ -652,18 +629,17 @@ static struct enum_list enum_ssl_version[] = { /* note that we do not initialise the defaults union - it is not allowed in ANSI C */ static struct parm_struct parm_table[] = { {"Base Options", P_SEP, P_SEPARATOR}, - - {"coding system", P_STRING, P_GLOBAL, &Globals.szCodingSystem, handle_coding_system, NULL, 0}, - {"client code page", P_INTEGER, P_GLOBAL, &Globals.client_code_page, handle_client_code_page, NULL, 0}, - {"code page directory", P_STRING, P_GLOBAL, &Globals.szCodePageDir, NULL, NULL, 0}, - {"comment", P_STRING, P_LOCAL, &sDefault.comment, NULL, NULL, FLAG_BASIC | FLAG_SHARE | FLAG_PRINT | FLAG_DOS_STRING}, - {"path", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, FLAG_BASIC | FLAG_SHARE | FLAG_PRINT | FLAG_DOS_STRING}, - {"directory", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, FLAG_DOS_STRING}, - {"workgroup", P_USTRING, P_GLOBAL, &Globals.szWorkGroup, NULL, NULL, FLAG_BASIC | FLAG_DOS_STRING}, - {"netbios name", P_UGSTRING, P_GLOBAL, global_myname, handle_netbios_name, NULL, FLAG_BASIC | FLAG_DOS_STRING}, - {"netbios aliases", P_LIST, P_GLOBAL, &Globals.szNetbiosAliases, NULL, NULL, FLAG_DOS_STRING}, - {"netbios scope", P_UGSTRING, P_GLOBAL, global_scope, NULL, NULL, FLAG_DOS_STRING}, - {"server string", P_STRING, P_GLOBAL, &Globals.szServerString, NULL, NULL, FLAG_BASIC | FLAG_DOS_STRING}, + + {"dos charset", P_STRING, P_GLOBAL, &Globals.dos_charset, NULL, NULL, 0}, + {"unix charset", P_STRING, P_GLOBAL, &Globals.unix_charset, NULL, NULL, 0}, + {"comment", P_STRING, P_LOCAL, &sDefault.comment, NULL, NULL, FLAG_BASIC | FLAG_SHARE | FLAG_PRINT}, + {"path", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, FLAG_BASIC | FLAG_SHARE | FLAG_PRINT}, + {"directory", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, 0}, + {"workgroup", P_USTRING, P_GLOBAL, &Globals.szWorkGroup, NULL, NULL, FLAG_BASIC}, + {"netbios name", P_UGSTRING, P_GLOBAL, global_myname, handle_netbios_name, NULL, FLAG_BASIC}, + {"netbios aliases", P_LIST, P_GLOBAL, &Globals.szNetbiosAliases, NULL, NULL, 0}, + {"netbios scope", P_UGSTRING, P_GLOBAL, global_scope, NULL, NULL, 0}, + {"server string", P_STRING, P_GLOBAL, &Globals.szServerString, NULL, NULL, FLAG_BASIC }, {"interfaces", P_LIST, P_GLOBAL, &Globals.szInterfaces, NULL, NULL, FLAG_BASIC}, {"bind interfaces only", P_BOOL, P_GLOBAL, &Globals.bBindInterfacesOnly, NULL, NULL, 0}, @@ -851,8 +827,8 @@ static struct parm_struct parm_table[] = { {"show add printer wizard", P_BOOL, P_GLOBAL, &Globals.bMsAddPrinterWizard, NULL, NULL, 0}, {"os2 driver map", P_STRING, P_GLOBAL, &Globals.szOs2DriverMap, NULL, NULL, 0}, - {"printer name", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL, FLAG_PRINT|FLAG_DOS_STRING}, - {"printer", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL, FLAG_DOS_STRING}, + {"printer name", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL, FLAG_PRINT}, + {"printer", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL, 0}, {"printer driver", P_STRING, P_LOCAL, &sDefault.szPrinterDriver, NULL, NULL, FLAG_PRINT}, {"printer driver file", P_STRING, P_LOCAL, &sDefault.szDriverFile, NULL, NULL, FLAG_PRINT}, {"printer driver location", P_STRING, P_LOCAL, &sDefault.szPrinterDriverLocation, NULL, NULL, FLAG_PRINT | FLAG_GLOBAL}, @@ -860,7 +836,6 @@ static struct parm_struct parm_table[] = { {"Filename Handling", P_SEP, P_SEPARATOR}, {"strip dot", P_BOOL, P_GLOBAL, &Globals.bStripDot, NULL, NULL, 0}, - {"character set", P_STRING, P_GLOBAL, &Globals.szCharacterSet, handle_character_set, NULL, 0}, {"mangled stack", P_INTEGER, P_GLOBAL, &Globals.mangled_stack, NULL, NULL, 0}, {"default case", P_ENUM, P_LOCAL, &sDefault.iDefaultCase, NULL, enum_case, FLAG_SHARE}, {"case sensitive", P_BOOL, P_LOCAL, &sDefault.bCaseSensitive, NULL, NULL, FLAG_SHARE | FLAG_GLOBAL}, @@ -872,9 +847,9 @@ static struct parm_struct parm_table[] = { {"hide dot files", P_BOOL, P_LOCAL, &sDefault.bHideDotFiles, NULL, NULL, FLAG_SHARE | FLAG_GLOBAL}, {"hide unreadable", P_BOOL, P_LOCAL, &sDefault.bHideUnReadable, NULL, NULL, FLAG_SHARE | FLAG_GLOBAL}, {"delete veto files", P_BOOL, P_LOCAL, &sDefault.bDeleteVetoFiles, NULL, NULL, FLAG_SHARE | FLAG_GLOBAL}, - {"veto files", P_STRING, P_LOCAL, &sDefault.szVetoFiles, NULL, NULL, FLAG_SHARE | FLAG_GLOBAL | FLAG_DOS_STRING}, - {"hide files", P_STRING, P_LOCAL, &sDefault.szHideFiles, NULL, NULL, FLAG_SHARE | FLAG_GLOBAL | FLAG_DOS_STRING}, - {"veto oplock files", P_STRING, P_LOCAL, &sDefault.szVetoOplockFiles, NULL, NULL, FLAG_SHARE | FLAG_GLOBAL | FLAG_DOS_STRING}, + {"veto files", P_STRING, P_LOCAL, &sDefault.szVetoFiles, NULL, NULL, FLAG_SHARE | FLAG_GLOBAL }, + {"hide files", P_STRING, P_LOCAL, &sDefault.szHideFiles, NULL, NULL, FLAG_SHARE | FLAG_GLOBAL }, + {"veto oplock files", P_STRING, P_LOCAL, &sDefault.szVetoOplockFiles, NULL, NULL, FLAG_SHARE | FLAG_GLOBAL }, {"map system", P_BOOL, P_LOCAL, &sDefault.bMap_system, NULL, NULL, FLAG_SHARE | FLAG_GLOBAL}, {"map hidden", P_BOOL, P_LOCAL, &sDefault.bMap_hidden, NULL, NULL, FLAG_SHARE | FLAG_GLOBAL}, {"map archive", P_BOOL, P_LOCAL, &sDefault.bMap_archive, NULL, NULL, FLAG_SHARE | FLAG_GLOBAL}, @@ -902,10 +877,10 @@ static struct parm_struct parm_table[] = { {"add user to group script", P_STRING, P_GLOBAL, &Globals.szAddUserToGroupScript, NULL, NULL, 0}, {"delete user from group script", P_STRING, P_GLOBAL, &Globals.szDelUserToGroupScript, NULL, NULL, 0}, - {"logon script", P_STRING, P_GLOBAL, &Globals.szLogonScript, NULL, NULL, FLAG_DOS_STRING}, - {"logon path", P_STRING, P_GLOBAL, &Globals.szLogonPath, NULL, NULL, FLAG_DOS_STRING}, + {"logon script", P_STRING, P_GLOBAL, &Globals.szLogonScript, NULL, NULL, 0}, + {"logon path", P_STRING, P_GLOBAL, &Globals.szLogonPath, NULL, NULL, 0}, {"logon drive", P_STRING, P_GLOBAL, &Globals.szLogonDrive, NULL, NULL, 0}, - {"logon home", P_STRING, P_GLOBAL, &Globals.szLogonHome, NULL, NULL, FLAG_DOS_STRING}, + {"logon home", P_STRING, P_GLOBAL, &Globals.szLogonHome, NULL, NULL, 0}, {"domain logons", P_BOOL, P_GLOBAL, &Globals.bDomainLogons, NULL, NULL, 0}, {"Browse Options", P_SEP, P_SEPARATOR}, @@ -962,8 +937,8 @@ static struct parm_struct parm_table[] = { {"delete share command", P_STRING, P_GLOBAL, &Globals.szDeleteShareCommand, NULL, NULL, 0}, {"config file", P_STRING, P_GLOBAL, &Globals.szConfigFile, NULL, NULL, FLAG_HIDE}, - {"preload", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_DOS_STRING}, - {"auto services", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_DOS_STRING}, + {"preload", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, 0}, + {"auto services", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, 0}, {"lock dir", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, 0}, {"lock directory", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, 0}, #ifdef WITH_UTMP @@ -973,11 +948,10 @@ static struct parm_struct parm_table[] = { {"utmp", P_BOOL, P_GLOBAL, &Globals.bUtmp, NULL, NULL, 0}, #endif - {"default service", P_STRING, P_GLOBAL, &Globals.szDefaultService, NULL, NULL, FLAG_DOS_STRING}, - {"default", P_STRING, P_GLOBAL, &Globals.szDefaultService, NULL, NULL, FLAG_DOS_STRING}, + {"default service", P_STRING, P_GLOBAL, &Globals.szDefaultService, NULL, NULL, 0}, + {"default", P_STRING, P_GLOBAL, &Globals.szDefaultService, NULL, NULL, 0}, {"message command", P_STRING, P_GLOBAL, &Globals.szMsgCommand, NULL, NULL, 0}, {"dfree command", P_STRING, P_GLOBAL, &Globals.szDfree, NULL, NULL, 0}, - {"valid chars", P_STRING, P_GLOBAL, &Globals.szValidChars, handle_valid_chars, NULL, 0}, {"remote announce", P_STRING, P_GLOBAL, &Globals.szRemoteAnnounce, NULL, NULL, 0}, {"remote browse sync", P_STRING, P_GLOBAL, &Globals.szRemoteBrowseSync, NULL, NULL, 0}, {"socket address", P_STRING, P_GLOBAL, &Globals.szSocketAddress, NULL, NULL, 0}, @@ -997,7 +971,7 @@ static struct parm_struct parm_table[] = { {"root preexec close", P_BOOL, P_LOCAL, &sDefault.bRootpreexecClose, NULL, NULL, FLAG_SHARE}, {"root postexec", P_STRING, P_LOCAL, &sDefault.szRootPostExec, NULL, NULL, FLAG_SHARE | FLAG_PRINT}, {"available", P_BOOL, P_LOCAL, &sDefault.bAvailable, NULL, NULL, FLAG_BASIC | FLAG_SHARE | FLAG_PRINT}, - {"volume", P_STRING, P_LOCAL, &sDefault.volume, NULL, NULL, FLAG_SHARE | FLAG_DOS_STRING}, + {"volume", P_STRING, P_LOCAL, &sDefault.volume, NULL, NULL, FLAG_SHARE }, {"fstype", P_STRING, P_LOCAL, &sDefault.fstype, NULL, NULL, FLAG_SHARE}, {"set directory", P_BOOLREV, P_LOCAL, &sDefault.bNo_set_dir, NULL, NULL, FLAG_SHARE}, {"source environment", P_STRING, P_GLOBAL, &Globals.szSourceEnv, handle_source_env, NULL, 0}, @@ -1222,7 +1196,6 @@ static void init_globals(void) string_set(&Globals.szLogonPath, "\\\\%N\\%U\\profile"); string_set(&Globals.szNameResolveOrder, "lmhosts host wins bcast"); - string_set(&Globals.szCodePageDir, CODEPAGEDIR); Globals.bLoadPrinters = True; Globals.bUseRhosts = False; @@ -1275,7 +1248,6 @@ static void init_globals(void) string_set(&Globals.szNISHomeMapName, "auto.home"); #endif #endif - Globals.client_code_page = DEFAULT_CLIENT_CODE_PAGE; Globals.bTimeServer = False; Globals.bBindInterfacesOnly = False; Globals.bUnixPasswdSync = False; @@ -1352,13 +1324,6 @@ static void init_globals(void) Globals.winbind_cache_time = 15; Globals.bWinbindEnumUsers = True; Globals.bWinbindEnumGroups = True; - - /* - * This must be done last as it checks the value in - * client_code_page. - */ - - interpret_coding_system(KANJI); } static TALLOC_CTX *lp_talloc; @@ -1496,7 +1461,6 @@ FN_GLOBAL_STRING(lp_template_shell, &Globals.szTemplateShell) FN_GLOBAL_STRING(lp_winbind_separator, &Globals.szWinbindSeparator) FN_GLOBAL_BOOL(lp_winbind_enum_users, &Globals.bWinbindEnumUsers) FN_GLOBAL_BOOL(lp_winbind_enum_groups, &Globals.bWinbindEnumGroups) -FN_GLOBAL_STRING(lp_codepagedir,&Globals.szCodePageDir) #ifdef WITH_LDAP FN_GLOBAL_STRING(lp_ldap_server, &Globals.szLdapServer) FN_GLOBAL_STRING(lp_ldap_suffix, &Globals.szLdapSuffix) @@ -1587,7 +1551,6 @@ FN_GLOBAL_INTEGER(lp_lpqcachetime, &Globals.lpqcachetime) FN_GLOBAL_INTEGER(lp_max_smbd_processes, &Globals.iMaxSmbdProcesses) FN_GLOBAL_INTEGER(lp_totalprintjobs, &Globals.iTotalPrintJobs) FN_GLOBAL_INTEGER(lp_syslog, &Globals.syslog) -FN_GLOBAL_INTEGER(lp_client_code_page, &Globals.client_code_page) static FN_GLOBAL_INTEGER(lp_announce_as, &Globals.announce_as) FN_GLOBAL_INTEGER(lp_lm_announce, &Globals.lm_announce) FN_GLOBAL_INTEGER(lp_lm_interval, &Globals.lm_interval) @@ -1767,7 +1730,7 @@ static void free_service(service * pservice) /*************************************************************************** add a new service to the services array initialising it with the given -service. name must be in DOS codepage. +service. ***************************************************************************/ static int add_a_service(service * pservice, char *name) { @@ -1822,7 +1785,7 @@ static int add_a_service(service * pservice, char *name) /*************************************************************************** add a new home service, with the specified home directory, defaults coming -from service ifrom. homename must be in DOS codepage. +from service ifrom. ***************************************************************************/ BOOL lp_add_home(char *pszHomename, int iDefaultService, char *pszHomedir) { @@ -1851,7 +1814,7 @@ BOOL lp_add_home(char *pszHomename, int iDefaultService, char *pszHomedir) } /*************************************************************************** -add a new service, based on an old one. pszService must be in DOS codepage. +add a new service, based on an old one. ***************************************************************************/ int lp_add_service(char *pszService, int iDefaultService) { @@ -1894,7 +1857,6 @@ static BOOL lp_add_ipc(char *ipc_name, BOOL guest_ok) /*************************************************************************** add a new printer service, with defaults coming from service iFrom. -printername must be in DOS codepage. ***************************************************************************/ BOOL lp_add_printer(char *pszPrintername, int iDefaultService) { @@ -2209,11 +2171,6 @@ static BOOL handle_netbios_name(char *pszParmValue, char **ptr) standard_sub_basic(netbios_name); strupper(netbios_name); - /* - * Convert from UNIX to DOS string - the UNIX to DOS converter - * isn't called on the special handlers. - */ - unix_to_dos(netbios_name, True); pstrcpy(global_myname, netbios_name); DEBUG(4, @@ -2305,11 +2262,11 @@ static BOOL handle_source_env(char *pszParmValue, char **ptr) if (*p == '|') { - lines = file_lines_pload(p + 1, NULL, True); + lines = file_lines_pload(p + 1, NULL); } else { - lines = file_lines_load(fname, NULL, True); + lines = file_lines_load(fname, NULL); } if (!lines) @@ -2341,67 +2298,6 @@ static BOOL handle_vfs_object(char *pszParmValue, char **ptr) return True; } -/*************************************************************************** - handle the interpretation of the coding system parameter - *************************************************************************/ -static BOOL handle_coding_system(char *pszParmValue, char **ptr) -{ - string_set(ptr, pszParmValue); - interpret_coding_system(pszParmValue); - return (True); -} - -/*************************************************************************** - Handle the interpretation of the character set system parameter. -***************************************************************************/ - -static char *saved_character_set = NULL; - -static BOOL handle_character_set(char *pszParmValue, char **ptr) -{ - /* A dependency here is that the parameter client code page should be - set before this is called. - */ - string_set(ptr, pszParmValue); - strupper(*ptr); - saved_character_set = strdup(*ptr); - interpret_character_set(*ptr, lp_client_code_page()); - return (True); -} - -/*************************************************************************** - Handle the interpretation of the client code page parameter. - We handle this separately so that we can reset the character set - parameter in case this came before 'client code page' in the smb.conf. -***************************************************************************/ - -static BOOL handle_client_code_page(char *pszParmValue, char **ptr) -{ - Globals.client_code_page = atoi(pszParmValue); - if (saved_character_set != NULL) - interpret_character_set(saved_character_set, - lp_client_code_page()); - codepage_initialise(lp_client_code_page()); - return (True); -} - -/*************************************************************************** -handle the valid chars lines -***************************************************************************/ - -static BOOL handle_valid_chars(char *pszParmValue, char **ptr) -{ - string_set(ptr, pszParmValue); - - /* A dependency here is that the parameter client code page must be - set before this is called - as calling codepage_initialise() - would overwrite the valid char lines. - */ - codepage_initialise(lp_client_code_page()); - - add_char_string(pszParmValue); - return (True); -} /*************************************************************************** handle the include operation @@ -2651,27 +2547,19 @@ BOOL lp_do_parameter(int snum, char *pszParmName, char *pszParmValue) case P_STRING: string_set(parm_ptr, pszParmValue); - if (parm_table[parmnum].flags & FLAG_DOS_STRING) - unix_to_dos(*(char **)parm_ptr, True); break; case P_USTRING: string_set(parm_ptr, pszParmValue); - if (parm_table[parmnum].flags & FLAG_DOS_STRING) - unix_to_dos(*(char **)parm_ptr, True); strupper(*(char **)parm_ptr); break; case P_GSTRING: pstrcpy((char *)parm_ptr, pszParmValue); - if (parm_table[parmnum].flags & FLAG_DOS_STRING) - unix_to_dos((char *)parm_ptr, True); break; case P_UGSTRING: pstrcpy((char *)parm_ptr, pszParmValue); - if (parm_table[parmnum].flags & FLAG_DOS_STRING) - unix_to_dos((char *)parm_ptr, True); strupper((char *)parm_ptr); break; @@ -2715,7 +2603,7 @@ static BOOL do_parameter(char *pszParmName, char *pszParmValue) /*************************************************************************** print a parameter of the specified type ***************************************************************************/ -static void print_parameter(struct parm_struct *p, void *ptr, FILE * f, char *(*dos_to_ext)(char *, BOOL)) +static void print_parameter(struct parm_struct *p, void *ptr, FILE * f) { int i; switch (p->type) @@ -2756,34 +2644,23 @@ static void print_parameter(struct parm_struct *p, void *ptr, FILE * f, char *( if ((char ***)ptr && *(char ***)ptr) { char **list = *(char ***)ptr; - if (p->flags & FLAG_DOS_STRING) - for (; *list; list++) - fprintf(f, "%s%s", dos_to_ext(*list, False), - ((*(list+1))?", ":"")); - else - for (; *list; list++) - fprintf(f, "%s%s", *list, - ((*(list+1))?", ":"")); + for (; *list; list++) + fprintf(f, "%s%s", *list, + ((*(list+1))?", ":"")); } break; case P_GSTRING: case P_UGSTRING: if ((char *)ptr) { - if (p->flags & FLAG_DOS_STRING) - fprintf(f, "%s", dos_to_ext((char *)ptr, False)); - else - fprintf(f, "%s", (char *)ptr); + fprintf(f, "%s", (char *)ptr); } break; case P_STRING: case P_USTRING: if (*(char **)ptr) { - if(p->flags & FLAG_DOS_STRING) - fprintf(f,"%s",dos_to_ext(*(char **)ptr, False)); - else - fprintf(f, "%s", *(char **)ptr); + fprintf(f, "%s", *(char **)ptr); } break; case P_SEP: @@ -2852,7 +2729,7 @@ void init_locals(void) /*************************************************************************** Process a new section (service). At this stage all sections are services. Later we'll have special sections that permit server parameters to be set. -Returns True on success, False on failure. SectionName must be in DOS codepage. +Returns True on success, False on failure. ***************************************************************************/ static BOOL do_section(char *pszSectionName) { @@ -2945,7 +2822,7 @@ static BOOL is_default(int i) /*************************************************************************** Display the contents of the global structure. ***************************************************************************/ -static void dump_globals(FILE *f, char *(*dos_to_ext)(char *, BOOL)) +static void dump_globals(FILE *f) { int i; fprintf(f, "# Global parameters\n[global]\n"); @@ -2958,7 +2835,7 @@ static void dump_globals(FILE *f, char *(*dos_to_ext)(char *, BOOL)) if (defaults_saved && is_default(i)) continue; fprintf(f, "\t%s = ", parm_table[i].label); - print_parameter(&parm_table[i], parm_table[i].ptr, f, dos_to_ext); + print_parameter(&parm_table[i], parm_table[i].ptr, f); fprintf(f, "\n"); } } @@ -2979,7 +2856,7 @@ BOOL lp_is_default(int snum, struct parm_struct *parm) /*************************************************************************** Display the contents of a single services record. ***************************************************************************/ -static void dump_a_service(service * pService, FILE * f, char *(*dos_to_ext)(char *, BOOL)) +static void dump_a_service(service * pService, FILE * f) { int i; if (pService != &sDefault) @@ -3010,7 +2887,7 @@ static void dump_a_service(service * pService, FILE * f, char *(*dos_to_ext)(cha fprintf(f, "\t%s = ", parm_table[i].label); print_parameter(&parm_table[i], - ((char *)pService) + pdiff, f, dos_to_ext); + ((char *)pService) + pdiff, f); fprintf(f, "\n"); } } @@ -3158,7 +3035,6 @@ void lp_add_one_printer(char *name, char *comment) if ((i = lp_servicenumber(name)) >= 0) { string_set(&ServicePtrs[i]->comment, comment); - unix_to_dos(ServicePtrs[i]->comment, True); ServicePtrs[i]->autoloaded = True; } } @@ -3353,14 +3229,12 @@ BOOL lp_load(char *pszFname, BOOL global_only, BOOL save_defaults, /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */ /* if bWINSsupport is true and we are in the client */ - - if (in_client && Globals.bWINSsupport) - { - + if (in_client && Globals.bWINSsupport) { string_set(&Globals.szWINSserver, "127.0.0.1"); - } + init_iconv(Globals.unix_charset, Globals.dos_charset); + return (bRetval); } @@ -3384,7 +3258,7 @@ int lp_numservices(void) /*************************************************************************** Display the contents of the services array in human-readable form. ***************************************************************************/ -void lp_dump(FILE *f, BOOL show_defaults, int maxtoprint, char *(*dos_to_ext)(char *, BOOL)) +void lp_dump(FILE *f, BOOL show_defaults, int maxtoprint) { int iService; @@ -3393,24 +3267,24 @@ void lp_dump(FILE *f, BOOL show_defaults, int maxtoprint, char *(*dos_to_ext)(ch defaults_saved = False; } - dump_globals(f, dos_to_ext); + dump_globals(f); - dump_a_service(&sDefault, f, dos_to_ext); + dump_a_service(&sDefault, f); for (iService = 0; iService < maxtoprint; iService++) - lp_dump_one(f, show_defaults, iService, dos_to_ext); + lp_dump_one(f, show_defaults, iService); } /*************************************************************************** Display the contents of one service in human-readable form. ***************************************************************************/ -void lp_dump_one(FILE * f, BOOL show_defaults, int snum, char *(*dos_to_ext)(char *, BOOL)) +void lp_dump_one(FILE * f, BOOL show_defaults, int snum) { if (VALID(snum)) { if (ServicePtrs[snum]->szService[0] == '\0') return; - dump_a_service(ServicePtrs[snum], f, dos_to_ext); + dump_a_service(ServicePtrs[snum], f); } } @@ -3429,7 +3303,6 @@ int lp_servicenumber(char *pszServiceName) if (VALID(iService) && strequal(lp_servicename(iService), pszServiceName)) break; - if (iService < 0) DEBUG(7, ("lp_servicenumber: couldn't find %s\n", @@ -3573,7 +3446,7 @@ void lp_remove_service(int snum) } /******************************************************************* -copy a service. new_name must be in dos codepage +copy a service. ********************************************************************/ void lp_copy_service(int snum, char *new_name) { @@ -3781,4 +3654,3 @@ void lp_list_free(char **list) for(; *tlist; tlist++) free(*tlist); free (list); } - diff --git a/source3/param/params.c b/source3/param/params.c index b359b269d4..4e74953889 100644 --- a/source3/param/params.c +++ b/source3/param/params.c @@ -195,25 +195,12 @@ static int EatComment( myFILE *InFile ) static int Continuation( char *line, int pos ) { - int pos2 = 0; - - pos--; - while( (pos >= 0) && isspace(line[pos]) ) - pos--; - - /* we should recognize if `\` is part of a multibyte character or not. */ - while(pos2 <= pos) { - size_t skip = 0; - skip = get_character_len(line[pos2]); - if (skip) { - pos2 += skip; - } else if (pos == pos2) { - return( ((pos >= 0) && ('\\' == line[pos])) ? pos : -1 ); - } else { - pos2++; - } - } - return (-1); + pos--; + while( (pos >= 0) && isspace(line[pos]) ) + pos--; + + return (((pos >= 0) && ('\\' == line[pos])) ? pos : -1 ); + return (-1); } @@ -271,7 +258,7 @@ static BOOL Section( myFILE *InFile, BOOL (*sfunc)(char *) ) DEBUG(0, ("%s Empty section name in configuration file.\n", func )); return( False ); } - if( !sfunc( unix_to_dos(bufr,True) ) ) /* Got a valid name. Deal with it. */ + if( !sfunc(bufr) ) /* Got a valid name. Deal with it. */ return( False ); (void)EatComment( InFile ); /* Finish off the line. */ return( True ); diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c index 4a8a363923..12b340dfe5 100644 --- a/source3/passdb/secrets.c +++ b/source3/passdb/secrets.c @@ -99,7 +99,6 @@ BOOL secrets_fetch_domain_sid(char *domain, DOM_SID *sid) size_t size; slprintf(key, sizeof(key)-1, "%s/%s", SECRETS_DOMAIN_SID, domain); - dos_to_unix(key, True); /* Convert key to unix-codepage */ dyn_sid = (DOM_SID *)secrets_fetch(key, &size); if (dyn_sid == NULL) @@ -123,13 +122,9 @@ form a key for fetching a domain trust password char *trust_keystr(char *domain) { static fstring keystr; - fstring dos_domain; - - fstrcpy(dos_domain, domain); - unix_to_dos(dos_domain, True); slprintf(keystr,sizeof(keystr)-1,"%s/%s", - SECRETS_MACHINE_ACCT_PASS, dos_domain); + SECRETS_MACHINE_ACCT_PASS, domain); return keystr; } diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 5e28f3e5b6..d099c29cc1 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -288,7 +288,6 @@ int write_ntforms(nt_forms_struct **list, int number) (*list)[i].bottom); if (len > sizeof(buf)) break; slprintf(key, sizeof(key)-1, "%s%s", FORMS_PREFIX, (*list)[i].name); - dos_to_unix(key, True); /* Convert key to unix-codepage */ kbuf.dsize = strlen(key)+1; kbuf.dptr = key; dbuf.dsize = len; @@ -371,7 +370,6 @@ BOOL delete_a_form(nt_forms_struct **list, UNISTR2 *del_name, int *count, uint32 } slprintf(key, sizeof(key)-1, "%s%s", FORMS_PREFIX, (*list)[n].name); - dos_to_unix(key, True); /* Convert key to unix-codepage */ kbuf.dsize = strlen(key)+1; kbuf.dptr = key; if (tdb_delete(tdb, kbuf) != 0) { @@ -1461,7 +1459,6 @@ static uint32 add_a_printer_driver_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 *driver) } slprintf(key, sizeof(key)-1, "%s%s/%d/%s", DRIVERS_PREFIX, architecture, driver->cversion, driver->name); - dos_to_unix(key, True); /* Convert key to unix-codepage */ DEBUG(5,("add_a_printer_driver_3: Adding driver with key %s\n", key )); @@ -1826,7 +1823,6 @@ uint32 del_a_printer(char *sharename) TDB_DATA kbuf; slprintf(key, sizeof(key)-1, "%s%s", PRINTERS_PREFIX, sharename); - dos_to_unix(key, True); /* Convert key to unix-codepage */ kbuf.dptr=key; kbuf.dsize=strlen(key)+1; @@ -1913,7 +1909,6 @@ static uint32 update_a_printer_2(NT_PRINTER_INFO_LEVEL_2 *info) slprintf(key, sizeof(key)-1, "%s%s", PRINTERS_PREFIX, info->sharename); - dos_to_unix(key, True); /* Convert key to unix-codepage */ kbuf.dptr = key; kbuf.dsize = strlen(key)+1; @@ -2287,7 +2282,7 @@ static void map_to_os2_driver(fstring drivername) return; } - lines = file_lines_load(mapfile, &numlines, True); + lines = file_lines_load(mapfile, &numlines); if (numlines == 0) { DEBUG(0,("No entries in OS/2 driver map %s\n",mapfile)); return; @@ -2439,7 +2434,6 @@ static uint32 get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstring sharen ZERO_STRUCT(info); slprintf(key, sizeof(key)-1, "%s%s", PRINTERS_PREFIX, sharename); - dos_to_unix(key, True); /* Convert key to unix-codepage */ kbuf.dptr = key; kbuf.dsize = strlen(key)+1; diff --git a/source3/printing/pcap.c b/source3/printing/pcap.c index e9c2e46090..1f909d3533 100644 --- a/source3/printing/pcap.c +++ b/source3/printing/pcap.c @@ -296,8 +296,6 @@ BOOL pcap_printername_ok(char *pszPrintername, char *pszPrintcapname) if (*line == '#' || *line == 0) continue; - unix_to_dos(line,True); - /* now we have a real printer line - cut it off at the first : */ p = strchr(line,':'); if (p) *p = 0; @@ -383,8 +381,6 @@ void pcap_printer_fn(void (*fn)(char *, char *)) p = strchr(line,':'); if (p) *p = 0; - unix_to_dos(line,True); - /* now find the most likely printer name and comment this is pure guesswork, but it's better than nothing */ *name = 0; diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c index 3ca0af537f..b9929c4823 100644 --- a/source3/printing/print_cups.c +++ b/source3/printing/print_cups.c @@ -198,9 +198,11 @@ cups_printer_fn(void (*fn)(char *, char *)) /* I - Function to call */ break; if (info == NULL || !info[0]) - (*fn)(unix_to_dos(name,False), make_model); + (*fn)(name, make_model); else - (*fn)(unix_to_dos(name,False), info); + (*fn)(name,info); + + } ippDelete(response); @@ -268,8 +270,7 @@ cups_printername_ok(char *name) /* I - Name of printer */ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requested-attributes", NULL, "printer-uri"); - slprintf(uri, sizeof(uri) - 1, "ipp://localhost/printers/%s", - dos_to_unix(name, False)); + slprintf(uri, sizeof(uri) - 1, "ipp://localhost/printers/%s", name); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); diff --git a/source3/printing/print_generic.c b/source3/printing/print_generic.c index ef38d26493..3e5753583e 100644 --- a/source3/printing/print_generic.c +++ b/source3/printing/print_generic.c @@ -83,8 +83,6 @@ static int print_run_command(int snum,char *command, int *outfd, ...) pstring_sub(syscmd, "%p", p); standard_sub_snum(snum,syscmd); - /* Convert script args to unix-codepage */ - dos_to_unix(syscmd, True); ret = smbrun(syscmd,outfd); DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret)); @@ -195,9 +193,7 @@ static int generic_queue_get(int snum, print_queue_struct **q, print_status_stru print_queue_struct *queue = NULL; fstring printer_name; - /* Convert printer name (i.e. share name) to unix-codepage */ fstrcpy(printer_name, lp_servicename(snum)); - dos_to_unix(printer_name, True); print_run_command(snum, lp_lpqcommand(snum), &fd, NULL); @@ -208,7 +204,7 @@ static int generic_queue_get(int snum, print_queue_struct **q, print_status_stru } numlines = 0; - qlines = fd_lines_load(fd, &numlines, True); + qlines = fd_lines_load(fd, &numlines); close(fd); /* turn the lpq output into a series of job structures */ diff --git a/source3/printing/print_svid.c b/source3/printing/print_svid.c index 58a1d03f49..301f388671 100644 --- a/source3/printing/print_svid.c +++ b/source3/printing/print_svid.c @@ -50,7 +50,7 @@ static void populate_printers(void) char **lines; int i; - lines = file_lines_pload("/usr/bin/lpstat -v", NULL, False); + lines = file_lines_pload("/usr/bin/lpstat -v", NULL); if (!lines) return; for (i=0;lines[i];i++) { @@ -107,7 +107,7 @@ void sysv_printer_fn(void (*fn)(char *, char *)) if (printers == NULL) populate_printers(); for (tmp = printers; tmp != NULL; tmp = tmp->next) - (fn)(unix_to_dos(tmp->name,False), ""); + (fn)(tmp->name, ""); } diff --git a/source3/printing/printing.c b/source3/printing/printing.c index aab4c2f43f..d0a07ccb4c 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -255,7 +255,6 @@ static void print_cache_flush(int snum) { fstring key; slprintf(key, sizeof(key)-1, "CACHE/%s", lp_servicename(snum)); - dos_to_unix(key, True); /* Convert key to unix-codepage */ tdb_store_int(tdb, key, -1); } @@ -328,10 +327,7 @@ static void print_queue_update(int snum) fstring keystr, printer_name, cachestr; TDB_DATA data, key; - /* Convert printer name (i.e. share name) to unix-codepage for all of the - * following tdb key generation */ fstrcpy(printer_name, lp_servicename(snum)); - dos_to_unix(printer_name, True); /* * Check to see if someone else is doing this update. @@ -598,11 +594,9 @@ static BOOL is_owner(struct current_user *user, int jobid) if (!pjob || !user) return False; if ((vuser = get_valid_user_struct(user->vuid)) != NULL) { - return strequal(pjob->user, - unix_to_dos(vuser->user.smb_name,False)); + return strequal(pjob->user, vuser->user.smb_name); } else { - return strequal(pjob->user, - unix_to_dos(uidtoname(user->uid),False)); + return strequal(pjob->user, uidtoname(user->uid)); } } @@ -752,7 +746,6 @@ static BOOL print_cache_expired(int snum) time_t t2, t = time(NULL); slprintf(key, sizeof(key)-1, "CACHE/%s", lp_servicename(snum)); - dos_to_unix(key, True); /* Convert key to unix-codepage */ t2 = tdb_fetch_int(tdb, key); if (t2 == ((time_t)-1) || (t - t2) >= lp_lpqcachetime()) { DEBUG(3, ("print cache expired\n")); @@ -771,7 +764,6 @@ static int get_queue_status(int snum, print_status_struct *status) ZERO_STRUCTP(status); slprintf(keystr, sizeof(keystr)-1, "STATUS/%s", lp_servicename(snum)); - dos_to_unix(keystr, True); /* Convert key to unix-codepage */ key.dptr = keystr; key.dsize = strlen(keystr); data = tdb_fetch(tdb, key); @@ -888,9 +880,9 @@ int print_job_start(struct current_user *user, int snum, char *jobname) fstrcpy(pjob.jobname, jobname); if ((vuser = get_valid_user_struct(user->vuid)) != NULL) { - fstrcpy(pjob.user, unix_to_dos(vuser->user.smb_name,False)); + fstrcpy(pjob.user, vuser->user.smb_name); } else { - fstrcpy(pjob.user, unix_to_dos(uidtoname(user->uid),False)); + fstrcpy(pjob.user, uidtoname(user->uid)); } fstrcpy(pjob.qname, lp_servicename(snum)); @@ -1128,7 +1120,6 @@ int print_queue_status(int snum, */ ZERO_STRUCTP(status); slprintf(keystr, sizeof(keystr)-1, "STATUS/%s", lp_servicename(snum)); - dos_to_unix(keystr, True); /* Convert key to unix-codepage */ key.dptr = keystr; key.dsize = strlen(keystr); data = tdb_fetch(tdb, key); diff --git a/source3/rpc_client/cli_login.c b/source3/rpc_client/cli_login.c index aaf4fe17aa..f46aa7b08f 100644 --- a/source3/rpc_client/cli_login.c +++ b/source3/rpc_client/cli_login.c @@ -165,14 +165,11 @@ BOOL cli_nt_login_network(struct cli_state *cli, char *domain, char *username, /* indicate a "network" login */ ctr->switch_value = NET_LOGON_TYPE; - fstrcpy(dos_wksta_name, cli->clnt_name_slash); - unix_to_dos(dos_wksta_name, True); + clistr_pull(cli, dos_wksta_name, cli->clnt_name_slash, sizeof(dos_wksta_name), 0, STR_TERMINATE); - fstrcpy(dos_username, username); - unix_to_dos(dos_username, True); + clistr_pull(cli, dos_username, username, sizeof(dos_username), 0, STR_TERMINATE); - fstrcpy(dos_domain, domain); - unix_to_dos(dos_domain, True); + clistr_pull(cli, dos_domain, username, sizeof(dos_domain), 0, STR_TERMINATE); /* Create the structure needed for SAM logon. */ init_id_info2(&ctr->auth.id2, dos_domain, 0, smb_userid_low, 0, diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index c4e55c3749..96d77ab3cf 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -164,18 +164,14 @@ BOOL do_lsa_query_info_pol(struct cli_state *cli, switch (r_q.info_class) { case 3: if (r_q.dom.id3.buffer_dom_name != 0) { - char *dom_name = dos_unistrn2(r_q.dom.id3.uni_domain_name.buffer, - r_q.dom.id3.uni_domain_name.uni_str_len); - fstrcpy(domain_name, dom_name); + rpcstr_pull(domain_name, r_q.dom.id3.uni_domain_name.buffer, sizeof(domain_name), r_q.dom.id3.uni_domain_name.uni_str_len*2, 0); } if (r_q.dom.id3.buffer_dom_sid != 0) *domain_sid = r_q.dom.id3.dom_sid.sid; break; case 5: if (r_q.dom.id5.buffer_dom_name != 0) { - char *dom_name = dos_unistrn2(r_q.dom.id5.uni_domain_name.buffer, - r_q.dom.id5.uni_domain_name.uni_str_len); - fstrcpy(domain_name, dom_name); + rpcstr_pull(domain_name, r_q.dom.id5.uni_domain_name.buffer, sizeof(domain_name), r_q.dom.id5.uni_domain_name.uni_str_len*2, 0); } if (r_q.dom.id5.buffer_dom_sid != 0) *domain_sid = r_q.dom.id5.dom_sid.sid; diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c index 2c9d38166d..5b96c8300f 100644 --- a/source3/rpc_client/cli_netlogon.c +++ b/source3/rpc_client/cli_netlogon.c @@ -73,7 +73,7 @@ BOOL cli_net_logon_ctrl2(struct cli_state *cli, uint32 status_level) global_myname, status_level)); /* store the parameters */ - init_q_logon_ctrl2(&q_l, unix_to_dos(cli->srv_name_slash,False), + init_q_logon_ctrl2(&q_l, cli->srv_name_slash, status_level); /* turn parameters into data stream */ @@ -136,7 +136,7 @@ BOOL cli_net_auth2(struct cli_state *cli, uint16 sec_chan, credstr(cli->clnt_cred.challenge.data), neg_flags)); /* store the parameters */ - init_q_auth_2(&q_a, unix_to_dos(cli->srv_name_slash,False), cli->mach_acct, + init_q_auth_2(&q_a, cli->srv_name_slash, cli->mach_acct, sec_chan, global_myname, &cli->clnt_cred.challenge, neg_flags); /* turn parameters into data stream */ @@ -225,7 +225,7 @@ BOOL cli_net_req_chal(struct cli_state *cli, DOM_CHAL *clnt_chal, DOM_CHAL *srv_ cli->desthost, global_myname, credstr(clnt_chal->data))); /* store the parameters */ - init_q_req_chal(&q_c, unix_to_dos(cli->srv_name_slash,False), + init_q_req_chal(&q_c, cli->srv_name_slash, global_myname, clnt_chal); /* turn parameters into data stream */ @@ -291,7 +291,7 @@ BOOL cli_net_srv_pwset(struct cli_state *cli, uint8 hashed_mach_pwd[16]) credstr(new_clnt_cred.challenge.data), new_clnt_cred.timestamp.time)); /* store the parameters */ - init_q_srv_pwset(&q_s, unix_to_dos(cli->srv_name_slash,False), + init_q_srv_pwset(&q_s, cli->srv_name_slash, cli->mach_acct, sec_chan_type, global_myname, &new_clnt_cred, (char *)hashed_mach_pwd); @@ -369,7 +369,7 @@ static uint32 cli_net_sam_logon_internal(struct cli_state *cli, NET_ID_INFO_CTR /* store the parameters */ q_s.validation_level = validation_level; - init_sam_info(&q_s.sam_id, unix_to_dos(cli->srv_name_slash,False), + init_sam_info(&q_s.sam_id, cli->srv_name_slash, global_myname, &new_clnt_cred, &dummy_rtn_creds, ctr->switch_value, ctr); @@ -506,7 +506,7 @@ BOOL cli_net_sam_logoff(struct cli_state *cli, NET_ID_INFO_CTR *ctr) memset(&dummy_rtn_creds, '\0', sizeof(dummy_rtn_creds)); - init_sam_info(&q_s.sam_id, unix_to_dos(cli->srv_name_slash,False), + init_sam_info(&q_s.sam_id, cli->srv_name_slash, global_myname, &new_clnt_cred, &dummy_rtn_creds, ctr->switch_value, ctr); diff --git a/source3/rpc_client/cli_reg.c b/source3/rpc_client/cli_reg.c index dc547801df..2e71d5a18f 100644 --- a/source3/rpc_client/cli_reg.c +++ b/source3/rpc_client/cli_reg.c @@ -311,7 +311,7 @@ BOOL do_reg_query_key(struct cli_state *cli, POLICY_HND *hnd, } *class_len = r_o.hdr_class.uni_max_len; - fstrcpy(class, dos_unistr2_to_str(&r_o.uni_class)); + rpcstr_pull(class, &r_o.uni_class, -1, -1, 0); *num_subkeys = r_o.num_subkeys ; *max_subkeylen = r_o.max_subkeylen ; *max_subkeysize = r_o.max_subkeysize; @@ -438,7 +438,8 @@ BOOL do_reg_query_info(struct cli_state *cli, POLICY_HND *hnd, return False; } - fstrcpy(key_value, dos_buffer2_to_str(r_o.uni_val)); + /*fstrcpy(key_value, dos_buffer2_to_str(r_o.uni_val));*/ + rpcstr_pull(key_value, r_o.uni_val->buffer, sizeof(fstring), r_o.uni_val->buf_len, 0); *key_type = r_o.type; prs_mem_free(&rbuf); @@ -819,7 +820,7 @@ BOOL do_reg_enum_key(struct cli_state *cli, POLICY_HND *hnd, (*unk_1) = r_o.unknown_1; (*unk_2) = r_o.unknown_2; - fstrcpy(key_name, dos_unistr2(r_o.key_name.str.buffer)); + rpcstr_pull(key_name, r_o.key_name.str.buffer, -1, -1, 0); (*mod_time) = nt_time_to_unix(&r_o.time); prs_mem_free(&rbuf); @@ -942,7 +943,7 @@ BOOL do_reg_enum_val(struct cli_state *cli, POLICY_HND *hnd, } (*val_type) = r_o.type; - fstrcpy(val_name, dos_unistr2_to_str(&r_o.uni_name)); + rpcstr_pull(val_name, &r_o.uni_name, -1, -1, 0); prs_mem_free(&rbuf); diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index 4b118dd2b4..216a6e2eca 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -539,8 +539,7 @@ void init_unistr(UNISTR *str, const char *buf) if (str->buffer == NULL) smb_panic("init_unistr: malloc fail\n"); - /* store the string (null-terminated copy) */ - dos_struni2((char *)str->buffer, buf, len); + rpcstr_push(str->buffer, buf, len, STR_TERMINATE); } /******************************************************************* @@ -605,12 +604,12 @@ void init_buffer3_str(BUFFER3 *str, char *buf, int len) /* set up string lengths. */ str->buf_max_len = len * 2; - str->buf_len = len * 2; + str->buf_len = len * 2; create_buffer3(str, str->buf_max_len); - /* store the string (null-terminated 8 bit chars into 16 bit chars) */ - dos_struni2((char *)str->buffer, buf, str->buf_max_len); + rpcstr_push(str->buffer, buf, str->buf_max_len, STR_TERMINATE); + } /******************************************************************* @@ -911,8 +910,7 @@ void init_unistr2(UNISTR2 *str, const char *buf, size_t len) return; } - /* store the string (null-terminated 8 bit chars into 16 bit chars) */ - dos_struni2((char *)str->buffer, buf, len); + rpcstr_push((char *)str->buffer, buf, len, STR_TERMINATE); } /******************************************************************* @@ -1483,8 +1481,7 @@ void init_unistr3(UNISTR3 *str, const char *buf) if (str->str.buffer == NULL) smb_panic("init_unistr3: malloc fail\n"); - /* store the string (null-terminated copy) */ - dos_struni2((char *)str->str.buffer, buf, len); + rpcstr_push((char *)str->str.buffer, buf, len, STR_TERMINATE); } /******************************************************************* diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index f330c5947e..a60bad0aa2 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -877,14 +877,15 @@ void init_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, memcpy(rsp->nt_resp, nt_resp, 24); if (neg_flags & NTLMSSP_NEGOTIATE_UNICODE) { - dos_struni2(rsp->domain, domain, sizeof(rsp->domain)); - dos_struni2(rsp->user, user, sizeof(rsp->user)); - dos_struni2(rsp->wks, wks, sizeof(rsp->wks)); + rpcstr_push(rsp->domain, domain, sizeof(rsp->domain), 0); + rpcstr_push(rsp->user, user, sizeof(rsp->user), 0); + rpcstr_push(rsp->wks, wks, sizeof(rsp->wks), 0); } else { fstrcpy(rsp->domain, domain); fstrcpy(rsp->user, user); fstrcpy(rsp->wks, wks); } + rsp->sess_key[0] = 0; } diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 2b81a7708c..b303bf108e 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -4713,7 +4713,7 @@ static BOOL uniarray_2_dosarray(BUFFER5 *buf5, fstring **ar) *ar = NULL; while (src < ((char *)buf5->buffer) + buf5->buf_len*2) { - unistr_to_dos(f, src, sizeof(f)-1); + rpcstr_pull(f, src, sizeof(f)-1, -1, 0); src = skip_unibuf(src, 2*buf5->buf_len - PTR_DIFF(src,buf5->buffer)); *ar = (fstring *)Realloc(*ar, sizeof(fstring)*(n+2)); fstrcpy((*ar)[n], f); diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c index afcace3f9c..cd97dfc6d1 100644 --- a/source3/rpc_server/srv_lsa_nt.c +++ b/source3/rpc_server/srv_lsa_nt.c @@ -72,7 +72,7 @@ static int init_dom_ref(DOM_R_REF *ref, char *dom_name, DOM_SID *dom_sid) if (dom_name != NULL) { for (num = 0; num < ref->num_ref_doms_1; num++) { fstring domname; - fstrcpy(domname, dos_unistr2_to_str(&ref->ref_dom[num].uni_dom_name)); + rpcstr_pull(domname, &ref->ref_dom[num].uni_dom_name, sizeof(domname), -1, 0); if (strequal(domname, dom_name)) return num; } @@ -128,7 +128,7 @@ static void init_lsa_rid2s(DOM_R_REF *ref, DOM_RID2 *rid2, /* Split name into domain and user component */ - pstrcpy(full_name, dos_unistr2_to_str(&name[i])); + rpcstr_pull(full_name, &name[i], sizeof(full_name), -1, 0); split_domain_name(full_name, dom_name, user); /* Lookup name */ @@ -238,11 +238,6 @@ static void init_lsa_trans_names(TALLOC_CTX *ctx, DOM_R_REF *ref, LSA_TRANS_NAME sid_split_rid(&find_sid, &rid); } - /* unistr routines take dos codepage strings */ - - unix_to_dos(dom_name, True); - unix_to_dos(name, True); - dom_idx = init_dom_ref(ref, dom_name, &find_sid); DEBUG(10,("init_lsa_trans_names: added user '%s\\%s' to " @@ -337,7 +332,6 @@ uint32 _lsa_query_info(pipes_struct *p, LSA_Q_QUERY_INFO *q_u, LSA_R_QUERY_INFO { LSA_INFO_UNION *info = &r_u->dom; DOM_SID domain_sid; - fstring dos_domain; char *name = NULL; DOM_SID *sid = NULL; @@ -346,9 +340,6 @@ uint32 _lsa_query_info(pipes_struct *p, LSA_Q_QUERY_INFO *q_u, LSA_R_QUERY_INFO if (!find_policy_by_hnd(p, &q_u->pol, NULL)) return NT_STATUS_INVALID_HANDLE; - fstrcpy(dos_domain, global_myworkgroup); - unix_to_dos(dos_domain, True); - switch (q_u->info_class) { case 0x02: { @@ -368,20 +359,20 @@ uint32 _lsa_query_info(pipes_struct *p, LSA_Q_QUERY_INFO *q_u, LSA_R_QUERY_INFO switch (lp_server_role()) { case ROLE_DOMAIN_PDC: case ROLE_DOMAIN_BDC: - name = dos_domain; + name = global_myworkgroup; sid = &global_sam_sid; break; case ROLE_DOMAIN_MEMBER: - name = dos_domain; + name = global_myworkgroup; /* We need to return the Domain SID here. */ - if (secrets_fetch_domain_sid(dos_domain, + if (secrets_fetch_domain_sid(global_myworkgroup, &domain_sid)) sid = &domain_sid; else return NT_STATUS_CANT_ACCESS_DOMAIN_INFO; break; case ROLE_STANDALONE: - name = dos_domain; + name = global_myworkgroup; sid = NULL; /* Tell it we're not in a domain. */ break; default: @@ -394,15 +385,15 @@ uint32 _lsa_query_info(pipes_struct *p, LSA_Q_QUERY_INFO *q_u, LSA_R_QUERY_INFO switch (lp_server_role()) { case ROLE_DOMAIN_PDC: case ROLE_DOMAIN_BDC: - name = dos_domain; + name = global_myworkgroup; sid = &global_sam_sid; break; case ROLE_DOMAIN_MEMBER: - name = dos_domain; + name = global_myworkgroup; sid = &global_sam_sid; break; case ROLE_STANDALONE: - name = dos_domain; + name = global_myworkgroup; sid = &global_sam_sid; break; default: diff --git a/source3/rpc_server/srv_netlog_nt.c b/source3/rpc_server/srv_netlog_nt.c index bbda4060f2..14f3e1d211 100644 --- a/source3/rpc_server/srv_netlog_nt.c +++ b/source3/rpc_server/srv_netlog_nt.c @@ -202,8 +202,7 @@ uint32 _net_req_chal(pipes_struct *p, NET_Q_REQ_CHAL *q_u, NET_R_REQ_CHAL *r_u) if (!get_valid_user_struct(p->vuid)) return NT_STATUS_NO_SUCH_USER; - fstrcpy(mach_acct, dos_unistrn2(q_u->uni_logon_clnt.buffer, - q_u->uni_logon_clnt.uni_str_len)); + rpcstr_pull(mach_acct,q_u->uni_logon_clnt.buffer,sizeof(fstring),q_u->uni_logon_clnt.uni_str_len*2,0); strlower(mach_acct); fstrcat(mach_acct, "$"); @@ -357,8 +356,8 @@ uint32 _net_srv_pwset(pipes_struct *p, NET_Q_SRV_PWSET *q_u, NET_R_SRV_PWSET *r_ DEBUG(5,("_net_srv_pwset: %d\n", __LINE__)); - pstrcpy(mach_acct, dos_unistrn2(q_u->clnt_id.login.uni_acct_name.buffer, - q_u->clnt_id.login.uni_acct_name.uni_str_len)); + rpcstr_pull(mach_acct,q_u->clnt_id.login.uni_acct_name.buffer, + sizeof(mach_acct),q_u->clnt_id.login.uni_acct_name.uni_str_len*2,0); DEBUG(3,("Server Password Set Wksta:[%s]\n", mach_acct)); @@ -592,7 +591,7 @@ uint32 _net_sam_logon(pipes_struct *p, NET_Q_SAM_LOGON *q_u, NET_R_SAM_LOGON *r_ /* check username exists */ - pstrcpy(nt_username, dos_unistrn2(uni_samlogon_user->buffer, uni_samlogon_user->uni_str_len)); + rpcstr_pull(nt_username,uni_samlogon_user->buffer,sizeof(nt_username),uni_samlogon_user->uni_str_len*2,0); DEBUG(3,("User:[%s]\n", nt_username)); diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 5f6a1d479c..cdf914a164 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -296,9 +296,9 @@ static BOOL api_pipe_ntlmssp_verify(pipes_struct *p, RPC_AUTH_NTLMSSP_RESP *ntlm */ if (p->ntlmssp_chal_flags & NTLMSSP_NEGOTIATE_UNICODE) { - fstrcpy(user_name, dos_unistrn2((uint16*)ntlmssp_resp->user, ntlmssp_resp->hdr_usr.str_str_len/2)); - fstrcpy(domain, dos_unistrn2((uint16*)ntlmssp_resp->domain, ntlmssp_resp->hdr_domain.str_str_len/2)); - fstrcpy(wks, dos_unistrn2((uint16*)ntlmssp_resp->wks, ntlmssp_resp->hdr_wks.str_str_len/2)); + rpcstr_pull(user_name, ntlmssp_resp->user, sizeof(fstring), ntlmssp_resp->hdr_usr.str_str_len*2, 0 ); + rpcstr_pull(domain, ntlmssp_resp->domain, sizeof(fstring), ntlmssp_resp->hdr_domain.str_str_len*2, 0); + rpcstr_pull(wks, ntlmssp_resp->wks, sizeof(fstring), ntlmssp_resp->hdr_wks.str_str_len*2, 0); } else { fstrcpy(user_name, ntlmssp_resp->user); fstrcpy(domain, ntlmssp_resp->domain); diff --git a/source3/rpc_server/srv_reg_nt.c b/source3/rpc_server/srv_reg_nt.c index 502d551437..3ed673c68a 100644 --- a/source3/rpc_server/srv_reg_nt.c +++ b/source3/rpc_server/srv_reg_nt.c @@ -85,7 +85,7 @@ uint32 _reg_open_entry(pipes_struct *p, REG_Q_OPEN_ENTRY *q_u, REG_R_OPEN_ENTRY if (!find_policy_by_hnd(p, &q_u->pol, NULL)) return NT_STATUS_INVALID_HANDLE; - fstrcpy(name, dos_unistrn2(q_u->uni_name.buffer, q_u->uni_name.uni_str_len)); + rpcstr_pull(name,q_u->uni_name.buffer,sizeof(name),q_u->uni_name.uni_str_len*2,0); DEBUG(5,("reg_open_entry: %s\n", name)); @@ -129,7 +129,7 @@ uint32 _reg_info(pipes_struct *p, REG_Q_INFO *q_u, REG_R_INFO *r_u) if (find_policy_by_hnd(p, &q_u->pol, NULL) == -1) return NT_STATUS_INVALID_HANDLE; - fstrcpy(name, dos_unistrn2(q_u->uni_type.buffer, q_u->uni_type.uni_str_len)); + rpcstr_pull(name, q_u->uni_type.buffer, sizeof(name), q_u->uni_type.uni_str_len*2, 0); DEBUG(5,("reg_info: checking key: %s\n", name)); diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c index 5106271c60..d783de3b4b 100644 --- a/source3/rpc_server/srv_samr_nt.c +++ b/source3/rpc_server/srv_samr_nt.c @@ -246,7 +246,7 @@ static char *unmap_unixname(char *unix_user_name, int name_idx) if (!*unix_user_name) return NULL; if (!*mapfile) return NULL; - lines = file_lines_load(mapfile, NULL,False); + lines = file_lines_load(mapfile, NULL); if (!lines) { DEBUG(0,("unmap_unixname: can't open username map %s\n", mapfile)); return NULL; @@ -1253,7 +1253,7 @@ uint32 _samr_lookup_names(pipes_struct *p, SAMR_Q_LOOKUP_NAMES *q_u, SAMR_R_LOOK rid [i] = 0xffffffff; type[i] = SID_NAME_UNKNOWN; - fstrcpy(name, dos_unistrn2(q_u->uni_name[i].buffer, q_u->uni_name[i].uni_str_len)); + rpcstr_pull(name, q_u->uni_name[i].buffer, sizeof(name), q_u->uni_name[i].uni_str_len*2, 0); if(sid_equal(&pol_sid, &global_sam_sid)) { DOM_SID sid; @@ -1284,8 +1284,8 @@ uint32 _samr_chgpasswd_user(pipes_struct *p, SAMR_Q_CHGPASSWD_USER *q_u, SAMR_R_ r_u->status = NT_STATUS_NOPROBLEMO; - fstrcpy(user_name, dos_unistrn2(q_u->uni_user_name.buffer, q_u->uni_user_name.uni_str_len)); - fstrcpy(wks , dos_unistrn2(q_u->uni_dest_host.buffer, q_u->uni_dest_host.uni_str_len)); + rpcstr_pull(user_name, q_u->uni_user_name.buffer, sizeof(user_name), q_u->uni_user_name.uni_str_len*2, 0); + rpcstr_pull(wks, q_u->uni_dest_host.buffer, sizeof(wks), q_u->uni_dest_host.uni_str_len,0); DEBUG(5,("samr_chgpasswd_user: user: %s wks: %s\n", user_name, wks)); @@ -1810,7 +1810,7 @@ uint32 _api_samr_create_user(pipes_struct *p, SAMR_Q_CREATE_USER *q_u, SAMR_R_CR reply if the account already exists... */ - fstrcpy(mach_acct, dos_unistrn2(user_account.buffer, user_account.uni_str_len)); + rpcstr_pull(mach_acct, user_account.buffer, sizeof(mach_acct), user_account.uni_str_len*2, 0); strlower(mach_acct); pdb_init_sam(&sam_pass); diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 3fcb08891d..7002241a00 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -300,7 +300,6 @@ static uint32 delete_printer_handle(pipes_struct *p, POLICY_HND *hnd) /* Printer->dev.handlename equals portname equals sharename */ slprintf(command, sizeof(command)-1, "%s \"%s\"", cmd, Printer->dev.handlename); - dos_to_unix(command, True); /* Convert printername to unix-codepage */ DEBUG(10,("Running [%s]\n", command)); ret = smbrun(command, NULL); @@ -944,8 +943,8 @@ BOOL convert_devicemode(char *printername, const DEVICEMODE *devmode, return False; } - unistr_to_dos(nt_devmode->devicename, (const char *)devmode->devicename.buffer, 31); - unistr_to_dos(nt_devmode->formname, (const char *)devmode->formname.buffer, 31); + rpcstr_pull(nt_devmode->devicename,devmode->devicename.buffer, 31, -1, 0); + rpcstr_pull(nt_devmode->formname,devmode->formname.buffer, 31, -1, 0); nt_devmode->specversion=devmode->specversion; nt_devmode->driverversion=devmode->driverversion; @@ -1356,7 +1355,6 @@ static BOOL srv_spoolss_replyopenprinter(char *printer, uint32 localprinter, uin fstring unix_printer; fstrcpy(unix_printer, printer+2); /* the +2 is to strip the leading 2 backslashs */ - dos_to_unix(unix_printer, True); if(!spoolss_connect_to_client(&cli, unix_printer)) return False; @@ -1437,7 +1435,7 @@ static void spoolss_notify_server_name(int snum, slprintf(temp_name, sizeof(temp_name)-1, "\\\\%s", global_myname); - len = (uint32)dos_PutUniCode(temp, temp_name, sizeof(temp) - 2, True); + len = rpcstr_push(temp, temp_name, sizeof(temp)-2, 0); data->notify_data.data.length = len / 2 - 1; data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); @@ -1471,8 +1469,7 @@ static void spoolss_notify_printer_name(int snum, p++; } - len = (uint32)dos_PutUniCode(temp, p, sizeof(temp) - 2, True); - + len = rpcstr_push(temp, p, sizeof(temp)-2, 0); data->notify_data.data.length = len / 2 - 1; data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); @@ -1496,8 +1493,7 @@ static void spoolss_notify_share_name(int snum, pstring temp; uint32 len; - len = (uint32)dos_PutUniCode(temp, lp_servicename(snum), - sizeof(temp) - 2, True); + len = rpcstr_push(temp, lp_servicename(snum), sizeof(temp) - 2, 0); data->notify_data.data.length = len / 2 - 1; data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); @@ -1524,8 +1520,7 @@ static void spoolss_notify_port_name(int snum, /* even if it's strange, that's consistant in all the code */ - len = (uint32)dos_PutUniCode(temp, printer->info_2->portname, - sizeof(temp) - 2, True); + len = rpcstr_push(temp, printer->info_2->portname, sizeof(temp) - 2, 0); data->notify_data.data.length = len / 2 - 1; data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); @@ -1552,9 +1547,7 @@ static void spoolss_notify_driver_name(int snum, pstring temp; uint32 len; - len = (uint32)dos_PutUniCode(temp, printer->info_2->drivername, - sizeof(temp) - 2, True); - + len = rpcstr_push(temp, printer->info_2->drivername, sizeof(temp) - 2, 0); data->notify_data.data.length = len / 2 - 1; data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); @@ -1579,11 +1572,10 @@ static void spoolss_notify_comment(int snum, uint32 len; if (*printer->info_2->comment == '\0') - len = (uint32)dos_PutUniCode(temp, lp_comment(snum), - sizeof(temp) - 2, True); + len = rpcstr_push(temp, lp_comment(snum), sizeof(temp) - 2, 0); + else - len = (uint32)dos_PutUniCode(temp, printer->info_2->comment, - sizeof(temp) - 2, True); + len = rpcstr_push(temp, printer->info_2->comment, sizeof(temp) - 2, 0); data->notify_data.data.length = len / 2 - 1; data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); @@ -1610,8 +1602,7 @@ static void spoolss_notify_location(int snum, pstring temp; uint32 len; - len = (uint32)dos_PutUniCode(temp, printer->info_2->location, - sizeof(temp) - 2, True); + len = rpcstr_push(temp, printer->info_2->location,sizeof(temp) - 2, 0); data->notify_data.data.length = len / 2 - 1; data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); @@ -1650,8 +1641,7 @@ static void spoolss_notify_sepfile(int snum, pstring temp; uint32 len; - len = (uint32)dos_PutUniCode(temp, printer->info_2->sepfile, - sizeof(temp) - 2, True); + len = rpcstr_push(temp, printer->info_2->sepfile, sizeof(temp) - 2, 0); data->notify_data.data.length = len / 2 - 1; data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); @@ -1677,8 +1667,7 @@ static void spoolss_notify_print_processor(int snum, pstring temp; uint32 len; - len = (uint32)dos_PutUniCode(temp, printer->info_2->printprocessor, - sizeof(temp) - 2, True); + len = rpcstr_push(temp, printer->info_2->printprocessor, sizeof(temp) - 2, 0); data->notify_data.data.length = len / 2 - 1; data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); @@ -1704,8 +1693,8 @@ static void spoolss_notify_parameters(int snum, pstring temp; uint32 len; - len = (uint32)dos_PutUniCode(temp, printer->info_2->parameters, - sizeof(temp) - 2, True); + len = rpcstr_push(temp, printer->info_2->parameters, sizeof(temp) - + 2, 0); data->notify_data.data.length = len / 2 - 1; data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); @@ -1731,8 +1720,7 @@ static void spoolss_notify_datatype(int snum, pstring temp; uint32 len; - len = (uint32)dos_PutUniCode(temp, printer->info_2->datatype, - sizeof(pstring) - 2, True); + len = rpcstr_push(temp, printer->info_2->datatype, sizeof(pstring)-2, 0); data->notify_data.data.length = len / 2 - 1; data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); @@ -1882,8 +1870,8 @@ static void spoolss_notify_username(int snum, pstring temp; uint32 len; - len = (uint32)dos_PutUniCode(temp, queue->user, - sizeof(temp) - 2, True); + len = rpcstr_push(temp, queue->user, sizeof(temp) - 2, 0); + data->notify_data.data.length = len / 2 - 1; data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); @@ -1920,9 +1908,8 @@ static void spoolss_notify_job_name(int snum, pstring temp; uint32 len; - len = (uint32)dos_PutUniCode(temp, queue->file, sizeof(temp) - 2, - True); - + len = rpcstr_push(temp, queue->file, sizeof(temp) - 2, 0); + data->notify_data.data.length = len / 2 - 1; data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); @@ -1970,7 +1957,7 @@ static void spoolss_notify_job_status_string(int snum, } #endif /* NO LONGER NEEDED. */ - len = (uint32)dos_PutUniCode(temp, p, sizeof(temp) - 2, True); + len = rpcstr_push(temp, p, sizeof(temp) - 2, 0); data->notify_data.data.length = len / 2 - 1; data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); @@ -3487,7 +3474,7 @@ static void init_unistr_array(uint16 **uni_array, fstring *char_array, char *ser DEBUG(0,("init_unistr_array: Realloc error\n" )); return; } - j += (dos_PutUniCode((char *)(*uni_array+j), line , sizeof(uint16)*strlen(line), True) / sizeof(uint16) ); + j += (rpcstr_push((*uni_array+j), line, sizeof(uint16)*strlen(line)+2, 0)/ sizeof(uint16)); i++; } @@ -4231,8 +4218,6 @@ static BOOL add_printer_hook(NT_PRINTER_INFO_LEVEL *printer) printer->info_2->portname, printer->info_2->drivername, printer->info_2->location, driverlocation); - /* Convert script args to unix-codepage */ - dos_to_unix(command, True); DEBUG(10,("Running [%s]\n", command)); ret = smbrun(command, &fd); DEBUGADD(10,("returned [%d]\n", ret)); @@ -4245,7 +4230,7 @@ static BOOL add_printer_hook(NT_PRINTER_INFO_LEVEL *printer) numlines = 0; /* Get lines and convert them back to dos-codepage */ - qlines = fd_lines_load(fd, &numlines, True); + qlines = fd_lines_load(fd, &numlines); DEBUGADD(10,("Lines returned = [%d]\n", numlines)); close(fd); @@ -5507,7 +5492,7 @@ static uint32 enumports_level_1(NEW_BUFFER *buffer, uint32 offered, uint32 *need } numlines = 0; - qlines = fd_lines_load(fd, &numlines,True); + qlines = fd_lines_load(fd, &numlines); DEBUGADD(10,("Lines returned = [%d]\n", numlines)); close(fd); @@ -5605,7 +5590,7 @@ static uint32 enumports_level_2(NEW_BUFFER *buffer, uint32 offered, uint32 *need } numlines = 0; - qlines = fd_lines_load(fd, &numlines,True); + qlines = fd_lines_load(fd, &numlines); DEBUGADD(10,("Lines returned = [%d]\n", numlines)); close(fd); @@ -6061,7 +6046,7 @@ uint32 _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S return ERROR_NOT_ENOUGH_MEMORY; } - *out_value_len = (uint32)dos_PutUniCode((char *)*out_value, value, in_value_len, True); + *out_value_len = rpcstr_push((char *)*out_value,value, in_value_len, 0); *out_type=type; diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c index b487eb1c82..78d9429b43 100644 --- a/source3/rpc_server/srv_srvsvc_nt.c +++ b/source3/rpc_server/srv_srvsvc_nt.c @@ -1229,9 +1229,7 @@ static char *valid_share_pathname(char *dos_pathname) if (getcwd(saved_pathname, sizeof(saved_pathname)) == NULL) return False; - /* Convert to UNIX charset. */ pstrcpy(unix_pathname, ptr); - dos_to_unix(unix_pathname, True); ret = chdir(unix_pathname); @@ -1338,7 +1336,6 @@ uint32 _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, S slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\" \"%s\" \"%s\"", lp_change_share_cmd(), CONFIGFILE, share_name, ptr, comment); - dos_to_unix(command, True); /* Convert to unix-codepage */ DEBUG(10,("_srv_net_share_set_info: Running [%s]\n", command )); if ((ret = smbrun(command, NULL)) != 0) { @@ -1455,7 +1452,6 @@ uint32 _srv_net_share_add(pipes_struct *p, SRV_Q_NET_SHARE_ADD *q_u, SRV_R_NET_S slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\" \"%s\" \"%s\"", lp_add_share_cmd(), CONFIGFILE, share_name, ptr, comment); - dos_to_unix(command, True); /* Convert to unix-codepage */ DEBUG(10,("_srv_net_share_add: Running [%s]\n", command )); if ((ret = smbrun(command, NULL)) != 0) { @@ -1522,7 +1518,6 @@ uint32 _srv_net_share_del(pipes_struct *p, SRV_Q_NET_SHARE_DEL *q_u, SRV_R_NET_S slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\"", lp_delete_share_cmd(), CONFIGFILE, lp_servicename(snum)); - dos_to_unix(command, True); /* Convert to unix-codepage */ DEBUG(10,("_srv_net_share_del: Running [%s]\n", command )); if ((ret = smbrun(command, NULL)) != 0) { diff --git a/source3/rpc_server/srv_wkssvc_nt.c b/source3/rpc_server/srv_wkssvc_nt.c index 40771d2fb9..47566bbf3e 100644 --- a/source3/rpc_server/srv_wkssvc_nt.c +++ b/source3/rpc_server/srv_wkssvc_nt.c @@ -50,7 +50,7 @@ static void create_wks_info_100(WKS_INFO_100 *inf) 0x000001f4, /* platform id info */ lp_major_announce_version(), lp_minor_announce_version(), - my_name, unix_to_dos(domain,False)); + my_name, domain); } /******************************************************************* diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index 6b5d45a249..30c1616779 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -204,9 +204,9 @@ static void display_print_info_0(PRINTER_INFO_0 *i1) fstring name; fstring servername; - unistr_to_ascii(name, i1->printername.buffer, sizeof(name) - 1); - unistr_to_ascii(servername, i1->servername.buffer, sizeof(servername) - 1); - + rpcstr_pull(name, i1->printername.buffer, sizeof(name), 0, STR_TERMINATE); + rpcstr_pull(servername, i1->servername.buffer, sizeof(servername), 0,STR_TERMINATE); + printf("\tprintername:[%s]\n", name); printf("\tservername:[%s]\n", servername); printf("\tcjobs:[0x%x]\n", i1->cjobs); @@ -257,9 +257,9 @@ static void display_print_info_1(PRINTER_INFO_1 *i1) fstring name; fstring comm; - unistr_to_ascii(desc, i1->description.buffer, sizeof(desc) - 1); - unistr_to_ascii(name, i1->name .buffer, sizeof(name) - 1); - unistr_to_ascii(comm, i1->comment .buffer, sizeof(comm) - 1); + rpcstr_pull(desc, i1->description.buffer, sizeof(desc), 0, STR_TERMINATE); + rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE); + rpcstr_pull(comm, i1->comment.buffer, sizeof(comm), 0, STR_TERMINATE); printf("\tflags:[0x%x]\n", i1->flags); printf("\tname:[%s]\n", name); @@ -284,23 +284,17 @@ static void display_print_info_2(PRINTER_INFO_2 *i2) fstring datatype; fstring parameters; - unistr_to_ascii(servername, i2->servername.buffer, - sizeof(servername) - 1); - unistr_to_ascii(printername, i2->printername.buffer, - sizeof(printername) - 1); - unistr_to_ascii(sharename, i2->sharename.buffer, - sizeof(sharename) - 1); - unistr_to_ascii(portname, i2->portname.buffer, sizeof(portname) - 1); - unistr_to_ascii(drivername, i2->drivername.buffer, - sizeof(drivername) - 1); - unistr_to_ascii(comment, i2->comment.buffer, sizeof(comment) - 1); - unistr_to_ascii(location, i2->location.buffer, sizeof(location) - 1); - unistr_to_ascii(sepfile, i2->sepfile.buffer, sizeof(sepfile) - 1); - unistr_to_ascii(printprocessor, i2->printprocessor.buffer, - sizeof(printprocessor) - 1); - unistr_to_ascii(datatype, i2->datatype.buffer, sizeof(datatype) - 1); - unistr_to_ascii(parameters, i2->parameters.buffer, - sizeof(parameters) - 1); + rpcstr_pull(servername, i2->servername.buffer,sizeof(servername), 0, STR_TERMINATE); + rpcstr_pull(printername, i2->printername.buffer,sizeof(printername), 0, STR_TERMINATE); + rpcstr_pull(sharename, i2->sharename.buffer,sizeof(sharename), 0, STR_TERMINATE); + rpcstr_pull(portname, i2->portname.buffer,sizeof(portname), 0, STR_TERMINATE); + rpcstr_pull(drivername, i2->drivername.buffer,sizeof(drivername), 0, STR_TERMINATE); + rpcstr_pull(comment, i2->comment.buffer,sizeof(comment), 0, STR_TERMINATE); + rpcstr_pull(location, i2->location.buffer,sizeof(location), 0, STR_TERMINATE); + rpcstr_pull(sepfile, i2->sepfile.buffer,sizeof(sepfile), 0, STR_TERMINATE); + rpcstr_pull(printprocessor, i2->printprocessor.buffer,sizeof(printprocessor), 0, STR_TERMINATE); + rpcstr_pull(datatype, i2->datatype.buffer,sizeof(datatype), 0, STR_TERMINATE); + rpcstr_pull(parameters, i2->parameters.buffer,sizeof(parameters), 0, STR_TERMINATE); printf("\tservername:[%s]\n", servername); printf("\tprintername:[%s]\n", printername); @@ -420,7 +414,7 @@ static void display_port_info_1(PORT_INFO_1 *i1) { fstring buffer; - unistr_to_ascii(buffer, i1->port_name.buffer, sizeof(buffer)-1); + rpcstr_pull(buffer, i1->port_name.buffer, sizeof(buffer), 0, STR_TERMINATE); printf("\tPort Name:\t[%s]\n", buffer); } @@ -431,11 +425,13 @@ static void display_port_info_2(PORT_INFO_2 *i2) { fstring buffer; - unistr_to_ascii(buffer, i2->port_name.buffer, sizeof(buffer) - 1); + rpcstr_pull(buffer, i2->port_name.buffer, sizeof(buffer), 0, STR_TERMINATE); printf("\tPort Name:\t[%s]\n", buffer); - unistr_to_ascii(buffer, i2->monitor_name.buffer, sizeof(buffer) - 1); + rpcstr_pull(buffer, i2->monitor_name.buffer, sizeof(buffer), 0, STR_TERMINATE); + printf("\tMonitor Name:\t[%s]\n", buffer); - unistr_to_ascii(buffer, i2->description.buffer, sizeof(buffer) - 1); + rpcstr_pull(buffer, i2->description.buffer, sizeof(buffer), 0, STR_TERMINATE); + printf("\tDescription:\t[%s]\n", buffer); printf("\tPort Type:\t[%d]\n", i2->port_type); printf("\tReserved:\t[%d]\n", i2->reserved); @@ -600,7 +596,7 @@ static void display_print_driver_1(DRIVER_INFO_1 *i1) if (i1 == NULL) return; - unistr_to_ascii(name, i1->name.buffer, sizeof(name)-1); + rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE); printf ("Printer Driver Info 1:\n"); printf ("\tDriver Name: [%s]\n\n", name); @@ -621,11 +617,11 @@ static void display_print_driver_2(DRIVER_INFO_2 *i1) if (i1 == NULL) return; - unistr_to_ascii(name, i1->name.buffer, sizeof(name)-1); - unistr_to_ascii(architecture, i1->architecture.buffer, sizeof(architecture)-1); - unistr_to_ascii(driverpath, i1->driverpath.buffer, sizeof(driverpath)-1); - unistr_to_ascii(datafile, i1->datafile.buffer, sizeof(datafile)-1); - unistr_to_ascii(configfile, i1->configfile.buffer, sizeof(configfile)-1); + rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE); + rpcstr_pull(architecture, i1->architecture.buffer, sizeof(architecture), 0, STR_TERMINATE); + rpcstr_pull(driverpath, i1->driverpath.buffer, sizeof(driverpath), 0, STR_TERMINATE); + rpcstr_pull(datafile, i1->datafile.buffer, sizeof(datafile), 0, STR_TERMINATE); + rpcstr_pull(configfile, i1->configfile.buffer, sizeof(configfile), 0, STR_TERMINATE); printf ("Printer Driver Info 2:\n"); printf ("\tVersion: [%x]\n", i1->version); @@ -659,19 +655,18 @@ static void display_print_driver_3(DRIVER_INFO_3 *i1) if (i1 == NULL) return; - unistr_to_ascii(name, i1->name.buffer, sizeof(name)-1); - unistr_to_ascii(architecture, i1->architecture.buffer, sizeof(architecture)-1); - unistr_to_ascii(driverpath, i1->driverpath.buffer, sizeof(driverpath)-1); - unistr_to_ascii(datafile, i1->datafile.buffer, sizeof(datafile)-1); - unistr_to_ascii(configfile, i1->configfile.buffer, sizeof(configfile)-1); - unistr_to_ascii(helpfile, i1->helpfile.buffer, sizeof(helpfile)-1); - - unistr_to_ascii(monitorname, i1->monitorname.buffer, sizeof(monitorname)-1); - unistr_to_ascii(defaultdatatype, i1->defaultdatatype.buffer, sizeof(defaultdatatype)-1); + rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE); + rpcstr_pull(architecture, i1->architecture.buffer, sizeof(architecture), 0, STR_TERMINATE); + rpcstr_pull(driverpath, i1->driverpath.buffer, sizeof(driverpath), 0, STR_TERMINATE); + rpcstr_pull(datafile, i1->datafile.buffer, sizeof(datafile), 0, STR_TERMINATE); + rpcstr_pull(configfile, i1->configfile.buffer, sizeof(configfile), 0, STR_TERMINATE); + rpcstr_pull(helpfile, i1->helpfile.buffer, sizeof(helpfile), 0, STR_TERMINATE); + rpcstr_pull(monitorname, i1->monitorname.buffer, sizeof(monitorname), 0, STR_TERMINATE); + rpcstr_pull(defaultdatatype, i1->defaultdatatype.buffer, sizeof(defaultdatatype), 0, STR_TERMINATE); printf ("Printer Driver Info 3:\n"); printf ("\tVersion: [%x]\n", i1->version); - printf ("\tDriver Name: [%s]\n",name ); + printf ("\tDriver Name: [%s]\n",name); printf ("\tArchitecture: [%s]\n", architecture); printf ("\tDriver Path: [%s]\n", driverpath); printf ("\tDatafile: [%s]\n", datafile); @@ -680,7 +675,8 @@ static void display_print_driver_3(DRIVER_INFO_3 *i1) while (valid) { - unistr_to_ascii(dependentfiles, i1->dependentfiles+length, sizeof(dependentfiles)-1); + rpcstr_pull(dependentfiles, i1->dependentfiles+length, sizeof(dependentfiles), 0, STR_TERMINATE); + length+=strlen(dependentfiles)+1; if (strlen(dependentfiles) > 0) @@ -913,7 +909,7 @@ static void display_printdriverdir_1(DRIVER_DIRECTORY_1 *i1) if (i1 == NULL) return; - unistr_to_ascii(name, i1->name.buffer, sizeof(name)-1); + rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE); printf ("\tDirectory Name:[%s]\n", name); } @@ -1139,7 +1135,7 @@ static uint32 cmd_spoolss_addprinterdriver (struct cli_state *cli, int argc, cha return result; } - unistr_to_ascii (driver_name, info3.name.buffer, sizeof(driver_name)-1); + rpcstr_pull(driver_name, info3.name.buffer, sizeof(driver_name), 0, STR_TERMINATE); printf ("Printer Driver %s successfully installed.\n", driver_name); /* cleanup */ diff --git a/source3/rpcclient/display.c b/source3/rpcclient/display.c index 12ae5e2dfe..345ed7d49a 100644 --- a/source3/rpcclient/display.c +++ b/source3/rpcclient/display.c @@ -170,8 +170,8 @@ void display_srv_info_101(FILE *out_hnd, enum action_type action, fstring name; fstring comment; - fstrcpy(name , dos_unistrn2(sv101->uni_name .buffer, sv101->uni_name .uni_str_len)); - fstrcpy(comment , dos_unistrn2(sv101->uni_comment .buffer, sv101->uni_comment .uni_str_len)); + rpcstr_pull(name, sv101->uni_name.buffer, sizeof(name), sv101->uni_name.uni_str_len*2, 0); + rpcstr_pull(comment, sv101->uni_comment.buffer, sizeof(comment), sv101->uni_comment.uni_str_len*2, 0); display_server(out_hnd, action, name, sv101->srv_type, comment); @@ -212,9 +212,9 @@ void display_srv_info_102(FILE *out_hnd, enum action_type action,SRV_INFO_102 *s fstring comment; fstring usr_path; - fstrcpy(name , dos_unistrn2(sv102->uni_name .buffer, sv102->uni_name .uni_str_len)); - fstrcpy(comment , dos_unistrn2(sv102->uni_comment .buffer, sv102->uni_comment .uni_str_len)); - fstrcpy(usr_path, dos_unistrn2(sv102->uni_usr_path.buffer, sv102->uni_usr_path.uni_str_len)); + rpcstr_pull(name, sv102->uni_name.buffer, sizeof(name), sv102->uni_name.uni_str_len*2, 0); + rpcstr_pull(comment, sv102->uni_comment.buffer, sizeof(comment), sv102->uni_comment.uni_str_len*2, 0); + rpcstr_pull(usr_path, sv102->uni_usr_path.buffer, sizeof(usr_path), sv102->uni_usr_path.uni_str_len*2, 0); display_server(out_hnd, action, name, sv102->srv_type, comment); @@ -325,8 +325,8 @@ void display_conn_info_1(FILE *out_hnd, enum action_type action, fstring usr_name; fstring net_name; - fstrcpy(usr_name, dos_unistrn2(str1->uni_usr_name.buffer, str1->uni_usr_name.uni_str_len)); - fstrcpy(net_name, dos_unistrn2(str1->uni_net_name.buffer, str1->uni_net_name.uni_str_len)); + rpcstr_pull(usr_name, str1->uni_usr_name.buffer, sizeof(usr_name), str1->uni_usr_name.uni_str_len*2,0); + rpcstr_pull(net_name, str1->uni_net_name.buffer, sizeof(net_name), str1->uni_net_name.uni_str_len*2,0); fprintf(out_hnd, "\tid : %d\n", info1->id); fprintf(out_hnd, "\ttype : %s\n", get_share_type_str(info1->type)); @@ -481,8 +481,8 @@ void display_share_info_1(FILE *out_hnd, enum action_type action, fstring remark ; fstring net_name; - fstrcpy(net_name, dos_unistrn2(info1->info_1_str.uni_netname.buffer, info1->info_1_str.uni_netname.uni_str_len)); - fstrcpy(remark , dos_unistrn2(info1->info_1_str.uni_remark .buffer, info1->info_1_str.uni_remark .uni_str_len)); + rpcstr_pull(net_name, info1->info_1_str.uni_netname.buffer, sizeof(net_name), info1->info_1_str.uni_netname.uni_str_len*2, 0); + rpcstr_pull(remark, info1->info_1_str.uni_remark.buffer, sizeof(remark), info1->info_1_str.uni_remark.uni_str_len*2, 0); display_share(out_hnd, action, net_name, info1->info_1.type, remark); @@ -523,10 +523,10 @@ void display_share_info_2(FILE *out_hnd, enum action_type action, fstring path ; fstring passwd ; - fstrcpy(net_name, dos_unistrn2(info2->info_2_str.uni_netname.buffer, info2->info_2_str.uni_netname.uni_str_len)); - fstrcpy(remark , dos_unistrn2(info2->info_2_str.uni_remark .buffer, info2->info_2_str.uni_remark .uni_str_len)); - fstrcpy(path , dos_unistrn2(info2->info_2_str.uni_path .buffer, info2->info_2_str.uni_path .uni_str_len)); - fstrcpy(passwd , dos_unistrn2(info2->info_2_str.uni_passwd .buffer, info2->info_2_str.uni_passwd .uni_str_len)); + rpcstr_pull(net_name, info2->info_2_str.uni_netname.buffer, sizeof(net_name), info2->info_2_str.uni_netname.uni_str_len*2, 0); + rpcstr_pull(remark, info2->info_2_str.uni_remark.buffer, sizeof(remark), info2->info_2_str.uni_remark.uni_str_len*2, 0); + rpcstr_pull(path, info2->info_2_str.uni_path.buffer, sizeof(path), info2->info_2_str.uni_path.uni_str_len*2, 0); + rpcstr_pull(passwd, info2->info_2_str.uni_passwd.buffer, sizeof(passwd), info2->info_2_str.uni_passwd.uni_str_len*2, 0); display_share2(out_hnd, action, net_name, info2->info_2.type, remark, info2->info_2.perms, @@ -617,8 +617,8 @@ void display_file_info_3(FILE *out_hnd, enum action_type action, fstring path_name; fstring user_name; - fstrcpy(path_name, dos_unistrn2(str3->uni_path_name.buffer, str3->uni_path_name.uni_str_len)); - fstrcpy(user_name, dos_unistrn2(str3->uni_user_name.buffer, str3->uni_user_name.uni_str_len)); + rpcstr_pull(path_name, str3->uni_path_name.buffer, sizeof(path_name), str3->uni_path_name.uni_str_len*2, 0); + rpcstr_pull(user_name, str3->uni_user_name.buffer, sizeof(user_name), str3->uni_user_name.uni_str_len*2, 0); fprintf(out_hnd, "\tid : %d\n", info3->id); fprintf(out_hnd, "\tperms : %s\n", get_file_mode_str(info3->perms)); @@ -908,16 +908,27 @@ void display_sam_user_info_21(FILE *out_hnd, enum action_type action, SAM_USER_I } case ACTION_ENUMERATE: { - fprintf(out_hnd, "\t\tUser Name : %s\n", dos_unistrn2(usr->uni_user_name .buffer, usr->uni_user_name .uni_str_len)); /* username unicode string */ - fprintf(out_hnd, "\t\tFull Name : %s\n", dos_unistrn2(usr->uni_full_name .buffer, usr->uni_full_name .uni_str_len)); /* user's full name unicode string */ - fprintf(out_hnd, "\t\tHome Drive : %s\n", dos_unistrn2(usr->uni_home_dir .buffer, usr->uni_home_dir .uni_str_len)); /* home directory unicode string */ - fprintf(out_hnd, "\t\tDir Drive : %s\n", dos_unistrn2(usr->uni_dir_drive .buffer, usr->uni_dir_drive .uni_str_len)); /* home directory drive unicode string */ - fprintf(out_hnd, "\t\tProfile Path: %s\n", dos_unistrn2(usr->uni_profile_path.buffer, usr->uni_profile_path.uni_str_len)); /* profile path unicode string */ - fprintf(out_hnd, "\t\tLogon Script: %s\n", dos_unistrn2(usr->uni_logon_script.buffer, usr->uni_logon_script.uni_str_len)); /* logon script unicode string */ - fprintf(out_hnd, "\t\tDescription : %s\n", dos_unistrn2(usr->uni_acct_desc .buffer, usr->uni_acct_desc .uni_str_len)); /* user description unicode string */ - fprintf(out_hnd, "\t\tWorkstations: %s\n", dos_unistrn2(usr->uni_workstations.buffer, usr->uni_workstations.uni_str_len)); /* workstaions unicode string */ - fprintf(out_hnd, "\t\tUnknown Str : %s\n", dos_unistrn2(usr->uni_unknown_str .buffer, usr->uni_unknown_str .uni_str_len)); /* unknown string unicode string */ - fprintf(out_hnd, "\t\tRemote Dial : %s\n", dos_unistrn2(usr->uni_munged_dial .buffer, usr->uni_munged_dial .uni_str_len)); /* munged remote access unicode string */ + pstring tmp; + rpcstr_pull(tmp, usr->uni_user_name.buffer, sizeof(tmp),usr->uni_user_name.uni_str_len*2, 0); + fprintf(out_hnd, "\t\tUser Name : %s\n", tmp); /* username unicode string */ + rpcstr_pull(tmp, usr->uni_full_name.buffer, sizeof(tmp),usr->uni_full_name.uni_str_len*2, 0); + fprintf(out_hnd, "\t\tFull Name : %s\n", tmp); /* user's full name unicode string */ + rpcstr_pull(tmp, usr->uni_home_dir.buffer, sizeof(tmp),usr->uni_home_dir.uni_str_len*2, 0); + fprintf(out_hnd, "\t\tHome Drive : %s\n", tmp); /* home directory unicode string */ + rpcstr_pull(tmp, usr->uni_dir_drive.buffer, sizeof(tmp),usr->uni_dir_drive.uni_str_len*2, 0); + fprintf(out_hnd, "\t\tDir Drive : %s\n", tmp); /* home directory drive unicode string */ + rpcstr_pull(tmp, usr->uni_profile_path.buffer, sizeof(tmp),usr->uni_profile_path.uni_str_len*2, 0); + fprintf(out_hnd, "\t\tProfile Path: %s\n", tmp); /* profile path unicode string */ + rpcstr_pull(tmp, usr->uni_logon_script.buffer, sizeof(tmp),usr->uni_logon_script.uni_str_len*2, 0); + fprintf(out_hnd, "\t\tLogon Script: %s\n", tmp); /* logon script unicode string */ + rpcstr_pull(tmp, usr->uni_acct_desc.buffer, sizeof(tmp),usr->uni_acct_desc.uni_str_len*2, 0); + fprintf(out_hnd, "\t\tDescription : %s\n", tmp); /* user description unicode string */ + rpcstr_pull(tmp, usr->uni_workstations.buffer, sizeof(tmp),usr->uni_workstations.uni_str_len*2, 0); + fprintf(out_hnd, "\t\tWorkstations: %s\n", tmp); /* workstaions unicode string */ + rpcstr_pull(tmp, usr->uni_unknows_str.buffer, sizeof(tmp),usr->uni_unknown_str.uni_str_len*2, 0); + fprintf(out_hnd, "\t\tUnknown Str : %s\n", tmp); /* unknown string unicode string */ + rpcstr_pull(tmp, usr->uni_munged_dial.buffer, sizeof(tmp),usr->uni_munged_dial.uni_str_len*2, 0); + fprintf(out_hnd, "\t\tRemote Dial : %s\n", tmp); /* munged remote access unicode string */ fprintf(out_hnd, "\t\tLogon Time : %s\n", http_timestring(nt_time_to_unix(&(usr->logon_time )))); fprintf(out_hnd, "\t\tLogoff Time : %s\n", http_timestring(nt_time_to_unix(&(usr->logoff_time )))); @@ -1206,13 +1217,16 @@ char *get_reg_val_type_str(uint32 type) static void print_reg_value(FILE *out_hnd, char *val_name, uint32 val_type, BUFFER2 *value) { fstring type; + pstring intvalue; fstrcpy(type, get_reg_val_type_str(val_type)); switch (val_type) { case 0x01: /* unistr */ { - fprintf(out_hnd,"\t%s:\t%s:\t%s\n", val_name, type, dos_buffer2_to_str(value)); + rpcstr_pull(intvalue, value->buffer, sizeof(intvalue), value->buf_len, 0); + /*fprintf(out_hnd,"\t%s:\t%s:\t%s\n", val_name, type, dos_buffer2_to_str(value));*/ + fprintf(out_hnd,"\t%s:\t%s:\t%s\n", val_name, type, value); break; } diff --git a/source3/rpcclient/display_spool.c b/source3/rpcclient/display_spool.c index 54162a99b7..cdca0c393d 100644 --- a/source3/rpcclient/display_spool.c +++ b/source3/rpcclient/display_spool.c @@ -32,8 +32,8 @@ static void display_print_info_0(FILE *out_hnd, PRINTER_INFO_0 *i1) if (i1 == NULL) return; - unistr_to_ascii(name, i1->printername.buffer, sizeof(name)-1); - unistr_to_ascii(server, i1->servername.buffer, sizeof(server)-1); + rpcstr_pull(name, i1->printername.buffer, sizeof(name), 0, STR_TERMINATE); + rpcstr_pull(server, i1->servername.buffer, sizeof(server), 0, STR_TERMINATE); report(out_hnd, "\tprintername:[%s]\n", name); report(out_hnd, "\tservername:[%s]\n", server); @@ -85,9 +85,9 @@ static void display_print_info_1(FILE *out_hnd, PRINTER_INFO_1 *i1) if (i1 == NULL) return; - unistr_to_ascii(desc, i1->description.buffer, sizeof(desc)-1); - unistr_to_ascii(name, i1->name .buffer, sizeof(name)-1); - unistr_to_ascii(comm, i1->comment .buffer, sizeof(comm)-1); + rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE); + rpcstr_pull(desc, i1->description.buffer, sizeof(desc), 0, STR_TERMINATE); + rpcstr_pull(comm, i1->comment.buffer, sizeof(comm), 0, STR_TERMINATE); report(out_hnd, "\tflags:[%x]\n", i1->flags); report(out_hnd, "\tname:[%s]\n", name); @@ -115,18 +115,18 @@ static void display_print_info_2(FILE *out_hnd, PRINTER_INFO_2 *i2) if (i2 == NULL) return; - unistr_to_ascii(servername, i2->servername.buffer, sizeof(servername)-1); - unistr_to_ascii(printername, i2->printername.buffer, sizeof(printername)-1); - unistr_to_ascii(sharename, i2->sharename.buffer, sizeof(sharename)-1); - unistr_to_ascii(portname, i2->portname.buffer, sizeof(portname)-1); - unistr_to_ascii(drivername, i2->drivername.buffer, sizeof(drivername)-1); - unistr_to_ascii(comment, i2->comment.buffer, sizeof(comment)-1); - unistr_to_ascii(location, i2->location.buffer, sizeof(location)-1); - unistr_to_ascii(sepfile, i2->sepfile.buffer, sizeof(sepfile)-1); - unistr_to_ascii(printprocessor, i2->printprocessor.buffer, sizeof(printprocessor)-1); - unistr_to_ascii(datatype, i2->datatype.buffer, sizeof(datatype)-1); - unistr_to_ascii(parameters, i2->parameters.buffer, sizeof(parameters)-1); - + rpcstr_pull(servername, i2->servername.buffer,sizeof(servername), 0, STR_TERMINATE); + rpcstr_pull(printername, i2->printername.buffer,sizeof(printername), 0, STR_TERMINATE); + rpcstr_pull(sharename, i2->sharename.buffer,sizeof(sharename), 0, STR_TERMINATE); + rpcstr_pull(portname, i2->portname.buffer,sizeof(portname), 0, STR_TERMINATE); + rpcstr_pull(drivername, i2->drivername.buffer,sizeof(drivername), 0, STR_TERMINATE); + rpcstr_pull(comment, i2->comment.buffer,sizeof(comment), 0, STR_TERMINATE); + rpcstr_pull(location, i2->location.buffer,sizeof(location), 0, STR_TERMINATE); + rpcstr_pull(sepfile, i2->sepfile.buffer,sizeof(sepfile), 0, STR_TERMINATE); + rpcstr_pull(printprocessor, i2->printprocessor.buffer,sizeof(printprocessor), 0, STR_TERMINATE); + rpcstr_pull(datatype, i2->datatype.buffer,sizeof(datatype), 0, STR_TERMINATE); + rpcstr_pull(parameters, i2->parameters.buffer,sizeof(parameters), 0, STR_TERMINATE); + report(out_hnd, "\tservername:[%s]\n", servername); report(out_hnd, "\tprintername:[%s]\n", printername); report(out_hnd, "\tsharename:[%s]\n", sharename); @@ -371,7 +371,7 @@ void display_port_info_1(FILE *out_hnd, enum action_type action, PORT_INFO_1 *i1 report(out_hnd, "Port:\n"); break; case ACTION_ENUMERATE: - unistr_to_ascii(buffer, i1->port_name.buffer, sizeof(buffer)-1); + rpcstr_pull(buffer, i1->port_name.buffer, sizeof(bufferi), 0, STR_TERMINATE); fprintf (out_hnd, "\tPort Name:\t[%s]\n\n", buffer); break; case ACTION_FOOTER: @@ -393,11 +393,12 @@ void display_port_info_2(FILE *out_hnd, enum action_type action, PORT_INFO_2 *i2 report(out_hnd, "Port:\n"); break; case ACTION_ENUMERATE: - unistr_to_ascii(buffer, i2->port_name.buffer, sizeof(buffer)-1); + rpcstr_pull(buffer, i2->port_name.buffer, sizeof(buffer), 0, STR_TERMINATE); fprintf (out_hnd, "\tPort Name:\t[%s]\n", buffer); - unistr_to_ascii(buffer, i2->monitor_name.buffer, sizeof(buffer)-1); + rpcstr_pull(buffer, i2->monitor_name.buffer, sizeof(buffer), 0, STR_TERMINATE); + fprintf (out_hnd, "\tMonitor Name:\t[%s]\n", buffer); - unistr_to_ascii(buffer, i2->description.buffer, sizeof(buffer)-1); + rpcstr_pull(buffer, i2->description.buffer, sizeof(buffer), 0, STR_TERMINATE); fprintf (out_hnd, "\tDescription:\t[%s]\n", buffer); fprintf (out_hnd, "\tPort Type:\t[%d]\n", i2->port_type); fprintf (out_hnd, "\tReserved:\t[%d]\n", i2->reserved); @@ -429,7 +430,7 @@ void display_printer_enumdata(FILE *out_hnd, enum action_type action, uint32 idx case ACTION_ENUMERATE: report(out_hnd, "[%d]", idx); report(out_hnd, "\t[%d]", valuelen); - unistr_to_ascii(buffer, value, sizeof(buffer)-1); + rpcstr_pull(buffer, value, sizeof(buffer), 0, STR_TERMINATE); report(out_hnd, "\t[%s]", buffer); report(out_hnd, "\t[%d]", rvaluelen); report(out_hnd, "\t\t[%d]", type); @@ -467,29 +468,27 @@ void display_job_info_2(FILE *out_hnd, enum action_type action, fstring tmp; report(out_hnd, "\tjob id:\t%d\n", i2->jobid); - unistr_to_ascii(tmp, i2->printername.buffer, sizeof(tmp)-1); + rpcstr_pull(tmp, i2->printername.buffer, sizeof(tmp), 0, STR_TERMINATE); report(out_hnd, "\tprinter name:\t%s\n", tmp); - unistr_to_ascii(tmp, i2->machinename.buffer, sizeof(tmp)-1); + rpcstr_pull(tmp, i2->machinename.buffer, sizeof(tmp), 0, STR_TERMINATE); report(out_hnd, "\tmachine name:\t%s\n", tmp); - unistr_to_ascii(tmp, i2->username.buffer, sizeof(tmp)-1); + rpcstr_pull(tmp, i2->username.buffer, sizeof(tmp), 0, STR_TERMINATE); report(out_hnd, "\tusername:\t%s\n", tmp); - unistr_to_ascii(tmp, i2->document.buffer, sizeof(tmp)-1); + rpcstr_pull(tmp, i2->document.buffer, sizeof(tmp), 0, STR_TERMINATE); report(out_hnd, "\tdocument:\t%s\n", tmp); - unistr_to_ascii(tmp, i2->notifyname.buffer, sizeof(tmp)-1); + rpcstr_pull(tmp, i2->notifyname.buffer, sizeof(tmp), 0, STR_TERMINATE); report(out_hnd, "\tnotify name:\t%s\n", tmp); - unistr_to_ascii(tmp, i2->datatype.buffer, sizeof(tmp)-1); + rpcstr_pull(tmp, i2->datatype.buffer, sizeof(tmp), 0, STR_TERMINATE); report(out_hnd, "\tdata type:\t%s\n", tmp); - unistr_to_ascii(tmp, i2->printprocessor.buffer, sizeof(tmp)-1); + rpcstr_pull(tmp, i2->printprocessor.buffer, sizeof(tmp), 0, STR_TERMINATE); report(out_hnd, "\tprint processor:\t%s\n", tmp); - unistr_to_ascii(tmp, i2->parameters.buffer, sizeof(tmp)-1); + rpcstr_pull(tmp, i2->parameters.buffer, sizeof(tmp), 0, STR_TERMINATE); report(out_hnd, "\tparameters:\t%s\n", tmp); - unistr_to_ascii(tmp, i2->drivername.buffer, sizeof(tmp)-1); + rpcstr_pull(tmp, i2->drivername.buffer, sizeof(tmp), 0, STR_TERMINATE); report(out_hnd, "\tdriver name:\t%s\n", tmp); report(out_hnd, "\tDevice Mode:\tNOT DISPLAYED YET\n"); -/* - DEVICEMODE *devmode; -*/ - unistr_to_ascii(tmp, i2->text_status.buffer, sizeof(tmp)-1); + + rpcstr_pull(tmp, i2->text_status.buffer, sizeof(tmp), 0, STR_TERMINATE); report(out_hnd, "\ttext status:\t%s\n", tmp); /* SEC_DESC sec_desc;*/ report(out_hnd, "\tstatus:\t%d\n", i2->status); @@ -539,17 +538,17 @@ void display_job_info_1(FILE *out_hnd, enum action_type action, fstring tmp; report(out_hnd, "\tjob id:\t%d\n", i1->jobid); - unistr_to_ascii(tmp, i1->printername.buffer, sizeof(tmp)-1); + rpcstr_pull(tmp, i1->printername.buffer, sizeof(tmp), 0, STR_TERMINATE); report(out_hnd, "\tprinter name:\t%s\n", tmp); - unistr_to_ascii(tmp, i1->machinename.buffer, sizeof(tmp)-1); + rpcstr_pull(tmp, i1->machinename.buffer, sizeof(tmp), 0, STR_TERMINATE); report(out_hnd, "\tmachine name:\t%s\n", tmp); - unistr_to_ascii(tmp, i1->username.buffer, sizeof(tmp)-1); + rpcstr_pull(tmp, i1->username.buffer, sizeof(tmp), 0, STR_TERMINATE); report(out_hnd, "\tusername:\t%s\n", tmp); - unistr_to_ascii(tmp, i1->document.buffer, sizeof(tmp)-1); + rpcstr_pull(tmp, i1->document.buffer, sizeof(tmp), 0, STR_TERMINATE); report(out_hnd, "\tdocument:\t%s\n", tmp); - unistr_to_ascii(tmp, i1->datatype.buffer, sizeof(tmp)-1); + rpcstr_pull(tmp, i1->datatype.buffer, sizeof(tmp), 0, STR_TERMINATE); report(out_hnd, "\tdata type:\t%s\n", tmp); - unistr_to_ascii(tmp, i1->text_status.buffer, sizeof(tmp)-1); + rpcstr_pull(tmp, i1->text_status.buffer, sizeof(tmp), 0, STR_TERMINATE); report(out_hnd, "\ttext status:\t%s\n", tmp); report(out_hnd, "\tstatus:\t%d\n", i1->status); report(out_hnd, "\tpriority:\t%d\n", i1->priority); @@ -690,7 +689,7 @@ static void display_print_driver_1(FILE *out_hnd, DRIVER_INFO_1 *i1) if (i1 == NULL) return; - unistr_to_ascii(name, i1->name.buffer, sizeof(name)-1); + rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE); report(out_hnd, "\tname:[%s]\n", name); } @@ -708,11 +707,11 @@ static void display_print_driver_2(FILE *out_hnd, DRIVER_INFO_2 *i1) if (i1 == NULL) return; - unistr_to_ascii(name, i1->name.buffer, sizeof(name)-1); - unistr_to_ascii(architecture, i1->architecture.buffer, sizeof(architecture)-1); - unistr_to_ascii(driverpath, i1->driverpath.buffer, sizeof(driverpath)-1); - unistr_to_ascii(datafile, i1->datafile.buffer, sizeof(datafile)-1); - unistr_to_ascii(configfile, i1->configfile.buffer, sizeof(configfile)-1); + rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE); + rpcstr_pull(architecture, i1->architecture.buffer, sizeof(architecture), 0, STR_TERMINATE); + rpcstr_pull(driverpath, i1->driverpath.buffer, sizeof(driverpath), 0, STR_TERMINATE); + rpcstr_pull(datafile, i1->datafile.buffer, sizeof(datafile), 0, STR_TERMINATE); + rpcstr_pull(configfile, i1->conigfile.buffer, sizeof(configfile), 0, STR_TERMINATE); report(out_hnd, "\tversion:[%x]\n", i1->version); report(out_hnd, "\tname:[%s]\n", name); @@ -743,18 +742,17 @@ static void display_print_driver_3(FILE *out_hnd, DRIVER_INFO_3 *i1) if (i1 == NULL) return; - unistr_to_ascii(name, i1->name.buffer, sizeof(name)-1); - unistr_to_ascii(architecture, i1->architecture.buffer, sizeof(architecture)-1); - unistr_to_ascii(driverpath, i1->driverpath.buffer, sizeof(driverpath)-1); - unistr_to_ascii(datafile, i1->datafile.buffer, sizeof(datafile)-1); - unistr_to_ascii(configfile, i1->configfile.buffer, sizeof(configfile)-1); - unistr_to_ascii(helpfile, i1->helpfile.buffer, sizeof(helpfile)-1); - - unistr_to_ascii(monitorname, i1->monitorname.buffer, sizeof(monitorname)-1); - unistr_to_ascii(defaultdatatype, i1->defaultdatatype.buffer, sizeof(defaultdatatype)-1); + rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE); + rpcstr_pull(architecture, i1->architecture.buffer, sizeof(architecture), 0, STR_TERMINATE); + rpcstr_pull(driverpath, i1->driverpath.buffer, sizeof(driverpath), 0, STR_TERMINATE); + rpcstr_pull(datafile, i1->datafile.buffer, sizeof(datafile), 0, STR_TERMINATE); + rpcstr_pull(configfile, i1->configfile.buffer, sizeof(configfile), 0, STR_TERMINATE); + rpcstr_pull(helpfile, i1->helpfile.buffer, sizeof(helpfile), 0, STR_TERMINATE); + rpcstr_pull(monitorname, i1->monitorname.buffer, sizeof(monitorname), 0, STR_TERMINATE); + rpcstr_pull(defaultdatatype, i1->defaultdatatype.buffer, sizeof(defaultdatatype), 0, STR_TERMINATE); report(out_hnd, "\tversion:[%x]\n", i1->version); - report(out_hnd, "\tname:[%s]\n",name ); + report(out_hnd, "\tname:[%s]\n",name); report(out_hnd, "\tarchitecture:[%s]\n", architecture); report(out_hnd, "\tdriverpath:[%s]\n", driverpath); report(out_hnd, "\tdatafile:[%s]\n", datafile); @@ -763,7 +761,7 @@ static void display_print_driver_3(FILE *out_hnd, DRIVER_INFO_3 *i1) while (valid) { - unistr_to_ascii(dependentfiles, i1->dependentfiles+length, sizeof(dependentfiles)-1); + rpcstr_pull(dependentfiles, i1->dependentfiles+length, sizeof(dependentfiles), 0, STR_TERMINATE); length+=strlen(dependentfiles)+1; if (strlen(dependentfiles) > 0) @@ -888,7 +886,7 @@ static void display_printdriverdir_info_1(FILE *out_hnd, DRIVER_DIRECTORY_1 *i1) if (i1 == NULL) return; - unistr_to_ascii(name, i1->name.buffer, sizeof(name)-1); + rpcstr_pull(name, i1->name.buffer, sizeof(name), 0, STR_TERMINATE); report(out_hnd, "\tname:[%s]\n", name); } diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index e8029dec49..0d1b84f849 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -540,7 +540,6 @@ static void usage(char *pname) server; struct cmd_set **cmd_set; - charset_initialise(); setlinebuf(stdout); DEBUGLEVEL = 1; @@ -623,7 +622,6 @@ static void usage(char *pname) } DEBUGLEVEL = olddebug; - codepage_initialise(lp_client_code_page()); load_interfaces(); TimeInit(); diff --git a/source3/script/mkproto.awk b/source3/script/mkproto.awk index 76a61193a2..d37aa04761 100644 --- a/source3/script/mkproto.awk +++ b/source3/script/mkproto.awk @@ -126,7 +126,7 @@ END { gotstart = 1; } - if( $0 ~ /^long|^char|^uint|^struct|^BOOL|^void|^time|^smb_shm_offset_t|^shm_offset_t|^FILE|^SMB_OFF_T|^size_t|^ssize_t|^SMB_BIG_UINT/ ) { + if( $0 ~ /^smb_iconv_t|^long|^char|^uint|^struct|^BOOL|^void|^time|^smb_shm_offset_t|^shm_offset_t|^FILE|^SMB_OFF_T|^size_t|^ssize_t|^SMB_BIG_UINT/ ) { gotstart = 1; } diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c index c6f6eca0ba..12e38f2a65 100644 --- a/source3/smbd/chgpasswd.c +++ b/source3/smbd/chgpasswd.c @@ -793,14 +793,12 @@ BOOL check_oem_password(char *user, /* * nt passwords are in unicode */ - int uni_pw_len = new_pw_len; - char *pw; - new_pw_len /= 2; - pw = dos_unistrn2((uint16 *)(&lmdata[512 - uni_pw_len]),new_pw_len); - memcpy(new_passwd, pw, new_pw_len + 1); + pull_ucs2(NULL, new_passwd, + (const smb_ucs2_t *)&lmdata[512 - new_pw_len], + new_passwd_size, new_pw_len, 0); } else { memcpy(new_passwd, &lmdata[512 - new_pw_len], new_pw_len); - new_passwd[new_pw_len] = '\0'; + new_passwd[new_pw_len] = 0; } /* diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 217c81228f..dfbc2272e6 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -172,7 +172,7 @@ static int close_normal_file(files_struct *fsp, BOOL normal_close) if (normal_close && delete_on_close) { DEBUG(5,("close_file: file %s. Delete on close was set - deleting file.\n", fsp->fsp_name)); - if(fsp->conn->vfs_ops.unlink(conn,dos_to_unix(fsp->fsp_name, False)) != 0) { + if(fsp->conn->vfs_ops.unlink(conn,fsp->fsp_name) != 0) { /* * This call can potentially fail as another smbd may have * had the file open with delete on close set and deleted diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c index 796a54e77d..a6c37c7aba 100644 --- a/source3/smbd/connection.c +++ b/source3/smbd/connection.c @@ -53,7 +53,6 @@ BOOL yield_connection(connection_struct *conn,char *name,int max_connections) key.pid = sys_getpid(); key.cnum = conn?conn->cnum:-1; fstrcpy(key.name, name); - dos_to_unix(key.name, True); /* Convert key to unix-codepage */ kbuf.dptr = (char *)&key; kbuf.dsize = sizeof(key); @@ -174,7 +173,6 @@ BOOL claim_connection(connection_struct *conn,char *name,int max_connections,BOO key.pid = sys_getpid(); key.cnum = conn?conn->cnum:-1; fstrcpy(key.name, name); - dos_to_unix(key.name, True); /* Convert key to unix-codepage */ kbuf.dptr = (char *)&key; kbuf.dsize = sizeof(key); diff --git a/source3/smbd/dfree.c b/source3/smbd/dfree.c index 64c6182cd8..7848309a5e 100644 --- a/source3/smbd/dfree.c +++ b/source3/smbd/dfree.c @@ -66,7 +66,7 @@ static void disk_norm(BOOL small_query, SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree, return number of 1K blocks available on a path and total number ****************************************************************************/ -static SMB_BIG_UINT disk_free(char *path, BOOL small_query, +static SMB_BIG_UINT disk_free(const char *path, BOOL small_query, SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BIG_UINT *dsize) { int dfree_retval; @@ -91,7 +91,7 @@ static SMB_BIG_UINT disk_free(char *path, BOOL small_query, slprintf(syscmd, sizeof(syscmd)-1, "%s %s", dfree_command, path); DEBUG (3, ("disk_free: Running command %s\n", syscmd)); - lines = file_lines_pload(syscmd, NULL, True); + lines = file_lines_pload(syscmd, NULL); if (lines) { char *line = lines[0]; @@ -161,8 +161,8 @@ static SMB_BIG_UINT disk_free(char *path, BOOL small_query, /**************************************************************************** wrap it to get filenames right ****************************************************************************/ -SMB_BIG_UINT sys_disk_free(char *path, BOOL small_query, +SMB_BIG_UINT sys_disk_free(const char *path, BOOL small_query, SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BIG_UINT *dsize) { - return(disk_free(dos_to_unix(path,False),small_query, bsize,dfree,dsize)); + return disk_free(path,small_query, bsize,dfree,dsize); } diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index fa9cbdc4a2..9a9c745944 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -625,7 +625,7 @@ BOOL get_dir_entry(connection_struct *conn,char *mask,int dirtype,char *fname, pstrcpy(pathreal,path); pstrcat(path,fname); pstrcat(pathreal,dname); - if (conn->vfs_ops.stat(conn,dos_to_unix(pathreal, False), &sbuf) != 0) + if (conn->vfs_ops.stat(conn, pathreal, &sbuf) != 0) { DEBUG(5,("Couldn't stat 1 [%s]. Error = %s\n",path, strerror(errno) )); continue; @@ -701,7 +701,7 @@ void *OpenDir(connection_struct *conn, char *name, BOOL use_veto) { Dir *dirp; char *n; - DIR *p = conn->vfs_ops.opendir(conn,dos_to_unix(name,False)); + DIR *p = conn->vfs_ops.opendir(conn,name); int used=0; if (!p) return(NULL); @@ -720,9 +720,6 @@ void *OpenDir(connection_struct *conn, char *name, BOOL use_veto) l = strlen(n)+1; - /* Return value of vfs_readdirname has already gone through - unix_to_dos() */ - /* If it's a vetoed file, pretend it doesn't even exist */ if (use_veto && conn && IS_VETO_PATH(conn, n)) continue; diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index 9ec1fa2606..89e5b1586c 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -282,7 +282,7 @@ int file_utime(connection_struct *conn, char *fname, struct utimbuf *times) errno = 0; - if(conn->vfs_ops.utime(conn,dos_to_unix(fname, False), times) == 0) + if(conn->vfs_ops.utime(conn,fname, times) == 0) return 0; if((errno != EPERM) && (errno != EACCES)) @@ -310,7 +310,7 @@ int file_utime(connection_struct *conn, char *fname, struct utimbuf *times) current_user.ngroups,current_user.groups)))) { /* We are allowed to become root and change the filetime. */ become_root(); - ret = conn->vfs_ops.utime(conn,dos_to_unix(fname, False), times); + ret = conn->vfs_ops.utime(conn,fname, times); unbecome_root(); } } diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index bdbcd81b64..9b76d63dc6 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -436,7 +436,7 @@ BOOL check_name(char *name,connection_struct *conn) #ifdef S_ISLNK if (!lp_symlinks(SNUM(conn))) { SMB_STRUCT_STAT statbuf; - if ( (conn->vfs_ops.lstat(conn,dos_to_unix(name,False),&statbuf) != -1) && + if ( (conn->vfs_ops.lstat(conn,name,&statbuf) != -1) && (S_ISLNK(statbuf.st_mode)) ) { DEBUG(3,("check_name: denied: file path name %s is a symlink\n",name)); ret=0; diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index eb6ccb4fce..e853112bfe 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -385,7 +385,7 @@ int reply_trans(connection_struct *conn, char *inbuf,char *outbuf, int size, int START_PROFILE(SMBtrans); memset(name, '\0',sizeof(name)); - srvstr_pull(inbuf, name, smb_buf(inbuf), sizeof(name), -1, STR_TERMINATE|STR_CONVERT); + srvstr_pull(inbuf, name, smb_buf(inbuf), sizeof(name), -1, STR_TERMINATE); if (dscnt > tdscnt || pscnt > tpscnt) { exit_server("invalid trans parameters\n"); diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c index 69a0fa5ac3..2b71770b2e 100644 --- a/source3/smbd/lanman.c +++ b/source3/smbd/lanman.c @@ -75,8 +75,7 @@ static int CopyExpanded(connection_struct *conn, StrnCpy(buf,src,sizeof(buf)/2); pstring_sub(buf,"%S",lp_servicename(snum)); standard_sub_conn(conn,buf); - StrnCpy(*dst,buf,*n-1); - l = strlen(*dst) + 1; + l = push_ascii(*dst,buf,*n-1, STR_TERMINATE); (*dst) += l; (*n) -= l; return l; @@ -86,8 +85,7 @@ static int CopyAndAdvance(char** dst, char* src, int* n) { int l; if (!src || !dst || !n || !(*dst)) return(0); - StrnCpy(*dst,src,*n-1); - l = strlen(*dst) + 1; + l = push_ascii(*dst,src,*n-1, STR_TERMINATE); (*dst) += l; (*n) -= l; return l; @@ -356,7 +354,7 @@ static void PackDriverData(struct pack_desc* desc) SIVAL(drivdata,0,sizeof drivdata); /* cb */ SIVAL(drivdata,4,1000); /* lVersion */ memset(drivdata+8,0,32); /* szDeviceName */ - srvstr_push_ascii(drivdata+8,"NULL",-1); + push_ascii(drivdata+8,"NULL",-1, STR_TERMINATE); PACKl(desc,"l",drivdata,sizeof drivdata); /* pDriverData */ } @@ -563,7 +561,7 @@ static void fill_printq_info_52(connection_struct *conn, int snum, int uLevel, DEBUG(10,("snum: %d\nprinterdriver: [%s]\nlp_driverfile: [%s]\n", snum, drivername, lp_driverfile(snum))); - lines = file_lines_load(lp_driverfile(snum),NULL, False); + lines = file_lines_load(lp_driverfile(snum),NULL); if (!lines) { DEBUG(3,("Can't open %s - %s\n", lp_driverfile(snum), @@ -795,7 +793,7 @@ static int get_printerdrivernumber(int snum) DEBUG(10,("snum: %d\nprinterdriver: [%s]\nlp_driverfile: [%s]\n", snum, drivername, lp_driverfile(snum))); - lines = file_lines_load(lp_driverfile(snum), NULL, False); + lines = file_lines_load(lp_driverfile(snum), NULL); if (!lines) { DEBUG(3,("Can't open %s - %s\n", lp_driverfile(snum),strerror(errno))); @@ -1110,7 +1108,7 @@ static int get_server_info(uint32 servertype, BOOL local_list_only; int i; - lines = file_lines_load(lock_path(SERVER_LIST), NULL, False); + lines = file_lines_load(lock_path(SERVER_LIST), NULL); if (!lines) { DEBUG(4,("Can't open %s - %s\n",lock_path(SERVER_LIST),strerror(errno))); return(0); @@ -1255,15 +1253,15 @@ static int fill_srv_info(struct srv_info_struct *service, switch (uLevel) { case 0: - srvstr_push_ascii(p,service->name,15); - break; + push_ascii(p,service->name, 15, STR_TERMINATE); + break; case 1: - srvstr_push_ascii(p,service->name,15); - SIVAL(p,18,service->type); - SIVAL(p,22,PTR_DIFF(p2,baseaddr)); - len += CopyAndAdvance(&p2,service->comment,&l2); - break; + push_ascii(p,service->name,15, STR_TERMINATE); + SIVAL(p,18,service->type); + SIVAL(p,22,PTR_DIFF(p2,baseaddr)); + len += CopyAndAdvance(&p2,service->comment,&l2); + break; } if (stringbuf) @@ -1340,7 +1338,7 @@ static BOOL api_RNetServerEnum(connection_struct *conn, uint16 vuid, char *param DEBUG(4, ("local_only:%s\n", BOOLSTR(local_request))); if (strcmp(str1, "WrLehDz") == 0) { - srvstr_pull_ascii(domain, p, sizeof(fstring)); + pull_ascii_fstring(domain, p); } else { fstrcpy(domain, global_myworkgroup); } @@ -1515,7 +1513,7 @@ static int fill_share_info(connection_struct *conn, int snum, int uLevel, } if (!baseaddr) baseaddr = p; - srvstr_push_ascii(p,lp_servicename(snum),13); + push_ascii(p,lp_servicename(snum),13, STR_TERMINATE); if (uLevel > 0) { @@ -1727,7 +1725,7 @@ static BOOL api_SetUserPassword(connection_struct *conn,uint16 vuid, char *param fstring user; fstring pass1,pass2; - srvstr_pull_ascii(user,p,sizeof(user)); + pull_ascii_fstring(user,p); p = skip_string(p,1); @@ -1868,7 +1866,7 @@ static BOOL api_SamOEMChangePassword(connection_struct *conn,uint16 vuid, char * } p = skip_string(p,1); - p += srvstr_pull_ascii(user,p,sizeof(user)); + p += pull_ascii_fstring(user,p); DEBUG(3,("api_SamOEMChangePassword: Change password for <%s>\n",user)); @@ -2138,7 +2136,7 @@ static BOOL api_RNetServerGetInfo(connection_struct *conn,uint16 vuid, char *par p2 = p + struct_len; if (uLevel != 20) { srvstr_push(NULL, p,local_machine,16, - STR_ASCII|STR_UPPER|STR_TERMINATE|STR_CONVERT); + STR_ASCII|STR_UPPER|STR_TERMINATE); } p += 16; if (uLevel > 0) diff --git a/source3/smbd/mangle.c b/source3/smbd/mangle.c index 61af1f7ded..8df71d4557 100644 --- a/source3/smbd/mangle.c +++ b/source3/smbd/mangle.c @@ -244,7 +244,6 @@ static BOOL is_reserved_msdos( char *fname ) static BOOL is_illegal_name( char *name ) { unsigned char *s; - int skip; if( !name ) return( True ); @@ -255,18 +254,10 @@ static BOOL is_illegal_name( char *name ) s = (unsigned char *)name; while( *s ) { - skip = get_character_len( *s ); - if( skip != 0 ) - { - s += skip; - } - else - { - if( isillegal( *s ) ) + if( *s>0x7F && isillegal( *s ) ) return( True ); else s++; - } } return( False ); @@ -325,7 +316,6 @@ BOOL is_8_3( char *fname, BOOL check_case ) { int len; int l; - int skip; char *p; char *dot_pos; char *slash_pos = strrchr( fname, '/' ); @@ -374,17 +364,12 @@ BOOL is_8_3( char *fname, BOOL check_case ) dot_pos = NULL; while( *p ) { - if( (skip = get_character_len( *p )) != 0 ) - p += skip; - else - { if( *p == '.' && !dot_pos ) dot_pos = (char *)p; - else + /*else if( !isdoschar( *p ) ) - return( False ); + return( False );*/ p++; - } } /* no dot and less than 9 means OK */ @@ -844,7 +829,6 @@ void mangle_name_83( char *s) char base[9]; int baselen = 0; int extlen = 0; - int skip; extension[0] = 0; base[0] = 0; @@ -879,31 +863,9 @@ void mangle_name_83( char *s) *p++ = 0; while( *p && extlen < 3 ) { - skip = get_character_len( *p ); - switch( skip ) - { - case 2: - if( extlen < 2 ) - { + if( /*isdoschar (*p) &&*/ *p != '.' ) extension[extlen++] = p[0]; - extension[extlen++] = p[1]; - } - else - { - extension[extlen++] = mangle( (unsigned char)*p ); - } - p += 2; - break; - case 1: - extension[extlen++] = p[0]; p++; - break; - default: - if( isdoschar (*p) && *p != '.' ) - extension[extlen++] = p[0]; - p++; - break; - } } extension[extlen] = 0; } @@ -913,31 +875,9 @@ void mangle_name_83( char *s) while( *p && baselen < 5 ) { - skip = get_character_len(*p); - switch( skip ) - { - case 2: - if( baselen < 4 ) - { + if( /*isdoschar( *p ) &&*/ *p != '.' ) base[baselen++] = p[0]; - base[baselen++] = p[1]; - } - else - { - base[baselen++] = mangle( (unsigned char)*p ); - } - p += 2; - break; - case 1: - base[baselen++] = p[0]; p++; - break; - default: - if( isdoschar( *p ) && *p != '.' ) - base[baselen++] = p[0]; - p++; - break; - } } base[baselen] = 0; diff --git a/source3/smbd/message.c b/source3/smbd/message.c index bae9f6c906..a5726d44f8 100644 --- a/source3/smbd/message.c +++ b/source3/smbd/message.c @@ -66,7 +66,6 @@ static void msg_deliver(void) if(msgpos > 0) { msgbuf[msgpos] = '\0'; /* Ensure null terminated. */ - pstrcpy(msgbuf,dos_to_unix(msgbuf,False)); } for (i=0;i<msgpos;) { @@ -121,8 +120,8 @@ int reply_sends(connection_struct *conn, outsize = set_message(outbuf,0,0,True); p = smb_buf(inbuf)+1; - p += srvstr_pull(inbuf, msgfrom, p, sizeof(msgfrom), -1, STR_TERMINATE|STR_CONVERT) + 1; - p += srvstr_pull(inbuf, msgto, p, sizeof(msgto), -1, STR_TERMINATE|STR_CONVERT) + 1; + p += srvstr_pull(inbuf, msgfrom, p, sizeof(msgfrom), -1, STR_TERMINATE) + 1; + p += srvstr_pull(inbuf, msgto, p, sizeof(msgto), -1, STR_TERMINATE) + 1; msg = p; @@ -163,8 +162,8 @@ int reply_sendstrt(connection_struct *conn, msgpos = 0; p = smb_buf(inbuf)+1; - p += srvstr_pull(inbuf, msgfrom, p, sizeof(msgfrom), -1, STR_TERMINATE|STR_CONVERT) + 1; - p += srvstr_pull(inbuf, msgto, p, sizeof(msgto), -1, STR_TERMINATE|STR_CONVERT) + 1; + p += srvstr_pull(inbuf, msgfrom, p, sizeof(msgfrom), -1, STR_TERMINATE) + 1; + p += srvstr_pull(inbuf, msgto, p, sizeof(msgto), -1, STR_TERMINATE) + 1; DEBUG( 3, ( "SMBsendstrt (from %s to %s)\n", msgfrom, msgto ) ); diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c index 11400af710..de6f5d789f 100644 --- a/source3/smbd/negprot.c +++ b/source3/smbd/negprot.c @@ -235,7 +235,7 @@ static int reply_nt1(char *outbuf) if (doencrypt) memcpy(p, cryptkey, 8); p += 8; p += srvstr_push(outbuf, p, global_myworkgroup, -1, - STR_UNICODE|STR_CONVERT|STR_TERMINATE|STR_NOALIGN); + STR_UNICODE|STR_TERMINATE|STR_NOALIGN); SSVAL(outbuf,smb_vwv17, p - q); /* length of challenge+domain strings */ set_message_end(outbuf, p); diff --git a/source3/smbd/noquotas.c b/source3/smbd/noquotas.c index 5c55bb47c8..a6951d97fc 100644 --- a/source3/smbd/noquotas.c +++ b/source3/smbd/noquotas.c @@ -25,7 +25,7 @@ * Needed for auto generation of proto.h. */ -BOOL disk_quotas(char *path,SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BIG_UINT *dsize) +BOOL disk_quotas(const char *path,SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BIG_UINT *dsize) { (*bsize) = 512; /* This value should be ignored */ diff --git a/source3/smbd/notify_kernel.c b/source3/smbd/notify_kernel.c index d7408c06b5..11a5592458 100644 --- a/source3/smbd/notify_kernel.c +++ b/source3/smbd/notify_kernel.c @@ -125,7 +125,7 @@ static void *kernel_register_notify(connection_struct *conn, char *path, uint32 int fd; unsigned long kernel_flags; - fd = dos_open(path, O_RDONLY, 0); + fd = conn->vfs_ops.open(conn, path, O_RDONLY, 0); if (fd == -1) { DEBUG(3,("Failed to open directory %s for change notify\n", path)); diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index f2b6ba7a80..ea37b14e5e 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -574,7 +574,7 @@ static int do_ntcreate_pipe_open(connection_struct *conn, int pnum = -1; char *p = NULL; - srvstr_pull(inbuf, fname, smb_buf(inbuf), sizeof(fname), -1, STR_TERMINATE|STR_CONVERT); + srvstr_pull(inbuf, fname, smb_buf(inbuf), sizeof(fname), -1, STR_TERMINATE); if ((ret = nt_open_pipe(fname, conn, inbuf, outbuf, &pnum)) != 0) return ret; @@ -682,7 +682,7 @@ int reply_ntcreate_and_X(connection_struct *conn, * Check to see if this is a mac fork of some kind. */ - srvstr_pull(inbuf, fname, smb_buf(inbuf), sizeof(fname), -1, STR_TERMINATE|STR_CONVERT); + srvstr_pull(inbuf, fname, smb_buf(inbuf), sizeof(fname), -1, STR_TERMINATE); if( strchr(fname, ':')) { SSVAL(outbuf, smb_flg2, SVAL(outbuf,smb_flg2) | FLAGS2_32_BIT_ERROR_CODES); @@ -710,10 +710,10 @@ int reply_ntcreate_and_X(connection_struct *conn, } srvstr_pull(inbuf, &fname[dir_name_len], smb_buf(inbuf), sizeof(fname)-dir_name_len, - -1, STR_TERMINATE|STR_CONVERT); + -1, STR_TERMINATE); } else { srvstr_pull(inbuf, fname, smb_buf(inbuf), sizeof(fname), - -1, STR_TERMINATE|STR_CONVERT); + -1, STR_TERMINATE); } /* @@ -971,7 +971,7 @@ static int do_nt_transact_create_pipe( connection_struct *conn, return(ERROR(ERRDOS,ERRbadaccess)); } - srvstr_pull(inbuf, fname, params+53, sizeof(fname), -1, STR_TERMINATE|STR_CONVERT); + srvstr_pull(inbuf, fname, params+53, sizeof(fname), -1, STR_TERMINATE); if ((ret = nt_open_pipe(fname, conn, inbuf, outbuf, &pnum)) != 0) return ret; @@ -1188,7 +1188,7 @@ static int call_nt_transact_create(connection_struct *conn, * Check to see if this is a mac fork of some kind. */ - srvstr_pull(inbuf, fname, params+53, sizeof(fname), -1, STR_TERMINATE|STR_CONVERT); + srvstr_pull(inbuf, fname, params+53, sizeof(fname), -1, STR_TERMINATE); if( strchr(fname, ':')) { SSVAL(outbuf, smb_flg2, SVAL(outbuf,smb_flg2) | FLAGS2_32_BIT_ERROR_CODES); @@ -1215,9 +1215,9 @@ static int call_nt_transact_create(connection_struct *conn, } srvstr_pull(inbuf, &fname[dir_name_len], params+53, sizeof(fname)-dir_name_len, - -1, STR_TERMINATE|STR_CONVERT); + -1, STR_TERMINATE); } else { - srvstr_pull(inbuf, fname, params+53, sizeof(fname), -1, STR_TERMINATE|STR_CONVERT); + srvstr_pull(inbuf, fname, params+53, sizeof(fname), -1, STR_TERMINATE); } /* @@ -1511,7 +1511,7 @@ static int call_nt_transact_rename(connection_struct *conn, int outsize = 0; CHECK_FSP(fsp, conn); - srvstr_pull(inbuf, new_name, params+4, sizeof(new_name), -1, STR_TERMINATE|STR_CONVERT); + srvstr_pull(inbuf, new_name, params+4, sizeof(new_name), -1, STR_TERMINATE); outsize = rename_internals(conn, inbuf, outbuf, fsp->fsp_name, new_name, replace_if_exists); diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 8bfddd4c71..7c48e28138 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -38,14 +38,13 @@ static int fd_open(struct connection_struct *conn, char *fname, #ifdef O_NONBLOCK flags |= O_NONBLOCK; #endif - - fd = conn->vfs_ops.open(conn,dos_to_unix(fname,False),flags,mode); + fd = conn->vfs_ops.open(conn,fname,flags,mode); /* Fix for files ending in '.' */ if((fd == -1) && (errno == ENOENT) && (strchr(fname,'.')==NULL)) { pstrcat(fname,"."); - fd = conn->vfs_ops.open(conn,dos_to_unix(fname,False),flags,mode); + fd = conn->vfs_ops.open(conn,fname,flags,mode); } DEBUG(10,("fd_open: name %s, flags = 0%o mode = 0%o, fd = %d. %s\n", fname, @@ -199,13 +198,6 @@ static BOOL open_file(files_struct *fsp,connection_struct *conn, fsp->stat_open = False; fsp->directory_delete_on_close = False; fsp->conn = conn; - /* - * Note that the file name here is the *untranslated* name - * ie. it is still in the DOS codepage sent from the client. - * All use of this filename will pass though the sys_xxxx - * functions which will do the dos_to_unix translation before - * mapping into a UNIX filename. JRA. - */ string_set(&fsp->fsp_name,fname); fsp->wbmpx_ptr = NULL; fsp->wcp = NULL; /* Write cache pointer. */ @@ -923,13 +915,6 @@ files_struct *open_file_stat(connection_struct *conn, char *fname, fsp->stat_open = True; fsp->directory_delete_on_close = False; fsp->conn = conn; - /* - * Note that the file name here is the *untranslated* name - * ie. it is still in the DOS codepage sent from the client. - * All use of this filename will pass though the sys_xxxx - * functions which will do the dos_to_unix translation before - * mapping into a UNIX filename. JRA. - */ string_set(&fsp->fsp_name,fname); fsp->wbmpx_ptr = NULL; fsp->wcp = NULL; /* Write cache pointer. */ @@ -1094,13 +1079,6 @@ files_struct *open_directory(connection_struct *conn, char *fname, fsp->is_directory = True; fsp->directory_delete_on_close = False; fsp->conn = conn; - /* - * Note that the file name here is the *untranslated* name - * ie. it is still in the DOS codepage sent from the client. - * All use of this filename will pass though the sys_xxxx - * functions which will do the dos_to_unix translation before - * mapping into a UNIX filename. JRA. - */ string_set(&fsp->fsp_name,fname); fsp->wbmpx_ptr = NULL; diff --git a/source3/smbd/password.c b/source3/smbd/password.c index 0c720b6a29..8bcd17d326 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -946,7 +946,7 @@ static BOOL check_user_equiv(char *user, char *remote, char *equiv_file) int plus_allowed = 1; char *file_host; char *file_user; - char **lines = file_lines_load(equiv_file, NULL, False); + char **lines = file_lines_load(equiv_file, NULL); int i; DEBUG(5, ("check_user_equiv %s %s %s\n", user, remote, equiv_file)); diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index 4832184df7..db7e594a9e 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -1704,7 +1704,7 @@ static BOOL set_canon_ace_list(files_struct *fsp, canon_ace *the_ace, BOOL defau */ if(default_ace || fsp->is_directory || fsp->fd == -1) { - if (sys_acl_set_file(dos_to_unix(fsp->fsp_name,False), the_acl_type, the_acl) == -1) { + if (sys_acl_set_file(fsp->fsp_name, the_acl_type, the_acl) == -1) { DEBUG(0,("set_canon_ace_list: sys_acl_set_file type %s failed for file %s (%s).\n", the_acl_type == SMB_ACL_TYPE_DEFAULT ? "directory default" : "file", fsp->fsp_name, strerror(errno) )); @@ -1850,14 +1850,14 @@ size_t get_nt_acl(files_struct *fsp, SEC_DESC **ppdesc) * Get the ACL from the path. */ - posix_acl = sys_acl_get_file( dos_to_unix(fsp->fsp_name, False), SMB_ACL_TYPE_ACCESS); + posix_acl = sys_acl_get_file(fsp->fsp_name, SMB_ACL_TYPE_ACCESS); /* * If it's a directory get the default POSIX ACL. */ if(fsp->is_directory) - dir_acl = sys_acl_get_file( dos_to_unix(fsp->fsp_name, False), SMB_ACL_TYPE_DEFAULT); + dir_acl = sys_acl_get_file(fsp->fsp_name, SMB_ACL_TYPE_DEFAULT); } else { @@ -2115,7 +2115,7 @@ BOOL set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd) * No default ACL - delete one if it exists. */ - if (sys_acl_delete_def_file(dos_to_unix(fsp->fsp_name,False)) == -1) { + if (sys_acl_delete_def_file(fsp->fsp_name) == -1) { DEBUG(3,("set_nt_acl: sys_acl_delete_def_file failed (%s)\n", strerror(errno))); free_canon_ace_list(file_ace_list); return False; @@ -2143,7 +2143,7 @@ BOOL set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd) DEBUG(3,("set_nt_acl: chmod %s. perms = 0%o.\n", fsp->fsp_name, (unsigned int)posix_perms )); - if(conn->vfs_ops.chmod(conn,dos_to_unix(fsp->fsp_name, False), posix_perms) == -1) { + if(conn->vfs_ops.chmod(conn,fsp->fsp_name, posix_perms) == -1) { DEBUG(3,("set_nt_acl: chmod %s, 0%o failed. Error = %s.\n", fsp->fsp_name, (unsigned int)posix_perms, strerror(errno) )); free_canon_ace_list(file_ace_list); @@ -2229,7 +2229,7 @@ static int chmod_acl_internals( SMB_ACL_T posix_acl, mode_t mode) Note that name is in UNIX character set. ****************************************************************************/ -int chmod_acl(char *name, mode_t mode) +int chmod_acl(const char *name, mode_t mode) { SMB_ACL_T posix_acl = NULL; int ret = -1; diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index edcc3f4838..fe0f2862c6 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -178,7 +178,6 @@ static int connection_error(char *inbuf,char *outbuf,int ecode) int reply_tcon(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize) { - BOOL doencrypt = SMBENCRYPT(); pstring service; pstring user; pstring password; @@ -194,9 +193,9 @@ int reply_tcon(connection_struct *conn, *service = *user = *password = *dev = 0; p = smb_buf(inbuf)+1; - p += srvstr_pull(inbuf, service, p, sizeof(service), -1, STR_TERMINATE|STR_CONVERT) + 1; - p += srvstr_pull(inbuf, password, p, sizeof(password), -1, STR_TERMINATE|STR_CONVERT) + 1; - p += srvstr_pull(inbuf, dev, p, sizeof(dev), -1, STR_TERMINATE|STR_CONVERT) + 1; + p += srvstr_pull(inbuf, service, p, sizeof(service), -1, STR_TERMINATE) + 1; + p += srvstr_pull(inbuf, password, p, sizeof(password), -1, STR_TERMINATE) + 1; + p += srvstr_pull(inbuf, dev, p, sizeof(dev), -1, STR_TERMINATE) + 1; *user = 0; p = strchr(service,'%'); @@ -219,14 +218,6 @@ int reply_tcon(connection_struct *conn, } /* - * Ensure the user and password names are in UNIX codepage format. - */ - - pstrcpy(user,dos_to_unix(user,False)); - if (!doencrypt) - pstrcpy(password,dos_to_unix(password,False)); - - /* * Pass the user through the NT -> unix user mapping * function. */ @@ -289,7 +280,7 @@ int reply_tcon_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt memcpy(password,smb_buf(inbuf),passlen); password[passlen]=0; p = smb_buf(inbuf) + passlen; - p += srvstr_pull(inbuf, path, p, sizeof(path), -1, STR_TERMINATE|STR_CONVERT); + p += srvstr_pull(inbuf, path, p, sizeof(path), -1, STR_TERMINATE); if (passlen != 24) { if (strequal(password," ")) @@ -308,7 +299,7 @@ int reply_tcon_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt *q++ = 0; fstrcpy(user,q); } - p += srvstr_pull(inbuf, devicename, p, sizeof(devicename), 6, STR_CONVERT|STR_ASCII); + p += srvstr_pull(inbuf, devicename, p, sizeof(devicename), 6, STR_ASCII); DEBUG(4,("Got device type %s\n",devicename)); @@ -343,7 +334,7 @@ int reply_tcon_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt set_message(outbuf,2,0,True); p = smb_buf(outbuf); p += srvstr_push(outbuf, p, devicename, -1, - STR_CONVERT|STR_TERMINATE|STR_ASCII); + STR_TERMINATE|STR_ASCII); set_message_end(outbuf,p); } else { /* NT sets the fstype of IPC$ to the null string */ @@ -353,9 +344,9 @@ int reply_tcon_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt p = smb_buf(outbuf); p += srvstr_push(outbuf, p, devicename, -1, - STR_CONVERT|STR_TERMINATE|STR_ASCII); + STR_TERMINATE|STR_ASCII); p += srvstr_push(outbuf, p, fsname, -1, - STR_CONVERT|STR_TERMINATE); + STR_TERMINATE); set_message_end(outbuf,p); @@ -430,8 +421,8 @@ int reply_ioctl(connection_struct *conn, { case IOCTL_QUERY_JOB_INFO: SSVAL(p,0,fsp->print_jobid); /* Job number */ - srvstr_push(outbuf, p+2, global_myname, 15, STR_TERMINATE|STR_CONVERT|STR_ASCII); - srvstr_push(outbuf, p+18, lp_servicename(SNUM(conn)), 13, STR_TERMINATE|STR_CONVERT|STR_ASCII); + srvstr_push(outbuf, p+2, global_myname, 15, STR_TERMINATE|STR_ASCII); + srvstr_push(outbuf, p+18, lp_servicename(SNUM(conn)), 13, STR_TERMINATE|STR_ASCII); break; } @@ -731,9 +722,8 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int return(ERROR(ERRDOS,ERRbuftoosmall)); } - memcpy(smb_apasswd,smb_buf(inbuf),smb_apasslen); - smb_apasswd[smb_apasslen] = 0; - srvstr_pull(inbuf, user, smb_buf(inbuf)+smb_apasslen, sizeof(user), -1, STR_TERMINATE|STR_CONVERT); + srvstr_pull(inbuf, smb_apasswd, smb_buf(inbuf), sizeof(smb_apasswd), smb_apasslen, 0); + srvstr_pull(inbuf, user, smb_buf(inbuf)+smb_apasslen, sizeof(user), -1, STR_TERMINATE); if (!doencrypt && (lp_security() != SEC_SERVER)) { smb_apasslen = strlen(smb_apasswd); @@ -814,23 +804,10 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int smb_ntpasslen = passlen2; memcpy(smb_ntpasswd,p+passlen1,smb_ntpasslen); smb_ntpasswd[smb_ntpasslen] = 0; - - /* - * Ensure the plaintext passwords are in UNIX format. - */ - if(!doencrypt) { - pstrcpy(smb_apasswd,dos_to_unix(smb_apasswd,False)); - pstrcpy(smb_ntpasswd,dos_to_unix(smb_ntpasswd,False)); - } - } else { /* we use the first password that they gave */ smb_apasslen = passlen1; StrnCpy(smb_apasswd,p,smb_apasslen); - /* - * Ensure the plaintext password is in UNIX format. - */ - pstrcpy(smb_apasswd,dos_to_unix(smb_apasswd,False)); /* trim the password */ smb_apasslen = strlen(smb_apasswd); @@ -843,20 +820,27 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int } p += passlen1 + passlen2; - p += srvstr_pull(inbuf, user, p, sizeof(user), -1, STR_CONVERT|STR_TERMINATE); + p += srvstr_pull(inbuf, user, p, sizeof(user), -1, + STR_TERMINATE); /* * Incoming user and domain are in DOS codepage format. Convert * to UNIX. */ p += srvstr_pull(inbuf, domain, p, sizeof(domain), - -1, STR_CONVERT|STR_TERMINATE); + -1, STR_TERMINATE); p += srvstr_pull(inbuf, native_os, p, sizeof(native_os), - -1, STR_CONVERT|STR_TERMINATE); + -1, STR_TERMINATE); p += srvstr_pull(inbuf, native_lanman, p, sizeof(native_lanman), - -1, STR_CONVERT|STR_TERMINATE); + -1, STR_TERMINATE); DEBUG(3,("Domain=[%s] NativeOS=[%s] NativeLanMan=[%s]\n", domain,native_os,native_lanman)); } + + /* don't allow for weird usernames */ + alpha_strcpy(user, user, ". _-", sizeof(user)); + if (strstr(user, "..")) { + return bad_password_error(inbuf, outbuf); + } /* don't allow for weird usernames */ alpha_strcpy(user, user, ". _-", sizeof(user)); @@ -923,7 +907,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int /* Work out who's who */ slprintf(dom_user, sizeof(dom_user) - 1,"%s%s%s", - dos_to_unix(domain, False), lp_winbind_separator(), user); + domain, lp_winbind_separator(), user); if (sys_getpwnam(dom_user) != NULL) { pstrcpy(user, dom_user); @@ -1050,9 +1034,9 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int char *p; set_message(outbuf,3,0,True); p = smb_buf(outbuf); - p += srvstr_push(outbuf, p, "Unix", -1, STR_TERMINATE|STR_CONVERT); - p += srvstr_push(outbuf, p, "Samba", -1, STR_TERMINATE|STR_CONVERT); - p += srvstr_push(outbuf, p, global_myworkgroup, -1, STR_TERMINATE|STR_CONVERT); + p += srvstr_push(outbuf, p, "Unix", -1, STR_TERMINATE); + p += srvstr_push(outbuf, p, "Samba", -1, STR_TERMINATE); + p += srvstr_push(outbuf, p, global_myworkgroup, -1, STR_TERMINATE); set_message_end(outbuf,p); /* perhaps grab OS version here?? */ } @@ -1544,7 +1528,7 @@ int reply_fclose(connection_struct *conn, char *inbuf,char *outbuf, int dum_size outsize = set_message(outbuf,1,0,True); p = smb_buf(inbuf) + 1; - p += srvstr_pull(inbuf, path, p, sizeof(path), -1, STR_TERMINATE|STR_CONVERT); + p += srvstr_pull(inbuf, path, p, sizeof(path), -1, STR_TERMINATE); p++; status_len = SVAL(p,0); p += 2; @@ -1886,7 +1870,7 @@ int reply_ctemp(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, START_PROFILE(SMBctemp); createmode = SVAL(inbuf,smb_vwv0); - srvstr_pull(inbuf, fname, smb_buf(inbuf)+1, sizeof(fname), -1, STR_TERMINATE|STR_CONVERT); + srvstr_pull(inbuf, fname, smb_buf(inbuf)+1, sizeof(fname), -1, STR_TERMINATE); pstrcat(fname,"/TMXXXXXX"); RESOLVE_DFSPATH(fname, conn, inbuf, outbuf); @@ -1928,7 +1912,7 @@ int reply_ctemp(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, SSVAL(outbuf,smb_vwv0,fsp->fnum); CVAL(smb_buf(outbuf),0) = 4; p = smb_buf(outbuf) + 1; - p += srvstr_push(outbuf, p, fname2, -1, STR_TERMINATE|STR_CONVERT); + p += srvstr_push(outbuf, p, fname2, -1, STR_TERMINATE); set_message_end(outbuf, p); if (oplock_request && lp_fake_oplocks(SNUM(conn))) { @@ -1957,7 +1941,7 @@ static BOOL can_delete(char *fname,connection_struct *conn, int dirtype) if (!CAN_WRITE(conn)) return(False); - if (conn->vfs_ops.lstat(conn,dos_to_unix(fname,False),&sbuf) != 0) return(False); + if (conn->vfs_ops.lstat(conn,fname,&sbuf) != 0) return(False); fmode = dos_mode(conn,fname,&sbuf); if (fmode & aDIR) return(False); if (!lp_delete_readonly(SNUM(conn))) { @@ -3333,7 +3317,7 @@ int reply_printqueue(connection_struct *conn, SSVAL(p,5, queue[i].job); SIVAL(p,7,queue[i].size); CVAL(p,11) = 0; - srvstr_push(outbuf, p+12, queue[i].user, 16, STR_CONVERT|STR_ASCII); + srvstr_push(outbuf, p+12, queue[i].user, 16, STR_ASCII); p += 28; } @@ -3472,7 +3456,7 @@ static BOOL recursive_rmdir(connection_struct *conn, char *directory) pstrcat(fullname, "/"); pstrcat(fullname, dname); - if(conn->vfs_ops.lstat(conn,dos_to_unix(fullname,False), &st) != 0) + if(conn->vfs_ops.lstat(conn,fullname, &st) != 0) { ret = True; break; @@ -3556,7 +3540,7 @@ BOOL rmdir_internals(connection_struct *conn, char *directory) pstrcat(fullname, "/"); pstrcat(fullname, dname); - if(conn->vfs_ops.lstat(conn,dos_to_unix(fullname, False), &st) != 0) + if(conn->vfs_ops.lstat(conn,fullname, &st) != 0) break; if(st.st_mode & S_IFDIR) { @@ -3707,7 +3691,7 @@ static BOOL can_rename(char *fname,connection_struct *conn) if (!CAN_WRITE(conn)) return(False); - if (conn->vfs_ops.lstat(conn,dos_to_unix(fname,False),&sbuf) != 0) return(False); + if (conn->vfs_ops.lstat(conn,fname,&sbuf) != 0) return(False); if (!check_file_sharing(conn,fname,True)) return(False); return(True); } @@ -3732,7 +3716,6 @@ int rename_internals(connection_struct *conn, BOOL exists=False; BOOL rc = True; SMB_STRUCT_STAT sbuf1, sbuf2; - pstring zdirectory; *directory = *mask = 0; @@ -3830,7 +3813,6 @@ int rename_internals(connection_struct *conn, } } - pstrcpy(zdirectory, dos_to_unix(directory, False)); if(replace_if_exists) { /* * NT SMB specific flag - rename can overwrite @@ -3840,15 +3822,13 @@ int rename_internals(connection_struct *conn, if(resolve_wildcards(directory,newname) && can_rename(directory,conn) && - !conn->vfs_ops.rename(conn,zdirectory, - dos_to_unix(newname,False))) + !conn->vfs_ops.rename(conn,directory,newname)) count++; } else { if (resolve_wildcards(directory,newname) && can_rename(directory,conn) && !vfs_file_exist(conn,newname,NULL) && - !conn->vfs_ops.rename(conn,zdirectory, - dos_to_unix(newname,False))) + !conn->vfs_ops.rename(conn,directory,newname)) count++; } @@ -3906,8 +3886,7 @@ int rename_internals(connection_struct *conn, continue; } - if (!conn->vfs_ops.rename(conn,dos_to_unix(fname,False), - dos_to_unix(destname,False))) + if (!conn->vfs_ops.rename(conn,fname,destname)) count++; DEBUG(3,("rename_internals: doing rename on %s -> %s\n",fname,destname)); } @@ -4228,7 +4207,7 @@ int reply_setdir(connection_struct *conn, char *inbuf,char *outbuf, int dum_size return(ERROR(ERRDOS,ERRnoaccess)); } - srvstr_pull(inbuf, newdir, smb_buf(inbuf) + 1, sizeof(newdir), -1, STR_TERMINATE|STR_CONVERT); + srvstr_pull(inbuf, newdir, smb_buf(inbuf) + 1, sizeof(newdir), -1, STR_TERMINATE); if (strlen(newdir) == 0) { ok = True; diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 1dcf861a17..8d115d954c 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -635,8 +635,6 @@ static void usage(char *pname) setup_logging(argv[0],False); - charset_initialise(); - /* we want to re-seed early to prevent time delays causing client problems at a later date. (tridge) */ generate_random_buffer(NULL, 0, False); @@ -712,8 +710,6 @@ static void usage(char *pname) } #endif /* WITH_SSL */ - codepage_initialise(lp_client_code_page()); - fstrcpy(global_myworkgroup, lp_workgroup()); CatchSignal(SIGHUP,SIGNAL_CAST sig_hup); diff --git a/source3/smbd/service.c b/source3/smbd/service.c index 0e2c0ff7a1..836ef30f80 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -245,7 +245,6 @@ connection_struct *make_connection(char *service,char *user,char *password, int if (*user && Get_Pwnam(user,True)) { fstring dos_username; fstrcpy(dos_username, user); - unix_to_dos(dos_username, True); return(make_connection(dos_username,user,password, pwlen,dev,vuid,ecode)); } @@ -255,7 +254,6 @@ connection_struct *make_connection(char *service,char *user,char *password, int fstring dos_username; fstrcpy(user,validated_username(vuid)); fstrcpy(dos_username, user); - unix_to_dos(dos_username, True); return(make_connection(dos_username,user,password,pwlen,dev,vuid,ecode)); } } else { @@ -265,7 +263,6 @@ connection_struct *make_connection(char *service,char *user,char *password, int fstring dos_username; fstrcpy(user,current_user_info.smb_name); fstrcpy(dos_username, user); - unix_to_dos(dos_username, True); return(make_connection(dos_username,user,password,pwlen,dev,vuid,ecode)); } } diff --git a/source3/smbd/srvstr.c b/source3/smbd/srvstr.c index 0651fb725b..3c452653f2 100644 --- a/source3/smbd/srvstr.c +++ b/source3/smbd/srvstr.c @@ -19,150 +19,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define NO_SYSLOG - #include "includes.h" -#define UNICODE_FLAG(buf, flags) (!(flags & STR_ASCII) && \ - ((flags & STR_UNICODE || \ - (SVAL(buf, smb_flg2) & FLAGS2_UNICODE_STRINGS)))) - -/**************************************************************************** -return an alignment of either 0 or 1 -if unicode is not negotiated then return 0 -otherwise return 1 if offset is off -****************************************************************************/ -static int srvstr_align(void *inbuf, int offset, int flags) -{ - if ((flags & STR_NOALIGN) || !UNICODE_FLAG(inbuf, flags)) return 0; - return offset & 1; -} - -/**************************************************************************** -copy a string from a char* src to a unicode or ascii -dos code page destination choosing unicode or ascii based on the -FLAGS2_UNICODE_STRINGS bit in inbuf -return the number of bytes occupied by the string in the destination -flags can have: - STR_TERMINATE means include the null termination - STR_CONVERT means convert from unix to dos codepage - STR_UPPER means uppercase in the destination - STR_ASCII use ascii even with unicode servers - STR_UNICODE means to force as unicode - STR_NOALIGN means don't do alignment -dest_len is the maximum length allowed in the destination. If dest_len -is -1 then no maxiumum is used -****************************************************************************/ -int srvstr_push(void *outbuf, void *dest, const char *src, int dest_len, int flags) -{ - int len=0; - - /* treat a pstring as "unlimited" length */ - if (dest_len == -1) { - dest_len = sizeof(pstring); - } - - if (srvstr_align(outbuf, PTR_DIFF(dest, outbuf), flags)) { - *(char *)dest = 0; - dest = (void *)((char *)dest + 1); - dest_len--; - len++; - } - - if (!UNICODE_FLAG(outbuf, flags)) { - /* the client doesn't want unicode */ - safe_strcpy(dest, src, dest_len); - len = strlen(dest); - if (flags & STR_TERMINATE) len++; - if (flags & STR_CONVERT) unix_to_dos(dest,True); - if (flags & STR_UPPER) strupper(dest); - return len; - } - - /* the server likes unicode. give it the works */ - if (flags & STR_CONVERT) { - dos_PutUniCode(dest, src, dest_len, flags & STR_TERMINATE); - } else { - ascii_to_unistr(dest, src, dest_len); - } - if (flags & STR_UPPER) { - strupper_w(dest); - } - len += strlen(src)*2; - if (flags & STR_TERMINATE) len += 2; - return len; -} - -/**************************************************************************** -copy a string from a unicode or ascii source (depending on flg2) -to a char* destination -flags can have: - STR_CONVERT means convert from dos to unix codepage - STR_TERMINATE means the string in src is null terminated - STR_UNICODE means to force as unicode - STR_NOALIGN means don't do alignment -if STR_TERMINATE is set then src_len is ignored -src_len is the length of the source area in bytes -return the number of bytes occupied by the string in src -****************************************************************************/ -int srvstr_pull(void *inbuf, char *dest, const void *src, int dest_len, int src_len, int flags) -{ - int len; - - if (dest_len == -1) { - dest_len = sizeof(pstring); - } - - if (srvstr_align(inbuf, PTR_DIFF(src, inbuf), flags)) { - src = (void *)((char *)src + 1); - if (src_len > 0) src_len--; - } - - if (!UNICODE_FLAG(inbuf, flags)) { - /* the server doesn't want unicode */ - if (flags & STR_TERMINATE) { - safe_strcpy(dest, src, dest_len); - len = strlen(src)+1; - } else { - if (src_len > dest_len) src_len = dest_len; - len = src_len; - memcpy(dest, src, len); - dest[len] = 0; - } - if (flags & STR_CONVERT) dos_to_unix(dest,True); - return len; - } - - if (flags & STR_TERMINATE) { - unistr_to_ascii(dest, src, dest_len); - len = strlen(dest)*2 + 2; - } else { - int i, c; - if (dest_len*2 < src_len) src_len = 2*dest_len; - for (i=0; i < src_len; i += 2) { - c = SVAL(src, i); - *dest++ = c; - } - *dest++ = 0; - len = src_len; - } - if (flags & STR_CONVERT) dos_to_unix(dest,True); - return len; -} - -/**************************************************************************** -these are useful for replacing all those StrnCpy() ops for copying data -to/from the wire -****************************************************************************/ - -int srvstr_push_ascii(void *dest, const char *src, int dest_len) +int srvstr_push(void *base_ptr, void *dest, const char *src, int dest_len, int flags) { - return srvstr_push(NULL, dest, src, dest_len, - STR_ASCII|STR_CONVERT|STR_TERMINATE); + return push_string(base_ptr, dest, src, dest_len, flags); } -int srvstr_pull_ascii(char *dest, const void *src, int dest_len) +int srvstr_pull(void *base_ptr, char *dest, const void *src, int dest_len, int src_len, + int flags) { - return srvstr_pull(NULL, dest, src, dest_len, -1, - STR_ASCII|STR_CONVERT|STR_TERMINATE); + return pull_string(base_ptr, dest, src, dest_len, src_len, flags); } diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index f94b24f595..f768a72c6d 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -471,8 +471,7 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn, SSVAL(p,l1_attrFile,mode); p += l1_achName; nameptr = p; - len = srvstr_push(outbuf, p, fname, -1, - STR_TERMINATE|STR_CONVERT); + len = srvstr_push(outbuf, p, fname, -1, STR_TERMINATE); SCVAL(p, -1, len); p += len; break; @@ -493,7 +492,7 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn, p += l2_achName; nameptr = p; len = srvstr_push(outbuf, p, fname, -1, - STR_TERMINATE|STR_CONVERT); + STR_TERMINATE); SCVAL(p, -1, len); p += len; break; @@ -509,8 +508,7 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn, SIVAL(p,26,4); p += 31; nameptr = p; - len = srvstr_push(outbuf, p, fname, -1, - STR_TERMINATE|STR_CONVERT); + len = srvstr_push(outbuf, p, fname, -1, STR_TERMINATE); SCVAL(p, -1, len); p += len; break; @@ -529,8 +527,7 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn, SSVAL(p,24,mode); p += 33; nameptr = p; - len = srvstr_push(outbuf, p, fname, -1, - STR_TERMINATE|STR_CONVERT); + len = srvstr_push(outbuf, p, fname, -1, STR_TERMINATE); SCVAL(p, -1, len); p += len; SIVAL(q,4,PTR_DIFF(p, q)); @@ -556,16 +553,14 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn, pstrcpy(mangled_name, fname); name_map_mangle(mangled_name,True,True,SNUM(conn)); mangled_name[12] = 0; - len = srvstr_push(outbuf, p+2, mangled_name, 24, - STR_CONVERT|STR_UPPER); + len = srvstr_push(outbuf, p+2, mangled_name, 24, STR_UPPER); SSVAL(p, 0, len); } else { SSVAL(p,0,0); *(p+2) = 0; } p += 2 + 24; - len = srvstr_push(outbuf, p, fname, -1, - STR_TERMINATE|STR_CONVERT); + len = srvstr_push(outbuf, p, fname, -1, STR_TERMINATE); SIVAL(q,0,len); p += len; len = PTR_DIFF(p, pdata); @@ -586,8 +581,7 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn, p += 16; SIVAL(p,0,nt_extmode); p += 4; p += 4; - len = srvstr_push(outbuf, p, fname, -1, - STR_TERMINATE|STR_CONVERT); + len = srvstr_push(outbuf, p, fname, -1, STR_TERMINATE); SIVAL(p, -4, len); p += len; len = PTR_DIFF(p, pdata); @@ -611,8 +605,7 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn, p += 4; SIVAL(p,0,0); p += 4; - len = srvstr_push(outbuf, p, fname, -1, - STR_TERMINATE|STR_CONVERT); + len = srvstr_push(outbuf, p, fname, -1, STR_TERMINATE); SIVAL(p, -4, len); p += len; @@ -626,8 +619,7 @@ static BOOL get_lanman2_dir_entry(connection_struct *conn, p += 4; SIVAL(p,0,reskey); p += 4; p += 4; - len = srvstr_push(outbuf, p, fname, -1, - STR_TERMINATE|STR_CONVERT); + len = srvstr_push(outbuf, p, fname, -1, STR_TERMINATE); SIVAL(p, -4, len); p += len; len = PTR_DIFF(p, pdata); @@ -923,7 +915,7 @@ static int call_trans2findnext(connection_struct *conn, *mask = *directory = *resume_name = 0; - srvstr_pull(inbuf, resume_name, params+12, sizeof(resume_name), -1, STR_TERMINATE|STR_CONVERT); + srvstr_pull(inbuf, resume_name, params+12, sizeof(resume_name), -1, STR_TERMINATE); DEBUG(3,("call_trans2findnext: dirhandle = %d, max_data_bytes = %d, maxentries = %d, \ close_after_request=%d, close_if_end = %d requires_resume_key = %d \ @@ -1194,7 +1186,7 @@ static int call_trans2qfsinfo(connection_struct *conn, */ SIVAL(pdata,0,str_checksum(lp_servicename(snum)) ^ (str_checksum(local_machine)<<16) ); len = srvstr_push(outbuf, pdata+l2_vol_szVolLabel, vname, -1, - STR_TERMINATE|STR_CONVERT); + STR_TERMINATE); SCVAL(pdata,l2_vol_cch,len); data_len = l2_vol_szVolLabel + len; DEBUG(5,("call_trans2qfsinfo : time = %x, namelen = %d, name = %s\n", @@ -1206,13 +1198,13 @@ static int call_trans2qfsinfo(connection_struct *conn, FILE_DEVICE_IS_MOUNTED| (lp_nt_acl_support() ? FILE_PERSISTENT_ACLS : 0)); /* FS ATTRIBUTES */ SIVAL(pdata,4,255); /* Max filename component length */ - len = srvstr_push(outbuf, pdata+12, fstype, -1, STR_TERMINATE|STR_CONVERT); + len = srvstr_push(outbuf, pdata+12, fstype, -1, STR_TERMINATE); SIVAL(pdata,8,len); data_len = 12 + len; break; case SMB_QUERY_FS_LABEL_INFO: - len = srvstr_push(outbuf, pdata+4, vname, -1, STR_TERMINATE|STR_CONVERT); + len = srvstr_push(outbuf, pdata+4, vname, -1, STR_TERMINATE); data_len = 4 + len; SIVAL(pdata,0,len); break; @@ -1224,7 +1216,7 @@ static int call_trans2qfsinfo(connection_struct *conn, SIVAL(pdata,8,str_checksum(lp_servicename(snum)) ^ (str_checksum(local_machine)<<16)); - len = srvstr_push(outbuf, pdata+18, vname, -1, STR_TERMINATE|STR_CONVERT); + len = srvstr_push(outbuf, pdata+18, vname, -1, STR_TERMINATE); SIVAL(pdata,12,len); data_len = 18+len; DEBUG(5,("call_trans2qfsinfo : SMB_QUERY_FS_VOLUME_INFO namelen = %d, vol=%s serv=%s\n", @@ -1517,7 +1509,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn, *short_name = '\0'; } len = srvstr_push(outbuf, pdata+4, short_name, -1, - STR_TERMINATE|STR_CONVERT|STR_UPPER); + STR_TERMINATE|STR_UPPER); data_size = 4 + len; SIVAL(pdata,0,len); } @@ -1531,9 +1523,9 @@ static int call_trans2qfilepathinfo(connection_struct *conn, * you like hearing about me suffering.... :-). JRA. */ if(strequal(".", fname)) { - len = srvstr_push(outbuf, pdata+4, "\\", -1, STR_TERMINATE|STR_CONVERT); + len = srvstr_push(outbuf, pdata+4, "\\", -1, STR_TERMINATE); } else { - len = srvstr_push(outbuf, pdata+4, fname, -1, STR_TERMINATE|STR_CONVERT); + len = srvstr_push(outbuf, pdata+4, fname, -1, STR_TERMINATE); } data_size = 4 + len; SIVAL(pdata,0,len); @@ -1571,7 +1563,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn, SIVAL(pdata,0,mode); /* is this the right sort of mode info? */ pdata += 4; pdata += 4; /* alignment */ - len = srvstr_push(outbuf, pdata+4, fname, -1, STR_TERMINATE|STR_CONVERT); + len = srvstr_push(outbuf, pdata+4, fname, -1, STR_TERMINATE); SIVAL(pdata,0,len); pdata += 4 + len; data_size = PTR_DIFF(pdata,(*ppdata)); @@ -1722,7 +1714,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn, SIVAL(pdata,0,pos); SIVAL(pdata,4,size); SIVAL(pdata,12,size); - len = srvstr_push(outbuf, pdata+24, fname, -1, STR_TERMINATE|STR_CONVERT); + len = srvstr_push(outbuf, pdata+24, fname, -1, STR_TERMINATE); SIVAL(pdata,20,len); data_size = 24 + len; break; @@ -2294,7 +2286,7 @@ static int call_trans2getdfsreferral(connection_struct *conn, char* inbuf, if(!lp_host_msdfs()) return(ERROR(ERRDOS,ERRbadfunc)); - srvstr_pull(inbuf, pathname, ¶ms[2], sizeof(pathname), -1, STR_TERMINATE|STR_CONVERT); + srvstr_pull(inbuf, pathname, ¶ms[2], sizeof(pathname), -1, STR_TERMINATE); if((reply_size = setup_dfs_referral(pathname,max_referral_level,ppdata)) < 0) return(ERROR(ERRDOS,ERRbadfile)); @@ -2331,8 +2323,8 @@ static int call_trans2ioctl(connection_struct *conn, char* inbuf, CAN ACCEPT THIS IN UNICODE. JRA. */ SSVAL(pdata,0,fsp->print_jobid); /* Job number */ - srvstr_push( outbuf, pdata + 2, global_myname, 15, STR_CONVERT|STR_ASCII|STR_TERMINATE); /* Our NetBIOS name */ - srvstr_push( outbuf, pdata+18, lp_servicename(SNUM(conn)), 13, STR_CONVERT|STR_ASCII|STR_TERMINATE); /* Service name */ + srvstr_push( outbuf, pdata + 2, global_myname, 15, STR_ASCII|STR_TERMINATE); /* Our NetBIOS name */ + srvstr_push( outbuf, pdata+18, lp_servicename(SNUM(conn)), 13, STR_ASCII|STR_TERMINATE); /* Service name */ send_trans2_replies(outbuf,bufsize,*pparams,0,*ppdata,32); return(-1); } else { diff --git a/source3/smbd/vfs-wrap.c b/source3/smbd/vfs-wrap.c index a0b4966c59..241216e9d7 100644 --- a/source3/smbd/vfs-wrap.c +++ b/source3/smbd/vfs-wrap.c @@ -29,7 +29,7 @@ is sure to try and execute them. These stubs are used to prevent this possibility. */ -int vfswrap_dummy_connect(connection_struct *conn, char *service, char *user) +int vfswrap_dummy_connect(connection_struct *conn, const char *service, const char *user) { return 0; /* Return >= 0 for success */ } @@ -40,7 +40,7 @@ void vfswrap_dummy_disconnect(connection_struct *conn) /* Disk operations */ -SMB_BIG_UINT vfswrap_disk_free(connection_struct *conn, char *path, BOOL small_query, SMB_BIG_UINT *bsize, +SMB_BIG_UINT vfswrap_disk_free(connection_struct *conn, const char *path, BOOL small_query, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize) { SMB_BIG_UINT result; @@ -59,7 +59,7 @@ SMB_BIG_UINT vfswrap_disk_free(connection_struct *conn, char *path, BOOL small_q /* Directory operations */ -DIR *vfswrap_opendir(connection_struct *conn, char *fname) +DIR *vfswrap_opendir(connection_struct *conn, const char *fname) { DIR *result; @@ -93,7 +93,7 @@ struct dirent *vfswrap_readdir(connection_struct *conn, DIR *dirp) return result; } -int vfswrap_mkdir(connection_struct *conn, char *path, mode_t mode) +int vfswrap_mkdir(connection_struct *conn, const char *path, mode_t mode) { int result; @@ -126,7 +126,7 @@ int vfswrap_mkdir(connection_struct *conn, char *path, mode_t mode) return result; } -int vfswrap_rmdir(connection_struct *conn, char *path) +int vfswrap_rmdir(connection_struct *conn, const char *path) { int result; @@ -162,7 +162,7 @@ int vfswrap_closedir(connection_struct *conn, DIR *dirp) /* File operations */ -int vfswrap_open(connection_struct *conn, char *fname, int flags, mode_t mode) +int vfswrap_open(connection_struct *conn, const char *fname, int flags, mode_t mode) { int result; @@ -207,7 +207,7 @@ ssize_t vfswrap_read(files_struct *fsp, int fd, char *data, size_t n) return result; } -ssize_t vfswrap_write(files_struct *fsp, int fd, char *data, size_t n) +ssize_t vfswrap_write(files_struct *fsp, int fd, const char *data, size_t n) { ssize_t result; @@ -235,7 +235,7 @@ SMB_OFF_T vfswrap_lseek(files_struct *fsp, int filedes, SMB_OFF_T offset, int wh return result; } -int vfswrap_rename(connection_struct *conn, char *old, char *new) +int vfswrap_rename(connection_struct *conn, const char *old, const char *new) { int result; @@ -267,7 +267,7 @@ int vfswrap_fsync(files_struct *fsp, int fd) #endif } -int vfswrap_stat(connection_struct *conn, char *fname, SMB_STRUCT_STAT *sbuf) +int vfswrap_stat(connection_struct *conn, const char *fname, SMB_STRUCT_STAT *sbuf) { int result; @@ -301,7 +301,7 @@ int vfswrap_fstat(files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf) return result; } -int vfswrap_lstat(connection_struct *conn, char *path, SMB_STRUCT_STAT *sbuf) +int vfswrap_lstat(connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf) { int result; @@ -318,7 +318,7 @@ int vfswrap_lstat(connection_struct *conn, char *path, SMB_STRUCT_STAT *sbuf) return result; } -int vfswrap_unlink(connection_struct *conn, char *path) +int vfswrap_unlink(connection_struct *conn, const char *path) { int result; @@ -335,7 +335,7 @@ int vfswrap_unlink(connection_struct *conn, char *path) return result; } -int vfswrap_chmod(connection_struct *conn, char *path, mode_t mode) +int vfswrap_chmod(connection_struct *conn, const char *path, mode_t mode) { int result; @@ -397,7 +397,7 @@ int vfswrap_fchmod(files_struct *fsp, int fd, mode_t mode) return result; } -int vfswrap_chown(connection_struct *conn, char *path, uid_t uid, gid_t gid) +int vfswrap_chown(connection_struct *conn, const char *path, uid_t uid, gid_t gid) { int result; @@ -425,7 +425,7 @@ int vfswrap_fchown(files_struct *fsp, int fd, uid_t uid, gid_t gid) return result; } -int vfswrap_chdir(connection_struct *conn, char *path) +int vfswrap_chdir(connection_struct *conn, const char *path) { int result; @@ -459,7 +459,7 @@ char *vfswrap_getwd(connection_struct *conn, char *path) return result; } -int vfswrap_utime(connection_struct *conn, char *path, struct utimbuf *times) +int vfswrap_utime(connection_struct *conn, const char *path, struct utimbuf *times) { int result; @@ -595,7 +595,7 @@ size_t vfswrap_fget_nt_acl(files_struct *fsp, int fd, SEC_DESC **ppdesc) return get_nt_acl(fsp, ppdesc); } -size_t vfswrap_get_nt_acl(files_struct *fsp, char *name, SEC_DESC **ppdesc) +size_t vfswrap_get_nt_acl(files_struct *fsp, const char *name, SEC_DESC **ppdesc) { return get_nt_acl(fsp, ppdesc); } @@ -605,12 +605,12 @@ BOOL vfswrap_fset_nt_acl(files_struct *fsp, int fd, uint32 security_info_sent, S return set_nt_acl(fsp, security_info_sent, psd); } -BOOL vfswrap_set_nt_acl(files_struct *fsp, char *name, uint32 security_info_sent, SEC_DESC *psd) +BOOL vfswrap_set_nt_acl(files_struct *fsp, const char *name, uint32 security_info_sent, SEC_DESC *psd) { return set_nt_acl(fsp, security_info_sent, psd); } -int vfswrap_chmod_acl(connection_struct *conn, char *name, mode_t mode) +int vfswrap_chmod_acl(connection_struct *conn, const char *name, mode_t mode) { return chmod_acl(name, mode); } diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index ac00d00e9e..747d393386 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -1,6 +1,6 @@ /* Unix SMB/Netbios implementation. - Version 1.9. + Version 3.0 VFS initialisation and support functions Copyright (C) Tim Potter 1999 @@ -109,156 +109,46 @@ static BOOL vfs_init_default(connection_struct *conn) static BOOL vfs_init_custom(connection_struct *conn) { int vfs_version = -1; - struct vfs_ops *ops, *(*init_fptr)(int *); + struct vfs_ops *ops, *(*init_fptr)(int *, struct vfs_ops *); - DEBUG(3, ("Initialising custom vfs hooks from %s\n", - lp_vfsobj(SNUM(conn)))); - - /* Open object file */ + DEBUG(3, ("Initialising custom vfs hooks from %s\n", + lp_vfsobj(SNUM(conn)))); - if ((conn->dl_handle = sys_dlopen(lp_vfsobj(SNUM(conn)), RTLD_NOW | RTLD_GLOBAL)) == NULL) { + /* Open object file */ + if ((conn->dl_handle = sys_dlopen(lp_vfsobj(SNUM(conn)), + RTLD_NOW | RTLD_GLOBAL)) == NULL) { DEBUG(0, ("Error opening %s: %s\n", lp_vfsobj(SNUM(conn)), dlerror())); return False; - } - - /* Get handle on vfs_init() symbol */ + } - init_fptr = (struct vfs_ops *(*)(int *))sys_dlsym(conn->dl_handle, "vfs_init"); + /* Get handle on vfs_init() symbol */ + init_fptr = (struct vfs_ops *(*)(int *, struct vfs_ops *))sys_dlsym(conn->dl_handle, "vfs_init"); - if (init_fptr == NULL) { + if (init_fptr == NULL) { DEBUG(0, ("No vfs_init() symbol found in %s\n", - lp_vfsobj(SNUM(conn)))); + lp_vfsobj(SNUM(conn)))); return False; - } + } - /* Initialise vfs_ops structure */ + /* Initialise vfs_ops structure */ + conn->vfs_ops = default_vfs_ops; - if ((ops = init_fptr(&vfs_version)) == NULL) { - DEBUG(0, ("vfs_init function from %s failed\n", lp_vfsobj(SNUM(conn)))); + if ((ops = init_fptr(&vfs_version, &conn->vfs_ops)) == NULL) { + DEBUG(0, ("vfs_init function from %s failed\n", lp_vfsobj(SNUM(conn)))); return False; - } - + } + if (vfs_version != SMB_VFS_INTERFACE_VERSION) { DEBUG(0, ("vfs_init returned wrong interface version info (was %d, should be %d)\n", - vfs_version, SMB_VFS_INTERFACE_VERSION )); + vfs_version, SMB_VFS_INTERFACE_VERSION )); return False; } + + if (ops != &conn->vfs_ops) { + memcpy(&conn->vfs_ops, ops, sizeof(struct vfs_ops)); + } - /* Fill in unused operations with default (disk based) ones. - There's probably a neater way to do this then a whole bunch of - if statements. */ - - memcpy(&conn->vfs_ops, ops, sizeof(struct vfs_ops)); - - if (conn->vfs_ops.connect == NULL) - conn->vfs_ops.connect = default_vfs_ops.connect; - - if (conn->vfs_ops.disconnect == NULL) - conn->vfs_ops.disconnect = default_vfs_ops.disconnect; - - if (conn->vfs_ops.disk_free == NULL) - conn->vfs_ops.disk_free = default_vfs_ops.disk_free; - - if (conn->vfs_ops.opendir == NULL) - conn->vfs_ops.opendir = default_vfs_ops.opendir; - - if (conn->vfs_ops.readdir == NULL) - conn->vfs_ops.readdir = default_vfs_ops.readdir; - - if (conn->vfs_ops.mkdir == NULL) - conn->vfs_ops.mkdir = default_vfs_ops.mkdir; - - if (conn->vfs_ops.rmdir == NULL) - conn->vfs_ops.rmdir = default_vfs_ops.rmdir; - - if (conn->vfs_ops.closedir == NULL) - conn->vfs_ops.closedir = default_vfs_ops.closedir; - - if (conn->vfs_ops.open == NULL) - conn->vfs_ops.open = default_vfs_ops.open; - - if (conn->vfs_ops.close == NULL) - conn->vfs_ops.close = default_vfs_ops.close; - - if (conn->vfs_ops.read == NULL) - conn->vfs_ops.read = default_vfs_ops.read; - - if (conn->vfs_ops.write == NULL) - conn->vfs_ops.write = default_vfs_ops.write; - - if (conn->vfs_ops.lseek == NULL) - conn->vfs_ops.lseek = default_vfs_ops.lseek; - - if (conn->vfs_ops.rename == NULL) - conn->vfs_ops.rename = default_vfs_ops.rename; - - if (conn->vfs_ops.fsync == NULL) - conn->vfs_ops.fsync = default_vfs_ops.fsync; - - if (conn->vfs_ops.stat == NULL) - conn->vfs_ops.stat = default_vfs_ops.stat; - - if (conn->vfs_ops.fstat == NULL) - conn->vfs_ops.fstat = default_vfs_ops.fstat; - - if (conn->vfs_ops.lstat == NULL) - conn->vfs_ops.lstat = default_vfs_ops.lstat; - - if (conn->vfs_ops.unlink == NULL) - conn->vfs_ops.unlink = default_vfs_ops.unlink; - - if (conn->vfs_ops.chmod == NULL) - conn->vfs_ops.chmod = default_vfs_ops.chmod; - - if (conn->vfs_ops.fchmod == NULL) - conn->vfs_ops.fchmod = default_vfs_ops.fchmod; - - if (conn->vfs_ops.chown == NULL) - conn->vfs_ops.chown = default_vfs_ops.chown; - - if (conn->vfs_ops.fchown == NULL) - conn->vfs_ops.fchown = default_vfs_ops.fchown; - - if (conn->vfs_ops.chdir == NULL) - conn->vfs_ops.chdir = default_vfs_ops.chdir; - - if (conn->vfs_ops.getwd == NULL) - conn->vfs_ops.getwd = default_vfs_ops.getwd; - - if (conn->vfs_ops.utime == NULL) - conn->vfs_ops.utime = default_vfs_ops.utime; - - if (conn->vfs_ops.ftruncate == NULL) - conn->vfs_ops.ftruncate = default_vfs_ops.ftruncate; - - if (conn->vfs_ops.lock == NULL) - conn->vfs_ops.lock = default_vfs_ops.lock; - - if (conn->vfs_ops.symlink == NULL) - conn->vfs_ops.symlink = default_vfs_ops.symlink; - - if (conn->vfs_ops.readlink == NULL) - conn->vfs_ops.readlink = default_vfs_ops.readlink; - - if (conn->vfs_ops.fget_nt_acl == NULL) - conn->vfs_ops.fget_nt_acl = default_vfs_ops.fget_nt_acl; - - if (conn->vfs_ops.get_nt_acl == NULL) - conn->vfs_ops.get_nt_acl = default_vfs_ops.get_nt_acl; - - if (conn->vfs_ops.fset_nt_acl == NULL) - conn->vfs_ops.fset_nt_acl = default_vfs_ops.fset_nt_acl; - - if (conn->vfs_ops.set_nt_acl == NULL) - conn->vfs_ops.set_nt_acl = default_vfs_ops.set_nt_acl; - - if (conn->vfs_ops.chmod_acl == NULL) - conn->vfs_ops.chmod_acl = default_vfs_ops.chmod_acl; - - if (conn->vfs_ops.fchmod_acl == NULL) - conn->vfs_ops.fchmod_acl = default_vfs_ops.fchmod_acl; - - return True; + return True; } #endif @@ -294,7 +184,7 @@ BOOL vfs_init(connection_struct *conn) Check if directory exists. ********************************************************************/ -BOOL vfs_directory_exist(connection_struct *conn, char *dname, SMB_STRUCT_STAT *st) +BOOL vfs_directory_exist(connection_struct *conn, const char *dname, SMB_STRUCT_STAT *st) { SMB_STRUCT_STAT st2; BOOL ret; @@ -309,20 +199,26 @@ BOOL vfs_directory_exist(connection_struct *conn, char *dname, SMB_STRUCT_STAT * if(!ret) errno = ENOTDIR; - return ret; + return ret; } /******************************************************************* - vfs mkdir wrapper that calls dos_to_unix. + vfs getwd wrapper ********************************************************************/ +char *vfs_getwd(connection_struct *conn, char *path) +{ + return conn->vfs_ops.getwd(conn,path); +} -int vfs_mkdir(connection_struct *conn, char *fname, mode_t mode) +/******************************************************************* + vfs mkdir wrapper +********************************************************************/ + +int vfs_mkdir(connection_struct *conn, const char *name, mode_t mode) { int ret; - pstring name; SMB_STRUCT_STAT sbuf; - pstrcpy(name,dos_to_unix(fname,False)); /* paranoia copy */ if(!(ret=conn->vfs_ops.mkdir(conn,name,mode))) { /* * Check if high bits should have been set, @@ -337,23 +233,10 @@ int vfs_mkdir(connection_struct *conn, char *fname, mode_t mode) } /******************************************************************* - vfs getwd wrapper that calls dos_to_unix. -********************************************************************/ - -char *vfs_getwd(connection_struct *conn, char *unix_path) -{ - char *wd; - wd = conn->vfs_ops.getwd(conn,unix_path); - if (wd) - unix_to_dos(wd, True); - return wd; -} - -/******************************************************************* Check if a vfs file exists. ********************************************************************/ -BOOL vfs_file_exist(connection_struct *conn,char *fname,SMB_STRUCT_STAT *sbuf) +BOOL vfs_file_exist(connection_struct *conn,const char *fname,SMB_STRUCT_STAT *sbuf) { SMB_STRUCT_STAT st; @@ -397,7 +280,7 @@ ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count) Write data to a fd on the vfs. ****************************************************************************/ -ssize_t vfs_write_data(files_struct *fsp,char *buffer,size_t N) +ssize_t vfs_write_data(files_struct *fsp,const char *buffer,size_t N) { size_t total=0; ssize_t ret; @@ -549,13 +432,6 @@ char *vfs_readdirname(connection_struct *conn, void *p) dname = dname - 2; #endif - { - static pstring buf; - memcpy(buf, dname, NAMLEN(ptr)+1); - unix_to_dos(buf, True); - dname = buf; - } - return(dname); } diff --git a/source3/smbwrapper/smbsh.c b/source3/smbwrapper/smbsh.c index 8f3e0b70b4..c5007e187d 100644 --- a/source3/smbwrapper/smbsh.c +++ b/source3/smbwrapper/smbsh.c @@ -45,7 +45,6 @@ int main(int argc, char *argv[]) extern FILE *dbf; dbf = stdout; - charset_initialise(); smbw_setup_shared(); while ((opt = getopt(argc, argv, "W:U:R:d:P:l:hL:")) != EOF) { diff --git a/source3/smbwrapper/smbw.c b/source3/smbwrapper/smbw.c index 7ee2d9af26..fd7f2a0253 100644 --- a/source3/smbwrapper/smbw.c +++ b/source3/smbwrapper/smbw.c @@ -73,8 +73,6 @@ void smbw_init(void) exit(1); } - charset_initialise(); - in_client = True; load_interfaces(); diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c index ef6c9a978a..2eaa6057c6 100644 --- a/source3/torture/locktest.c +++ b/source3/torture/locktest.c @@ -510,8 +510,6 @@ static void usage(void) argv += NSERVERS; TimeInit(); - charset_initialise(); - codepage_initialise(lp_client_code_page()); lp_load(servicesf,True,False,False); load_interfaces(); diff --git a/source3/torture/locktest2.c b/source3/torture/locktest2.c index 0391aa2942..171386dec3 100644 --- a/source3/torture/locktest2.c +++ b/source3/torture/locktest2.c @@ -563,8 +563,6 @@ static void usage(void) argv += 4; TimeInit(); - charset_initialise(); - codepage_initialise(lp_client_code_page()); lp_load(servicesf,True,False,False); load_interfaces(); diff --git a/source3/torture/masktest.c b/source3/torture/masktest.c index a654b5bfd1..a10a4e954c 100644 --- a/source3/torture/masktest.c +++ b/source3/torture/masktest.c @@ -445,8 +445,6 @@ static void usage(void) argv += 1; TimeInit(); - charset_initialise(); - codepage_initialise(lp_client_code_page()); lp_load(servicesf,True,False,False); load_interfaces(); diff --git a/source3/torture/msgtest.c b/source3/torture/msgtest.c index 3fbf95af8f..f08d722803 100644 --- a/source3/torture/msgtest.c +++ b/source3/torture/msgtest.c @@ -46,8 +46,6 @@ void pong_message(int msg_type, pid_t src, void *buf, size_t len) TimeInit(); setup_logging(argv[0],True); - charset_initialise(); - lp_load(servicesf,False,False,False); message_init(); diff --git a/source3/torture/rpctorture.c b/source3/torture/rpctorture.c index c80cfe4ade..b42c315b1d 100644 --- a/source3/torture/rpctorture.c +++ b/source3/torture/rpctorture.c @@ -258,8 +258,6 @@ enum client_action fprintf(stderr, "Can't load %s - run testparm to debug it\n", servicesf); } - codepage_initialise(lp_client_code_page()); - DEBUGLEVEL = 0; cli_info.put_total_size = 0; @@ -303,7 +301,6 @@ enum client_action setup_logging(pname, True); TimeInit(); - charset_initialise(); myumask = umask(0); umask(myumask); diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 2cad5cd13a..a7c50fbfe0 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -3217,12 +3217,6 @@ static void usage(void) setbuffer(stdout, NULL, 0); #endif - charset_initialise(); - - codepage_initialise(lp_client_code_page()); - - codepage_initialise(lp_client_code_page()); - lp_load(servicesf,True,False,False); load_interfaces(); diff --git a/source3/utils/make_smbcodepage.c b/source3/utils/make_smbcodepage.c deleted file mode 100644 index 1bd3edc263..0000000000 --- a/source3/utils/make_smbcodepage.c +++ /dev/null @@ -1,476 +0,0 @@ -/* - Unix SMB/Netbios implementation. - Version 1.9. - Create codepage files from codepage_def.XXX files. - - Copyright (C) Jeremy Allison 1997-1999. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "includes.h" - -static char *prog_name = NULL; - -/* - * Print program usage and die. - */ - -static void codepage_usage(char *progname) -{ - fprintf(stderr, "Usage is : %s [c|d] <codepage> <inputfile> <outputfile>\n", - progname); - exit(1); -} - -/* - * Read a line from a buffer into a line buffer. Ensure null - * terminated. - */ - -static void read_line( char **buf, char *line_buf, int size) -{ - char *p = *buf; - int num = 0; - - for(; *p && (*p != '\n'); p++) - { - if(num < (size - 1)) - line_buf[num++] = *p; - } - if(*p) - p++; /* Go past the '\n' */ - line_buf[num] = '\0'; - *buf = p; -} - -/* - * Strip comment lines and blank lines from the data. - * Copies into a new buffer and frees the old. - * Returns the number of lines copied. - */ - -static int clean_data( char **buf, size_t *size) -{ - pstring linebuf; - char *p = *buf; - int num_lines = 0; - char *newbuf = (char *)malloc( *size + 1); - char *newbuf_p = NULL; - - if(newbuf == NULL) - { - fprintf(stderr, "%s: malloc fail for size %d.\n", prog_name, *size + 1); - exit(1); - } - - newbuf_p = newbuf; - *newbuf_p = '\0'; - - while( *p ) - { - char *cp; - - read_line( &p, linebuf, sizeof(linebuf)); - /* Null terminate after comment. */ - if((cp = strchr( linebuf, '#'))!= NULL) - *cp = '\0'; - - for(cp = linebuf;*cp && isspace(*cp); cp++) - ; - - if(*cp == '\0') - continue; - - safe_strcpy(newbuf_p, cp, *size - (newbuf_p - newbuf)); - num_lines++; - newbuf_p += (strlen(newbuf_p) + 1); - } - - free(*buf); - *buf = newbuf; - return num_lines; -} - -/* - * Parse a byte from a codepage file. - */ - -static BOOL parse_byte(char *buf, unsigned char *bp) -{ - unsigned int b; - char *endptr = NULL; - - b = (unsigned int)strtol(buf, &endptr, 0); - if(endptr == buf || b > 255) - return False; - - *bp = (unsigned char)b; - return True; -} - -/* - * Parse a bool from a codepage file. - */ - -static BOOL parse_bool(char *buf, unsigned char *bp) -{ - if(isdigit((int)*buf)) - { - char *endptr = NULL; - - *bp = (unsigned char)strtol(buf, &endptr, 0); - if(endptr == buf ) - return False; - if(*bp != 0) - *bp = 1; - } else { - if(strcasecmp(buf, "True") && strcasecmp(buf, "False")) - return False; - if(strcasecmp(buf, "True")==0) - *bp = 1; - else - *bp = 0; - } - return True; -} - -/* - * Print a parse error and exit. - */ - -static void parse_error(char *buf, char *msg) -{ - fprintf(stderr, "%s: %s whilst parsing line \n%s\n", prog_name, - msg, buf); - exit(1); -} - -/* - * Create a compiled codepage file from a codepage definition file. - */ - -static int do_compile(int codepage, char *input_file, char *output_file) -{ - FILE *fp = NULL; - size_t size = 0; - char *buf = NULL; - char *orig_buf = NULL; - char output_buf[CODEPAGE_HEADER_SIZE + 4 * MAXCODEPAGELINES]; - int num_lines = 0; - int i = 0; - SMB_STRUCT_STAT st; - - /* Get the size of the input file. Read the entire thing into memory. */ - if(sys_stat((char *)input_file, &st)!= 0) - { - fprintf(stderr, "%s: failed to get the file size for file %s. Error was %s\n", - prog_name, input_file, strerror(errno)); - exit(1); - } - - size = (uint32)st.st_size; - - /* I don't believe these things should be bigger than 100k :-) */ - if(size > 100*1024) - { - fprintf(stderr, "%s: filesize %d is too large for a codepage definition file. \ -The maximum size I will believe is 100k.\n", prog_name, size); - exit(1); - } - - if((fp = sys_fopen(input_file, "r")) == NULL) - { - fprintf(stderr, "%s: cannot open file %s for input.\n", prog_name, input_file); - exit(1); - } - - /* As we will be reading text, allocate one more byte for a '\0' */ - if((buf = (char *)malloc( size + 1 )) == NULL) - { - fprintf(stderr, "%s: malloc fail for size %d.\n", prog_name, size + 1); - fclose(fp); - exit(1); - } - - if(fread( buf, 1, size, fp) != size) - { - fprintf(stderr, "%s: read failed for file %s. Error was %s.\n", prog_name, - input_file, strerror(errno)); - free((char *)buf); - fclose(fp); - exit(1); - } - - /* Null terminate the text read. */ - buf[size] = '\0'; - - /* Go through the data line by line, strip out comments (anything - after a '#' to end-of-line) and blank lines. The rest should be - the codepage data. - */ - - num_lines = clean_data( &buf, &size); - - orig_buf = buf; /* Save for free(). */ - - /* There can be a maximum of MAXCODEPAGELINES lines. */ - if(num_lines > MAXCODEPAGELINES) - { - fprintf(stderr, "%s: There can be a maximum %d lines of data in a codepage \ -definition file. File %s has %d.\n", prog_name, MAXCODEPAGELINES, input_file, num_lines); - exit(1); - } - - /* Setup the output file header. */ - SSVAL(output_buf,CODEPAGE_VERSION_OFFSET,CODEPAGE_FILE_VERSION_ID); - SSVAL(output_buf,CODEPAGE_CLIENT_CODEPAGE_OFFSET,(uint16)codepage); - SIVAL(output_buf,CODEPAGE_LENGTH_OFFSET,(num_lines * 4)); - - /* Now convert the lines into the compiled form. */ - for(i = 0; i < num_lines; i++) - { - char token_buf[512]; - char *p = buf; - unsigned char b = 0; - - /* Get the 'lower' value. */ - if(!next_token(&p, token_buf, NULL, sizeof(token_buf))) - parse_error(buf, "cannot parse first value"); - if(!parse_byte( token_buf, &b)) - parse_error(buf, "first value doesn't resolve to a byte"); - - /* Add this to the output buffer. */ - SCVAL(output_buf,CODEPAGE_HEADER_SIZE+(i*4),b); - - /* Get the 'upper' value. */ - if(!next_token(&p, token_buf, NULL, sizeof(token_buf))) - parse_error(buf, "cannot parse second value"); - if(!parse_byte( token_buf, &b)) - parse_error(buf, "second value doesn't resolve to a byte"); - - /* Add this to the output buffer. */ - SCVAL(output_buf,CODEPAGE_HEADER_SIZE+(i*4) + 1,b); - - /* Get the 'upper to lower' value. */ - if(!next_token(&p, token_buf, NULL, sizeof(token_buf))) - parse_error(buf, "cannot parse third value"); - if(!parse_bool( token_buf, &b)) - parse_error(buf, "third value doesn't resolve to a boolean"); - - /* Add this to the output buffer. */ - SCVAL(output_buf,CODEPAGE_HEADER_SIZE+(i*4) + 2,b); - - /* Get the 'lower to upper' value. */ - if(!next_token(&p, token_buf, NULL, sizeof(token_buf))) - parse_error(buf, "cannot parse fourth value"); - if(!parse_bool( token_buf, &b)) - parse_error(buf, "fourth value doesn't resolve to a boolean"); - - /* Add this to the output buffer. */ - SCVAL(output_buf,CODEPAGE_HEADER_SIZE+(i*4) + 3,b); - - buf += (strlen(buf) + 1); - } - - /* Now write out the output_buf. */ - if((fp = sys_fopen(output_file, "w"))==NULL) - { - fprintf(stderr, "%s: Cannot open output file %s. Error was %s.\n", - prog_name, output_file, strerror(errno)); - exit(1); - } - - if(fwrite(output_buf, 1, CODEPAGE_HEADER_SIZE + (num_lines*4), fp) != - CODEPAGE_HEADER_SIZE + (num_lines*4)) - { - fprintf(stderr, "%s: Cannot write output file %s. Error was %s.\n", - prog_name, output_file, strerror(errno)); - exit(1); - } - - fclose(fp); - - free(orig_buf); - return 0; -} - -/* - * Placeholder for now. - */ - -static int do_decompile( int codepage, char *input_file, char *output_file) -{ - size_t size = 0; - SMB_STRUCT_STAT st; - char header_buf[CODEPAGE_HEADER_SIZE]; - char *buf = NULL; - FILE *fp = NULL; - int num_lines = 0; - int i = 0; - - /* Get the size of the input file. Read the entire thing into memory. */ - if(sys_stat((char *)input_file, &st)!= 0) - { - fprintf(stderr, "%s: failed to get the file size for file %s. Error was %s\n", - prog_name, input_file, strerror(errno)); - exit(1); - } - - size = (size_t)st.st_size; - - if( size < CODEPAGE_HEADER_SIZE || size > (CODEPAGE_HEADER_SIZE + 256)) - { - fprintf(stderr, "%s: file %s is an incorrect size for a \ -code page file.\n", prog_name, input_file); - exit(1); - } - - /* Read the first 8 bytes of the codepage file - check - the version number and code page number. All the data - is held in little endian format. - */ - - if((fp = sys_fopen( input_file, "r")) == NULL) - { - fprintf(stderr, "%s: cannot open file %s. Error was %s\n", - prog_name, input_file, strerror(errno)); - exit(1); - } - - if(fread( header_buf, 1, CODEPAGE_HEADER_SIZE, fp)!=CODEPAGE_HEADER_SIZE) - { - fprintf(stderr, "%s: cannot read header from file %s. Error was %s\n", - prog_name, input_file, strerror(errno)); - exit(1); - } - - /* Check the version value */ - if(SVAL(header_buf,CODEPAGE_VERSION_OFFSET) != CODEPAGE_FILE_VERSION_ID) - { - fprintf(stderr, "%s: filename %s has incorrect version id. \ -Needed %hu, got %hu.\n", - prog_name, input_file, (uint16)CODEPAGE_FILE_VERSION_ID, - SVAL(header_buf,CODEPAGE_VERSION_OFFSET)); - exit(1); - } - - /* Check the codepage matches */ - if(SVAL(header_buf,CODEPAGE_CLIENT_CODEPAGE_OFFSET) != (uint16)codepage) - { - fprintf(stderr, "%s: filename %s has incorrect codepage. \ -Needed %hu, got %hu.\n", - prog_name, input_file, (uint16)codepage, - SVAL(header_buf,CODEPAGE_CLIENT_CODEPAGE_OFFSET)); - exit(1); - } - - /* Check the length is correct. */ - if(IVAL(header_buf,CODEPAGE_LENGTH_OFFSET) != - (unsigned int)(size - CODEPAGE_HEADER_SIZE)) - { - fprintf(stderr, "%s: filename %s has incorrect size headers. \ -Needed %u, got %u.\n", prog_name, input_file, size - CODEPAGE_HEADER_SIZE, - IVAL(header_buf,CODEPAGE_LENGTH_OFFSET)); - exit(1); - } - - size -= CODEPAGE_HEADER_SIZE; /* Remove header */ - - /* Make sure the size is a multiple of 4. */ - if((size % 4 ) != 0) - { - fprintf(stderr, "%s: filename %s has a codepage size not a \ -multiple of 4.\n", prog_name, input_file); - exit(1); - } - - /* Allocate space for the code page file and read it all in. */ - if((buf = (char *)malloc( size )) == NULL) - { - fprintf (stderr, "%s: malloc fail for size %d.\n", - prog_name, size ); - exit(1); - } - - if(fread( buf, 1, size, fp)!=size) - { - fprintf(stderr, "%s: read fail on file %s. Error was %s.\n", - prog_name, input_file, strerror(errno)); - exit(1); - } - - fclose(fp); - - /* Now dump the codepage into an ascii file. */ - if((fp = sys_fopen(output_file, "w")) == NULL) - { - fprintf(stderr, "%s: cannot open file %s. Error was %s\n", - prog_name, output_file, strerror(errno)); - exit(1); - } - - fprintf(fp, "#\n# Codepage definition file for IBM Code Page %d.\n#\n", - codepage); - fprintf(fp, "# This file was automatically generated.\n#\n"); - fprintf(fp, "# defines lower->upper mapping.\n"); - fprintf(fp, "#\n#The columns are :\n# lower\tupper\tu-t-l\tl-t-u\n#\n"); - - num_lines = size / 4; - for( i = 0; i < num_lines; i++) - { - fprintf(fp, "0x%02X\t0x%02X\t%s\t%s\n", CVAL(buf, (i*4)), CVAL(buf, (i*4)+1), - CVAL(buf, (i*4)+2) ? "True" : "False", - CVAL(buf, (i*4)+3) ? "True" : "False"); - } - fclose(fp); - return 0; -} - -int main(int argc, char **argv) -{ - int codepage = 0; - char *input_file = NULL; - char *output_file = NULL; - BOOL compile = False; - - prog_name = argv[0]; - - if(argc != 5) - codepage_usage(prog_name); - - if(argv[1][0] != 'c' && argv[1][0] != 'C' && argv[1][0] != 'd' && - argv[1][0] != 'D') - codepage_usage(prog_name); - - input_file = argv[3]; - output_file = argv[4]; - - /* Are we compiling or decompiling. */ - if(argv[1][0] == 'c' || argv[1][0] == 'C') - compile = True; - - /* Convert the second argument into a client codepage value. */ - if((codepage = atoi(argv[2])) == 0) - { - fprintf(stderr, "%s: %s is not a valid codepage.\n", prog_name, argv[2]); - exit(1); - } - - if(compile) - return do_compile( codepage, input_file, output_file); - else - return do_decompile( codepage, input_file, output_file); -} diff --git a/source3/utils/make_unicodemap.c b/source3/utils/make_unicodemap.c deleted file mode 100644 index 3584facbf6..0000000000 --- a/source3/utils/make_unicodemap.c +++ /dev/null @@ -1,313 +0,0 @@ -/* - Unix SMB/Netbios implementation. - Version 2.0.x. - Create unicode map files from unicode_def.XXX files. - - Copyright (C) Jeremy Allison 1997-1999. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "includes.h" - -static char *prog_name = NULL; - -/* - * Print program usage and die. - */ - -static void unicode_map_usage(char *progname) -{ - fprintf(stderr, "Usage is : %s <codepage> <inputfile> <outputfile>\n", - progname); - exit(1); -} - -/* - * Read a line from a buffer into a line buffer. Ensure null - * terminated. - */ - -static void read_line( char **buf, char *line_buf, size_t size) -{ - char *p = *buf; - size_t num = 0; - - for(; *p && (*p != '\n') && (*p != '\032'); p++) { - if(num < (size - 1)) - line_buf[num++] = *p; - } - if(*p) - p++; /* Go past the '\n' */ - line_buf[num] = '\0'; - *buf = p; -} - -/* - * Strip comment lines and blank lines from the data. - * Copies into a new buffer and frees the old. - * Returns the number of lines copied. - */ - -static size_t clean_data( char **buf, size_t *size) -{ - pstring linebuf; - char *p = *buf; - size_t num_lines = 0; - char *newbuf = (char *)malloc( *size + 1); - char *newbuf_p = NULL; - - if(newbuf == NULL) { - fprintf(stderr, "%s: malloc fail for size %u.\n", prog_name, (unsigned int)(*size + 1)); - exit(1); - } - - newbuf_p = newbuf; - *newbuf_p = '\0'; - - while( *p ) { - char *cp; - - read_line( &p, linebuf, sizeof(linebuf)); - /* Null terminate after comment. */ - if((cp = strchr( linebuf, '#'))!= NULL) - *cp = '\0'; - - for(cp = linebuf;*cp && isspace(*cp); cp++) - ; - - if(*cp == '\0') - continue; - - safe_strcpy(newbuf_p, cp, *size - (newbuf_p - newbuf)); - num_lines++; - newbuf_p += (strlen(newbuf_p) + 1); - } - - free(*buf); - *buf = newbuf; - return num_lines; -} - -/* - * Parse a uint16 from a codepage file. - */ - -static BOOL parse_uint16(char *buf, uint16 *uip) -{ - unsigned int ui; - char *endptr = NULL; - - ui = (unsigned int)strtol(buf, &endptr, 0); - if(endptr == buf || ui > 65535) - return False; - - *uip = (uint16)ui; - return True; -} - -/* - * Print a parse error and exit. - */ - -static void parse_error(const char *buf, const char *input_file, const char *msg) -{ - fprintf(stderr, "%s: In file %s : %s whilst parsing line \n%s\n", prog_name, - input_file, msg, buf); - exit(1); -} - -/* - * Create a compiled unicode map file from a unicode map definition file. - */ - -static int do_compile(const char *codepage, const char *input_file, const char *output_file) -{ - FILE *fp = NULL; - size_t size = 0; - size_t offset = 0; - char *buf = NULL; - char *orig_buf = NULL; - char *output_buf = NULL; - uint16 cp_to_ucs2[65536]; - uint16 ucs2_to_cp[65536]; - BOOL multibyte_code_page = False; - int num_lines = 0; - int i = 0; - SMB_STRUCT_STAT st; - - /* Get the size of the input file. Read the entire thing into memory. */ - if(sys_stat(input_file, &st)!= 0) { - fprintf(stderr, "%s: failed to get the file size for file %s. Error was %s\n", - prog_name, input_file, strerror(errno)); - exit(1); - } - - size = (size_t)st.st_size; - - if((fp = sys_fopen(input_file, "r")) == NULL) { - fprintf(stderr, "%s: cannot open file %s for input.\n", prog_name, input_file); - exit(1); - } - - /* As we will be reading text, allocate one more byte for a '\0' */ - if((buf = (char *)malloc( size + 1 )) == NULL) { - fprintf(stderr, "%s: malloc fail for size %d.\n", prog_name, size + 1); - fclose(fp); - exit(1); - } - - if(fread( buf, 1, size, fp) != size) { - fprintf(stderr, "%s: read failed for file %s. Error was %s.\n", prog_name, - input_file, strerror(errno)); - free((char *)buf); - fclose(fp); - exit(1); - } - - /* Null terminate the text read. */ - buf[size] = '\0'; - - /* Go through the data line by line, strip out comments (anything - after a '#' to end-of-line) and blank lines. The rest should be - the codepage data. - */ - - num_lines = clean_data( &buf, &size); - - orig_buf = buf; /* Store for free(). */ - - /* - * Initialize the output data. - */ - - memset(cp_to_ucs2, '\0', sizeof(cp_to_ucs2)); - ucs2_to_cp[0] = 0; - for (i = 1; i < 65536; i++) - ucs2_to_cp[i] = (uint16)'_'; - - /* Now convert the lines into the compiled form. */ - - for(i = 0; i < num_lines; i++) { - char token_buf[512]; - char *p = buf; - uint16 cp = 0; - uint16 ucs2 = 0; - - /* Get the codepage value. */ - if(!next_token(&p, token_buf, NULL, sizeof(token_buf))) - parse_error(buf, input_file, "cannot parse first value"); - - if(!parse_uint16( token_buf, &cp)) - parse_error(buf, input_file, "first value doesn't resolve to an unsigned 16 bit integer"); - - if(cp > 255) - multibyte_code_page = True; - - /* Get the ucs2 value. */ - - if(!next_token(&p, token_buf, NULL, sizeof(token_buf))) { - - /* - * Some of the multibyte codepage to unicode map files - * list a single byte as a leading multibyte and have no - * second value. - */ - - buf += (strlen(buf) + 1); - continue; - } - - if(!parse_uint16( token_buf, &ucs2)) - parse_error(buf, input_file, "second value doesn't resolve to an unsigned 16 bit integer"); - - /* - * Set up the cross reference in little-endian format. - */ - - SSVAL(((char *)&cp_to_ucs2[cp]),0,ucs2); - SSVAL(((char *)&ucs2_to_cp[ucs2]),0,cp); - - /* - * Next line. - */ - buf += (strlen(buf) + 1); - } - - size = UNICODE_MAP_HEADER_SIZE + (multibyte_code_page ? (4*65536) : (2*256 + 2*65536)); - - if((output_buf = (char *)malloc( size )) == NULL) { - fprintf(stderr, "%s: output buffer malloc fail for size %d.\n", prog_name, size); - fclose(fp); - exit(1); - } - - /* Setup the output file header. */ - SSVAL(output_buf,UNICODE_MAP_VERSION_OFFSET,UNICODE_MAP_FILE_VERSION_ID); - memset(&output_buf[UNICODE_MAP_CLIENT_CODEPAGE_OFFSET],'\0',UNICODE_MAP_CODEPAGE_ID_SIZE); - safe_strcpy(&output_buf[UNICODE_MAP_CLIENT_CODEPAGE_OFFSET], codepage, UNICODE_MAP_CODEPAGE_ID_SIZE - 1); - output_buf[UNICODE_MAP_CLIENT_CODEPAGE_OFFSET+UNICODE_MAP_CODEPAGE_ID_SIZE-1] = '\0'; - - offset = UNICODE_MAP_HEADER_SIZE; - - if (multibyte_code_page) { - SIVAL(output_buf,UNICODE_MAP_CP_TO_UNICODE_LENGTH_OFFSET,2*65536); - memcpy(output_buf+offset, (char *)cp_to_ucs2, 2*65536); - offset += 2*65536; - } else { - SIVAL(output_buf,UNICODE_MAP_CP_TO_UNICODE_LENGTH_OFFSET,2*256); - memcpy(output_buf+offset, (char *)cp_to_ucs2, 2*256); - offset += 2*256; - } - SIVAL(output_buf,UNICODE_MAP_UNICODE_TO_CP_LENGTH_OFFSET,65536*2); - memcpy(output_buf+offset, (char *)ucs2_to_cp, 2*65536); - - /* Now write out the output_buf. */ - if((fp = sys_fopen(output_file, "w"))==NULL) { - fprintf(stderr, "%s: Cannot open output file %s. Error was %s.\n", - prog_name, output_file, strerror(errno)); - exit(1); - } - - if(fwrite(output_buf, 1, size, fp) != size) { - fprintf(stderr, "%s: Cannot write output file %s. Error was %s.\n", - prog_name, output_file, strerror(errno)); - exit(1); - } - - fclose(fp); - - free(orig_buf); - free(output_buf); - return 0; -} - -int main(int argc, char **argv) -{ - const char *codepage = NULL; - char *input_file = NULL; - char *output_file = NULL; - - prog_name = argv[0]; - - if(argc != 4) - unicode_map_usage(prog_name); - - codepage = argv[1]; - input_file = argv[2]; - output_file = argv[3]; - - return do_compile( codepage, input_file, output_file); -} diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c index 0f978a6cf3..adb75e6104 100644 --- a/source3/utils/nmblookup.c +++ b/source3/utils/nmblookup.c @@ -206,8 +206,6 @@ int main(int argc,char *argv[]) setup_logging(argv[0],True); - charset_initialise(); - while ((opt = getopt(argc, argv, "d:B:U:i:s:SMrhART")) != EOF) switch (opt) { diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c index ef62fe32df..2b1dfe9f92 100644 --- a/source3/utils/pdbedit.c +++ b/source3/utils/pdbedit.c @@ -592,8 +592,6 @@ int main (int argc, char **argv) setup_logging("tdbedit", True); - charset_initialise(); - if (argc < 2) { diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c index 51ae05b52a..9edc35f800 100644 --- a/source3/utils/smbcacls.c +++ b/source3/utils/smbcacls.c @@ -836,10 +836,8 @@ You can string acls together with spaces, commas or newlines\n\ argv += 2; TimeInit(); - charset_initialise(); lp_load(servicesf,True,False,False); - codepage_initialise(lp_client_code_page()); load_interfaces(); if (getenv("USER")) { diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c index 27a3b61170..fef4ded218 100644 --- a/source3/utils/smbcontrol.c +++ b/source3/utils/smbcontrol.c @@ -342,7 +342,6 @@ static BOOL do_command(char *dest, char *msg_name, char **params) TimeInit(); setup_logging(argv[0],True); - charset_initialise(); lp_load(servicesf,False,False,False); if (!message_init()) exit(1); diff --git a/source3/utils/smbfilter.c b/source3/utils/smbfilter.c index db83873e69..8550159955 100644 --- a/source3/utils/smbfilter.c +++ b/source3/utils/smbfilter.c @@ -210,8 +210,6 @@ int main(int argc, char *argv[]) setup_logging(argv[0],True); - charset_initialise(); - pstrcpy(configfile,CONFIGFILE); if (argc < 2) { diff --git a/source3/utils/smbgroupedit.c b/source3/utils/smbgroupedit.c index 76624312d5..ffaacca102 100644 --- a/source3/utils/smbgroupedit.c +++ b/source3/utils/smbgroupedit.c @@ -220,8 +220,6 @@ int main (int argc, char **argv) setup_logging("groupedit", True); - charset_initialise(); - if (argc < 2) { usage(); return 0; diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c index 3442efc3a8..ebc588eb64 100644 --- a/source3/utils/smbpasswd.c +++ b/source3/utils/smbpasswd.c @@ -901,8 +901,6 @@ int main(int argc, char **argv) setup_logging("smbpasswd", True); - charset_initialise(); - if(!initialize_password_db(True)) { fprintf(stderr, "Can't setup password database vectors.\n"); exit(1); @@ -927,8 +925,6 @@ int main(int argc, char **argv) } strupper(global_myname); - codepage_initialise(lp_client_code_page()); - secrets_init(); /* Check the effective uid - make sure we are not setuid */ diff --git a/source3/utils/smbw_sample.c b/source3/utils/smbw_sample.c index db92af9510..7d6eb7f353 100644 --- a/source3/utils/smbw_sample.c +++ b/source3/utils/smbw_sample.c @@ -33,9 +33,7 @@ int main(int argc, char *argv[]) extern int optind; char *path; - charset_initialise(); lp_load(CONFIGFILE,1,0,0); - codepage_initialise(lp_client_code_page()); smbw_setup_shared(); while ((opt = getopt(argc, argv, "W:U:R:d:P:l:hL:")) != EOF) { diff --git a/source3/utils/status.c b/source3/utils/status.c index 448239baba..ea683ad19c 100644 --- a/source3/utils/status.c +++ b/source3/utils/status.c @@ -135,7 +135,7 @@ static void print_share_mode(share_mode_entry *e, char *fname) else printf("NONE "); - printf(" %s %s",dos_to_unix(fname,False), + printf(" %s %s",fname, asctime(LocalTime((time_t *)&e->time.tv_sec))); } } @@ -252,8 +252,6 @@ static int traverse_fn1(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, void *st TimeInit(); setup_logging(argv[0],True); - charset_initialise(); - DEBUGLEVEL = 0; dbf = stderr; diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c index b8536d4b9d..c9080e1994 100644 --- a/source3/utils/testparm.c +++ b/source3/utils/testparm.c @@ -180,8 +180,6 @@ int main(int argc, char *argv[]) setup_logging(argv[0],True); - charset_initialise(); - while ((opt = getopt(argc, argv,"shL:t:")) != EOF) { switch (opt) { case 's': @@ -270,16 +268,13 @@ Level II oplocks can only be set if oplocks are also set.\n", } } - if (*term_code) - interpret_coding_system(term_code); - if (argc < 3) { if (!silent_mode) { printf("Press enter to see a dump of your service definitions\n"); fflush(stdout); getc(stdin); } - lp_dump(stdout,True, lp_numservices(), _dos_to_unix); + lp_dump(stdout,True, lp_numservices()); } if (argc >= 3) { diff --git a/source3/utils/testprns.c b/source3/utils/testprns.c index c03fa0436a..f8fdcd63a1 100644 --- a/source3/utils/testprns.c +++ b/source3/utils/testprns.c @@ -46,8 +46,6 @@ int main(int argc, char *argv[]) setup_logging(argv[0],True); - charset_initialise(); - if (argc < 2 || argc > 3) printf("Usage: testprns printername [printcapfile]\n"); else diff --git a/source3/web/statuspage.c b/source3/web/statuspage.c index f3b07425b7..2efc37a051 100644 --- a/source3/web/statuspage.c +++ b/source3/web/statuspage.c @@ -68,7 +68,7 @@ static void print_share_mode(share_mode_entry *e, char *fname) printf("</td>"); printf("<td>%s</td><td>%s</td></tr>\n", - dos_to_unix(fname,False),tstring(e->time.tv_sec)); + fname,tstring(e->time.tv_sec)); } diff --git a/source3/web/swat.c b/source3/web/swat.c index 8374cd445a..5dcfe3d658 100644 --- a/source3/web/swat.c +++ b/source3/web/swat.c @@ -354,13 +354,13 @@ static BOOL load_config(BOOL save_def) /**************************************************************************** write a config file ****************************************************************************/ -static void write_config(FILE *f, BOOL show_defaults, char *(*dos_to_ext)(char *, BOOL)) +static void write_config(FILE *f, BOOL show_defaults) { fprintf(f, "# Samba config file created using SWAT\n"); fprintf(f, "# from %s (%s)\n", cgi_remote_host(), cgi_remote_addr()); fprintf(f, "# Date: %s\n\n", timestring(False)); - lp_dump(f, show_defaults, iNumNonAutoPrintServices, dos_to_ext); + lp_dump(f, show_defaults, iNumNonAutoPrintServices); } /**************************************************************************** @@ -383,9 +383,9 @@ static int save_reload(int snum) fchmod(fileno(f), S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH); } - write_config(f, False, _dos_to_unix); + write_config(f, False); if (snum) - lp_dump_one(f, False, snum, _dos_to_unix); + lp_dump_one(f, False, snum); fclose(f); lp_killunused(NULL); @@ -408,10 +408,6 @@ static void commit_parameter(int snum, struct parm_struct *parm, char *v) int i; char *s; - /* lp_do_parameter() will do unix_to_dos(v). */ - if(parm->flags & FLAG_DOS_STRING) - dos_to_unix(v, True); - if (snum < 0 && parm->class == P_LOCAL) { /* this handles the case where we are changing a local variable globally. We need to change the parameter in @@ -511,7 +507,7 @@ static void viewconfig_page(void) } printf("<p><pre>"); - write_config(stdout, full_view, _dos_to_dos); + write_config(stdout, full_view); printf("</pre>"); printf("</form>\n"); } @@ -591,12 +587,8 @@ static void shares_page(void) } if (cgi_variable("createshare") && (share=cgi_variable("newshare"))) { - /* add_a_service() which is called by lp_copy_service() - will do unix_to_dos() conversion, so we need dos_to_unix() before the lp_copy_service(). */ - pstring unix_share; - pstrcpy(unix_share, dos_to_unix(share, False)); load_config(False); - lp_copy_service(GLOBALS_SNUM, unix_share); + lp_copy_service(GLOBALS_SNUM, share); iNumNonAutoPrintServices = lp_numservices(); save_reload(0); snum = lp_servicenumber(share); @@ -930,12 +922,8 @@ static void printers_page(void) } if (cgi_variable("createshare") && (share=cgi_variable("newshare"))) { - /* add_a_service() which is called by lp_copy_service() - will do unix_to_dos() conversion, so we need dos_to_unix() before the lp_copy_service(). */ - pstring unix_share; - pstrcpy(unix_share, dos_to_unix(share, False)); load_config(False); - lp_copy_service(GLOBALS_SNUM, unix_share); + lp_copy_service(GLOBALS_SNUM, share); iNumNonAutoPrintServices = lp_numservices(); snum = lp_servicenumber(share); lp_do_parameter(snum, "print ok", "Yes"); @@ -1047,7 +1035,6 @@ static void printers_page(void) } setup_logging(argv[0],False); - charset_initialise(); load_config(True); iNumNonAutoPrintServices = lp_numservices(); load_printers(); |