diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/Makefile.in | 56 | ||||
-rwxr-xr-x | source3/configure | 619 | ||||
-rw-r--r-- | source3/include/config.h.in | 6 | ||||
-rw-r--r-- | source3/lib/debug.c | 13 | ||||
-rw-r--r-- | source3/nmbd/nmbd.c | 5 | ||||
-rw-r--r-- | source3/nsswitch/winbindd.c | 6 | ||||
-rw-r--r-- | source3/smbd/server.c | 132 | ||||
-rw-r--r-- | source3/wrepld/server.c | 11 |
8 files changed, 684 insertions, 164 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index 63cc348eb6..cd5ced1f44 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -141,12 +141,14 @@ LIB_OBJ = lib/charcnv.o lib/debug.o lib/fault.o \ lib/md5.o lib/hmacmd5.o lib/iconv.o lib/smbpasswd.o \ nsswitch/wb_client.o nsswitch/wb_common.o \ lib/pam_errors.o intl/lang_tdb.o lib/account_pol.o \ - lib/adt_tree.o lib/popt_common.o lib/gencache.o $(TDB_OBJ) + lib/adt_tree.o lib/gencache.o $(TDB_OBJ) LIB_SMBD_OBJ = lib/system_smbd.o lib/util_smbd.o READLINE_OBJ = lib/readline.o +POPT_LIB_OBJ = lib/popt_common.o + UBIQX_OBJ = ubiqx/ubi_BinTree.o ubiqx/ubi_Cache.o ubiqx/ubi_SplayTree.o \ ubiqx/ubi_dLinkList.o ubiqx/ubi_sLinkList.o ubiqx/debugparse.o @@ -223,6 +225,9 @@ PASSDB_OBJ = $(PASSDB_GET_SET_OBJ) passdb/passdb.o passdb/pdb_interface.o \ passdb/pdb_unix.o passdb/util_sam_sid.o \ passdb/pdb_compat.o passdb/pdb_nisplus.o +PDB_XML_OBJ = passdb/pdb_xml.o +PDB_MYSQL_OBJ = passdb/pdb_mysql.o + GROUPDB_OBJ = groupdb/mapping.o # passdb/smbpass.o passdb/ldap.o passdb/nispass.o @@ -269,7 +274,7 @@ SMBD_OBJ_BASE = $(SMBD_OBJ_SRV) $(MSDFS_OBJ) $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_ $(NOTIFY_OBJ) $(GROUPDB_OBJ) $(AUTH_OBJ) \ $(LIBMSRPC_OBJ) $(LIBMSRPC_SERVER_OBJ) \ $(LIBADS_OBJ) $(LIBADS_SERVER_OBJ) \ - $(LIB_SMBD_OBJ) $(REGISTRY_OBJ) + $(LIB_SMBD_OBJ) $(REGISTRY_OBJ) $(POPT_LIB_OBJ) PRINTING_OBJ = printing/pcap.o printing/print_svid.o \ @@ -296,7 +301,7 @@ NMBD_OBJ1 = nmbd/asyncdns.o nmbd/nmbd.o nmbd/nmbd_become_dmb.o \ nmbd/nmbd_workgroupdb.o nmbd/nmbd_synclists.o NMBD_OBJ = $(NMBD_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) \ - $(PROFILE_OBJ) $(LIB_OBJ) $(SECRETS_OBJ) + $(PROFILE_OBJ) $(LIB_OBJ) $(SECRETS_OBJ) $(POPT_LIB_OBJ) WREPL_OBJ1 = wrepld/server.o wrepld/process.o wrepld/parser.o wrepld/socket.o \ wrepld/partners.o @@ -315,7 +320,7 @@ SMBSH_OBJ = smbwrapper/smbsh.o smbwrapper/shared.o \ $(PARAM_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) STATUS_OBJ = utils/status.o $(LOCKING_OBJ) $(PARAM_OBJ) \ - $(UBIQX_OBJ) $(PROFILE_OBJ) $(LIB_OBJ) + $(UBIQX_OBJ) $(PROFILE_OBJ) $(LIB_OBJ) $(POPT_LIB_OBJ) SMBCONTROL_OBJ = utils/smbcontrol.o $(LOCKING_OBJ) $(PARAM_OBJ) \ $(UBIQX_OBJ) $(PROFILE_OBJ) $(LIB_OBJ) @@ -324,7 +329,7 @@ SMBTREE_OBJ = utils/smbtree.o $(LOCKING_OBJ) $(PARAM_OBJ) \ $(UBIQX_OBJ) $(PROFILE_OBJ) $(LIB_OBJ) $(LIBSMB_OBJ) TESTPARM_OBJ = utils/testparm.o \ - $(PARAM_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) + $(PARAM_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) $(POPT_LIB_OBJ) TESTPRNS_OBJ = utils/testprns.o $(PARAM_OBJ) $(PRINTING_OBJ) $(UBIQX_OBJ) \ $(LIB_OBJ) @@ -334,7 +339,8 @@ SMBPASSWD_OBJ = utils/smbpasswd.o $(PARAM_OBJ) $(SECRETS_OBJ) \ $(UBIQX_OBJ) $(LIB_OBJ) PDBEDIT_OBJ = utils/pdbedit.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(PASSDB_OBJ) \ - $(UBIQX_OBJ) $(LIB_OBJ) $(GROUPDB_OBJ) $(SECRETS_OBJ) + $(UBIQX_OBJ) $(LIB_OBJ) $(GROUPDB_OBJ) $(SECRETS_OBJ) \ + $(POPT_LIB_OBJ) SMBGROUPEDIT_OBJ = utils/smbgroupedit.o $(GROUPDB_OBJ) $(PARAM_OBJ) \ $(LIBSMB_OBJ) $(PASSDB_OBJ) $(SECRETS_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) @@ -349,7 +355,7 @@ RPCCLIENT_OBJ = $(RPCCLIENT_OBJ1) \ $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) \ $(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(LIBMSRPC_OBJ) \ $(READLINE_OBJ) $(GROUPDB_OBJ) \ - $(LIBADS_OBJ) $(SECRETS_OBJ) + $(LIBADS_OBJ) $(SECRETS_OBJ) $(POPT_LIB_OBJ) PAM_WINBIND_OBJ = nsswitch/pam_winbind.po nsswitch/wb_common.po lib/snprintf.po @@ -372,7 +378,7 @@ LIBSMBCLIENT_OBJ = libsmb/libsmbclient.o libsmb/libsmb_compat.o \ CLIENT_OBJ1 = client/client.o client/clitar.o CLIENT_OBJ = $(CLIENT_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) \ - $(READLINE_OBJ) + $(READLINE_OBJ) $(POPT_LIB_OBJ) NET_OBJ1 = utils/net.o utils/net_ads.o utils/net_ads_cldap.o utils/net_help.o \ utils/net_rap.o utils/net_rpc.o utils/net_rpc_samsync.o \ @@ -383,7 +389,7 @@ NET_OBJ = $(NET_OBJ1) $(SECRETS_OBJ) $(LIBSMB_OBJ) \ $(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ) \ $(PARAM_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) \ $(LIBMSRPC_OBJ) $(LIBMSRPC_SERVER_OBJ) \ - $(LIBADS_OBJ) $(LIBADS_SERVER_OBJ) + $(LIBADS_OBJ) $(LIBADS_SERVER_OBJ) $(POPT_LIB_OBJ) CUPS_OBJ = client/smbspool.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) @@ -451,7 +457,7 @@ PROTO_OBJ = $(SMBD_OBJ_MAIN) \ $(PRINTING_OBJ) $(PRINTBACKEND_OBJ) $(OPLOCK_OBJ) $(NOTIFY_OBJ) \ $(QUOTAOBJS) $(PASSDB_OBJ) $(GROUPDB_OBJ) $(MSDFS_OBJ) \ $(READLINE_OBJ) $(PROFILE_OBJ) $(LIBADS_OBJ) $(LIBADS_SERVER_OBJ) \ - $(LIB_SMBD_OBJ) $(REGISTRY_OBJ) + $(LIB_SMBD_OBJ) $(REGISTRY_OBJ) $(POPT_LIB_OBJ) NSS_OBJ_0 = nsswitch/wins.o $(PARAM_OBJ) $(UBIQX_OBJ) $(LIBSMB_OBJ) \ $(LIB_OBJ) $(NSSWINS_OBJ) @@ -608,14 +614,14 @@ bin/.dummy: dir=bin $(MAKEDIR); fi @: >> $@ || : > $@ # what a fancy emoticon! -bin/smbd: $(SMBD_OBJ) bin/.dummy +bin/smbd: $(SMBD_OBJ) @BUILD_POPT@ bin/.dummy @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(SMBD_OBJ) $(LDFLAGS) $(DYNEXP) $(PRINTLIBS) \ - $(AUTHLIBS) $(LIBS) + $(AUTHLIBS) $(LIBS) @BUILD_POPT@ -bin/nmbd: $(NMBD_OBJ) bin/.dummy +bin/nmbd: $(NMBD_OBJ) @BUILD_POPT@ bin/.dummy @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(NMBD_OBJ) $(LDFLAGS) $(LIBS) + @$(CC) $(FLAGS) -o $@ $(NMBD_OBJ) $(LDFLAGS) $(LIBS) @BUILD_POPT@ bin/wrepld: $(WREPL_OBJ) bin/.dummy @echo Linking $@ @@ -630,9 +636,9 @@ bin/rpcclient: $(RPCCLIENT_OBJ) @BUILD_POPT@ bin/.dummy @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(RPCCLIENT_OBJ) $(LDFLAGS) $(DYNEXP) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) @BUILD_POPT@ -bin/smbclient: $(CLIENT_OBJ) bin/.dummy +bin/smbclient: $(CLIENT_OBJ) @BUILD_POPT@ bin/.dummy @echo Linking $@ - @$(CC) $(FLAGS) -o $@ $(CLIENT_OBJ) $(LDFLAGS) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) + @$(CC) $(FLAGS) -o $@ $(CLIENT_OBJ) $(LDFLAGS) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) @BUILD_POPT@ bin/net: $(NET_OBJ) @BUILD_POPT@ bin/.dummy @echo Linking $@ @@ -654,7 +660,7 @@ bin/smbumount: $(UMOUNT_OBJ) bin/.dummy @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(UMOUNT_OBJ) $(LDFLAGS) $(LIBS) -bin/testparm: $(TESTPARM_OBJ) bin/.dummy +bin/testparm: $(TESTPARM_OBJ) @BUILD_POPT@ bin/.dummy @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(TESTPARM_OBJ) $(LDFLAGS) $(LIBS) @BUILD_POPT@ @@ -678,7 +684,7 @@ bin/smbpasswd: $(SMBPASSWD_OBJ) bin/.dummy @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(SMBPASSWD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) -bin/pdbedit: $(PDBEDIT_OBJ) bin/.dummy +bin/pdbedit: $(PDBEDIT_OBJ) @BUILD_POPT@ bin/.dummy @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(PDBEDIT_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @BUILD_POPT@ @@ -718,7 +724,7 @@ bin/nsstest: $(NSSTEST_OBJ) bin/.dummy @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(NSSTEST_OBJ) $(LDFLAGS) $(LIBS) -bin/vfstest: $(VFSTEST_OBJ) bin/.dummy +bin/vfstest: $(VFSTEST_OBJ) @BUILD_POPT@ bin/.dummy @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(VFSTEST_OBJ) $(LDFLAGS) $(TERMLDFLAGS) $(TERMLIBS) $(DYNEXP) $(PRINTLIBS) $(AUTHLIBS) $(LIBS) @BUILD_POPT@ @@ -768,7 +774,7 @@ bin/libsmbclient.a: $(LIBSMBCLIENT_PICOBJS) libsmbclient: bin/libsmbclient.a bin/libsmbclient.@SHLIBEXT@ -nsswitch/libnss_wins.so: $(NSS_OBJ) +nsswitch/libnss_wins.@SHLIBEXT@: $(NSS_OBJ) @echo "Linking $@" @$(SHLD) $(LDSHFLAGS) -o $@ $(NSS_OBJ) -lc \ @SONAMEFLAG@`basename $@` @@ -792,6 +798,16 @@ nsswitch/pam_winbind.@SHLIBEXT@: $(PAM_WINBIND_OBJ) bin/.dummy @$(SHLD) $(LDSHFLAGS) -o $@ $(PAM_WINBIND_OBJ) \ @SONAMEFLAG@`basename $@` -lpam +bin/pdb_mysql.@SHLIBEXT@: $(PDB_MYSQL_OBJ) + @echo "Building plugin $@" + @$(SHLD) $(LDSHFLAGS) -o $@ $(PDB_MYSQL_OBJ) @MYSQL_LIBS@ \ + @SONAMEFLAG@`basename $@` + +bin/pdb_xml.@SHLIBEXT@: $(PDB_XML_OBJ) + @echo "Building plugin $@" + @$(SHLD) $(LDSHFLAGS) -o $@ $(PDB_XML_OBJ) @XML_LIBS@ \ + @SONAMEFLAG@`basename $@` + bin/wbinfo: $(WBINFO_OBJ) $(PARAM_OBJ) $(LIB_OBJ) \ $(UBIQX_OBJ) $(SECRETS_OBJ) @BUILD_POPT@ bin/.dummy @echo Linking $@ diff --git a/source3/configure b/source3/configure index 57263e77b7..53487964f8 100755 --- a/source3/configure +++ b/source3/configure @@ -306,7 +306,7 @@ ac_includes_default="\ # include <unistd.h> #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS configdir lockdir piddir logfilebase privatedir swatdir RUNPROG MPROGS LDSHFLAGS SONAMEFLAG SHLD HOST_OS PAM_MOD WRAP WRAP32 WRAPPROG PICFLAG PICSUFFIX POBAD_CC SHLIBEXT LIBSMBCLIENT_SHARED LIBSMBCLIENT PRINTLIBS AUTHLIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AWK BROKEN_CC build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CPP EGREP CUPS_CONFIG LIBOBJS TERMLIBS TERMLDFLAGS ROFF DYNEXP QUOTAOBJS manlangs WINBIND_TARGETS WINBIND_STARGETS WINBIND_LTARGETS WINBIND_PAM_TARGETS WINBIND_NSS_EXTRA_OBJS WINBIND_NSS_EXTRA_LIBS BUILD_POPT FLAGS1 PYTHON builddir LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS configdir lockdir piddir logfilebase privatedir swatdir RUNPROG MPROGS LDSHFLAGS SONAMEFLAG SHLD HOST_OS PAM_MOD WRAP WRAP32 WRAPPROG PICFLAG PICSUFFIX POBAD_CC SHLIBEXT LIBSMBCLIENT_SHARED LIBSMBCLIENT PRINTLIBS AUTHLIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AWK BROKEN_CC build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os CPP EGREP CUPS_CONFIG LIBOBJS TERMLIBS TERMLDFLAGS ROFF DYNEXP MYSQL_CONFIG MYSQL_CFLAGS MYSQL_LIBS XML2_CONFIG XML_CFLAGS XML_LIBS QUOTAOBJS manlangs WINBIND_TARGETS WINBIND_STARGETS WINBIND_LTARGETS WINBIND_PAM_TARGETS WINBIND_NSS_EXTRA_OBJS WINBIND_NSS_EXTRA_LIBS BUILD_POPT FLAGS1 PYTHON builddir LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -847,6 +847,8 @@ Optional Features: --enable-krb5developer Turn on developer warnings and debugging, except -Wstrict-prototypes (default=no) --enable-dmalloc Enable heap debugging default=no --enable-cups Turn on CUPS support (default=auto) + --disable-mysqltest Do not try to compile and run a test MYSQL program + --disable-xmltest Do not try to compile and run a test LIBXML program Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -866,10 +868,15 @@ Optional Packages: --with-ads Active Directory support (default yes) --with-krb5=base-dir Locate Kerberos 5 support (default=/usr) --with-ldap LDAP support (default yes) + --with-mysql-prefix=PFX Prefix where MYSQL is installed (optional) + --with-mysql-exec-prefix=PFX Exec prefix where MYSQL is installed (optional) + --with-xml-prefix=PFX Prefix where libxml is installed (optional) + --with-xml-exec-prefix=PFX Exec prefix where libxml is installed (optional) --with-automount Include AUTOMOUNT support (default=no) --with-smbmount Include SMBMOUNT (Linux only) support (default=no) --with-pam Include PAM support (default=no) --with-pam_smbpass Build a PAM module to allow other applications to use our smbpasswd file (default=no) + --with-sam Build new (experimental) SAM database (default=no) --with-ldapsam Include LDAP SAM 2.2 compatible configuration (default=no) --with-tdbsam Include experimental TDB SAM support (default=no) --with-nisplussam Include NISPLUS SAM support (default=no) @@ -11525,7 +11532,8 @@ done -for ac_func in syslog vsyslog getgrouplist + +for ac_func in syslog vsyslog getgrouplist timegm do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -20140,6 +20148,571 @@ _ACEOF fi fi +######################################################## +# Compile with MySQL support? + +# Check whether --with-mysql-prefix or --without-mysql-prefix was given. +if test "${with_mysql_prefix+set}" = set; then + withval="$with_mysql_prefix" + mysql_prefix="$withval" +else + mysql_prefix="" +fi; + +# Check whether --with-mysql-exec-prefix or --without-mysql-exec-prefix was given. +if test "${with_mysql_exec_prefix+set}" = set; then + withval="$with_mysql_exec_prefix" + mysql_exec_prefix="$withval" +else + mysql_exec_prefix="" +fi; +# Check whether --enable-mysqltest or --disable-mysqltest was given. +if test "${enable_mysqltest+set}" = set; then + enableval="$enable_mysqltest" + +else + enable_mysqltest=yes +fi; + + if test x$mysql_exec_prefix != x ; then + mysql_args="$mysql_args --exec-prefix=$mysql_exec_prefix" + if test x${MYSQL_CONFIG+set} != xset ; then + MYSQL_CONFIG=$mysql_exec_prefix/bin/mysql_config + fi + fi + if test x$mysql_prefix != x ; then + mysql_args="$mysql_args --prefix=$mysql_prefix" + if test x${MYSQL_CONFIG+set} != xset ; then + MYSQL_CONFIG=$mysql_prefix/bin/mysql_config + fi + fi + + + # Extract the first word of "mysql_config", so it can be a program name with args. +set dummy mysql_config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_MYSQL_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MYSQL_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_MYSQL_CONFIG="$MYSQL_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_MYSQL_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_MYSQL_CONFIG" && ac_cv_path_MYSQL_CONFIG="no" + ;; +esac +fi +MYSQL_CONFIG=$ac_cv_path_MYSQL_CONFIG + +if test -n "$MYSQL_CONFIG"; then + echo "$as_me:$LINENO: result: $MYSQL_CONFIG" >&5 +echo "${ECHO_T}$MYSQL_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + min_mysql_version=0.11.0 + echo "$as_me:$LINENO: checking for MYSQL - version >= $min_mysql_version" >&5 +echo $ECHO_N "checking for MYSQL - version >= $min_mysql_version... $ECHO_C" >&6 + no_mysql="" + if test "$MYSQL_CONFIG" = "no" ; then + no_mysql=yes + else + MYSQL_CFLAGS=`$MYSQL_CONFIG $mysqlconf_args --cflags | sed -e "s/'//g"` + MYSQL_LIBS=`$MYSQL_CONFIG $mysqlconf_args --libs | sed -e "s/'//g"` + + mysql_major_version=`$MYSQL_CONFIG $mysql_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` + mysql_minor_version=`$MYSQL_CONFIG $mysql_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` + mysql_micro_version=`$MYSQL_CONFIG $mysql_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` + if test "x$enable_mysqltest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $MYSQL_CFLAGS" + LIBS="$LIBS $MYSQL_LIBS" + rm -f conf.mysqltest + if test "$cross_compiling" = yes; then + echo $ac_n "cross compiling; assumed OK... $ac_c" +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <mysql.h> + +char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main (int argc, char *argv[]) +{ +int major, minor, micro; + char *tmp_version; + + /* This hangs on some systems (?) + system ("touch conf.mysqltest"); + */ + { FILE *fp = fopen("conf.mysqltest", "a"); if ( fp ) fclose(fp); } + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_mysql_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_mysql_version"); + exit(1); + } + + if (($mysql_major_version > major) || + (($mysql_major_version == major) && ($mysql_minor_version > minor)) || + (($mysql_major_version == major) && ($mysql_minor_version == minor) && ($mysql_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'mysql_config --version' returned %d.%d.%d, but the minimum version\n", $mysql_major_version, $mysql_minor_version, $mysql_micro_version); + printf("*** of MYSQL required is %d.%d.%d. If mysql_config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If mysql_config was wrong, set the environment variable MYSQL_CONFIG\n"); + printf("*** to point to the correct copy of mysql_config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +} + + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +no_mysql=yes +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_mysql" = x ; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + : + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + if test "$MYSQL_CONFIG" = "no" ; then + echo "*** The mysql_config script installed by MYSQL could not be found" + echo "*** If MYSQL was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the MYSQL_CONFIG environment variable to the" + echo "*** full path to mysql_config." + else + if test -f conf.mysqltest ; then + : + else + echo "*** Could not run MYSQL test program, checking why..." + CFLAGS="$CFLAGS $MYSQL_CFLAGS" + LIBS="$LIBS $MYSQL_LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#include <stdio.h> +#include <mysql.h> + +int main(int argc, char *argv[]) +{ return 0; } +#undef main +#define main K_and_R_C_main + +int +main () +{ + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding MYSQL or finding the wrong" + echo "*** version of MYSQL. If it is not finding MYSQL, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means MYSQL was incorrectly installed" + echo "*** or that you have moved MYSQL since it was installed. In the latter case, you" + echo "*** may want to edit the mysql_config script: $MYSQL_CONFIG" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + MYSQL_CFLAGS="" + MYSQL_LIBS="" + : + fi + + + rm -f conf.mysqltest + +CFLAGS="$CFLAGS $MYSQL_CFLAGS" + + +######################################################## +# Compile with XML support? + + +# Check whether --with-xml-prefix or --without-xml-prefix was given. +if test "${with_xml_prefix+set}" = set; then + withval="$with_xml_prefix" + xml_config_prefix="$withval" +else + xml_config_prefix="" +fi; + +# Check whether --with-xml-exec-prefix or --without-xml-exec-prefix was given. +if test "${with_xml_exec_prefix+set}" = set; then + withval="$with_xml_exec_prefix" + xml_config_exec_prefix="$withval" +else + xml_config_exec_prefix="" +fi; +# Check whether --enable-xmltest or --disable-xmltest was given. +if test "${enable_xmltest+set}" = set; then + enableval="$enable_xmltest" + +else + enable_xmltest=yes +fi; + + if test x$xml_config_exec_prefix != x ; then + xml_config_args="$xml_config_args --exec-prefix=$xml_config_exec_prefix" + if test x${XML2_CONFIG+set} != xset ; then + XML2_CONFIG=$xml_config_exec_prefix/bin/xml2-config + fi + fi + if test x$xml_config_prefix != x ; then + xml_config_args="$xml_config_args --prefix=$xml_config_prefix" + if test x${XML2_CONFIG+set} != xset ; then + XML2_CONFIG=$xml_config_prefix/bin/xml2-config + fi + fi + + # Extract the first word of "xml2-config", so it can be a program name with args. +set dummy xml2-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_XML2_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $XML2_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_XML2_CONFIG="$XML2_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_XML2_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_XML2_CONFIG" && ac_cv_path_XML2_CONFIG="no" + ;; +esac +fi +XML2_CONFIG=$ac_cv_path_XML2_CONFIG + +if test -n "$XML2_CONFIG"; then + echo "$as_me:$LINENO: result: $XML2_CONFIG" >&5 +echo "${ECHO_T}$XML2_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + min_xml_version=2.0.0 + echo "$as_me:$LINENO: checking for libxml - version >= $min_xml_version" >&5 +echo $ECHO_N "checking for libxml - version >= $min_xml_version... $ECHO_C" >&6 + no_xml="" + if test "$XML2_CONFIG" = "no" ; then + no_xml=yes + else + XML_CFLAGS=`$XML2_CONFIG $xml_config_args --cflags` + XML_LIBS=`$XML2_CONFIG $xml_config_args --libs` + xml_config_major_version=`$XML2_CONFIG $xml_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` + xml_config_minor_version=`$XML2_CONFIG $xml_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` + xml_config_micro_version=`$XML2_CONFIG $xml_config_args --version | \ + sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` + if test "x$enable_xmltest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $XML_CFLAGS" + LIBS="$XML_LIBS $LIBS" + rm -f conf.xmltest + if test "$cross_compiling" = yes; then + echo $ac_n "cross compiling; assumed OK... $ac_c" +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <libxml/xmlversion.h> + +int +main() +{ + int xml_major_version, xml_minor_version, xml_micro_version; + int major, minor, micro; + char *tmp_version; + + system("touch conf.xmltest"); + + /* Capture xml2-config output via autoconf/configure variables */ + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = (char *)strdup("$min_xml_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string from xml2-config\n", "$min_xml_version"); + exit(1); + } + free(tmp_version); + + /* Capture the version information from the header files */ + tmp_version = (char *)strdup(LIBXML_DOTTED_VERSION); + if (sscanf(tmp_version, "%d.%d.%d", &xml_major_version, &xml_minor_version, &xml_micro_version) != 3) { + printf("%s, bad version string from libxml includes\n", "LIBXML_DOTTED_VERSION"); + exit(1); + } + free(tmp_version); + + /* Compare xml2-config output to the libxml headers */ + if ((xml_major_version != $xml_config_major_version) || + (xml_minor_version != $xml_config_minor_version) || + (xml_micro_version != $xml_config_micro_version)) + { + printf("*** libxml header files (version %d.%d.%d) do not match\n", + xml_major_version, xml_minor_version, xml_micro_version); + printf("*** xml2-config (version %d.%d.%d)\n", + $xml_config_major_version, $xml_config_minor_version, $xml_config_micro_version); + return 1; + } +/* Compare the headers to the library to make sure we match */ + /* Less than ideal -- doesn't provide us with return value feedback, + * only exits if there's a serious mismatch between header and library. + */ + LIBXML_TEST_VERSION; + + /* Test that the library is greater than our minimum version */ + if ((xml_major_version > major) || + ((xml_major_version == major) && (xml_minor_version > minor)) || + ((xml_major_version == major) && (xml_minor_version == minor) && + (xml_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** An old version of libxml (%d.%d.%d) was found.\n", + xml_major_version, xml_minor_version, xml_micro_version); + printf("*** You need a version of libxml newer than %d.%d.%d. The latest version of\n", + major, minor, micro); + printf("*** libxml is always available from ftp://ftp.xmlsoft.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the xml2-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of LIBXML, but you can also set the XML2_CONFIG environment to point to the\n"); + printf("*** correct copy of xml2-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + return 1; +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) +no_xml=yes +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + + if test "x$no_xml" = x ; then + echo "$as_me:$LINENO: result: yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version)" >&5 +echo "${ECHO_T}yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version)" >&6 + : + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + if test "$XML2_CONFIG" = "no" ; then + echo "*** The xml2-config script installed by LIBXML could not be found" + echo "*** If libxml was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the XML2_CONFIG environment variable to the" + echo "*** full path to xml2-config." + else + if test -f conf.xmltest ; then + : + else + echo "*** Could not run libxml test program, checking why..." + CFLAGS="$CFLAGS $XML_CFLAGS" + LIBS="$LIBS $XML_LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#include <libxml/xmlversion.h> +#include <stdio.h> + +int +main () +{ + LIBXML_TEST_VERSION; return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding LIBXML or finding the wrong" + echo "*** version of LIBXML. If it is not finding LIBXML, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means LIBXML was incorrectly installed" + echo "*** or that you have moved LIBXML since it was installed. In the latter case, you" + echo "*** may want to edit the xml2-config script: $XML2_CONFIG" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + + XML_CFLAGS="" + XML_LIBS="" + : + fi + + + rm -f conf.xmltest + +CFLAGS="$CFLAGS $XML_CFLAGS" + ################################################# # check for automount support echo "$as_me:$LINENO: checking whether to use AUTOMOUNT" >&5 @@ -20534,6 +21107,36 @@ _ACEOF fi fi +# New experimental SAM system + +echo "$as_me:$LINENO: checking whether to build the new (experimental) SAM database" >&5 +echo $ECHO_N "checking whether to build the new (experimental) SAM database... $ECHO_C" >&6 + +# Check whether --with-sam or --without-sam was given. +if test "${with_sam+set}" = set; then + withval="$with_sam" + case "$withval" in + yes) + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define WITH_SAM 1 +_ACEOF + + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +fi; + + ######################################################################################## ## ## TESTS FOR SAM BACKENDS. KEEP THESE GROUPED TOGETHER @@ -20870,7 +21473,7 @@ echo "$as_me: WARNING: --with-manpages-langs called without argument - will use echo "$as_me:$LINENO: result: $manlangs" >&5 echo "${ECHO_T}$manlangs" >&6 - manlangs=`echo $manlangs | sed "s/,/ /"` # replacing commas with spaces to produce a list + manlangs=`echo $manlangs | sed "s/,/ /g"` # replacing commas with spaces to produce a list else manlangs="en" @@ -22693,7 +23296,7 @@ builddir=`pwd` # I added make files that are outside /source directory. # I know this is not a good solution, will work out a better # solution soon. --simo - ac_config_files="$ac_config_files include/stamp-h Makefile script/findsmb ../examples/VFS/Makefile ../examples/pdb/mysql/Makefile ../examples/pdb/xml/Makefile" + ac_config_files="$ac_config_files include/stamp-h Makefile script/findsmb ../examples/VFS/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -23202,8 +23805,6 @@ do "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "script/findsmb" ) CONFIG_FILES="$CONFIG_FILES script/findsmb" ;; "../examples/VFS/Makefile" ) CONFIG_FILES="$CONFIG_FILES ../examples/VFS/Makefile" ;; - "../examples/pdb/mysql/Makefile" ) CONFIG_FILES="$CONFIG_FILES ../examples/pdb/mysql/Makefile" ;; - "../examples/pdb/xml/Makefile" ) CONFIG_FILES="$CONFIG_FILES ../examples/pdb/xml/Makefile" ;; "include/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} @@ -23342,6 +23943,12 @@ s,@TERMLIBS@,$TERMLIBS,;t t s,@TERMLDFLAGS@,$TERMLDFLAGS,;t t s,@ROFF@,$ROFF,;t t s,@DYNEXP@,$DYNEXP,;t t +s,@MYSQL_CONFIG@,$MYSQL_CONFIG,;t t +s,@MYSQL_CFLAGS@,$MYSQL_CFLAGS,;t t +s,@MYSQL_LIBS@,$MYSQL_LIBS,;t t +s,@XML2_CONFIG@,$XML2_CONFIG,;t t +s,@XML_CFLAGS@,$XML_CFLAGS,;t t +s,@XML_LIBS@,$XML_LIBS,;t t s,@QUOTAOBJS@,$QUOTAOBJS,;t t s,@manlangs@,$manlangs,;t t s,@WINBIND_TARGETS@,$WINBIND_TARGETS,;t t diff --git a/source3/include/config.h.in b/source3/include/config.h.in index 384bee8760..0895a783d4 100644 --- a/source3/include/config.h.in +++ b/source3/include/config.h.in @@ -859,6 +859,9 @@ /* Define to 1 if you have the <termio.h> header file. */ #undef HAVE_TERMIO_H +/* Define to 1 if you have the `timegm' function. */ +#undef HAVE_TIMEGM + /* Whether Tru64 ACLs are available */ #undef HAVE_TRU64_ACLS @@ -1391,6 +1394,9 @@ /* Whether to include experimental quota support */ #undef WITH_QUOTAS +/* Whether to build the new (experimental) SAM database */ +#undef WITH_SAM + /* Whether to include sendfile() support */ #undef WITH_SENDFILE diff --git a/source3/lib/debug.c b/source3/lib/debug.c index 483db71b85..f2a362bb86 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -74,15 +74,12 @@ * * dbf - Global debug file handle. * debugf - Debug file name. - * append_log - If True, then the output file will be opened in append - * mode. * DEBUGLEVEL - System-wide debug message limit. Messages with message- * levels higher than DEBUGLEVEL will not be processed. */ XFILE *dbf = NULL; pstring debugf = ""; -BOOL append_log = False; BOOL debug_warn_unknown_class = True; BOOL debug_auto_add_unknown_class = True; BOOL AllowDebugChange = True; @@ -576,10 +573,7 @@ BOOL reopen_logs( void ) } pstrcpy( debugf, fname ); - if (append_log) - new_dbf = x_fopen( debugf, O_WRONLY|O_APPEND|O_CREAT, 0644); - else - new_dbf = x_fopen( debugf, O_WRONLY|O_CREAT|O_TRUNC, 0644 ); + new_dbf = x_fopen( debugf, O_WRONLY|O_APPEND|O_CREAT, 0644); if (!new_dbf) { log_overflow = True; @@ -731,10 +725,7 @@ void check_log_size( void ) { mode_t oldumask = umask( 022 ); - if( append_log ) - dbf = x_fopen( debugf, O_WRONLY|O_APPEND|O_CREAT, 0644 ); - else - dbf = x_fopen( debugf, O_WRONLY|O_CREAT|O_TRUNC, 0644 ); + dbf = x_fopen( debugf, O_WRONLY|O_APPEND|O_CREAT, 0644 ); (void)umask( oldumask ); if( dbf ) { diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index 9f4a934fae..50730d40f3 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -661,15 +661,12 @@ static BOOL init_structs(void) **************************************************************************** */ int main(int argc, const char *argv[]) { - extern BOOL append_log; static BOOL opt_interactive = False; poptContext pc; struct poptOption long_options[] = { POPT_AUTOHELP {"daemon", 'D', POPT_ARG_VAL, &is_daemon, True, "Become a daemon(default)" }, - {"log-append", 'a', POPT_ARG_VAL, &append_log, True, "Append to log file" }, {"interactive", 'i', POPT_ARG_VAL, &opt_interactive, True, "Run interactive (not a daemon)" }, - {"log-overwrite", 'o', POPT_ARG_VAL, &append_log, False, "Overwrite log file, don't append" }, {"hosts", 'H', POPT_ARG_STRING, dyn_LMHOSTSFILE, 'H', "Load a netbios hosts file"}, {"port", 'p', POPT_ARG_INT, &global_nmb_port, NMB_PORT, "Listen on the specified port" }, {NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug }, @@ -683,8 +680,6 @@ static BOOL init_structs(void) int opt; pstring logfile; - append_log = True; /* Default, override with '-o' option. */ - global_nmb_port = NMB_PORT; global_in_nmbd = True; diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c index 059d2f40d3..2bd6d7967c 100644 --- a/source3/nsswitch/winbindd.c +++ b/source3/nsswitch/winbindd.c @@ -746,7 +746,6 @@ static void usage(void) extern BOOL AllowDebugChange; extern pstring global_myname; extern fstring global_myworkgroup; - extern BOOL append_log; pstring logfile; BOOL interactive = False; int opt; @@ -759,11 +758,6 @@ static void usage(void) fault_setup((void (*)(void *))fault_quit ); - /* Append to log file by default as we are a single process daemon - program. */ - - append_log = True; - snprintf(logfile, sizeof(logfile), "%s/log.winbindd", dyn_LOGFILEBASE); lp_set_logfile(logfile); diff --git a/source3/smbd/server.c b/source3/smbd/server.c index ad00794bd7..3d9a4675b2 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -3,6 +3,7 @@ Main SMB server routines Copyright (C) Andrew Tridgell 1992-1998 Copyright (C) Martin Pool 2002 + Copyright (C) Jelmer Vernooij 2002 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 @@ -612,120 +613,48 @@ static void init_structs(void ) } /**************************************************************************** - Usage on the program. -****************************************************************************/ - -static void usage(char *pname) -{ - - d_printf("Usage: %s [-DaioPh?Vb] [-d debuglevel] [-l log basename] [-p port]\n", pname); - d_printf(" [-O socket options] [-s services file]\n"); - d_printf("\t-D Become a daemon (default)\n"); - d_printf("\t-a Append to log file (default)\n"); - d_printf("\t-i Run interactive (not a daemon)\n" ); - d_printf("\t-o Overwrite log file, don't append\n"); - d_printf("\t-h Print usage\n"); - d_printf("\t-? Print usage\n"); - d_printf("\t-V Print version\n"); - d_printf("\t-b Print build options\n"); - d_printf("\t-d debuglevel Set the debuglevel\n"); - d_printf("\t-l log basename. Basename for log/debug files\n"); - d_printf("\t-p port Listen on the specified port\n"); - d_printf("\t-O socket options Socket options\n"); - d_printf("\t-s services file. Filename of services file\n"); - d_printf("\n"); -} - -/**************************************************************************** main program. ****************************************************************************/ - int main(int argc,char *argv[]) + int main(int argc,const char *argv[]) { - extern BOOL append_log; - extern BOOL AllowDebugChange; - extern char *optarg; /* shall I run as a daemon */ - BOOL is_daemon = False; - BOOL interactive = False; - BOOL specified_logfile = False; - char *ports = NULL; + static BOOL is_daemon = False; + static BOOL interactive = False; + static char *ports = NULL; int opt; - pstring logfile; + poptContext pc; + + struct poptOption long_options[] = { + POPT_AUTOHELP + {"daemon", 'D', POPT_ARG_VAL, &is_daemon, True, "Become a daemon (default)" }, + {"interactive", 'i', POPT_ARG_VAL, &interactive, True, "Run interactive (not a daemon)"}, + {"build-options", 'b', POPT_ARG_NONE, NULL, 'b', "Print build options" }, + {"port", 'p', POPT_ARG_STRING, &ports, 0, "Listen on the specified ports"}, + {NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug}, + {NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_configfile}, + {NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_socket_options}, + {NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_log_base}, + {NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_version}, + { NULL } + }; #ifdef HAVE_SET_AUTH_PARAMETERS set_auth_parameters(argc,argv); #endif - /* this is for people who can't start the program correctly */ - while (argc > 1 && (*argv[1] != '-')) { - argv++; - argc--; - } - - while ( EOF != (opt = getopt(argc, argv, "O:l:s:d:Dp:h?bVaiof:")) ) + pc = poptGetContext("smbd", argc, argv, long_options, 0); + + while((opt = poptGetNextOpt(pc)) != -1) { switch (opt) { - case 'O': - pstrcpy(user_socket_options,optarg); - break; - - case 's': - pstrcpy(dyn_CONFIGFILE,optarg); - break; - - case 'l': - specified_logfile = True; - pstr_sprintf(logfile, "%s/log.smbd", optarg); - lp_set_logfile(logfile); - break; - - case 'a': - append_log = True; - break; - - case 'i': - interactive = True; - break; - - case 'o': - append_log = False; - break; - - case 'D': - is_daemon = True; - break; - - case 'd': - if (*optarg == 'A') - DEBUGLEVEL = 10000; - else - DEBUGLEVEL = atoi(optarg); - AllowDebugChange = False; - break; - - case 'p': - ports = optarg; - break; - - case 'h': - case '?': - usage(argv[0]); - exit(0); - break; - - case 'V': - d_printf("Version %s\n",VERSION); - exit(0); - break; case 'b': - build_options(True); /* Display output to screen as well as debug */ + build_options(True); /* Display output to screen as well as debug */ exit(0); break; - default: - DEBUG(0,("Incorrect program usage - are you sure the command line is correct?\n")); - usage(argv[0]); - exit(1); } + } + + poptFreeContext(pc); #ifdef HAVE_SETLUID /* needed for SecureWare on SCO */ @@ -736,13 +665,6 @@ static void usage(char *pname) load_case_tables(); - append_log = True; - - if(!specified_logfile) { - pstr_sprintf(logfile, "%s/log.smbd", dyn_LOGFILEBASE); - lp_set_logfile(logfile); - } - set_remote_machine_name("smbd"); setup_logging(argv[0],interactive); diff --git a/source3/wrepld/server.c b/source3/wrepld/server.c index 14d3e730f4..f08674afbb 100644 --- a/source3/wrepld/server.c +++ b/source3/wrepld/server.c @@ -541,7 +541,6 @@ static void process(void) ****************************************************************************/ int main(int argc,char *argv[]) { - extern BOOL append_log; extern char *optarg; /* shall I run as a daemon */ BOOL is_daemon = False; @@ -576,18 +575,10 @@ static void process(void) lp_set_logfile(logfile); break; - case 'a': - append_log = True; - break; - case 'i': interactive = True; break; - case 'o': - append_log = False; - break; - case 'D': is_daemon = True; break; @@ -628,8 +619,6 @@ static void process(void) load_case_tables(); - append_log = True; - if(!specified_logfile) { slprintf(logfile, sizeof(logfile)-1, "%s/log.wrepld", dyn_LOGFILEBASE); |