1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

first step in converting the head branch to use lang_tdb.c instead

of gettext for internationalisation support. There is more to do
(This used to be commit ab7f67677a1ade4669e5c2750d0a38422ea616a9)
This commit is contained in:
Andrew Tridgell 2001-10-11 08:40:42 +00:00
parent d5a62df4c5
commit 8cec5cf35f
12 changed files with 803 additions and 2745 deletions

View File

@ -7,7 +7,7 @@ prefix=@prefix@
exec_prefix=@exec_prefix@
mandir=@mandir@
LIBS=@LIBS@ @INTLLIBS@
LIBS=@LIBS@
CC=@CC@
SHLD=@SHLD@
CFLAGS=@CFLAGS@
@ -25,7 +25,6 @@ INSTALLCMD=@INSTALL@
VPATH=@srcdir@
srcdir=@srcdir@
builddir=@builddir@
top_builddir=.
SHELL=/bin/sh
BASEDIR= @prefix@
@ -58,13 +57,6 @@ SWATDIR = @swatdir@
# the directory where lock files go
LOCKDIR = @lockdir@
# swat i18n with gettext
I18N_PACKAGE = @PACKAGE@
i18n_datadir = $(prefix)/@DATADIRNAME@
i18n_localedir = $(i18n_datadir)/locale
intlsubdirs = po intl
top_srcdir = @top_srcdir@
# man pages language(s)
man_langs = "@manlangs@"
@ -73,7 +65,7 @@ FLAGS1 = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/s
FLAGS2 = -DCONFIGFILE=\"$(CONFIGFILE)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\"
FLAGS3 = -DSWATDIR=\"$(SWATDIR)\" -DSBINDIR=\"$(SBINDIR)\" -DLOCKDIR=\"$(LOCKDIR)\"
FLAGS4 = -DDRIVERFILE=\"$(DRIVERFILE)\" -DBINDIR=\"$(BINDIR)\" -DFORMSFILE=\"$(FORMSFILE)\" -DNTDRIVERSDIR=\"$(NTDRIVERSDIR)\" -DLIBDIR=\"$(LIBDIR)\"
FLAGS5 = $(FLAGS1) $(FLAGS2) $(FLAGS3) $(FLAGS4) -DHAVE_INCLUDES_H -DI18N_PACKAGE=\"$(I18N_PACKAGE)\" -DI18N_LOCALEDIR=\"$(i18n_localedir)\" -Iintl -I$(srcdir)/intl
FLAGS5 = $(FLAGS1) $(FLAGS2) $(FLAGS3) $(FLAGS4) -DHAVE_INCLUDES_H
FLAGS = $(ISA) $(FLAGS5) $(PASSWD_FLAGS)
FLAGS32 = $(ISA32) $(FLAGS5) $(PASSWD_FLAGS)
@ -420,7 +412,7 @@ WINBIND_NSS_PICOBJS = $(WINBIND_NSS_OBJ:.o=.po)
######################################################################
# now the rules...
######################################################################
all : CHECK I18N-SUPPORT-ALL include/proto.h $(SPROGS) $(PROGS) $(SHLIBS) nsswitch
all : CHECK include/proto.h $(SPROGS) $(PROGS) $(SHLIBS) nsswitch
pam_smbpass : CHECK bin/pam_smbpass.@SHLIBEXT@
@ -663,7 +655,7 @@ 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 installswat I18N-SUPPORT-INSTALL
install: installbin installman installscripts installswat
installdirs:
-$(SHELL) $(srcdir)/install-sh -d -m $(INSTALLPERMS) \
@ -681,7 +673,6 @@ installscripts: installdirs
installswat: installdirs
@$(SHELL) $(srcdir)/script/installswat.sh $(SWATDIR) $(srcdir) \
@i18n_swat@
installclientlib:
-$(INSTALLCMD) bin/libsmbclient.so $(LIBDIR)
@ -708,11 +699,8 @@ uninstallbin:
uninstallscripts:
@$(SHELL) $(srcdir)/script/uninstallscripts.sh $(INSTALLPERMS) $(BINDIR) $(SCRIPTS)
clean: I18N-SUPPORT-CLEAN
@test -d intl/po || mkdir intl/po
-mv po/* intl/po
clean:
-rm -f core */*~ *~ */*.o */*.po */*.po32 */*.@SHLIBEXT@ $(PROGS) $(SPROGS) include/build_env.h
-mv intl/po/* po/
winbindd_proto:
@cd $(srcdir) && $(SHELL) script/mkproto.sh $(AWK) \
@ -782,18 +770,3 @@ config.status: $(srcdir)/configure
Makefile: $(srcdir)/Makefile.in config.status
@echo "WARNING: you need to run ./config.status"
# SWAT i18n
I18N-SUPPORT-ALL:
@for I in ${intlsubdirs}; do (cd $$I; ${MAKE} all || exit 1); done
I18N-SUPPORT-INSTALL:
@for I in ${intlsubdirs}; do (cd $$I; ${MAKE} install || exit 1); done
I18N-SUPPORT-CLEAN:
@for I in ${intlsubdirs}; do (cd $$I; ${MAKE} clean || exit 1); done
I18N-SUPPORT-DISTCLEAN:
@for I in ${intlsubdirs}; do (cd $$I; ${MAKE} distclean || exit 1); done
I18N-SUPPORT-UNINSTALL:
@for I in ${intlsubdirs}; do (cd $$I; ${MAKE} uninstall || exit 1); done

View File

@ -1019,7 +1019,7 @@ static int cmd_mkdir(void)
/****************************************************************************
show alt name
****************************************************************************/
static void cmd_altname(void)
static int cmd_altname(void)
{
pstring name;
fstring buf;
@ -1029,11 +1029,13 @@ static void cmd_altname(void)
if (!next_token_nr(NULL,p,NULL,sizeof(buf))) {
d_printf("altname <file>\n");
return;
return 1;
}
pstrcat(name,p);
do_altname(name);
return 0;
}

