mirror of
https://github.com/samba-team/samba.git
synced 2025-03-24 10:50:22 +03:00
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)
This commit is contained in:
parent
9e9e73303e
commit
87fbb7092b
@ -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)
|
||||
|
||||
|
@ -153,3 +153,4 @@
|
||||
#undef HAVE_VASPRINTF_DECL
|
||||
#undef HAVE_SNPRINTF_DECL
|
||||
#undef HAVE_VSNPRINTF_DECL
|
||||
#undef HAVE_NATIVE_ICONV
|
||||
|
@ -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);
|
||||
|
@ -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 :-} */
|
||||
/* add a '.' to start of file name, convert from ugly dos \'s in path
|
||||
* to lovely unix /'s :-} */
|
||||
*tptr++='.';
|
||||
|
||||
*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--;
|
||||
}
|
||||
}
|
||||
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!
|
||||
*/
|
||||
/* 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));
|
||||
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--;
|
||||
}
|
||||
}
|
||||
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))));
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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
|
||||
|
1260
source3/configure
vendored
1260
source3/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -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>
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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_ */
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
||||
};
|
||||
|
@ -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
|
||||
|
||||
|
||||
=============================================================================
|
||||
|
@ -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];
|
||||
|
||||
static void initmaps(void) {
|
||||
int k;
|
||||
|
||||
for (k = 0; k < 256; k++) unix2dos[k] = k;
|
||||
for (k = 0; k < 256; k++) dos2unix[k] = k;
|
||||
|
||||
mapsinited = True;
|
||||
}
|
||||
|
||||
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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void setupmaps(void)
|
||||
|
||||
/****************************************************************************
|
||||
Initialize iconv conversion descriptors
|
||||
****************************************************************************/
|
||||
void init_iconv(char *unix_charset, char *dos_charset)
|
||||
{
|
||||
int i;
|
||||
if (!mapsinited) initmaps();
|
||||
#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));
|
||||
|
||||
/* Do not map undefined characters to some accidental code */
|
||||
for (i = 128; i < 256; i++)
|
||||
{
|
||||
unix2dos[i] = CTRLZ;
|
||||
dos2unix[i] = CTRLZ;
|
||||
}
|
||||
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 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");
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
/* 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");
|
||||
}
|
||||
|
||||
/* Init for russian language (iso8859-5) */
|
||||
|
||||
/* Added by Max Khon <max@iclub.nsu.ru> */
|
||||
|
||||
static void init_iso8859_5(void)
|
||||
/****************************************************************************
|
||||
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)
|
||||
{
|
||||
setupmaps();
|
||||
size_t i_len, o_len;
|
||||
size_t retval;
|
||||
char* inbuf = (char*)src;
|
||||
char* outbuf = (char*)dest;
|
||||
|
||||
/* 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");
|
||||
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;
|
||||
}
|
||||
|
||||
/* Added by Antonios Kavarnos (Antonios.Kavarnos@softlab.ece.ntua.gr */
|
||||
|
||||
static void init_iso8859_7(void)
|
||||
int unix_strupper(const char *src, size_t srclen, char *dest, size_t destlen)
|
||||
{
|
||||
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 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);
|
||||
}
|
||||
|
||||
/* Added by Deniz Akkus (akkus@alum.mit.edu) */
|
||||
|
||||
static void init_iso8859_9(void)
|
||||
int unix_strlower(const char *src, size_t srclen, char *dest, size_t destlen)
|
||||
{
|
||||
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");
|
||||
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);
|
||||
}
|
||||
|
||||
/* 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");
|
||||
}
|
||||
|
||||
/* Init for russian language (koi8) */
|
||||
|
||||
static void init_koi8_r(void)
|
||||
int ucs2_align(const void *base_ptr, const void *p, 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");
|
||||
if (flags & (STR_NOALIGN|STR_ASCII)) return 0;
|
||||
return PTR_DIFF(p, base_ptr) & 1;
|
||||
}
|
||||
|
||||
|
||||
/* Init for ROMAN-8 (HP-UX) */
|
||||
|
||||
static void init_roman8(void) {
|
||||
|
||||
setupmaps();
|
||||
|
||||
/* 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");
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert unix to dos
|
||||
*/
|
||||
char *unix2dos_format(char *str,BOOL overwrite)
|
||||
/****************************************************************************
|
||||
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)
|
||||
{
|
||||
char *p;
|
||||
char *dp;
|
||||
int src_len = strlen(src);
|
||||
pstring tmpbuf;
|
||||
|
||||
if (!mapsinited)
|
||||
initmaps();
|
||||
/* treat a pstring as "unlimited" length */
|
||||
if (dest_len == -1) {
|
||||
dest_len = sizeof(pstring);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
if (flags & STR_UPPER) {
|
||||
pstrcpy(tmpbuf, src);
|
||||
strupper(tmpbuf);
|
||||
src = tmpbuf;
|
||||
}
|
||||
|
||||
if (flags & STR_TERMINATE) {
|
||||
src_len++;
|
||||
}
|
||||
|
||||
return convert_string(unix_to_dos, src, src_len, dest, dest_len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert dos to unix
|
||||
*/
|
||||
char *dos2unix_format(char *str, BOOL overwrite)
|
||||
int push_ascii_fstring(void *dest, const char *src)
|
||||
{
|
||||
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;
|
||||
}
|
||||
return push_ascii(dest, src, sizeof(fstring), STR_TERMINATE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Interpret character set.
|
||||
*/
|
||||
void interpret_character_set(char *str, int codepage)
|
||||
int push_ascii_pstring(void *dest, const char *src)
|
||||
{
|
||||
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);
|
||||
return push_ascii(dest, src, sizeof(pstring), STR_TERMINATE);
|
||||
}
|
||||
|
||||
int push_pstring(void *dest, const char *src)
|
||||
{
|
||||
return push_ascii(dest, src, sizeof(pstring), STR_TERMINATE);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
int pull_ascii_pstring(char *dest, const void *src)
|
||||
{
|
||||
return pull_ascii(dest, src, sizeof(pstring), -1, STR_TERMINATE);
|
||||
}
|
||||
|
||||
int pull_ascii_fstring(char *dest, const void *src)
|
||||
{
|
||||
return pull_ascii(dest, src, sizeof(fstring), -1, STR_TERMINATE);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
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)
|
||||
{
|
||||
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--;
|
||||
}
|
||||
|
||||
if (flags & STR_TERMINATE) src_len = strlen_w(src)*2+2;
|
||||
|
||||
ret = convert_string(ucs2_to_unix, src, src_len, dest, dest_len);
|
||||
if (dest_len) dest[MIN(ret, dest_len-1)] = 0;
|
||||
|
||||
return src_len;
|
||||
}
|
||||
|
||||
int pull_ucs2_pstring(char *dest, const void *src)
|
||||
{
|
||||
return pull_ucs2(NULL, dest, src, sizeof(pstring), -1, STR_TERMINATE);
|
||||
}
|
||||
|
||||
int pull_ucs2_fstring(char *dest, const void *src)
|
||||
{
|
||||
return pull_ucs2(NULL, dest, src, sizeof(fstring), -1, STR_TERMINATE);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
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 (!(flags & STR_ASCII) && \
|
||||
((flags & STR_UNICODE || \
|
||||
(SVAL(base_ptr, smb_flg2) & FLAGS2_UNICODE_STRINGS)))) {
|
||||
return ucs2_align(base_ptr, p, flags);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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 */
|
||||
|
@ -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));
|
||||
}
|
346
source3/lib/iconv.c
Normal file
346
source3/lib/iconv.c
Normal file
@ -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;
|
||||
}
|
1691
source3/lib/kanji.c
1691
source3/lib/kanji.c
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||
wpstring p, s;
|
||||
|
||||
return ms_fnmatch(pattern, file);
|
||||
pstrcpy_wa(p, pattern);
|
||||
pstrcpy_wa(s, string);
|
||||
|
||||
return ms_fnmatch_w(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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
#endif /* FNMATCH_TEST */
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -726,176 +726,6 @@ struct passwd *sys_getpwuid(uid_t uid)
|
||||
return setup_pwret(getpwuid(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).
|
||||
|
@ -194,21 +194,6 @@ BOOL file_exist(char *fname,SMB_STRUCT_STAT *sbuf)
|
||||
return(S_ISREG(sbuf->st_mode));
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
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
|
||||
********************************************************************/
|
||||
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
@ -348,112 +214,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
|
||||
********************************************************************/
|
||||
@ -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;
|
||||
front_len = front? strlen(front) : 0;
|
||||
back_len = back? strlen(back) : 0;
|
||||
|
||||
sP = s;
|
||||
s_len = strlen( s ) + 1;
|
||||
front_len = (front) ? strlen( front ) + 1 : 0;
|
||||
back_len = (back) ? strlen( back ) + 1 : 0;
|
||||
len = strlen(s);
|
||||
|
||||
/*
|
||||
* 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 );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 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 );
|
||||
}
|
||||
|
||||
/*
|
||||
* 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;
|
||||
smb_ucs2_t *ptr;
|
||||
|
||||
#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(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;
|
||||
|
||||
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;
|
||||
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 (!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 (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);
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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] ?
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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 );
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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. */
|
||||
|
@ -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,
|
||||
|
@ -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))) {
|
||||
|
@ -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 */
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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 );
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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--;
|
||||
|
||||
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);
|
||||
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 );
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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 */
|
||||
|
@ -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, "");
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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:
|
||||
|
@ -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));
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
|
@ -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)
|
||||
|
@ -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 )
|
||||
{
|
||||
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 != '.' )
|
||||
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 )
|
||||
{
|
||||
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 != '.' )
|
||||
if( /*isdoschar( *p ) &&*/ *p != '.' )
|
||||
base[baselen++] = p[0];
|
||||
p++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
base[baselen] = 0;
|
||||
|
||||
|
@ -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 ) );
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user