View File

@ -1382,7 +1382,7 @@ int cmd_setmode(void)
case 'a': attra[direct]|=aARCH;
break;
default: DEBUG(0, ("setmode <filename> <perm=[+|-]rsha>\n"));
return;
return 1;
}
}

3245
source3/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -2524,15 +2524,6 @@ AC_SUBST(WINBIND_STARGETS)
AC_SUBST(WINBIND_LTARGETS)
AC_SUBST(WINBIND_PAM_PROGS)
#################################################
# Check for SWAT i18n support
PACKAGE=i18n_swat
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
AC_SUBST(PACKAGE)
ALL_LINGUAS="en ja pl tr"
AM_GNU_GETTEXT
#################################################
# final configure stuff
@ -2544,4 +2535,4 @@ AC_TRY_RUN([#include "${srcdir-.}/tests/summary.c"],
builddir=`pwd`
AC_SUBST(builddir)
AC_OUTPUT(include/stamp-h Makefile intl/Makefile po/Makefile.in)
AC_OUTPUT(include/stamp-h Makefile)

View File

@ -7,9 +7,6 @@
#undef _ALL_SOURCE
#endif
/* Define if using alloca.c. */
#undef C_ALLOCA
/* Define if type char is unsigned and you are not using gcc. */
#ifndef __CHAR_UNSIGNED__
#undef __CHAR_UNSIGNED__
@ -18,19 +15,9 @@
/* Define to empty if the keyword does not work. */
#undef const
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
This function is required for alloca.c support on those systems. */
#undef CRAY_STACKSEG_END
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define if you have alloca, as a function or macro. */
#undef HAVE_ALLOCA
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
#undef HAVE_ALLOCA_H
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
@ -64,15 +51,6 @@
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown
*/
#undef STACK_DIRECTION
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
@ -282,15 +260,6 @@
/* Define if you have the __acl function. */
#undef HAVE___ACL
/* Define if you have the __argz_count function. */
#undef HAVE___ARGZ_COUNT
/* Define if you have the __argz_next function. */
#undef HAVE___ARGZ_NEXT
/* Define if you have the __argz_stringify function. */
#undef HAVE___ARGZ_STRINGIFY
/* Define if you have the __chdir function. */
#undef HAVE___CHDIR
@ -531,9 +500,6 @@
/* Define if you have the crypt16 function. */
#undef HAVE_CRYPT16
/* Define if you have the dcgettext function. */
#undef HAVE_DCGETTEXT
/* Define if you have the dup2 function. */
#undef HAVE_DUP2
@ -603,9 +569,6 @@
/* Define if you have the getnetgrent function. */
#undef HAVE_GETNETGRENT
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
/* Define if you have the getprpwnam function. */
#undef HAVE_GETPRPWNAM
@ -651,9 +614,6 @@
/* Define if you have the mktime function. */
#undef HAVE_MKTIME
/* Define if you have the munmap function. */
#undef HAVE_MUNMAP
/* Define if you have the open64 function. */
#undef HAVE_OPEN64
@ -672,9 +632,6 @@
/* Define if you have the pread64 function. */
#undef HAVE_PREAD64
/* Define if you have the putenv function. */
#undef HAVE_PUTENV
/* Define if you have the putprpwnam function. */
#undef HAVE_PUTPRPWNAM
@ -729,9 +686,6 @@
/* Define if you have the setlinebuf function. */
#undef HAVE_SETLINEBUF
/* Define if you have the setlocale function. */
#undef HAVE_SETLOCALE
/* Define if you have the setluid function. */
#undef HAVE_SETLUID
@ -771,9 +725,6 @@
/* Define if you have the stat64 function. */
#undef HAVE_STAT64
/* Define if you have the stpcpy function. */
#undef HAVE_STPCPY
/* Define if you have the strcasecmp function. */
#undef HAVE_STRCASECMP
@ -831,9 +782,6 @@
/* Define if you have the yp_get_default_domain function. */
#undef HAVE_YP_GET_DEFAULT_DOMAIN
/* Define if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H
/* Define if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
@ -870,12 +818,6 @@
/* Define if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
@ -897,9 +839,6 @@
/* Define if you have the <netinet/tcp.h> header file. */
#undef HAVE_NETINET_TCP_H
/* Define if you have the <nl_types.h> header file. */
#undef HAVE_NL_TYPES_H
/* Define if you have the <nss.h> header file. */
#undef HAVE_NSS_H
@ -1086,9 +1025,6 @@
/* Define if you have the gen library (-lgen). */
#undef HAVE_LIBGEN
/* Define if you have the i library (-li). */
#undef HAVE_LIBI
/* Define if you have the iconv library (-liconv). */
#undef HAVE_LIBICONV

View File

@ -36,8 +36,15 @@ int d_vfprintf(FILE *f, const char *format, va_list ap)
{
char *p, *p2;
int ret, maxlen, clen;
ret = vasprintf(&p, format, ap);
const char *msgstr;
/* do any message translations */
msgstr = lang_msg(format);
if (!msgstr) return -1;
ret = vasprintf(&p, msgstr, ap);
lang_msg_free(msgstr);
if (ret <= 0) return ret;

View File

@ -16,7 +16,7 @@ SHELL = /bin/sh
srcdir = .
top_srcdir = ..
prefix = /usr/local/samba
prefix = /home/tridge/prefix
exec_prefix = ${prefix}
datadir = $(prefix)/share
localedir = $(datadir)/locale
@ -36,8 +36,8 @@ XGETTEXT = PATH=../src:$$PATH /usr/bin/xgettext
MSGMERGE = PATH=../src:$$PATH msgmerge
DEFS = -DHAVE_CONFIG_H
CFLAGS = -O
CPPFLAGS =
CFLAGS = -O -g -Wall -I/usr/local/include
CPPFLAGS = -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
INCLUDES = -I.. -I$(top_srcdir)/intl -I$(top_srcdir)/include

View File

@ -67,7 +67,7 @@ BOOL torture_utable(int dummy)
if (strncmp(alt_name, "X_A_L", 5) != 0) {
alt_allowed++;
valid[c] = 1;
/* d_printf("fname=[%s] alt_name=[%s]\n", fname, alt_name); */
d_printf("fname=[%s] alt_name=[%s]\n", fname, alt_name);
}
cli_close(&cli, fnum);

View File

@ -26,7 +26,7 @@
#define SECURITY_SET 0
/* this forces non-unicode */
#define CAPABILITY_MASK (CAP_NT_SMBS | CAP_RPC_REMOTE_APIS)
#define CAPABILITY_MASK 0
#define CAPABILITY_SET 0
/* and non-unicode for the client too */
@ -36,6 +36,22 @@
static char *netbiosname;
static char packet[BUFFER_SIZE];
static void save_file(const char *fname, void *packet, size_t length)
{
int fd;
fd = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0644);
if (fd == -1) {
perror(fname);
return;
}
if (write(fd, packet, length) != length) {
fprintf(stderr,"Failed to write %s\n", fname);
return;
}
close(fd);
printf("Wrote %d bytes to %s\n", length, fname);
}
static void filter_reply(char *buf)
{
int msg_type = CVAL(buf,0);
@ -75,8 +91,8 @@ static void filter_request(char *buf)
/* session request */
name_extract(buf,4,name1);
name_extract(buf,4 + name_len(buf + 4),name2);
DEBUG(0,("sesion_request: %s -> %s\n",
name1, name2));
d_printf("sesion_request: %s -> %s\n",
name1, name2);
if (netbiosname) {
/* replace the destination netbios name */
name_mangle(netbiosname, buf+4, 0x20);
@ -90,6 +106,10 @@ static void filter_request(char *buf)
case SMBsesssetupX:
/* force the client capabilities */
x = IVAL(buf,smb_vwv11);
d_printf("SMBsesssetupX cap=0x%08x\n", x);
d_printf("pwlen=%d/%d\n", SVAL(buf, smb_vwv7), SVAL(buf, smb_vwv8));
system("mv sessionsetup.dat sessionsetup1.dat");
save_file("sessionsetup.dat", smb_buf(buf), SVAL(buf, smb_vwv7));
x = (x | CLI_CAPABILITY_SET) & ~CLI_CAPABILITY_MASK;
SIVAL(buf, smb_vwv11, x);
break;
@ -103,10 +123,10 @@ static void filter_child(int c, struct in_addr dest_ip)
int s;
/* we have a connection from a new client, now connect to the server */
s = open_socket_out(SOCK_STREAM, &dest_ip, 139, LONG_CONNECT_TIMEOUT);
s = open_socket_out(SOCK_STREAM, &dest_ip, 445, LONG_CONNECT_TIMEOUT);
if (s == -1) {
DEBUG(0,("Unable to connect to %s\n", inet_ntoa(dest_ip)));
d_printf("Unable to connect to %s\n", inet_ntoa(dest_ip));
exit(1);
}
@ -123,28 +143,28 @@ static void filter_child(int c, struct in_addr dest_ip)
if (c != -1 && FD_ISSET(c, &fds)) {
if (!receive_smb(c, packet, 0)) {
DEBUG(0,("client closed connection\n"));
d_printf("client closed connection\n");
exit(0);
}
filter_request(packet);
if (!send_smb(s, packet)) {
DEBUG(0,("server is dead\n"));
d_printf("server is dead\n");
exit(1);
}
}
if (s != -1 && FD_ISSET(s, &fds)) {
if (!receive_smb(s, packet, 0)) {
DEBUG(0,("server closed connection\n"));
d_printf("server closed connection\n");
exit(0);
}
filter_reply(packet);
if (!send_smb(c, packet)) {
DEBUG(0,("client is dead\n"));
d_printf("client is dead\n");
exit(1);
}
}
}
DEBUG(0,("Connection closed\n"));
d_printf("Connection closed\n");
exit(0);
}
@ -156,20 +176,20 @@ static void start_filter(char *desthost)
CatchChild();
/* start listening on port 139 locally */
s = open_socket_in(SOCK_STREAM, 139, 0, 0, True);
/* start listening on port 445 locally */
s = open_socket_in(SOCK_STREAM, 445, 0, 0, True);
if (s == -1) {
DEBUG(0,("bind failed\n"));
d_printf("bind failed\n");
exit(1);
}
if (listen(s, 5) == -1) {
DEBUG(0,("listen failed\n"));
d_printf("listen failed\n");
}
if (!resolve_name(desthost, &dest_ip, 0x20)) {
DEBUG(0,("Unable to resolve host %s\n", desthost));
d_printf("Unable to resolve host %s\n", desthost);
exit(1);
}
@ -221,7 +241,7 @@ int main(int argc, char *argv[])
}
if (!lp_load(configfile,True,False,False)) {
DEBUG(0,("Unable to load config file\n"));
d_printf("Unable to load config file\n");
}
start_filter(desthost);

View File

@ -157,11 +157,6 @@ via the %%o substitution. With encrypted passwords this is not possible.\n", lp_
}
}
if (lp_status(-1) && lp_max_smbd_processes()) {
printf("ERROR: the 'max smbd processes' parameter is set and the 'status' parameter is set to 'no'.\n");
ret = 1;
}
return ret;
}

View File

@ -161,114 +161,7 @@ static BOOL ln_negotiate_language_help( LNNegotiator* pLn, const char* pstrLanga
rassert(ln_getPreflangCount(pLn) != 0);
return (ln_getPreflangCount(pLn) != 0);
}
/* parse catalog file header and get encoding information.*/
static BOOL parse_po_header(const char* pheader, pstring pencoding_name)
{
const char *ap_i_v = "Project-Id-Version:";
const char *acharset = "charset=";
char* penc;
int nenc;
if(pencoding_name == NULL) return False;
if(pheader == NULL || *pheader == '\0')
{
/* error or catalog is not available. */
pstrcpy(pencoding_name,"");
return False;
}
penc = strstr(pheader, acharset);
if(strncmp(pheader, ap_i_v, strlen(ap_i_v)) != 0 || penc == NULL)
{
/* catalog file exists, but header is not good.*/
pstrcpy(pencoding_name, "");
return True;
}
nenc = strcspn(penc + strlen(acharset), "\n");
strncpy(pencoding_name,
penc + strlen(acharset), nenc);
return True;
}
/* ad-hoc mime charset -> samba encoding name converter.
character conversion is done when internal samba data,
such as paramters, open files, share names, are going to be displayed.
it is only valid for japanese encodings because samba-2.0.7 only has
these three character convertors.
so other .po file(catalog file) should be encoded with one which
samba can deal with (i.e same as DOS codepage).
display-time conversion is deleted on this version because
all catalog files are encoded with samba internal encoding (DOS codepage).
THIS FUNCTION is ALREADY obsolated and maybe removed soon, -- monyo
*/
#define LN_SAMBA_ENCODINGS 3
static const char* get_samba_enc(const char* penc)
{
int i;
static const fstring fdefault = "";
static const fstring fmimeenc[LN_SAMBA_ENCODINGS] =
{
"EUC-JP", "Shift_JIS", "ISO-2022-JP"
};
static const fstring fsambaenc[LN_SAMBA_ENCODINGS] =
{
"euc", "sjis", "jis"
};
for(i = 0; i < LN_SAMBA_ENCODINGS; i++)
{
if(strcasecmp(penc, fmimeenc[i]) == 0)
return fsambaenc[i];
}
return fdefault;
}
/* ************************************************************
find a better language.
if the language specified by web browser matches to a language
which is supported by the swat server, this function returns it.
*********************************************************** */
static void set_a_language(const char* planguage)
{
/* included gettext source is affected by
these env.variables without locale settings.
*/
/*
putenv(env) will not duplicate env argument
but smbw_setenv() does this.
*/
FILE *file;
smbw_setenv("LANGUAGE", planguage);
smbw_setenv("LANG", planguage);
bindtextdomain(I18N_PACKAGE, I18N_LOCALEDIR);
textdomain(I18N_PACKAGE);
}
static int ln_set_pref_language(LNNegotiator* pLn)
{
int j;
pstring enc_name;
for(j = 0; j < ln_getPreflangCount(pLn); j++)
{
set_a_language(ln_getPreflang(pLn, j));
/* then check for _("") special entry which has
a lot of information about .po file. */
if(parse_po_header(_(""), enc_name))
{
/* the catalog file must exist and may have
encoding information .*/
/*
but in this version, catalog files must be
written with samba-internal encoding (i.e.
dos encoding, dos codepage)
so there is no need to convert.
//ln_init_swat_encoding(get_samba_enc(enc_name));
ln_init_swat_encoding(enc_name);
*/
return j;
}
}
return LN_NO_AVAILABLE_LANG;
/* no available or return the default? */
}
/* **************************************************************
initialize gettext. Before this, cgi_setup() should be done.
cgi_setup() calls ln_negotiate_language() if the user specifies