diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/examples/LDAP/samba-nds.schema samba-3.0.20a/examples/LDAP/samba-nds.schema --- samba-3.0.20/examples/LDAP/samba-nds.schema 2005-03-18 08:56:42.000000000 -0600 +++ samba-3.0.20a/examples/LDAP/samba-nds.schema 2005-09-29 16:52:49.634774000 -0500 @@ -128,7 +128,7 @@ dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.54 NAME 'sambaPasswordHistory' DESC 'Concatenated MD4 hashes of the unicode passwords used on this account' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{64} ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.54 NAME 'sambaPasswordHistory' DESC 'Concatenated MD4 hashes of the unicode passwords used on this account' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{1024} ) ## ## SID, of any type diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/examples/VFS/skel_opaque.c samba-3.0.20a/examples/VFS/skel_opaque.c --- samba-3.0.20/examples/VFS/skel_opaque.c 2005-07-28 08:19:54.000000000 -0500 +++ samba-3.0.20a/examples/VFS/skel_opaque.c 2005-09-29 16:52:49.732759000 -0500 @@ -71,27 +71,27 @@ return vfswrap_get_shadow_copy_data(NULL, fsp, shadow_copy_data, labels); } -static DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) +static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) { return vfswrap_opendir(NULL, conn, fname, mask, attr); } -static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) { return vfswrap_readdir(NULL, conn, dirp); } -static void skel_seekdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp, long offset) +static void skel_seekdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp, long offset) { return vfswrap_seekdir(NULL, conn, dirp, offset); } -static long skel_telldir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +static long skel_telldir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) { return vfswrap_telldir(NULL, conn, dirp); } -static void skel_rewinddir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +static void skel_rewinddir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) { return vfswrap_rewinddir(NULL, conn, dirp); } @@ -106,7 +106,7 @@ return vfswrap_rmdir(NULL, conn, path); } -static int skel_closedir(vfs_handle_struct *handle, connection_struct *conn, DIR *dir) +static int skel_closedir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dir) { return vfswrap_closedir(NULL, conn, dir); } diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/examples/VFS/skel_transparent.c samba-3.0.20a/examples/VFS/skel_transparent.c --- samba-3.0.20/examples/VFS/skel_transparent.c 2005-07-28 08:19:54.000000000 -0500 +++ samba-3.0.20a/examples/VFS/skel_transparent.c 2005-09-29 16:52:49.696765000 -0500 @@ -70,27 +70,27 @@ return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, labels); } -static DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) +static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) { return SMB_VFS_NEXT_OPENDIR(handle, conn, fname, mask, attr); } -static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) { return SMB_VFS_NEXT_READDIR(handle, conn, dirp); } -static void skel_seekdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp, long offset) +static void skel_seekdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp, long offset) { return SMB_VFS_NEXT_SEEKDIR(handle, conn, dirp, offset); } -static long skel_telldir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +static long skel_telldir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) { return SMB_VFS_NEXT_TELLDIR(handle, conn, dirp); } -static void skel_rewinddir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +static void skel_rewinddir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) { return SMB_VFS_NEXT_REWINDDIR(handle, conn, dirp); } @@ -105,7 +105,7 @@ return SMB_VFS_NEXT_RMDIR(handle, conn, path); } -static int skel_closedir(vfs_handle_struct *handle, connection_struct *conn, DIR *dir) +static int skel_closedir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dir) { return SMB_VFS_NEXT_CLOSEDIR(handle, conn, dir); } diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/MAINTAINERS samba-3.0.20a/MAINTAINERS --- samba-3.0.20/MAINTAINERS 1969-12-31 18:00:00.000000000 -0600 +++ samba-3.0.20a/MAINTAINERS 2005-09-29 16:52:49.498795000 -0500 @@ -0,0 +1,42 @@ +## +## List of current Samba Maintainers +## + +This file contains a list of developers responsible for +portions of the Samba 3.0 code. It also lists developers +responsible for 3rd party projects that work with Samba +(e.g. vfs modules). Note that this list is for you benefit, +but please do not abuse it by constantly emailing a stream +of help questions to the maintainers. Some are more open +to direct communication than others and most struggle with +enormous amounts of email every day. + +If a feature or functionality is not listed here, it probably +means that multiple people maintain that code. In that case, +the best location for help is the user community mailing list +. Currently this list restricts posting to +members only. You can find out more about this and other lists +at https://lists.samba.org/. + +All bug reports for code that is maintained *within* the +Samba subversion tree should be filed at https://bugzilla.samba.org/. + + +Feature/Function Developer +---------------- --------- + +samba-vscan Rainer Link + +pdb_mysql Peter Rindfuss + Darrell McGuire + +pdb_psql Ulrich Meis + Filip Jirsák + +General Documentation John Terpstra + +Printing Gerald (Jerry) Carter + + +-- +Please report any errors in this file to diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/packaging/Fedora/makerpms.sh samba-3.0.20a/packaging/Fedora/makerpms.sh --- samba-3.0.20/packaging/Fedora/makerpms.sh 2005-08-19 14:07:07.000000000 -0500 +++ samba-3.0.20a/packaging/Fedora/makerpms.sh 2005-09-29 17:35:13.664616000 -0500 @@ -18,7 +18,7 @@ USERID=`id -u` GRPID=`id -g` -VERSION='3.0.20' +VERSION='3.0.20a' SPECFILE="samba.spec" RPMVER=`rpm --version | awk '{print $3}'` RPM="rpmbuild" diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/packaging/Fedora/samba.spec samba-3.0.20a/packaging/Fedora/samba.spec --- samba-3.0.20/packaging/Fedora/samba.spec 2005-08-19 14:07:07.000000000 -0500 +++ samba-3.0.20a/packaging/Fedora/samba.spec 2005-09-29 17:35:13.680614000 -0500 @@ -3,7 +3,7 @@ Summary: The Samba SMB server. Name: samba -Version: 3.0.20 +Version: 3.0.20a Release: 1 License: GNU GPL Version 2 Group: System Environment/Daemons diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/packaging/RedHat/makerpms.sh samba-3.0.20a/packaging/RedHat/makerpms.sh --- samba-3.0.20/packaging/RedHat/makerpms.sh 2005-08-19 14:07:07.000000000 -0500 +++ samba-3.0.20a/packaging/RedHat/makerpms.sh 2005-09-29 17:35:13.691612000 -0500 @@ -20,7 +20,7 @@ USERID=`id -u` GRPID=`id -g` -VERSION='3.0.20' +VERSION='3.0.20a' SPECFILE="samba3.spec" RPMVER=`rpm --version | awk '{print $3}'` RPM="rpm" diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/packaging/RedHat/samba.spec samba-3.0.20a/packaging/RedHat/samba.spec --- samba-3.0.20/packaging/RedHat/samba.spec 2005-08-19 14:07:07.000000000 -0500 +++ samba-3.0.20a/packaging/RedHat/samba.spec 2005-09-29 17:35:13.708609000 -0500 @@ -4,7 +4,7 @@ Summary: Samba SMB client and server Vendor: Samba Team Name: samba -Version: 3.0.20 +Version: 3.0.20a Release: 1 License: GNU GPL version 2 Group: Networking diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/REVISION samba-3.0.20a/REVISION --- samba-3.0.20/REVISION 2005-08-19 14:07:10.000000000 -0500 +++ samba-3.0.20a/REVISION 2005-09-29 17:35:15.597320000 -0500 @@ -1,11 +1,11 @@ Path: . URL: svn+ssh://svn.samba.org/home/svn/samba/branches/SAMBA_3_0_RELEASE Repository UUID: 0c0555d6-39d7-0310-84fc-f1cc0bd64818 -Revision: 9402 +Revision: 10632 Node Kind: directory Schedule: normal Last Changed Author: jerry -Last Changed Rev: 9402 -Last Changed Date: 2005-08-19 13:37:08 -0500 (Fri, 19 Aug 2005) +Last Changed Rev: 10632 +Last Changed Date: 2005-09-29 17:34:39 -0500 (Thu, 29 Sep 2005) Properties Last Updated: 2005-02-25 11:59:52 -0600 (Fri, 25 Feb 2005) diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/client/client.c samba-3.0.20a/source/client/client.c --- samba-3.0.20/source/client/client.c 2005-07-28 08:19:53.000000000 -0500 +++ samba-3.0.20a/source/client/client.c 2005-09-29 16:52:49.220838000 -0500 @@ -1379,7 +1379,7 @@ static int file_find(struct file_list **list, const char *directory, const char *expression, BOOL match) { - DIR *dir; + SMB_STRUCT_DIR *dir; struct file_list *entry; struct stat statbuf; int ret; @@ -1387,7 +1387,7 @@ BOOL isdir; const char *dname; - dir = opendir(directory); + dir = sys_opendir(directory); if (!dir) return -1; @@ -1416,14 +1416,14 @@ if (ret == -1) { SAFE_FREE(path); - closedir(dir); + sys_closedir(dir); return -1; } } entry = SMB_MALLOC_P(struct file_list); if (!entry) { d_printf("Out of memory in file_find\n"); - closedir(dir); + sys_closedir(dir); return -1; } entry->file_path = path; @@ -1434,7 +1434,7 @@ } } - closedir(dir); + sys_closedir(dir); return 0; } diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/client/mount.cifs.c samba-3.0.20a/source/client/mount.cifs.c --- samba-3.0.20/source/client/mount.cifs.c 2005-08-19 12:16:29.000000000 -0500 +++ samba-3.0.20a/source/client/mount.cifs.c 2005-09-29 16:52:49.248833000 -0500 @@ -506,6 +506,8 @@ *filesys_flags &= ~MS_NOSUID; } else if (strncmp(data, "nodev", 5) == 0) { *filesys_flags |= MS_NODEV; + } else if (strncmp(data, "nobrl", 5) == 0) { + *filesys_flags &= ~MS_MANDLOCK; } else if (strncmp(data, "dev", 3) == 0) { *filesys_flags &= ~MS_NODEV; } else if (strncmp(data, "noexec", 6) == 0) { @@ -1138,8 +1140,6 @@ strcat(mountent.mnt_opts,"rw"); if(flags & MS_MANDLOCK) strcat(mountent.mnt_opts,",mand"); - else - strcat(mountent.mnt_opts,",nomand"); if(flags & MS_NOEXEC) strcat(mountent.mnt_opts,",noexec"); if(flags & MS_NOSUID) diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/client/smbspool.c samba-3.0.20a/source/client/smbspool.c --- samba-3.0.20/source/client/smbspool.c 2005-07-28 08:19:53.000000000 -0500 +++ samba-3.0.20a/source/client/smbspool.c 2005-09-29 16:52:49.236835000 -0500 @@ -226,12 +226,12 @@ { if (getenv("CLASS") == NULL) { - fprintf(stderr, "ERROR: Unable to connect to SAMBA host, will retry in 60 seconds..."); - sleep (60); + fprintf(stderr, "ERROR: Unable to connect to CIFS host, will retry in 60 seconds..."); + sleep (60); /* should just waiting and retrying fix authentication ??? */ } else { - fprintf(stderr, "ERROR: Unable to connect to SAMBA host, trying next printer..."); + fprintf(stderr, "ERROR: Unable to connect to CIFS host, trying next printer..."); return (1); } } @@ -288,7 +288,7 @@ static char * get_ticket_cache( uid_t uid ) { - DIR *tcdir; /* directory where ticket caches are stored */ + SMB_STRUCT_DIR *tcdir; /* directory where ticket caches are stored */ SMB_STRUCT_DIRENT *dirent; /* directory entry */ char *filename = NULL; /* holds file names on the tmp directory */ SMB_STRUCT_STAT buf; @@ -298,7 +298,7 @@ time_t t = 0; snprintf(user_cache_prefix, CC_MAX_FILE_LEN, "%s%d", CC_PREFIX, uid ); - tcdir = opendir( TICKET_CC_DIR ); + tcdir = sys_opendir( TICKET_CC_DIR ); if ( tcdir == NULL ) return NULL; @@ -331,10 +331,14 @@ } } + sys_closedir(tcdir); + if ( ticket_file == NULL ) { +#ifdef DEVELOPER /* no ticket cache found */ fprintf(stderr, "ERROR: No ticket cache found for userid=%d\n", uid); +#endif return NULL; } @@ -423,10 +427,10 @@ return NULL; } - if (!cli_send_tconX(cli, share, "?????",password, strlen(password)+1)) + if (!cli_send_tconX(cli, share, "?????", password, strlen(password)+1)) { + fprintf(stderr, "ERROR: Tree connect failed (%s)\n", cli_errstr(cli)); cli_shutdown(cli); - fprintf(stderr, "ERROR: Tree connect failed\n" ); return NULL; } @@ -455,15 +459,15 @@ get_myname(myname); - if ( (username) && ( *username ) && (password) && (*password) ) + /* See if we have a username first. This is for backwards compatible + behavior with 3.0.14a */ + + if ( username && *username ) { - /* - * User/password specified in the DEVICE_URI, use those credentials - * to connect to the server - */ cli = smb_complete_connection(myname, server, port, username, password, workgroup, share, 0 ); - if (cli ) { return cli; } + if (cli) + return cli; } /* diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/configure samba-3.0.20a/source/configure --- samba-3.0.20/source/configure 2005-08-19 14:09:01.000000000 -0500 +++ samba-3.0.20a/source/configure 2005-09-29 17:35:52.829608627 -0500 @@ -310,7 +310,7 @@ # include #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 LDSHFLAGS SONAMEFLAG SHLD HOST_OS PICFLAGS PICSUFFIX libc_cv_fpie PIE_CFLAGS PIE_LDFLAGS SHLIBEXT INSTALLCLIENT INSTALLCLIENTCMD_SH INSTALLCLIENTCMD_A LIBSMBCLIENT_SHARED LIBSMBCLIENT PRINT_LIBS AUTH_LIBS ACL_LIBS PASSDB_LIBS IDMAP_LIBS KRB5_LIBS LDAP_LIBS SHLIB_PROGS SMBWRAPPER SMBWRAP_OBJS SMBWRAP_INC EXTRA_BIN_PROGS EXTRA_SBIN_PROGS EXTRA_ALL_TARGETS SOCKWRAP CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AWK PERL AR ac_ct_AR BROKEN_CC build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os EGREP CUPS_CONFIG LIBOBJS TERMLIBS TERMLDFLAGS ROFF DYNEXP SMBLDAP SMBLDAPUTIL KRB5CONFIG XML2_CONFIG XML_CFLAGS XML_LIBS MYSQL_CONFIG MYSQL_CFLAGS MYSQL_LIBS PGSQL_CONFIG PGSQL_CFLAGS PGSQL_LIBS WINBIND_NSS WINBIND_WINS_NSS WINBIND_NSS_LDSHFLAGS WINBIND_NSS_EXTRA_OBJS WINBIND_NSS_EXTRA_LIBS BUILD_POPT POPTLIBS FLAGS1 PYTHON PDB_STATIC PDB_MODULES RPC_STATIC RPC_MODULES IDMAP_STATIC IDMAP_MODULES CHARSET_STATIC CHARSET_MODULES AUTH_STATIC AUTH_MODULES VFS_STATIC VFS_MODULES 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 LDSHFLAGS SONAMEFLAG SHLD HOST_OS PICFLAGS PICSUFFIX libc_cv_fpie PIE_CFLAGS PIE_LDFLAGS SHLIBEXT INSTALLCLIENT INSTALLCLIENTCMD_SH INSTALLCLIENTCMD_A LIBSMBCLIENT_SHARED LIBSMBCLIENT LIBSMBSHAREMODES_SHARED LIBSMBSHAREMODES PRINT_LIBS AUTH_LIBS ACL_LIBS PASSDB_LIBS IDMAP_LIBS KRB5_LIBS LDAP_LIBS SHLIB_PROGS SMBWRAPPER SMBWRAP_OBJS SMBWRAP_INC EXTRA_BIN_PROGS EXTRA_SBIN_PROGS EXTRA_ALL_TARGETS SOCKWRAP CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AWK PERL AR ac_ct_AR BROKEN_CC build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os EGREP CUPS_CONFIG LIBOBJS TERMLIBS TERMLDFLAGS ROFF DYNEXP SMBLDAP SMBLDAPUTIL KRB5CONFIG XML2_CONFIG XML_CFLAGS XML_LIBS MYSQL_CONFIG MYSQL_CFLAGS MYSQL_LIBS PGSQL_CONFIG PGSQL_CFLAGS PGSQL_LIBS WINBIND_NSS WINBIND_WINS_NSS WINBIND_NSS_LDSHFLAGS WINBIND_NSS_EXTRA_OBJS WINBIND_NSS_EXTRA_LIBS BUILD_POPT POPTLIBS FLAGS1 PYTHON PDB_STATIC PDB_MODULES RPC_STATIC RPC_MODULES IDMAP_STATIC IDMAP_MODULES CHARSET_STATIC CHARSET_MODULES AUTH_STATIC AUTH_MODULES VFS_STATIC VFS_MODULES builddir LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -902,6 +902,7 @@ --with-sys-quotas Include lib/sysquotas.c support (default=auto) --with-utmp Include utmp accounting (default, if supported by OS) --with-libsmbclient Build the libsmbclient shared library (default=yes if shared libs supported) + --with-libsmbsharemodes Build the libsmbsharemodes shared library (default=yes if shared libs supported) --with-spinlocks Use spin locks instead of fcntl locks (default=no) --with-acl-support Include ACL support (default=no) --with-aio-support Include asynchronous io support (default=no) @@ -1670,6 +1671,8 @@ + + # Set defaults PIE_CFLAGS="" PIE_LDFLAGS="" @@ -6278,7 +6281,8 @@ -for ac_header in unistd.h utime.h grp.h sys/id.h limits.h memory.h + +for ac_header in unistd.h utime.h grp.h sys/id.h limits.h memory.h alloca.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -6579,24 +6583,35 @@ done -## These fail to compile on IRIX so just check for their presence -for ac_header in rpcsvc/yp_prot.h + + + + + + +for ac_header in sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/prctl.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_header" >&5 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - cat >conftest.$ac_ext <<_ACEOF + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - - - +$ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext @@ -6621,22 +6636,105 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" + ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_Header=no" +ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF - sys/mode.h + fi done @@ -6647,7 +6745,9 @@ -for ac_header in sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h + + +for ac_header in sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h sys/socket.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -6797,14 +6897,7 @@ done - - - - - - - -for ac_header in sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h sys/socket.h +for ac_header in sys/un.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -6954,7 +7047,12 @@ done -for ac_header in sys/un.h + + + + + +for ac_header in sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -7109,7 +7207,7 @@ -for ac_header in sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h +for ac_header in sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -7261,10 +7359,7 @@ - - - -for ac_header in sys/termio.h sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h +for ac_header in sys/sysmacros.h security/_pam_macros.h dlfcn.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -7416,7 +7511,7 @@ -for ac_header in sys/sysmacros.h security/_pam_macros.h dlfcn.h +for ac_header in sys/syslog.h syslog.h execinfo.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -7567,8 +7662,7 @@ - -for ac_header in sys/syslog.h syslog.h execinfo.h +for ac_header in langinfo.h locale.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -7719,7 +7813,74 @@ -for ac_header in langinfo.h locale.h +for ac_header in rpcsvc/yp_prot.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#if HAVE_RPC_RPC_H +#include +#endif + + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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 + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +## These fail to compile on IRIX so just check for their presence + +for ac_header in sys/mode.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -9324,11 +9485,79 @@ done -## These faile to compile on Solaris so just check for their presence +for ac_header in netinet/ip.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#if HAVE_SYS_SOCKET_H +#include +#endif +#include +#if HAVE_NETINET_IN_SYSTM_H +#include +#endif -for ac_header in security/pam_modules.h net/if.h netinet/ip.h +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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 + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +for ac_header in net/if.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 @@ -9342,34 +9571,111 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ + +#include +#if HAVE_SYS_SOCKET_H +#include +#endif + + #include <$ac_header> _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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 + eval "$as_ac_Header=yes" else - ac_cpp_err=yes + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" fi -if test -z "$ac_cpp_err"; then +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +for ac_header in security/pam_modules.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#if HAVE_SECURITY_PAM_APPL_H +#include +#endif + + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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 eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - eval "$as_ac_Header=no" +eval "$as_ac_Header=no" fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -12705,8 +13011,20 @@ #include #include #endif -#include +#if TIME_WITH_SYS_TIME +# include +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif +#if HAVE_AIO_H #include +#endif + int main () { @@ -16163,8 +16481,7 @@ - -for ac_func in lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64 +for ac_func in lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 @@ -16379,6 +16696,113 @@ +for ac_func in opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64 +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + + + + + @@ -18724,6 +19148,161 @@ done +for ac_func in prctl +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#ifdef HAVE_SYS_PRCTL_H +#include +#endif + +int +main () +{ +int i; i = prtcl(0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_PRCTL 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + # # # @@ -24307,6 +24886,73 @@ echo "$as_me:$LINENO: checking for struct dirent64" >&5 echo $ECHO_N "checking for struct dirent64... $ECHO_C" >&6 +if test "${samba_cv_HAVE_STRUCT_DIR64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#if defined(HAVE_UNISTD_H) +#include +#endif +#include +#include +int +main () +{ +DIR64 de; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (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 + samba_cv_HAVE_STRUCT_DIR64=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +samba_cv_HAVE_STRUCT_DIR64=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $samba_cv_HAVE_STRUCT_DIR64" >&5 +echo "${ECHO_T}$samba_cv_HAVE_STRUCT_DIR64" >&6 +if test x"$samba_cv_HAVE_STRUCT_DIR64" = x"yes" && test x"$ac_cv_func_readdir64" = x"yes"; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_STRUCT_DIR64 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for struct dirent64" >&5 +echo $ECHO_N "checking for struct dirent64... $ECHO_C" >&6 if test "${samba_cv_HAVE_STRUCT_DIRENT64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -35760,8 +36406,8 @@ samba_cv_TRY_QUOTAS=no samba_cv_RUN_QUOTA_TESTS=auto samba_cv_WITH_SYS_QUOTAS=auto -samba_cv_TRY_SYS_QUOTAS=no -samba_cv_SYSQUOTA_FOUND=no; +samba_cv_TRY_SYS_QUOTAS=auto +samba_cv_SYSQUOTA_FOUND=no echo "$as_me:$LINENO: checking whether to try disk-quotas support" >&5 echo $ECHO_N "checking whether to try disk-quotas support... $ECHO_C" >&6 @@ -35844,7 +36490,7 @@ fi; -if test x"$samba_cv_TRY_SYS_QUOTAS" != x"no"; then +if test x"$samba_cv_TRY_SYS_QUOTAS" = x"auto"; then echo "$as_me:$LINENO: checking whether to try the lib/sysquotas.c interface on ${host_os}" >&5 echo $ECHO_N "checking whether to try the lib/sysquotas.c interface on ${host_os}... $ECHO_C" >&6 case "$host_os" in @@ -35853,31 +36499,48 @@ echo "${ECHO_T}yes" >&6 samba_cv_TRY_SYS_QUOTAS=yes samba_cv_RUN_QUOTA_TESTS=yes - samba_cv_SYSQUOTA_FOUND=yes + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + samba_cv_TRY_SYS_QUOTAS=no + ;; + esac +fi + +############################################# +# only check for quota stuff if --with-quotas +if test x"$samba_cv_RUN_QUOTA_TESTS" != x"no"; then + +case "$host_os" in + # on linux we didn't need to test we have builtin support + *linux*) + samba_cv_SYSQUOTA_FOUND=yes cat >>confdefs.h <<\_ACEOF #define HAVE_QUOTACTL_LINUX 1 _ACEOF - samba_cv_sysquotas_file="lib/sysquotas_linux.c" + samba_cv_sysquotas_file="lib/sysquotas_linux.c" + echo "$as_me:$LINENO: checking whether to use the lib/sysquotas_linux.c builtin support" >&5 +echo $ECHO_N "checking whether to use the lib/sysquotas_linux.c builtin support... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cat >>confdefs.h <<\_ACEOF #define HAVE_LINUX_XFS_QUOTAS 1 _ACEOF - samba_cv_found_xfs_header=yes + samba_cv_found_xfs_header=yes + echo "$as_me:$LINENO: checking whether to use the lib/sysquotas_xfs.c builtin support" >&5 +echo $ECHO_N "checking whether to use the lib/sysquotas_xfs.c builtin support... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 ;; *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - samba_cv_TRY_SYS_QUOTAS=no ;; - esac -fi - -############################################# -# only check for quota stuff if --with-quotas -if test x"$samba_cv_RUN_QUOTA_TESTS" != x"no"; then +esac # some broken header files need this if test "${ac_cv_header_asm_types_h+set}" = set; then @@ -37609,6 +38272,66 @@ fi; +INSTALLCLIENTCMD_SH=: +INSTALLCLIENTCMD_A=: +INSTALLCLIENT= +LIBSMBSHAREMODES_SHARED= +LIBSMBSHAREMODES= +echo "$as_me:$LINENO: checking whether to build the libsmbsharemodes shared library" >&5 +echo $ECHO_N "checking whether to build the libsmbsharemodes shared library... $ECHO_C" >&6 + +# Check whether --with-libsmbsharemodes or --without-libsmbsharemodes was given. +if test "${with_libsmbsharemodes+set}" = set; then + withval="$with_libsmbsharemodes" + case "$withval" in + no) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + *) + if test $BLDSHARED = true; then + INSTALLCLIENTCMD_SH="\$(INSTALLCMD)" + ## build the static version of libsmbsharemodes as well + INSTALLCLIENTCMD_A="\$(INSTALLCMD)" + LIBSMBSHAREMODES_SHARED=bin/libsmbsharemodes.$SHLIBEXT + LIBSMBSHAREMODES=libsmbsharemodes + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + enable_static=yes + echo "$as_me:$LINENO: result: no shared library support -- will supply static library" >&5 +echo "${ECHO_T}no shared library support -- will supply static library" >&6 + fi + if test $enable_static = yes; then + INSTALLCLIENTCMD_A="\$(INSTALLCMD)" + LIBSMBSHAREMODES=libsmbsharemodes + fi + INSTALLCLIENT=installclientlib + ;; + esac +else + +# if unspecified, default is to built it iff possible. + if test $BLDSHARED = true; then + INSTALLCLIENTCMD_SH="\$(INSTALLCMD)" + LIBSMBSHAREMODES_SHARED=bin/libsmbsharemodes.$SHLIBEXT + LIBSMBSHAREMODES=libsmbsharemodes + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + enable_static=yes + echo "$as_me:$LINENO: result: no shared library support -- will supply static library" >&5 +echo "${ECHO_T}no shared library support -- will supply static library" >&6 + fi + if test $enable_static = yes; then + INSTALLCLIENTCMD_A="\$(INSTALLCMD)" + LIBSMBSHAREMODES=libsmbsharemodes + fi + INSTALLCLIENT=installclientlib + +fi; + + ################################################# # these tests are taken from the GNU fileutils package { echo "$as_me:$LINENO: checking how to get filesystem space usage..." >&5 @@ -41267,12 +41990,12 @@ fi; -for i in `echo $default_static_modules | sed -e's/,/ /g'` +for i in `echo $default_static_modules | sed -e 's/,/ /g'` do eval MODULE_DEFAULT_$i=STATIC done -for i in `echo $default_shared_modules | sed -e's/,/ /g'` +for i in `echo $default_shared_modules | sed -e 's/,/ /g'` do eval MODULE_DEFAULT_$i=STATIC @@ -41291,7 +42014,7 @@ if test "${with_static_modules+set}" = set; then withval="$with_static_modules" if test $withval; then - for i in `echo $withval | sed -e's/,/ /g'` + for i in `echo $withval | sed -e 's/,/ /g'` do eval MODULE_$i=STATIC done @@ -41303,7 +42026,7 @@ if test "${with_shared_modules+set}" = set; then withval="$with_shared_modules" if test $withval; then - for i in `echo $withval | sed -e's/,/ /g'` + for i in `echo $withval | sed -e 's/,/ /g'` do eval MODULE_$i=SHARED done @@ -43831,6 +44554,8 @@ s,@INSTALLCLIENTCMD_A@,$INSTALLCLIENTCMD_A,;t t s,@LIBSMBCLIENT_SHARED@,$LIBSMBCLIENT_SHARED,;t t s,@LIBSMBCLIENT@,$LIBSMBCLIENT,;t t +s,@LIBSMBSHAREMODES_SHARED@,$LIBSMBSHAREMODES_SHARED,;t t +s,@LIBSMBSHAREMODES@,$LIBSMBSHAREMODES,;t t s,@PRINT_LIBS@,$PRINT_LIBS,;t t s,@AUTH_LIBS@,$AUTH_LIBS,;t t s,@ACL_LIBS@,$ACL_LIBS,;t t diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/configure.in samba-3.0.20a/source/configure.in --- samba-3.0.20/source/configure.in 2005-08-19 12:16:29.000000000 -0500 +++ samba-3.0.20a/source/configure.in 2005-09-29 16:52:47.665076000 -0500 @@ -219,6 +219,8 @@ AC_SUBST(INSTALLCLIENTCMD_A) AC_SUBST(LIBSMBCLIENT_SHARED) AC_SUBST(LIBSMBCLIENT) +AC_SUBST(LIBSMBSHAREMODES_SHARED) +AC_SUBST(LIBSMBSHAREMODES) AC_SUBST(PRINT_LIBS) AC_SUBST(AUTH_LIBS) AC_SUBST(ACL_LIBS) @@ -729,11 +731,9 @@ AC_HEADER_TIME AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(aio.h arpa/inet.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h rpc/nettype.h) -AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h) +AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h memory.h alloca.h) AC_CHECK_HEADERS(rpc/rpc.h rpcsvc/nis.h rpcsvc/ypclnt.h) -## These fail to compile on IRIX so just check for their presence -AC_CHECK_HEADERS(rpcsvc/yp_prot.h, sys/mode.h, [], [] -) -AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h) +AC_CHECK_HEADERS(sys/param.h ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/prctl.h) AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h sys/socket.h) AC_CHECK_HEADERS(sys/un.h) AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h termio.h) @@ -742,6 +742,15 @@ AC_CHECK_HEADERS(sys/syslog.h syslog.h execinfo.h) AC_CHECK_HEADERS(langinfo.h locale.h) +AC_CHECK_HEADERS(rpcsvc/yp_prot.h,,,[[ +#if HAVE_RPC_RPC_H +#include +#endif +]]) + +## These fail to compile on IRIX so just check for their presence +AC_CHECK_HEADERS(sys/mode.h,,,) + # Look for Darwin headers old_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-Iinclude $CPPFLAGS" @@ -784,8 +793,29 @@ AC_CHECK_HEADERS(sys/acl.h sys/attributes.h attr/xattr.h sys/xattr.h sys/extattr.h sys/uio.h) AC_CHECK_HEADERS(sys/cdefs.h glob.h) -## These faile to compile on Solaris so just check for their presence -AC_CHECK_HEADERS(security/pam_modules.h net/if.h netinet/ip.h, [], [], -) +AC_CHECK_HEADERS(netinet/ip.h,,,[[ +#include +#if HAVE_SYS_SOCKET_H +#include +#endif +#include +#if HAVE_NETINET_IN_SYSTM_H +#include +#endif +]]) + +AC_CHECK_HEADERS(net/if.h,,,[[ +#include +#if HAVE_SYS_SOCKET_H +#include +#endif +]]) + +AC_CHECK_HEADERS(security/pam_modules.h,,,[[ +#if HAVE_SECURITY_PAM_APPL_H +#include +#endif +]]) # For experimental utmp support (lastlog on some BSD-like systems) AC_CHECK_HEADERS(utmp.h utmpx.h lastlog.h) @@ -928,8 +958,20 @@ #include #include #endif -#include -#include ],[struct timespec ts;], +#if TIME_WITH_SYS_TIME +# include +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif +#if HAVE_AIO_H +#include +#endif +],[struct timespec ts;], samba_cv_struct_timespec=yes,samba_cv_struct_timespec=no)]) if test x"$samba_cv_struct_timespec" = x"yes"; then AC_DEFINE(HAVE_STRUCT_TIMESPEC,1,[Whether we have struct timespec]) @@ -1089,8 +1131,9 @@ AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent) AC_CHECK_FUNCS(initgroups select poll rdchk getgrnam getgrent pathconf realpath) AC_CHECK_FUNCS(setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate chsize stat64 fstat64) -AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64) +AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64) AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam setlinebuf) +AC_CHECK_FUNCS(opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64) AC_CHECK_FUNCS(srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink) AC_CHECK_FUNCS(syslog vsyslog timegm) AC_CHECK_FUNCS(setlocale nl_langinfo) @@ -1117,6 +1160,15 @@ AC_CHECK_FUNCS(pread _pread __pread pread64 _pread64 __pread64) AC_CHECK_FUNCS(pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64) AC_CHECK_FUNCS(open64 _open64 __open64 creat64) +AC_CHECK_FUNCS(prctl) + +AC_TRY_COMPILE([ +#ifdef HAVE_SYS_PRCTL_H +#include +#endif +], +[int i; i = prtcl(0); ], +AC_DEFINE(HAVE_PRCTL, 1, [Whether prctl is available]),[]) # # @@ -1594,6 +1646,19 @@ AC_DEFINE(HAVE_DEV64_T,1,[Whether the 'dev64_t' type is available]) fi +AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIR64,[ +AC_TRY_COMPILE([ +#if defined(HAVE_UNISTD_H) +#include +#endif +#include +#include ], +[DIR64 de;], +samba_cv_HAVE_STRUCT_DIR64=yes,samba_cv_HAVE_STRUCT_DIR64=no)]) +if test x"$samba_cv_HAVE_STRUCT_DIR64" = x"yes" && test x"$ac_cv_func_readdir64" = x"yes"; then + AC_DEFINE(HAVE_STRUCT_DIR64,1,[Whether the 'DIR64' abstract data type is available]) +fi + AC_CACHE_CHECK([for struct dirent64],samba_cv_HAVE_STRUCT_DIRENT64,[ AC_TRY_COMPILE([ #if defined(HAVE_UNISTD_H) @@ -3450,8 +3515,8 @@ samba_cv_TRY_QUOTAS=no samba_cv_RUN_QUOTA_TESTS=auto samba_cv_WITH_SYS_QUOTAS=auto -samba_cv_TRY_SYS_QUOTAS=no -samba_cv_SYSQUOTA_FOUND=no; +samba_cv_TRY_SYS_QUOTAS=auto +samba_cv_SYSQUOTA_FOUND=no AC_MSG_CHECKING(whether to try disk-quotas support) AC_ARG_WITH(quotas, @@ -3514,18 +3579,13 @@ AC_MSG_RESULT(${samba_cv_TRY_SYS_QUOTAS}) ) -if test x"$samba_cv_TRY_SYS_QUOTAS" != x"no"; then +if test x"$samba_cv_TRY_SYS_QUOTAS" = x"auto"; then AC_MSG_CHECKING(whether to try the lib/sysquotas.c interface on ${host_os}) case "$host_os" in *linux*) AC_MSG_RESULT(yes) samba_cv_TRY_SYS_QUOTAS=yes samba_cv_RUN_QUOTA_TESTS=yes - samba_cv_SYSQUOTA_FOUND=yes - AC_DEFINE(HAVE_QUOTACTL_LINUX,1,[Whether Linux quota support is available]) - samba_cv_sysquotas_file="lib/sysquotas_linux.c" - AC_DEFINE(HAVE_LINUX_XFS_QUOTAS,1,[Whether Linux xfs quota support is available]) - samba_cv_found_xfs_header=yes ;; *) AC_MSG_RESULT(no) @@ -3538,6 +3598,24 @@ # only check for quota stuff if --with-quotas if test x"$samba_cv_RUN_QUOTA_TESTS" != x"no"; then +case "$host_os" in + # on linux we didn't need to test we have builtin support + *linux*) + samba_cv_SYSQUOTA_FOUND=yes + AC_DEFINE(HAVE_QUOTACTL_LINUX,1,[Whether Linux quota support is available]) + samba_cv_sysquotas_file="lib/sysquotas_linux.c" + AC_MSG_CHECKING(whether to use the lib/sysquotas_linux.c builtin support) + AC_MSG_RESULT(yes) + + AC_DEFINE(HAVE_LINUX_XFS_QUOTAS,1,[Whether Linux xfs quota support is available]) + samba_cv_found_xfs_header=yes + AC_MSG_CHECKING(whether to use the lib/sysquotas_xfs.c builtin support) + AC_MSG_RESULT(yes) + ;; + *) + ;; +esac + # some broken header files need this AC_CHECK_HEADER(asm/types.h,[ AC_DEFINE(HAVE_ASM_TYPES_H,1,[check for ]) @@ -3827,6 +3905,56 @@ ) +INSTALLCLIENTCMD_SH=: +INSTALLCLIENTCMD_A=: +INSTALLCLIENT= +LIBSMBSHAREMODES_SHARED= +LIBSMBSHAREMODES= +AC_MSG_CHECKING(whether to build the libsmbsharemodes shared library) +AC_ARG_WITH(libsmbsharemodes, +[ --with-libsmbsharemodes Build the libsmbsharemodes shared library (default=yes if shared libs supported)], +[ case "$withval" in + no) + AC_MSG_RESULT(no) + ;; + *) + if test $BLDSHARED = true; then + INSTALLCLIENTCMD_SH="\$(INSTALLCMD)" + ## build the static version of libsmbsharemodes as well + INSTALLCLIENTCMD_A="\$(INSTALLCMD)" + LIBSMBSHAREMODES_SHARED=bin/libsmbsharemodes.$SHLIBEXT + LIBSMBSHAREMODES=libsmbsharemodes + AC_MSG_RESULT(yes) + else + enable_static=yes + AC_MSG_RESULT(no shared library support -- will supply static library) + fi + if test $enable_static = yes; then + INSTALLCLIENTCMD_A="\$(INSTALLCMD)" + LIBSMBSHAREMODES=libsmbsharemodes + fi + INSTALLCLIENT=installclientlib + ;; + esac ], +[ +# if unspecified, default is to built it iff possible. + if test $BLDSHARED = true; then + INSTALLCLIENTCMD_SH="\$(INSTALLCMD)" + LIBSMBSHAREMODES_SHARED=bin/libsmbsharemodes.$SHLIBEXT + LIBSMBSHAREMODES=libsmbsharemodes + AC_MSG_RESULT(yes) + else + enable_static=yes + AC_MSG_RESULT(no shared library support -- will supply static library) + fi + if test $enable_static = yes; then + INSTALLCLIENTCMD_A="\$(INSTALLCMD)" + LIBSMBSHAREMODES=libsmbsharemodes + fi] + INSTALLCLIENT=installclientlib +) + + ################################################# # these tests are taken from the GNU fileutils package AC_CHECKING(how to get filesystem space usage) @@ -4748,12 +4876,12 @@ esac ]) AC_SUBST(PYTHON) -for i in `echo $default_static_modules | sed -e's/,/ /g'` +for i in `echo $default_static_modules | sed -e 's/,/ /g'` do eval MODULE_DEFAULT_$i=STATIC done -for i in `echo $default_shared_modules | sed -e's/,/ /g'` +for i in `echo $default_shared_modules | sed -e 's/,/ /g'` do dnl Fall back to static if we cannot build shared libraries eval MODULE_DEFAULT_$i=STATIC @@ -4772,7 +4900,7 @@ AC_ARG_WITH(static-modules, [ --with-static-modules=MODULES Comma-seperated list of names of modules to statically link in], [ if test $withval; then - for i in `echo $withval | sed -e's/,/ /g'` + for i in `echo $withval | sed -e 's/,/ /g'` do eval MODULE_$i=STATIC done @@ -4781,7 +4909,7 @@ AC_ARG_WITH(shared-modules, [ --with-shared-modules=MODULES Comma-seperated list of names of modules to build shared], [ if test $withval; then - for i in `echo $withval | sed -e's/,/ /g'` + for i in `echo $withval | sed -e 's/,/ /g'` do eval MODULE_$i=SHARED done diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/include/config.h.in samba-3.0.20a/source/include/config.h.in --- samba-3.0.20/source/include/config.h.in 2005-08-19 14:08:58.000000000 -0500 +++ samba-3.0.20a/source/include/config.h.in 2005-09-29 17:35:48.575261242 -0500 @@ -123,6 +123,9 @@ /* Whether AIX ACLs are available */ #undef HAVE_AIX_ACLS +/* Define to 1 if you have the header file. */ +#undef HAVE_ALLOCA_H + /* Whether the AP_OPTS_USE_SUBKEY ap option is available */ #undef HAVE_AP_OPTS_USE_SUBKEY @@ -207,6 +210,9 @@ /* Define to 1 if you have the `chsize' function. */ #undef HAVE_CHSIZE +/* Define to 1 if you have the `closedir64' function. */ +#undef HAVE_CLOSEDIR64 + /* Whether the compiler will optimize out function calls */ #undef HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS @@ -872,6 +878,9 @@ /* Define to 1 if you have the `open64' function. */ #undef HAVE_OPEN64 +/* Define to 1 if you have the `opendir64' function. */ +#undef HAVE_OPENDIR64 + /* Defined if struct passwd has pw_age field */ #undef HAVE_PASSWD_PW_AGE @@ -893,6 +902,9 @@ /* Whether POSIX ACLs are available */ #undef HAVE_POSIX_ACLS +/* Whether prctl is available */ +#undef HAVE_PRCTL + /* Define to 1 if you have the `pread' function. */ #undef HAVE_PREAD @@ -962,6 +974,9 @@ /* Define to 1 if you have the `rename' function. */ #undef HAVE_RENAME +/* Define to 1 if you have the `rewinddir64' function. */ +#undef HAVE_REWINDDIR64 + /* Define to 1 if you have the `roken_getaddrinfo_hostspec' function. */ #undef HAVE_ROKEN_GETADDRINFO_HOSTSPEC @@ -998,6 +1013,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SECURITY__PAM_MACROS_H +/* Define to 1 if you have the `seekdir64' function. */ +#undef HAVE_SEEKDIR64 + /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT @@ -1187,6 +1205,9 @@ /* Define to 1 if you have the `strtoul' function. */ #undef HAVE_STRTOUL +/* Whether the 'DIR64' abstract data type is available */ +#undef HAVE_STRUCT_DIR64 + /* Whether the 'dirent64' struct is available */ #undef HAVE_STRUCT_DIRENT64 @@ -1276,6 +1297,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MMAN_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MODE_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MOUNT_H @@ -1286,6 +1310,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PRCTL_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PRIV_H @@ -1358,6 +1385,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_XATTR_H +/* Define to 1 if you have the `telldir64' function. */ +#undef HAVE_TELLDIR64 + /* Define to 1 if you have the header file. */ #undef HAVE_TERMIOS_H diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/include/includes.h samba-3.0.20a/source/include/includes.h --- samba-3.0.20/source/include/includes.h 2005-07-28 08:19:49.000000000 -0500 +++ samba-3.0.20a/source/include/includes.h 2005-09-29 16:52:47.052170000 -0500 @@ -744,6 +744,18 @@ #endif /* + * Type for DIR structure. + */ + +#ifndef SMB_STRUCT_DIR +# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_DIR64) +# define SMB_STRUCT_DIR DIR64 +# else +# define SMB_STRUCT_DIR DIR +# endif +#endif + +/* * Defines for 64 bit fcntl locks. */ diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/include/libsmbclient.h samba-3.0.20a/source/include/libsmbclient.h --- samba-3.0.20/source/include/libsmbclient.h 2005-07-28 08:19:50.000000000 -0500 +++ samba-3.0.20a/source/include/libsmbclient.h 2005-09-29 16:52:47.112161000 -0500 @@ -105,15 +105,15 @@ /** Length of this smbc_dirent in bytes */ unsigned int dirlen; - /** The length of the comment string in bytes (includes null - * terminator) + /** The length of the comment string in bytes (does not include + * null terminator) */ unsigned int commentlen; /** Points to the null terminated comment string */ char *comment; - /** The length of the name string in bytes (includes null - * terminator) + /** The length of the name string in bytes (does not include + * null terminator) */ unsigned int namelen; /** Points to the null terminated name string diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/include/regfio.h samba-3.0.20a/source/include/regfio.h --- samba-3.0.20/source/include/regfio.h 2005-07-28 08:19:50.000000000 -0500 +++ samba-3.0.20a/source/include/regfio.h 2005-09-29 16:52:47.084165000 -0500 @@ -80,6 +80,7 @@ typedef struct { uint32 nk_off; uint8 keycheck[sizeof(uint32)]; + char *fullname; } REGF_HASH_REC; typedef struct { diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/include/rpc_reg.h samba-3.0.20a/source/include/rpc_reg.h --- samba-3.0.20/source/include/rpc_reg.h 2005-07-28 08:19:50.000000000 -0500 +++ samba-3.0.20a/source/include/rpc_reg.h 2005-09-29 16:52:47.124159000 -0500 @@ -217,14 +217,17 @@ POLICY_HND handle; UNISTR4 name; UNISTR4 key_class; - uint32 reserved; + uint32 options; uint32 access; + + /* FIXME! collapse all this into one structure */ uint32 *sec_info; uint32 ptr2; BUFHDR hdr_sec; uint32 ptr3; SEC_DESC_BUF *data; - uint32 unknown_2; /* 0x0000 0000 */ + + uint32 *disposition; } REG_Q_CREATE_KEY_EX; typedef struct { diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/include/smb_macros.h samba-3.0.20a/source/include/smb_macros.h --- samba-3.0.20/source/include/smb_macros.h 2005-07-28 08:19:50.000000000 -0500 +++ samba-3.0.20a/source/include/smb_macros.h 2005-09-29 16:52:47.579090000 -0500 @@ -261,7 +261,7 @@ #define dos_format(fname) string_replace(fname,'/','\\') /***************************************************************************** - Check to see if we are a DO for this domain + Check to see if we are a DC for this domain *****************************************************************************/ #define IS_DC (lp_server_role()==ROLE_DOMAIN_PDC || lp_server_role()==ROLE_DOMAIN_BDC) diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/include/smb_share_modes.h samba-3.0.20a/source/include/smb_share_modes.h --- samba-3.0.20/source/include/smb_share_modes.h 1969-12-31 18:00:00.000000000 -0600 +++ samba-3.0.20a/source/include/smb_share_modes.h 2005-09-29 16:52:46.766214000 -0500 @@ -0,0 +1,110 @@ +/* + Samba share mode database library. + + Copyright (C) Jeremy Allison 2005. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef _SMB_SHARE_MODES_H_ +#define _SMB_STATE_MODES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif + +#include "tdb.h" + +/* Database context handle. */ +struct smbdb_ctx { + TDB_CONTEXT *smb_tdb; +}; + +/* Share mode entry. */ +/* + We use 64 bit types for device and inode as + we don't know what size mode Samba has been + compiled in - dev/ino may be 32, may be 64 + bits. This interface copes with either. +*/ + +struct smb_share_mode_entry { + uint64_t dev; + uint64_t ino; + uint32_t share_access; + uint32_t access_mask; + struct timeval open_time; + uint32_t file_id; + pid_t pid; +}; + +/* + * open/close sharemode database. + */ + +struct smbdb_ctx *smb_share_mode_db_open(const char *db_path); +int smb_share_mode_db_close(struct smbdb_ctx *db_ctx); + +/* + * lock/unlock entry in sharemode database. + */ + +int smb_lock_share_mode_entry(struct smbdb_ctx *db_ctx, + uint64_t dev, + uint64_t ino); + +int smb_unlock_share_mode_entry(struct smbdb_ctx *db_ctx, + uint64_t dev, + uint64_t ino); + +/* + * Share mode database accessor functions. + */ + +int smb_get_share_mode_entries(struct smbdb_ctx *db_ctx, + uint64_t dev, + uint64_t ino, + struct smb_share_mode_entry **pp_list, + unsigned char *p_delete_on_close); + +int smb_create_share_mode_entry(struct smbdb_ctx *db_ctx, + uint64_t dev, + uint64_t ino, + const struct smb_share_mode_entry *set_entry, + const char *path); + +int smb_delete_share_mode_entry(struct smbdb_ctx *db_ctx, + uint64_t dev, + uint64_t ino, + const struct smb_share_mode_entry *set_entry); + +int smb_change_share_mode_entry(struct smbdb_ctx *db_ctx, + uint64_t dev, + uint64_t ino, + const struct smb_share_mode_entry *set_entry, + const struct smb_share_mode_entry *new_entry); + +#ifdef __cplusplus +} +#endif +#endif diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/include/version.h samba-3.0.20a/source/include/version.h --- samba-3.0.20/source/include/version.h 2005-08-19 14:08:44.000000000 -0500 +++ samba-3.0.20a/source/include/version.h 2005-09-29 17:35:22.982187217 -0500 @@ -2,5 +2,6 @@ #define SAMBA_VERSION_MAJOR 3 #define SAMBA_VERSION_MINOR 0 #define SAMBA_VERSION_RELEASE 20 -#define SAMBA_VERSION_OFFICIAL_STRING "3.0.20" +#define SAMBA_VERSION_REVISION "a" +#define SAMBA_VERSION_OFFICIAL_STRING "3.0.20a" #define SAMBA_VERSION_STRING samba_version_string() diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/include/vfs.h samba-3.0.20a/source/include/vfs.h --- samba-3.0.20/source/include/vfs.h 2005-08-07 18:09:56.000000000 -0500 +++ samba-3.0.20a/source/include/vfs.h 2005-09-29 16:52:46.781212000 -0500 @@ -59,7 +59,8 @@ /* Changed to version 12 to add mask and attributes to opendir(). JRA Also include aio calls. JRA. */ /* Changed to version 13 as the internal structure of files_struct has changed. JRA */ -#define SMB_VFS_INTERFACE_VERSION 13 +/* Changed to version 14 as the we had to change DIR to SMB_STRUCT_DIR. JRA */ +#define SMB_VFS_INTERFACE_VERSION 14 /* to bug old modules which are trying to compile with the old functions */ @@ -224,14 +225,14 @@ /* Directory operations */ - DIR *(*opendir)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *fname, const char *mask, uint32 attributes); - SMB_STRUCT_DIRENT *(*readdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *dirp); - void (*seekdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *dirp, long offset); - long (*telldir)(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *dirp); - void (*rewind_dir)(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *dirp); + SMB_STRUCT_DIR *(*opendir)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *fname, const char *mask, uint32 attributes); + SMB_STRUCT_DIRENT *(*readdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_STRUCT_DIR *dirp); + void (*seekdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_STRUCT_DIR *dirp, long offset); + long (*telldir)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_STRUCT_DIR *dirp); + void (*rewind_dir)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_STRUCT_DIR *dirp); int (*mkdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, mode_t mode); int (*rmdir)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path); - int (*closedir)(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *dir); + int (*closedir)(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_STRUCT_DIR *dir); /* File operations */ diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/lib/fault.c samba-3.0.20a/source/lib/fault.c --- samba-3.0.20/source/lib/fault.c 2005-02-25 11:59:30.000000000 -0600 +++ samba-3.0.20a/source/lib/fault.c 2005-09-29 16:52:43.482718000 -0500 @@ -35,7 +35,8 @@ DEBUG(0,("===============================================================\n")); DEBUG(0,("INTERNAL ERROR: Signal %d in pid %d (%s)",sig,(int)sys_getpid(),SAMBA_VERSION_STRING)); - DEBUG(0,("\nPlease read the appendix Bugs of the Samba HOWTO collection\n")); + DEBUG(0,("\nPlease read the Trouble-Shooting section of the Samba3-HOWTO\n")); + DEBUG(0,("\nFrom: http://www.samba.org/samba/docs/Samba3-HOWTO.pdf\n")); DEBUG(0,("===============================================================\n")); smb_panic("internal error"); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/lib/messages.c samba-3.0.20a/source/lib/messages.c --- samba-3.0.20/source/lib/messages.c 2005-07-28 08:19:45.000000000 -0500 +++ samba-3.0.20a/source/lib/messages.c 2005-09-29 16:52:43.932649000 -0500 @@ -314,7 +314,7 @@ char *buf; unsigned int message_count = 0; - kbuf = message_key_pid(sys_getpid()); + kbuf = message_key_pid(pid); dbuf = tdb_fetch(tdb, kbuf); if (dbuf.dptr == NULL || dbuf.dsize == 0) { diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/lib/privileges.c samba-3.0.20a/source/lib/privileges.c --- samba-3.0.20/source/lib/privileges.c 2005-08-07 18:09:54.000000000 -0500 +++ samba-3.0.20a/source/lib/privileges.c 2005-09-29 16:52:43.723681000 -0500 @@ -285,6 +285,11 @@ if ( !tdb ) return False; + if ( !sid || (sid->num_auths == 0) ) { + DEBUG(0,("set_privileges: Refusing to store empty SID!\n")); + return False; + } + /* PRIV_ (NULL terminated) as the key */ fstr_sprintf( keystr, "%s%s", PRIVPREFIX, sid_string_static(sid) ); @@ -497,6 +502,12 @@ fstrcpy( sid_string, &key.dptr[strlen(PRIVPREFIX)] ); + /* this is a last ditch safety check to preventing returning + and invalid SID (i've somehow run into this on development branches) */ + + if ( strcmp( "S-0-0", sid_string ) == 0 ) + return 0; + if ( !string_to_sid(&sid, sid_string) ) { DEBUG(0,("travsersal_fn_enum__acct: Could not convert SID [%s]\n", sid_string)); @@ -811,11 +822,28 @@ /******************************************************************* *******************************************************************/ -BOOL privilege_set_to_se_priv( SE_PRIV *mask, PRIVILEGE_SET *privset ) +static BOOL luid_to_se_priv( LUID *luid, SE_PRIV *mask ) { int i; uint32 num_privs = count_all_privileges(); + for ( i=0; ilow == privs[i].luid.low ) { + se_priv_copy( mask, &privs[i].se_priv ); + return True; + } + } + + return False; +} + +/******************************************************************* +*******************************************************************/ + +BOOL privilege_set_to_se_priv( SE_PRIV *mask, PRIVILEGE_SET *privset ) +{ + int i; + ZERO_STRUCTP( mask ); for ( i=0; icount; i++ ) { @@ -827,12 +855,8 @@ if ( privset->set[i].luid.high != 0 ) return False; - /* make sure :LUID.low is in range */ - if ( privset->set[i].luid.low == 0 || privset->set[i].luid.low > num_privs ) - return False; - - r = privs[privset->set[i].luid.low - 1].se_priv; - se_priv_add( mask, &r ); + if ( luid_to_se_priv( &privset->set[i].luid, &r ) ) + se_priv_add( mask, &r ); } return True; diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/lib/sysquotas_4A.c samba-3.0.20a/source/lib/sysquotas_4A.c --- samba-3.0.20/source/lib/sysquotas_4A.c 2005-08-19 12:16:27.000000000 -0500 +++ samba-3.0.20a/source/lib/sysquotas_4A.c 2005-09-29 16:52:43.901653000 -0500 @@ -24,6 +24,12 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_QUOTA +#ifndef HAVE_SYS_QUOTAS +#ifdef HAVE_QUOTACTL_4A +#undef HAVE_QUOTACTL_4A +#endif +#endif + #ifdef HAVE_QUOTACTL_4A /* long quotactl(int cmd, char *special, qid_t id, caddr_t addr) */ /* this is used by: HPUX,IRIX */ diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/lib/sysquotas_linux.c samba-3.0.20a/source/lib/sysquotas_linux.c --- samba-3.0.20/source/lib/sysquotas_linux.c 2005-07-28 08:19:45.000000000 -0500 +++ samba-3.0.20a/source/lib/sysquotas_linux.c 2005-09-29 16:52:43.969643000 -0500 @@ -24,6 +24,12 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_QUOTA +#ifndef HAVE_SYS_QUOTAS +#ifdef HAVE_QUOTACTL_LINUX +#undef HAVE_QUOTACTL_LINUX +#endif +#endif + #ifdef HAVE_QUOTACTL_LINUX #include "samba_linux_quota.h" diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/lib/system.c samba-3.0.20a/source/lib/system.c --- samba-3.0.20/source/lib/system.c 2005-07-28 08:19:45.000000000 -0500 +++ samba-3.0.20a/source/lib/system.c 2005-09-29 16:52:43.761675000 -0500 @@ -366,7 +366,7 @@ An opendir wrapper that will deal with 64 bit filesizes. ********************************************************************/ -DIR *sys_opendir(const char *name) +SMB_STRUCT_DIR *sys_opendir(const char *name) { #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OPENDIR64) return opendir64(name); @@ -379,7 +379,7 @@ A readdir wrapper that will deal with 64 bit filesizes. ********************************************************************/ -SMB_STRUCT_DIRENT *sys_readdir(DIR *dirp) +SMB_STRUCT_DIRENT *sys_readdir(SMB_STRUCT_DIR *dirp) { #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_READDIR64) return readdir64(dirp); @@ -392,7 +392,7 @@ A seekdir wrapper that will deal with 64 bit filesizes. ********************************************************************/ -void sys_seekdir(DIR *dirp, long offset) +void sys_seekdir(SMB_STRUCT_DIR *dirp, long offset) { #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_SEEKDIR64) seekdir64(dirp, offset); @@ -405,7 +405,7 @@ A telldir wrapper that will deal with 64 bit filesizes. ********************************************************************/ -long sys_telldir(DIR *dirp) +long sys_telldir(SMB_STRUCT_DIR *dirp) { #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_TELLDIR64) return (long)telldir64(dirp); @@ -418,7 +418,7 @@ A rewinddir wrapper that will deal with 64 bit filesizes. ********************************************************************/ -void sys_rewinddir(DIR *dirp) +void sys_rewinddir(SMB_STRUCT_DIR *dirp) { #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_REWINDDIR64) rewinddir64(dirp); @@ -431,7 +431,7 @@ A close wrapper that will deal with 64 bit filesizes. ********************************************************************/ -int sys_closedir(DIR *dirp) +int sys_closedir(SMB_STRUCT_DIR *dirp) { #if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_CLOSEDIR64) return closedir64(dirp); @@ -960,7 +960,7 @@ Wide opendir. Just narrow and call sys_xxx. ****************************************************************************/ -DIR *wsys_opendir(const smb_ucs2_t *wfname) +SMB_STRUCT_DIR *wsys_opendir(const smb_ucs2_t *wfname) { pstring fname; return opendir(unicode_to_unix(fname,wfname,sizeof(fname))); @@ -970,7 +970,7 @@ Wide readdir. Return a structure pointer containing a wide filename. ****************************************************************************/ -SMB_STRUCT_WDIRENT *wsys_readdir(DIR *dirp) +SMB_STRUCT_WDIRENT *wsys_readdir(SMB_STRUCT_DIR *dirp) { static SMB_STRUCT_WDIRENT retval; SMB_STRUCT_DIRENT *dirval = sys_readdir(dirp); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/lib/talloc.c samba-3.0.20a/source/lib/talloc.c --- samba-3.0.20/source/lib/talloc.c 2005-07-28 08:19:45.000000000 -0500 +++ samba-3.0.20a/source/lib/talloc.c 2005-09-29 16:52:43.950646000 -0500 @@ -989,7 +989,6 @@ static char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap) { - struct talloc_chunk *tc; int len, s_len; va_list ap2; @@ -997,11 +996,9 @@ return talloc_vasprintf(NULL, fmt, ap); } - tc = talloc_chunk_from_ptr(s); - VA_COPY(ap2, ap); - s_len = tc->size - 1; + s_len = strlen(s); len = vsnprintf(NULL, 0, fmt, ap2); s = talloc_realloc(NULL, s, char, s_len + len+1); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/lib/util.c samba-3.0.20a/source/lib/util.c --- samba-3.0.20/source/lib/util.c 2005-08-19 12:16:27.000000000 -0500 +++ samba-3.0.20a/source/lib/util.c 2005-09-29 16:52:43.510713000 -0500 @@ -1618,7 +1618,7 @@ A readdir wrapper which just returns the file name. ********************************************************************/ -const char *readdirname(DIR *p) +const char *readdirname(SMB_STRUCT_DIR *p) { SMB_STRUCT_DIRENT *ptr; char *dname; diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/lib/util_unistr.c samba-3.0.20a/source/lib/util_unistr.c --- samba-3.0.20/source/lib/util_unistr.c 2005-08-19 12:16:27.000000000 -0500 +++ samba-3.0.20a/source/lib/util_unistr.c 2005-09-29 16:52:43.740678000 -0500 @@ -213,8 +213,9 @@ size_t dos_PutUniCode(char *dst,const char *src, ssize_t len, BOOL null_terminate) { - return push_ucs2(NULL, dst, src, len, - STR_UNICODE|STR_NOALIGN | (null_terminate?STR_TERMINATE:0)); + int flags = null_terminate ? STR_UNICODE|STR_NOALIGN|STR_TERMINATE + : STR_UNICODE|STR_NOALIGN; + return push_ucs2(NULL, dst, src, len, flags); } diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/libads/kerberos_verify.c samba-3.0.20a/source/libads/kerberos_verify.c --- samba-3.0.20/source/libads/kerberos_verify.c 2005-03-18 08:56:41.000000000 -0600 +++ samba-3.0.20a/source/libads/kerberos_verify.c 2005-09-29 16:52:47.748064000 -0500 @@ -86,7 +86,6 @@ goto out; } - ret = krb5_kt_start_seq_get(context, keytab, &kt_cursor); if (ret != KRB5_KT_END && ret != ENOENT ) { while (!auth_ok && (krb5_kt_next_entry(context, keytab, &kt_entry, &kt_cursor) == 0)) { ret = krb5_unparse_name(context, kt_entry.principal, &entry_princ_s); @@ -128,7 +127,11 @@ ZERO_STRUCT(kt_cursor); out: - + + for (i = 0; i < sizeof(valid_princ_formats) / sizeof(valid_princ_formats[0]); i++) { + SAFE_FREE(valid_princ_formats[i]); + } + if (!auth_ok) { if (!number_matched_principals) { DEBUG(3, ("ads_keytab_verify_ticket: no keytab principals matched expected file service name.\n")); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/libads/krb5_setpw.c samba-3.0.20a/source/libads/krb5_setpw.c --- samba-3.0.20/source/libads/krb5_setpw.c 2005-02-25 11:59:41.000000000 -0600 +++ samba-3.0.20a/source/libads/krb5_setpw.c 2005-09-29 16:52:47.850048000 -0500 @@ -317,23 +317,17 @@ switch(res_code) { case KRB5_KPASSWD_ACCESSDENIED: return KRB5KDC_ERR_BADOPTION; - break; case KRB5_KPASSWD_INITIAL_FLAG_NEEDED: return KRB5KDC_ERR_BADOPTION; /* return KV5M_ALT_METHOD; MIT-only define */ - break; case KRB5_KPASSWD_ETYPE_NOSUPP: return KRB5KDC_ERR_ETYPE_NOSUPP; - break; case KRB5_KPASSWD_BAD_PRINCIPAL: return KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN; - break; case KRB5_KPASSWD_POLICY_REJECT: return KRB5KDC_ERR_POLICY; - break; default: return KRB5KRB_ERR_GENERIC; - break; } } } diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/libsmb/clikrb5.c samba-3.0.20a/source/libsmb/clikrb5.c --- samba-3.0.20/source/libsmb/clikrb5.c 2005-07-28 08:19:46.000000000 -0500 +++ samba-3.0.20a/source/libsmb/clikrb5.c 2005-09-29 16:52:44.350585000 -0500 @@ -119,8 +119,10 @@ DEBUG(1,("krb5_get_pw_salt failed (%s)\n", error_message(ret))); return ret; } - return krb5_string_to_key_salt(context, enctype, password->data, - salt, key); + + ret = krb5_string_to_key_salt(context, enctype, password->data, salt, key); + krb5_free_salt(context, salt); + return ret; } #else #error UNKNOWN_CREATE_KEY_FUNCTIONS diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/libsmb/credentials.c samba-3.0.20a/source/libsmb/credentials.c --- samba-3.0.20/source/libsmb/credentials.c 2005-08-07 18:09:54.000000000 -0500 +++ samba-3.0.20a/source/libsmb/credentials.c 2005-09-29 16:52:44.365582000 -0500 @@ -208,36 +208,8 @@ DEBUG(5,("deal_with_creds: clnt_cred=%s\n", credstr(sto_clnt_cred->challenge.data))); - /* Bug #2953 - don't store new seed in client credentials - here, because we need to make sure we're moving forward first - */ + /* store new seed in client credentials */ + SIVAL(sto_clnt_cred->challenge.data, 0, new_cred); return True; } - -/* - stores new seed in client credentials - jmcd - Bug #2953 - moved this functionality out of deal_with_creds, because we're - not supposed to move to the next step in the chain if a nonexistent user tries to logon -*/ -void reseed_client_creds(DOM_CRED *sto_clnt_cred, DOM_CRED *rcv_clnt_cred) -{ - UTIME new_clnt_time; - uint32 new_cred; - - /* increment client time by one second */ - new_clnt_time.time = rcv_clnt_cred->timestamp.time + 1; - - /* first 4 bytes of the new seed is old client 4 bytes + clnt time + 1 */ - new_cred = IVAL(sto_clnt_cred->challenge.data, 0); - new_cred += new_clnt_time.time; - - DEBUG(5,("reseed_client_creds: new_cred[0]=%x\n", new_cred)); - DEBUG(5,("reseed_client_creds: new_clnt_time=%x\n", - new_clnt_time.time)); - DEBUG(5,("reseed_client_creds: clnt_cred=%s\n", - credstr(sto_clnt_cred->challenge.data))); - - /* store new seed in client credentials */ - SIVAL(sto_clnt_cred->challenge.data, 0, new_cred); -} diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/libsmb/smb_share_modes.c samba-3.0.20a/source/libsmb/smb_share_modes.c --- samba-3.0.20/source/libsmb/smb_share_modes.c 1969-12-31 18:00:00.000000000 -0600 +++ samba-3.0.20a/source/libsmb/smb_share_modes.c 2005-09-29 16:52:44.163613000 -0500 @@ -0,0 +1,462 @@ +/* + Samba share mode database library external interface library. + Used by non-Samba products needing access to the Samba share mode db. + + Copyright (C) Jeremy Allison 2005. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "includes.h" +#include "smb_share_modes.h" + +/* Remove the paranoid malloc checker. */ +#ifdef malloc +#undef malloc +#endif + +/* + * open/close sharemode database. + */ + +struct smbdb_ctx *smb_share_mode_db_open(const char *db_path) +{ + struct smbdb_ctx *smb_db = (struct smbdb_ctx *)malloc(sizeof(struct smbdb_ctx)); + + if (!smb_db) { + return NULL; + } + + memset(smb_db, '\0', sizeof(struct smbdb_ctx)); + + smb_db->smb_tdb = tdb_open(db_path, + 0, TDB_DEFAULT|TDB_CLEAR_IF_FIRST, + O_RDWR|O_CREAT, + 0644); + + if (!smb_db->smb_tdb) { + free(smb_db); + return NULL; + } + + /* Should check that this is the correct version.... */ + return smb_db; +} + +int smb_share_mode_db_close(struct smbdb_ctx *db_ctx) +{ + int ret = tdb_close(db_ctx->smb_tdb); + free(db_ctx); + return ret; +} + +static TDB_DATA get_locking_key(uint64_t dev, uint64_t ino) +{ + static struct locking_key lk; + TDB_DATA ld; + + memset(&lk, '\0', sizeof(struct locking_key)); + lk.dev = (SMB_DEV_T)dev; + lk.inode = (SMB_INO_T)ino; + ld.dptr = (char *)&lk; + ld.dsize = sizeof(lk); + return ld; +} + +/* + * lock/unlock entry in sharemode database. + */ + +int smb_lock_share_mode_entry(struct smbdb_ctx *db_ctx, + uint64_t dev, + uint64_t ino) +{ + return tdb_chainlock(db_ctx->smb_tdb, get_locking_key(dev, ino)); +} + +int smb_unlock_share_mode_entry(struct smbdb_ctx *db_ctx, + uint64_t dev, + uint64_t ino) +{ + return tdb_chainunlock(db_ctx->smb_tdb, get_locking_key(dev, ino)); +} + +/* Internal structure of Samba share mode db. */ +/* FIXME ! This should be moved into a Samba include file. */ + +struct locking_data { + union { + struct { + int num_share_mode_entries; + BOOL delete_on_close; + } s; + share_mode_entry dummy; /* Needed for alignment. */ + } u; + /* the following two entries are implicit + share_mode_entry modes[num_share_mode_entries]; + char file_name[]; + */ +}; + +/* + * Check if an external smb_share_mode_entry and an internal share_mode entry match. + */ + +static int share_mode_entry_equal(const struct smb_share_mode_entry *e_entry, const share_mode_entry *entry) +{ + return (e_entry->pid == entry->pid && + e_entry->file_id == (uint32_t)entry->share_file_id && + e_entry->open_time.tv_sec == entry->time.tv_sec && + e_entry->open_time.tv_usec == entry->time.tv_usec && + e_entry->share_access == (uint32_t)entry->share_access && + e_entry->access_mask == (uint32_t)entry->access_mask && + e_entry->dev == (uint64_t)entry->dev && + e_entry->ino == (uint64_t)entry->inode); +} + +/* + * Create an internal Samba share_mode entry from an external smb_share_mode_entry. + */ + +static void create_share_mode_entry(share_mode_entry *out, const struct smb_share_mode_entry *in) +{ + memset(out, '\0', sizeof(share_mode_entry)); + + out->pid = in->pid; + out->share_file_id = (unsigned long)in->file_id; + out->time.tv_sec = in->open_time.tv_sec; + out->time.tv_usec = in->open_time.tv_usec; + out->share_access = in->share_access; + out->access_mask = in->access_mask; + out->dev = (SMB_DEV_T)in->dev; + out->inode = (SMB_INO_T)in->ino; +} + +/* + * Return the current share mode list for an open file. + * This uses similar (but simplified) logic to locking/locking.c + */ + +int smb_get_share_mode_entries(struct smbdb_ctx *db_ctx, + uint64_t dev, + uint64_t ino, + struct smb_share_mode_entry **pp_list, + unsigned char *p_delete_on_close) +{ + TDB_DATA db_data; + struct smb_share_mode_entry *list = NULL; + int num_share_modes = 0; + struct locking_data *ld = NULL; /* internal samba db state. */ + share_mode_entry *shares = NULL; + size_t i; + int list_num; + + *pp_list = NULL; + *p_delete_on_close = 0; + + db_data = tdb_fetch(db_ctx->smb_tdb, get_locking_key(dev, ino)); + if (!db_data.dptr) { + return 0; + } + + ld = (struct locking_data *)db_data.dptr; + num_share_modes = ld->u.s.num_share_mode_entries; + + if (!num_share_modes) { + free(db_data.dptr); + return 0; + } + + list = (struct smb_share_mode_entry *)malloc(sizeof(struct smb_share_mode_entry)*num_share_modes); + if (!list) { + free(db_data.dptr); + return -1; + } + + memset(list, '\0', num_share_modes * sizeof(struct smb_share_mode_entry)); + + shares = (share_mode_entry *)(db_data.dptr + sizeof(share_mode_entry)); + + list_num = 0; + for (i = 0; i < num_share_modes; i++) { + share_mode_entry *share = &shares[i]; + struct smb_share_mode_entry *sme = &list[list_num]; + pid_t pid = share->pid; + + /* Check this process really exists. */ + if (kill(pid, 0) == -1 && (errno == ESRCH)) { + continue; /* No longer exists. */ + } + + /* Copy into the external list. */ + sme->dev = (uint64_t)share->dev; + sme->ino = (uint64_t)share->inode; + sme->share_access = (uint32_t)share->share_access; + sme->access_mask = (uint32_t)share->access_mask; + sme->open_time.tv_sec = share->time.tv_sec; + sme->open_time.tv_usec = share->time.tv_usec; + sme->file_id = (uint32_t)share->share_file_id; + sme->pid = share->pid; + list_num++; + } + + if (list_num == 0) { + free(db_data.dptr); + free(list); + return 0; + } + + *p_delete_on_close = ld->u.s.delete_on_close; + *pp_list = list; + free(db_data.dptr); + return list_num; +} + +/* + * Create an entry in the Samba share mode db. + */ + +int smb_create_share_mode_entry(struct smbdb_ctx *db_ctx, + uint64_t dev, + uint64_t ino, + const struct smb_share_mode_entry *new_entry, + const char *filename) /* Must be abolute utf8 path. */ +{ + TDB_DATA db_data; + TDB_DATA locking_key = get_locking_key(dev, ino); + int orig_num_share_modes = 0; + struct locking_data *ld = NULL; /* internal samba db state. */ + share_mode_entry *shares = NULL; + char *new_data_p = NULL; + size_t new_data_size = 0; + + db_data = tdb_fetch(db_ctx->smb_tdb, locking_key); + if (!db_data.dptr) { + /* We must create the entry. */ + db_data.dptr = malloc((2*sizeof(share_mode_entry)) + strlen(filename) + 1); + if (!db_data.dptr) { + return -1; + } + ld = (struct locking_data *)db_data.dptr; + ld->u.s.num_share_mode_entries = 1; + ld->u.s.delete_on_close = 0; + shares = (share_mode_entry *)(db_data.dptr + sizeof(share_mode_entry)); + create_share_mode_entry(shares, new_entry); + memcpy(db_data.dptr + 2*sizeof(share_mode_entry), + filename, + strlen(filename) + 1); + + db_data.dsize = 2*sizeof(share_mode_entry) + strlen(filename) + 1; + if (tdb_store(db_ctx->smb_tdb, locking_key, db_data, TDB_INSERT) == -1) { + free(db_data.dptr); + return -1; + } + free(db_data.dptr); + return 0; + } + + /* Entry exists, we must add a new entry. */ + new_data_p = malloc(db_data.dsize + sizeof(share_mode_entry)); + if (!new_data_p) { + free(db_data.dptr); + return -1; + } + + ld = (struct locking_data *)db_data.dptr; + orig_num_share_modes = ld->u.s.num_share_mode_entries; + + /* Copy the original data. */ + memcpy(new_data_p, db_data.dptr, (orig_num_share_modes+1)*sizeof(share_mode_entry)); + + /* Add in the new share mode */ + shares = (share_mode_entry *)(new_data_p + + ((orig_num_share_modes+1)*sizeof(share_mode_entry))); + + create_share_mode_entry(shares, new_entry); + + ld = (struct locking_data *)new_data_p; + ld->u.s.num_share_mode_entries++; + + /* Append the original filename */ + memcpy(new_data_p + ((ld->u.s.num_share_mode_entries+1)*sizeof(share_mode_entry)), + db_data.dptr + ((orig_num_share_modes+1)*sizeof(share_mode_entry)), + db_data.dsize - ((orig_num_share_modes+1) * sizeof(share_mode_entry))); + + new_data_size = db_data.dsize + sizeof(share_mode_entry); + + free(db_data.dptr); + + db_data.dptr = new_data_p; + db_data.dsize = new_data_size; + + if (tdb_store(db_ctx->smb_tdb, locking_key, db_data, TDB_REPLACE) == -1) { + free(db_data.dptr); + return -1; + } + free(db_data.dptr); + return 0; +} + +int smb_delete_share_mode_entry(struct smbdb_ctx *db_ctx, + uint64_t dev, + uint64_t ino, + const struct smb_share_mode_entry *del_entry) +{ + TDB_DATA db_data; + TDB_DATA locking_key = get_locking_key(dev, ino); + int orig_num_share_modes = 0; + struct locking_data *ld = NULL; /* internal samba db state. */ + share_mode_entry *shares = NULL; + char *new_data_p = NULL; + size_t filename_size = 0; + size_t i, num_share_modes; + const char *fname_ptr = NULL; + + db_data = tdb_fetch(db_ctx->smb_tdb, locking_key); + if (!db_data.dptr) { + return -1; /* Error - missing entry ! */ + } + + ld = (struct locking_data *)db_data.dptr; + orig_num_share_modes = ld->u.s.num_share_mode_entries; + shares = (share_mode_entry *)(db_data.dptr + sizeof(share_mode_entry)); + + if (orig_num_share_modes == 1) { + /* Only one entry - better be ours... */ + if (!share_mode_entry_equal(del_entry, shares)) { + /* Error ! We can't delete someone else's entry ! */ + free(db_data.dptr); + return -1; + } + /* It's ours - just remove the entire record. */ + free(db_data.dptr); + return tdb_delete(db_ctx->smb_tdb, locking_key); + } + + /* More than one - allocate a new record minus the one we'll delete. */ + new_data_p = malloc(db_data.dsize - sizeof(share_mode_entry)); + if (!new_data_p) { + free(db_data.dptr); + return -1; + } + + /* Copy the header. */ + memcpy(new_data_p, db_data.dptr, sizeof(share_mode_entry)); + + num_share_modes = 0; + for (i = 0; i < orig_num_share_modes; i++) { + share_mode_entry *share = &shares[i]; + pid_t pid = share->pid; + + /* Check this process really exists. */ + if (kill(pid, 0) == -1 && (errno == ESRCH)) { + continue; /* No longer exists. */ + } + + if (share_mode_entry_equal(del_entry, share)) { + continue; /* This is our delete taget. */ + } + + memcpy(new_data_p + ((num_share_modes+1)*sizeof(share_mode_entry)), + share, sizeof(share_mode_entry) ); + + num_share_modes++; + } + + if (num_share_modes == 0) { + /* None left after pruning. Delete record. */ + free(db_data.dptr); + free(new_data_p); + return tdb_delete(db_ctx->smb_tdb, locking_key); + } + + /* Copy the terminating filename. */ + fname_ptr = db_data.dptr + ((orig_num_share_modes+1) * sizeof(share_mode_entry)); + filename_size = db_data.dsize - (fname_ptr - db_data.dptr); + + memcpy(new_data_p + ((num_share_modes+1)*sizeof(share_mode_entry)), + fname_ptr, + filename_size); + + free(db_data.dptr); + + db_data.dptr = new_data_p; + + /* Re-save smaller record. */ + ld = (struct locking_data *)db_data.dptr; + ld->u.s.num_share_mode_entries = num_share_modes; + + db_data.dsize = ((num_share_modes+1)*sizeof(share_mode_entry)) + filename_size; + + if (tdb_store(db_ctx->smb_tdb, locking_key, db_data, TDB_REPLACE) == -1) { + free(db_data.dptr); + return -1; + } + free(db_data.dptr); + return 0; +} + +int smb_change_share_mode_entry(struct smbdb_ctx *db_ctx, + uint64_t dev, + uint64_t ino, + const struct smb_share_mode_entry *set_entry, + const struct smb_share_mode_entry *new_entry) +{ + TDB_DATA db_data; + TDB_DATA locking_key = get_locking_key(dev, ino); + int num_share_modes = 0; + struct locking_data *ld = NULL; /* internal samba db state. */ + share_mode_entry *shares = NULL; + size_t i; + int found_entry = 0; + + db_data = tdb_fetch(db_ctx->smb_tdb, locking_key); + if (!db_data.dptr) { + return -1; /* Error - missing entry ! */ + } + + ld = (struct locking_data *)db_data.dptr; + num_share_modes = ld->u.s.num_share_mode_entries; + shares = (share_mode_entry *)(db_data.dptr + sizeof(share_mode_entry)); + + for (i = 0; i < num_share_modes; i++) { + share_mode_entry *share = &shares[i]; + pid_t pid = share->pid; + + /* Check this process really exists. */ + if (kill(pid, 0) == -1 && (errno == ESRCH)) { + continue; /* No longer exists. */ + } + + if (share_mode_entry_equal(set_entry, share)) { + create_share_mode_entry(share, new_entry); + found_entry = 1; + break; + } + } + + if (!found_entry) { + free(db_data.dptr); + return -1; + } + + /* Save modified data. */ + if (tdb_store(db_ctx->smb_tdb, locking_key, db_data, TDB_REPLACE) == -1) { + free(db_data.dptr); + return -1; + } + free(db_data.dptr); + return 0; +} diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/Makefile.in samba-3.0.20a/source/Makefile.in --- samba-3.0.20/source/Makefile.in 2005-08-07 18:09:57.000000000 -0500 +++ samba-3.0.20a/source/Makefile.in 2005-09-29 16:52:39.681301000 -0500 @@ -97,8 +97,12 @@ LIBSMBCLIENT_MAJOR=0 LIBSMBCLIENT_MINOR=1 +LIBSMBSHAREMODES=bin/libsmbsharemodes.a @LIBSMBSHAREMODES_SHARED@ +LIBSMBSHAREMODES_MAJOR=0 +LIBSMBSHAREMODES_MINOR=1 -FLAGS1 = $(CFLAGS) @FLAGS1@ -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx @SMBWRAP_INC@ -I. $(CPPFLAGS) -I$(srcdir) + +FLAGS1 = $(CFLAGS) @FLAGS1@ -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx @SMBWRAP_INC@ -I. $(CPPFLAGS) -I$(srcdir) -I$(srcdir)/tdb FLAGS2 = FLAGS3 = FLAGS4 = @@ -137,7 +141,7 @@ EVERYTHING_PROGS = bin/debug2html@EXEEXT@ bin/smbfilter@EXEEXT@ bin/talloctort@EXEEXT@ \ bin/log2pcap@EXEEXT@ -SHLIBS = @SHLIB_PROGS@ @LIBSMBCLIENT@ +SHLIBS = @SHLIB_PROGS@ @LIBSMBCLIENT@ @LIBSMBSHAREMODES@ SCRIPTS = $(srcdir)/script/smbtar $(builddir)/script/findsmb @@ -510,6 +514,7 @@ $(LIBMSRPC_OBJ) $(RPC_PARSE_OBJ) \ $(SECRETS_OBJ) $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ) +LIBSMBSHAREMODES_OBJ = libsmb/smb_share_modes.o tdb/tdb.o tdb/spinlock.o # This shared library is intended for linking with unit test programs # to test Samba internals. It's called libbigballofmud.so to # discourage casual usage. @@ -633,6 +638,7 @@ PICOBJS = $(SMBWRAPPER_OBJ:.o=.@PICSUFFIX@) LIBSMBCLIENT_PICOBJS = $(LIBSMBCLIENT_OBJ:.o=.@PICSUFFIX@) +LIBSMBSHAREMODES_PICOBJS = $(LIBSMBSHAREMODES_OBJ:.o=.@PICSUFFIX@) PAM_SMBPASS_OBJ_0 = pam_smbpass/pam_smb_auth.o pam_smbpass/pam_smb_passwd.o \ pam_smbpass/pam_smb_acct.o pam_smbpass/support.o \ @@ -682,9 +688,9 @@ TDBBACKUP_OBJ = tdb/tdbbackup.o tdb/tdbback.o $(SNPRINTF_OBJ) $(TDBBASE_OBJ) -TDBTOOL_OBJ = tdb/tdbtool.o $(TDBBASE_OBJ) +TDBTOOL_OBJ = tdb/tdbtool.o $(TDBBASE_OBJ) $(SNPRINTF_OBJ) -TDBDUMP_OBJ = tdb/tdbdump.o $(TDBBASE_OBJ) +TDBDUMP_OBJ = tdb/tdbdump.o $(TDBBASE_OBJ) $(SNPRINTF_OBJ) NTLM_AUTH_OBJ1 = utils/ntlm_auth.o utils/ntlm_auth_diagnostics.o @@ -854,7 +860,7 @@ bin/profiles@EXEEXT@: $(PROFILES_OBJ) @BUILD_POPT@ bin/.dummy @echo Linking $@ - @$(CC) $(FLAGS) @PIE_LDFLAGS@ -o $@ $(PROFILES_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ @SOCKWRAP@ + @$(CC) $(FLAGS) @PIE_LDFLAGS@ -o $@ $(PROFILES_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @POPTLIBS@ bin/smbspool@EXEEXT@: $(CUPS_OBJ) bin/.dummy @echo Linking $@ @@ -996,6 +1002,16 @@ @echo Linking libsmbclient non-shared library $@ @-$(AR) -rc $@ $(LIBSMBCLIENT_PICOBJS) +bin/libsmbsharemodes.@SHLIBEXT@: $(LIBSMBSHAREMODES_PICOBJS) + @echo Linking libsmbsharemodes shared library $@ + @$(SHLD) $(LDSHFLAGS) -o $@ $(LIBSMBSHAREMODES_PICOBJS) $(LDFLAGS) $(LIBS) \ + $(KRB5LIBS) $(LDAP_LIBS) \ + @SONAMEFLAG@`basename $@`.$(LIBSMBSHAREMODES_MAJOR) + +bin/libsmbsharemodes.a: $(LIBSMBSHAREMODES_PICOBJS) + @echo Linking libsmbsharemodes non-shared library $@ + @-$(AR) -rc $@ $(LIBSMBSHAREMODES_PICOBJS) + # This is probably wrong for anything other than the GNU linker. bin/libbigballofmud.@SHLIBEXT@: $(LIBBIGBALLOFMUD_PICOBJS) @echo Linking bigballofmud shared library $@ @@ -1010,6 +1026,7 @@ # library. libsmbclient: $(LIBSMBCLIENT) +libsmbsharemodes: $(LIBSMBSHAREMODES) bin/librpc_lsarpc.@SHLIBEXT@: $(RPC_LSA_OBJ) @echo "Linking $@" @@ -1269,15 +1286,15 @@ bin/tdbbackup@EXEEXT@: $(TDBBACKUP_OBJ) bin/.dummy @echo Linking $@ - @$(CC) $(FLAGS) @PIE_LDFLAGS@ -o $@ $(DYNEXP) $(TDBBACKUP_OBJ) @SOCKWRAP@ + @$(CC) $(FLAGS) @PIE_LDFLAGS@ -o $@ $(LDFLAGS) $(DYNEXP) $(LIBS) $(TDBBACKUP_OBJ) @SOCKWRAP@ bin/tdbtool@EXEEXT@: $(TDBTOOL_OBJ) bin/.dummy @echo Linking $@ - @$(CC) $(FLAGS) @PIE_LDFLAGS@ -o $@ $(DYNEXP) $(TDBTOOL_OBJ) @SOCKWRAP@ + @$(CC) $(FLAGS) @PIE_LDFLAGS@ -o $@ $(LDFLAGS) $(DYNEXP) $(LIBS) $(TDBTOOL_OBJ) @SOCKWRAP@ bin/tdbdump@EXEEXT@: $(TDBDUMP_OBJ) bin/.dummy @echo Linking $@ - @$(CC) $(FLAGS) @PIE_LDFLAGS@ -o $@ $(DYNEXP) $(TDBDUMP_OBJ) @SOCKWRAP@ + @$(CC) $(FLAGS) @PIE_LDFLAGS@ -o $@ $(LDFLAGS) $(DYNEXP) $(LIBS) $(TDBDUMP_OBJ) @SOCKWRAP@ bin/t_strcmp@EXEEXT@: bin/libbigballofmud.@SHLIBEXT@ torture/t_strcmp.o $(CC) $(FLAGS) @PIE_LDFLAGS@ -o $@ $(DYNEXP) $(LIBS) torture/t_strcmp.o -L ./bin -lbigballofmud @@ -1433,7 +1450,8 @@ clean: delheaders python_clean -rm -f core */*~ *~ */*.o */*.@PICSUFFIX@ */*.@SHLIBEXT@ \ $(TOPFILES) $(BIN_PROGS) $(SBIN_PROGS) $(MODULES) $(TORTURE_PROGS) \ - $(LIBSMBCLIENT) $(EVERYTHING_PROGS) .headers.stamp + $(LIBSMBCLIENT) $(LIBSMBSHAREMODES) $(EVERYTHING_PROGS) .headers.stamp + -rm -rf t_dir # Making this target will just make sure that the prototype files # exist, not necessarily that they are up to date. Since they're diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/modules/vfs_audit.c samba-3.0.20a/source/modules/vfs_audit.c --- samba-3.0.20/source/modules/vfs_audit.c 2005-07-28 08:19:46.000000000 -0500 +++ samba-3.0.20a/source/modules/vfs_audit.c 2005-09-29 16:52:44.133618000 -0500 @@ -31,7 +31,7 @@ static int audit_connect(vfs_handle_struct *handle, connection_struct *conn, const char *svc, const char *user); static void audit_disconnect(vfs_handle_struct *handle, connection_struct *conn); -static DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr); +static SMB_STRUCT_DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr); static int audit_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode); static int audit_rmdir(vfs_handle_struct *handle, connection_struct *conn, const char *path); static int audit_open(vfs_handle_struct *handle, connection_struct *conn, const char *fname, int flags, mode_t mode); @@ -119,9 +119,9 @@ return; } -static DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) +static SMB_STRUCT_DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) { - DIR *result; + SMB_STRUCT_DIR *result; result = SMB_VFS_NEXT_OPENDIR(handle, conn, fname, mask, attr); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/modules/vfs_cap.c samba-3.0.20a/source/modules/vfs_cap.c --- samba-3.0.20/source/modules/vfs_cap.c 2005-07-28 08:19:46.000000000 -0500 +++ samba-3.0.20a/source/modules/vfs_cap.c 2005-09-29 16:52:44.127619000 -0500 @@ -38,14 +38,14 @@ dfree, dsize); } -static DIR *cap_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) +static SMB_STRUCT_DIR *cap_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) { pstring capname; capencode(capname, fname); return SMB_VFS_NEXT_OPENDIR(handle, conn, capname, mask, attr); } -static SMB_STRUCT_DIRENT *cap_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +static SMB_STRUCT_DIRENT *cap_readdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) { SMB_STRUCT_DIRENT *result; DEBUG(3,("cap: cap_readdir\n")); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/modules/vfs_catia.c samba-3.0.20a/source/modules/vfs_catia.c --- samba-3.0.20/source/modules/vfs_catia.c 2005-07-28 08:19:45.000000000 -0500 +++ samba-3.0.20a/source/modules/vfs_catia.c 2005-09-29 16:52:44.055630000 -0500 @@ -71,7 +71,7 @@ catia_string_replace(s, '\xb1', ' '); } -static DIR *catia_opendir(vfs_handle_struct *handle, connection_struct +static SMB_STRUCT_DIR *catia_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) { pstring name; @@ -82,7 +82,7 @@ } static SMB_STRUCT_DIRENT *catia_readdir(vfs_handle_struct *handle, - connection_struct *conn, DIR *dirp) + connection_struct *conn, SMB_STRUCT_DIR *dirp) { SMB_STRUCT_DIRENT *result = SMB_VFS_NEXT_READDIR(handle, conn, dirp); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/modules/vfs_default_quota.c samba-3.0.20a/source/modules/vfs_default_quota.c --- samba-3.0.20/source/modules/vfs_default_quota.c 2005-02-25 11:59:34.000000000 -0600 +++ samba-3.0.20a/source/modules/vfs_default_quota.c 2005-09-29 16:52:44.085625000 -0500 @@ -18,6 +18,56 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +/* + * This module allows the default quota values, + * in the windows explorer GUI, to be stored on a samba server. + * The problem is that linux filesystems only store quotas + * for users and groups, but no default quotas. + * + * Samba returns NO_LIMIT as the default quotas by default + * and refuses to update them. + * + * With this module you can store the default quotas that are reported to + * a windows client, in the quota record of a user. By default the root user + * is taken because quota limits for root are typically not enforced. + * + * This module takes 2 parametric parameters in smb.conf: + * (the default prefix for them is 'default_quota', + * it can be overwrittem when you load the module in + * the 'vfs objects' parameter like this: + * vfs objects = default_quota:myprefix) + * + * ":uid" parameter takes a integer argument, + * it specifies the uid of the quota record, that will be taken for + * storing the default USER-quotas. + * + * - default value: '0' (for root user) + * - e.g.: default_quota:uid = 65534 + * + * ":uid nolimit" parameter takes a boolean argument, + * it specifies if we should report the stored default quota values, + * also for the user record, or if you should just report NO_LIMIT + * to the windows client for the user specified by the ":uid" parameter. + * + * - default value: yes (that means to report NO_LIMIT) + * - e.g.: default_quota:uid nolimit = no + * + * ":gid" parameter takes a integer argument, + * it's just like ":uid" but for group quotas. + * (NOTE: group quotas are not supported from the windows explorer!) + * + * - default value: '0' (for root group) + * - e.g.: default_quota:gid = 65534 + * + * ":gid nolimit" parameter takes a boolean argument, + * it's just like ":uid nolimit" but for group quotas. + * (NOTE: group quotas are not supported from the windows explorer!) + * + * - default value: yes (that means to report NO_LIMIT) + * - e.g.: default_quota:uid nolimit = no + * + */ + #include "includes.h" #undef DBGC_CLASS diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/modules/vfs_extd_audit.c samba-3.0.20a/source/modules/vfs_extd_audit.c --- samba-3.0.20/source/modules/vfs_extd_audit.c 2005-07-28 08:19:46.000000000 -0500 +++ samba-3.0.20a/source/modules/vfs_extd_audit.c 2005-09-29 16:52:44.080626000 -0500 @@ -34,7 +34,7 @@ static int audit_connect(vfs_handle_struct *handle, connection_struct *conn, const char *svc, const char *user); static void audit_disconnect(vfs_handle_struct *handle, connection_struct *conn); -static DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr); +static SMB_STRUCT_DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr); static int audit_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode); static int audit_rmdir(vfs_handle_struct *handle, connection_struct *conn, const char *path); static int audit_open(vfs_handle_struct *handle, connection_struct *conn, const char *fname, int flags, mode_t mode); @@ -125,9 +125,9 @@ return; } -static DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) +static SMB_STRUCT_DIR *audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) { - DIR *result; + SMB_STRUCT_DIR *result; result = SMB_VFS_NEXT_OPENDIR(handle, conn, fname, mask, attr); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/modules/vfs_full_audit.c samba-3.0.20a/source/modules/vfs_full_audit.c --- samba-3.0.20/source/modules/vfs_full_audit.c 2005-07-28 08:19:45.000000000 -0500 +++ samba-3.0.20a/source/modules/vfs_full_audit.c 2005-09-29 16:52:44.073627000 -0500 @@ -86,22 +86,22 @@ struct files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, BOOL labels); -static DIR *smb_full_audit_opendir(vfs_handle_struct *handle, connection_struct *conn, +static SMB_STRUCT_DIR *smb_full_audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr); static SMB_STRUCT_DIRENT *smb_full_audit_readdir(vfs_handle_struct *handle, - connection_struct *conn, DIR *dirp); + connection_struct *conn, SMB_STRUCT_DIR *dirp); static void smb_full_audit_seekdir(vfs_handle_struct *handle, connection_struct *conn, - DIR *dirp, long offset); + SMB_STRUCT_DIR *dirp, long offset); static long smb_full_audit_telldir(vfs_handle_struct *handle, connection_struct *conn, - DIR *dirp); + SMB_STRUCT_DIR *dirp); static void smb_full_audit_rewinddir(vfs_handle_struct *handle, connection_struct *conn, - DIR *dirp); + SMB_STRUCT_DIR *dirp); static int smb_full_audit_mkdir(vfs_handle_struct *handle, connection_struct *conn, const char *path, mode_t mode); static int smb_full_audit_rmdir(vfs_handle_struct *handle, connection_struct *conn, const char *path); static int smb_full_audit_closedir(vfs_handle_struct *handle, connection_struct *conn, - DIR *dirp); + SMB_STRUCT_DIR *dirp); static int smb_full_audit_open(vfs_handle_struct *handle, connection_struct *conn, const char *fname, int flags, mode_t mode); static int smb_full_audit_close(vfs_handle_struct *handle, files_struct *fsp, int fd); @@ -845,10 +845,10 @@ return result; } -static DIR *smb_full_audit_opendir(vfs_handle_struct *handle, connection_struct *conn, +static SMB_STRUCT_DIR *smb_full_audit_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) { - DIR *result; + SMB_STRUCT_DIR *result; result = SMB_VFS_NEXT_OPENDIR(handle, conn, fname, mask, attr); @@ -858,7 +858,7 @@ } static SMB_STRUCT_DIRENT *smb_full_audit_readdir(vfs_handle_struct *handle, - connection_struct *conn, DIR *dirp) + connection_struct *conn, SMB_STRUCT_DIR *dirp) { SMB_STRUCT_DIRENT *result; @@ -873,7 +873,7 @@ } static void smb_full_audit_seekdir(vfs_handle_struct *handle, connection_struct *conn, - DIR *dirp, long offset) + SMB_STRUCT_DIR *dirp, long offset) { SMB_VFS_NEXT_SEEKDIR(handle, conn, dirp, offset); @@ -882,19 +882,19 @@ } static long smb_full_audit_telldir(vfs_handle_struct *handle, connection_struct *conn, - DIR *dirp) + SMB_STRUCT_DIR *dirp) { long result; result = SMB_VFS_NEXT_TELLDIR(handle, conn, dirp); - do_log(SMB_VFS_OP_OPENDIR, True, handle, ""); + do_log(SMB_VFS_OP_TELLDIR, True, handle, ""); return result; } static void smb_full_audit_rewinddir(vfs_handle_struct *handle, connection_struct *conn, - DIR *dirp) + SMB_STRUCT_DIR *dirp) { SMB_VFS_NEXT_REWINDDIR(handle, conn, dirp); @@ -927,7 +927,7 @@ } static int smb_full_audit_closedir(vfs_handle_struct *handle, connection_struct *conn, - DIR *dirp) + SMB_STRUCT_DIR *dirp) { int result; diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/modules/vfs_netatalk.c samba-3.0.20a/source/modules/vfs_netatalk.c --- samba-3.0.20/source/modules/vfs_netatalk.c 2005-07-28 08:19:46.000000000 -0500 +++ samba-3.0.20a/source/modules/vfs_netatalk.c 2005-09-29 16:52:44.121620000 -0500 @@ -148,11 +148,11 @@ { char *dpath; SMB_STRUCT_DIRENT *dent = 0; - DIR *dir; + SMB_STRUCT_DIR *dir; if (!path) return; - dir = opendir(path); + dir = sys_opendir(path); if (!dir) return; while (NULL != (dent = sys_readdir(dir))) { @@ -165,16 +165,16 @@ atalk_unlink_file(dpath); } - closedir(dir); + sys_closedir(dir); } /* Disk operations */ /* Directory operations */ -DIR *atalk_opendir(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *fname, const char *mask, uint32 attr) +SMB_STRUCT_DIR *atalk_opendir(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *fname, const char *mask, uint32 attr) { - DIR *ret = 0; + SMB_STRUCT_DIR *ret = 0; ret = SMB_VFS_NEXT_OPENDIR(handle, conn, fname, mask, attr); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/modules/vfs_shadow_copy.c samba-3.0.20a/source/modules/vfs_shadow_copy.c --- samba-3.0.20/source/modules/vfs_shadow_copy.c 2005-07-28 08:19:46.000000000 -0500 +++ samba-3.0.20a/source/modules/vfs_shadow_copy.c 2005-09-29 16:52:44.138617000 -0500 @@ -72,10 +72,10 @@ return False; } -static DIR *shadow_copy_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) +static SMB_STRUCT_DIR *shadow_copy_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) { shadow_copy_Dir *dirp; - DIR *p = SMB_VFS_NEXT_OPENDIR(handle,conn,fname,mask,attr); + SMB_STRUCT_DIR *p = SMB_VFS_NEXT_OPENDIR(handle,conn,fname,mask,attr); if (!p) { DEBUG(0,("shadow_copy_opendir: SMB_VFS_NEXT_OPENDIR() failed for [%s]\n",fname)); @@ -119,10 +119,10 @@ } SMB_VFS_NEXT_CLOSEDIR(handle,conn,p); - return((DIR *)dirp); + return((SMB_STRUCT_DIR *)dirp); } -SMB_STRUCT_DIRENT *shadow_copy_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *_dirp) +SMB_STRUCT_DIRENT *shadow_copy_readdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *_dirp) { shadow_copy_Dir *dirp = (shadow_copy_Dir *)_dirp; @@ -133,7 +133,7 @@ return NULL; } -static void shadow_copy_seekdir(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *_dirp, long offset) +static void shadow_copy_seekdir(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_STRUCT_DIR *_dirp, long offset) { shadow_copy_Dir *dirp = (shadow_copy_Dir *)_dirp; @@ -142,19 +142,19 @@ } } -static long shadow_copy_telldir(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *_dirp) +static long shadow_copy_telldir(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_STRUCT_DIR *_dirp) { shadow_copy_Dir *dirp = (shadow_copy_Dir *)_dirp; return( dirp->pos ) ; } -static void shadow_copy_rewinddir(struct vfs_handle_struct *handle, struct connection_struct *conn, DIR *_dirp) +static void shadow_copy_rewinddir(struct vfs_handle_struct *handle, struct connection_struct *conn, SMB_STRUCT_DIR *_dirp) { shadow_copy_Dir *dirp = (shadow_copy_Dir *)_dirp; dirp->pos = 0 ; } -int shadow_copy_closedir(vfs_handle_struct *handle, connection_struct *conn, DIR *_dirp) +int shadow_copy_closedir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *_dirp) { shadow_copy_Dir *dirp = (shadow_copy_Dir *)_dirp; @@ -166,7 +166,7 @@ static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, BOOL labels) { - DIR *p = SMB_VFS_NEXT_OPENDIR(handle,fsp->conn,fsp->conn->connectpath,NULL,0); + SMB_STRUCT_DIR *p = SMB_VFS_NEXT_OPENDIR(handle,fsp->conn,fsp->conn->connectpath,NULL,0); shadow_copy_data->num_volumes = 0; shadow_copy_data->labels = NULL; diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/nmbd/nmbd.c samba-3.0.20a/source/nmbd/nmbd.c --- samba-3.0.20/source/nmbd/nmbd.c 2005-07-28 08:19:49.000000000 -0500 +++ samba-3.0.20a/source/nmbd/nmbd.c 2005-09-29 16:52:46.670229000 -0500 @@ -650,7 +650,6 @@ pstring logfile; static BOOL opt_interactive; poptContext pc; - int opt; struct poptOption long_options[] = { POPT_AUTOHELP {"daemon", 'D', POPT_ARG_VAL, &is_daemon, True, "Become a daemon(default)" }, @@ -666,7 +665,7 @@ global_nmb_port = NMB_PORT; pc = poptGetContext("nmbd", argc, argv, long_options, 0); - while ((opt = poptGetNextOpt(pc)) != -1) ; + while (poptGetNextOpt(pc) != -1) {}; poptFreeContext(pc); global_in_nmbd = True; diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/nsswitch/pam_winbind.c samba-3.0.20a/source/nsswitch/pam_winbind.c --- samba-3.0.20/source/nsswitch/pam_winbind.c 2005-07-28 08:19:44.000000000 -0500 +++ samba-3.0.20a/source/nsswitch/pam_winbind.c 2005-09-29 16:52:42.992793000 -0500 @@ -106,7 +106,7 @@ /* Fill in request and send down pipe */ init_request(request, req_type); - if (write_sock(request, sizeof(*request)) == -1) { + if (write_sock(request, sizeof(*request), 0) == -1) { _pam_log(LOG_ERR, "write to socket failed!"); close_sock(); return PAM_SERVICE_ERR; diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/nsswitch/wb_common.c samba-3.0.20a/source/nsswitch/wb_common.c --- samba-3.0.20/source/nsswitch/wb_common.c 2005-07-28 08:19:44.000000000 -0500 +++ samba-3.0.20a/source/nsswitch/wb_common.c 2005-09-29 16:52:42.973796000 -0500 @@ -280,19 +280,11 @@ close(fd); return -1; - - if (connect(fd, (struct sockaddr *)&sunaddr, - sizeof(sunaddr)) == -1) { - close(fd); - return -1; - } - - return fd; } /* Connect to winbindd socket */ -int winbind_open_pipe_sock(void) +static int winbind_open_pipe_sock(int recursing) { #ifdef HAVE_UNIXSOCKET static pid_t our_pid; @@ -310,12 +302,17 @@ return winbindd_fd; } + if (recursing) { + return -1; + } + if ((winbindd_fd = winbind_named_pipe_sock(WINBINDD_SOCKET_DIR)) == -1) { return -1; } /* version-check the socket */ + request.flags = WBFLAG_RECURSE; if ((winbindd_request_response(WINBINDD_INTERFACE_VERSION, &request, &response) != NSS_STATUS_SUCCESS) || (response.data.interface_version != WINBIND_INTERFACE_VERSION)) { close_sock(); return -1; @@ -323,6 +320,7 @@ /* try and get priv pipe */ + request.flags = WBFLAG_RECURSE; if (winbindd_request_response(WINBINDD_PRIV_PIPE_DIR, &request, &response) == NSS_STATUS_SUCCESS) { int fd; if ((fd = winbind_named_pipe_sock(response.extra_data)) != -1) { @@ -341,7 +339,7 @@ /* Write data to winbindd socket */ -int write_sock(void *buffer, int count) +int write_sock(void *buffer, int count, int recursing) { int result, nwritten; @@ -349,7 +347,7 @@ restart: - if (winbind_open_pipe_sock() == -1) { + if (winbind_open_pipe_sock(recursing) == -1) { return -1; } @@ -542,7 +540,7 @@ init_request(request, req_type); - if (write_sock(request, sizeof(*request)) == -1) { + if (write_sock(request, sizeof(*request), request->flags & WBFLAG_RECURSE) == -1) { return NSS_STATUS_UNAVAIL; } diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/nsswitch/winbind_client.h samba-3.0.20a/source/nsswitch/winbind_client.h --- samba-3.0.20/source/nsswitch/winbind_client.h 2005-07-28 08:19:44.000000000 -0500 +++ samba-3.0.20a/source/nsswitch/winbind_client.h 2005-09-29 16:52:42.773826000 -0500 @@ -8,8 +8,7 @@ NSS_STATUS winbindd_request_response(int req_type, struct winbindd_request *request, struct winbindd_response *response); -int winbind_open_pipe_sock(void); -int write_sock(void *buffer, int count); +int write_sock(void *buffer, int count, int recursing); int read_reply(struct winbindd_response *response); void close_sock(void); void free_response(struct winbindd_response *response); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/nsswitch/winbindd_ads.c samba-3.0.20a/source/nsswitch/winbindd_ads.c --- samba-3.0.20/source/nsswitch/winbindd_ads.c 2005-08-19 12:16:27.000000000 -0500 +++ samba-3.0.20a/source/nsswitch/winbindd_ads.c 2005-09-29 16:52:42.747830000 -0500 @@ -282,6 +282,9 @@ continue; } + if (sid_check_is_in_builtin(&sid)) + continue; + if (!sid_peek_check_rid(&domain->sid, &sid, &rid)) { DEBUG(1,("No rid for %s !?\n", name)); continue; @@ -610,9 +613,16 @@ add_sid_to_array(mem_ctx, &primary_group, user_sids, num_groups); - for (i=0;iname, lp_workgroup()) + && lp_allow_trusted_domains() ) + { account_name = talloc_asprintf( mem_ctx, "%s$", lp_workgroup() ); } else { diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/nsswitch/winbindd_dual.c samba-3.0.20a/source/nsswitch/winbindd_dual.c --- samba-3.0.20/source/nsswitch/winbindd_dual.c 2005-08-19 12:16:27.000000000 -0500 +++ samba-3.0.20a/source/nsswitch/winbindd_dual.c 2005-09-29 16:52:42.937801000 -0500 @@ -158,9 +158,8 @@ return; } - if (state->response->result == WINBINDD_OK) - SMB_ASSERT(cache_retrieve_response(child->pid, - state->response)); + SMB_ASSERT(cache_retrieve_response(child->pid, + state->response)); DLIST_REMOVE(child->requests, state); @@ -304,34 +303,27 @@ static struct winbindd_child_dispatch_table child_dispatch_table[] = { - { WINBINDD_LOOKUPSID, winbindd_dual_lookupsid, "LOOKUPSID" }, - { WINBINDD_LOOKUPNAME, winbindd_dual_lookupname, "LOOKUPNAME" }, - { WINBINDD_LIST_TRUSTDOM, winbindd_dual_list_trusted_domains, - "LIST_TRUSTDOM" }, - { WINBINDD_INIT_CONNECTION, winbindd_dual_init_connection, - "INIT_CONNECTION" }, - { WINBINDD_GETDCNAME, winbindd_dual_getdcname, "GETDCNAME" }, - { WINBINDD_SHOW_SEQUENCE, winbindd_dual_show_sequence, - "SHOW_SEQUENCE" }, - { WINBINDD_PAM_AUTH, winbindd_dual_pam_auth, "PAM_AUTH" }, - { WINBINDD_PAM_AUTH_CRAP, winbindd_dual_pam_auth_crap, "AUTH_CRAP" }, - { WINBINDD_CHECK_MACHACC, winbindd_dual_check_machine_acct, - "CHECK_MACHACC" }, - { WINBINDD_DUAL_SID2UID, winbindd_dual_sid2uid, "DUAL_SID2UID" }, - { WINBINDD_DUAL_SID2GID, winbindd_dual_sid2gid, "DUAL_SID2GID" }, - { WINBINDD_DUAL_UID2NAME, winbindd_dual_uid2name, "DUAL_UID2NAME" }, - { WINBINDD_DUAL_NAME2UID, winbindd_dual_name2uid, "DUAL_NAME2UID" }, - { WINBINDD_DUAL_GID2NAME, winbindd_dual_gid2name, "DUAL_GID2NAME" }, - { WINBINDD_DUAL_NAME2GID, winbindd_dual_name2gid, "DUAL_NAME2GID" }, - { WINBINDD_DUAL_IDMAPSET, winbindd_dual_idmapset, "DUAL_IDMAPSET" }, - { WINBINDD_DUAL_USERINFO, winbindd_dual_userinfo, "DUAL_USERINFO" }, - { WINBINDD_ALLOCATE_RID, winbindd_dual_allocate_rid, "ALLOCATE_RID" }, - { WINBINDD_ALLOCATE_RID_AND_GID, winbindd_dual_allocate_rid_and_gid, - "ALLOCATE_RID_AND_GID" }, - { WINBINDD_GETUSERDOMGROUPS, winbindd_dual_getuserdomgroups, - "GETUSERDOMGROUPS" }, - { WINBINDD_DUAL_GETSIDALIASES, winbindd_dual_getsidaliases, - "GETSIDALIASES" }, + { WINBINDD_LOOKUPSID, winbindd_dual_lookupsid, "LOOKUPSID" }, + { WINBINDD_LOOKUPNAME, winbindd_dual_lookupname, "LOOKUPNAME" }, + { WINBINDD_LIST_TRUSTDOM, winbindd_dual_list_trusted_domains, "LIST_TRUSTDOM" }, + { WINBINDD_INIT_CONNECTION, winbindd_dual_init_connection, "INIT_CONNECTION" }, + { WINBINDD_GETDCNAME, winbindd_dual_getdcname, "GETDCNAME" }, + { WINBINDD_SHOW_SEQUENCE, winbindd_dual_show_sequence, "SHOW_SEQUENCE" }, + { WINBINDD_PAM_AUTH, winbindd_dual_pam_auth, "PAM_AUTH" }, + { WINBINDD_PAM_AUTH_CRAP, winbindd_dual_pam_auth_crap, "AUTH_CRAP" }, + { WINBINDD_CHECK_MACHACC, winbindd_dual_check_machine_acct, "CHECK_MACHACC" }, + { WINBINDD_DUAL_SID2UID, winbindd_dual_sid2uid, "DUAL_SID2UID" }, + { WINBINDD_DUAL_SID2GID, winbindd_dual_sid2gid, "DUAL_SID2GID" }, + { WINBINDD_DUAL_UID2NAME, winbindd_dual_uid2name, "DUAL_UID2NAME" }, + { WINBINDD_DUAL_NAME2UID, winbindd_dual_name2uid, "DUAL_NAME2UID" }, + { WINBINDD_DUAL_GID2NAME, winbindd_dual_gid2name, "DUAL_GID2NAME" }, + { WINBINDD_DUAL_NAME2GID, winbindd_dual_name2gid, "DUAL_NAME2GID" }, + { WINBINDD_DUAL_IDMAPSET, winbindd_dual_idmapset, "DUAL_IDMAPSET" }, + { WINBINDD_DUAL_USERINFO, winbindd_dual_userinfo, "DUAL_USERINFO" }, + { WINBINDD_ALLOCATE_RID, winbindd_dual_allocate_rid, "ALLOCATE_RID" }, + { WINBINDD_ALLOCATE_RID_AND_GID, winbindd_dual_allocate_rid_and_gid, "ALLOCATE_RID_AND_GID" }, + { WINBINDD_GETUSERDOMGROUPS, winbindd_dual_getuserdomgroups, "GETUSERDOMGROUPS" }, + { WINBINDD_DUAL_GETSIDALIASES, winbindd_dual_getsidaliases, "GETSIDALIASES" }, /* End of list */ { WINBINDD_NUM_CMDS, NULL, "NONE" } @@ -486,12 +478,11 @@ DEBUG(4,("child daemon request %d\n", (int)state.request.cmd)); + ZERO_STRUCT(state.response); state.request.null_term = '\0'; child_process_request(child->domain, &state); - if (state.response.result == WINBINDD_OK) - cache_store_response(sys_getpid(), - &state.response); + cache_store_response(sys_getpid(), &state.response); SAFE_FREE(state.response.extra_data); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/nsswitch/winbindd_group.c samba-3.0.20a/source/nsswitch/winbindd_group.c --- samba-3.0.20/source/nsswitch/winbindd_group.c 2005-07-28 08:19:44.000000000 -0500 +++ samba-3.0.20a/source/nsswitch/winbindd_group.c 2005-09-29 16:52:42.947800000 -0500 @@ -259,9 +259,10 @@ if ( !((name_type==SID_NAME_DOM_GRP) || ((name_type==SID_NAME_ALIAS) && domain->primary) || - ((name_type==SID_NAME_ALIAS) && domain->internal)) ) + ((name_type==SID_NAME_ALIAS) && domain->internal) || + ((name_type==SID_NAME_WKN_GRP) && domain->internal)) ) { - DEBUG(1, ("name '%s' is not a local or domain group: %d\n", + DEBUG(1, ("name '%s' is not a local, domain or builtin group: %d\n", name_group, name_type)); request_error(state); return; @@ -518,7 +519,8 @@ if ( ( lp_security() != SEC_ADS && domain->native_mode && domain->primary) || domain->internal ) { - DEBUG(4,("get_sam_group_entries: Native Mode 2k domain; enumerating local groups as well\n")); + DEBUG(4,("get_sam_group_entries: %s domain; enumerating local groups as well\n", + domain->native_mode ? "Native Mode 2k":"BUILTIN or local")); status = domain->methods->enum_local_groups(domain, mem_ctx, &num_entries, &sam_grp_entries); @@ -1148,7 +1150,9 @@ DOM_SID user_sid; NTSTATUS status; - int i, num_groups, len, bufsize; + int i, num_groups; + size_t bufsize; + ssize_t len; DOM_SID *groups; /* Ensure null termination */ diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/nsswitch/winbindd_nss.h samba-3.0.20a/source/nsswitch/winbindd_nss.h --- samba-3.0.20/source/nsswitch/winbindd_nss.h 2005-07-28 08:19:44.000000000 -0500 +++ samba-3.0.20a/source/nsswitch/winbindd_nss.h 2005-09-29 16:52:42.753830000 -0500 @@ -172,6 +172,8 @@ /* This is a flag that can only be sent from parent to child */ #define WBFLAG_IS_PRIVILEGED 0x0400 +/* Flag to say this is a winbindd internal send - don't recurse. */ +#define WBFLAG_RECURSE 0x0800 /* Winbind request structure */ diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/nsswitch/winbindd_pam.c samba-3.0.20a/source/nsswitch/winbindd_pam.c --- samba-3.0.20/source/nsswitch/winbindd_pam.c 2005-07-28 08:19:44.000000000 -0500 +++ samba-3.0.20a/source/nsswitch/winbindd_pam.c 2005-09-29 16:52:43.459721000 -0500 @@ -404,12 +404,15 @@ } while ( (attempts < 2) && retry ); - if (NT_STATUS_IS_OK(result) && - (!clnt_deal_with_creds(session_key, credentials, - &ret_creds))) { - DEBUG(3, ("DC %s sent wrong credentials\n", - pipe_cli->cli->srv_name_slash)); - result = NT_STATUS_ACCESS_DENIED; + /* Only check creds if we got a connection. */ + if (contact_domain->conn.cli && + !(NT_STATUS_EQUAL(result, NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND) || + NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))) { + if (!clnt_deal_with_creds(session_key, credentials, &ret_creds)) { + DEBUG(3, ("DC %s sent wrong credentials\n", + pipe_cli->cli->srv_name_slash)); + result = NT_STATUS_ACCESS_DENIED; + } } if (NT_STATUS_IS_OK(result)) { @@ -712,12 +715,15 @@ } while ( (attempts < 2) && retry ); - if (NT_STATUS_IS_OK(result) && - (!clnt_deal_with_creds(session_key, credentials, - &ret_creds))) { - DEBUG(3, ("DC %s sent wrong credentials\n", - pipe_cli->cli->srv_name_slash)); - result = NT_STATUS_ACCESS_DENIED; + /* Only check creds if we got a connection. */ + if (contact_domain->conn.cli && + !(NT_STATUS_EQUAL(result, NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND) || + (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL)))) { + if (!clnt_deal_with_creds(session_key, credentials, &ret_creds)) { + DEBUG(3, ("DC %s sent wrong credentials\n", + pipe_cli->cli->srv_name_slash)); + result = NT_STATUS_ACCESS_DENIED; + } } if (NT_STATUS_IS_OK(result)) { diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/nsswitch/winbindd_user.c samba-3.0.20a/source/nsswitch/winbindd_user.c --- samba-3.0.20/source/nsswitch/winbindd_user.c 2005-07-28 08:19:44.000000000 -0500 +++ samba-3.0.20a/source/nsswitch/winbindd_user.c 2005-09-29 16:52:42.768827000 -0500 @@ -230,6 +230,7 @@ const char *shell, uint32 group_rid) { + fstring username; struct getpwsid_state *s = talloc_get_type_abort(private_data, struct getpwsid_state); @@ -240,7 +241,9 @@ return; } - s->username = talloc_strdup(s->state->mem_ctx, acct_name); + fstrcpy( username, acct_name ); + strlower_m( username ); + s->username = talloc_strdup(s->state->mem_ctx, username); s->fullname = talloc_strdup(s->state->mem_ctx, full_name); s->homedir = talloc_strdup(s->state->mem_ctx, homedir); s->shell = talloc_strdup(s->state->mem_ctx, shell); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/nsswitch/winbindd_util.c samba-3.0.20a/source/nsswitch/winbindd_util.c --- samba-3.0.20/source/nsswitch/winbindd_util.c 2005-07-28 08:19:44.000000000 -0500 +++ samba-3.0.20a/source/nsswitch/winbindd_util.c 2005-09-29 16:52:42.761828000 -0500 @@ -98,7 +98,7 @@ { struct winbindd_domain *domain; const char *alternative_name = NULL; - static const DOM_SID null_sid; + static const DOM_SID null_sid = {0}; /* ignore alt_name if we are not in an AD domain */ @@ -444,7 +444,9 @@ state->request.data.init_conn.dcname [sizeof(state->request.data.init_conn.dcname)-1]='\0'; - fstrcpy(domain->dcname, state->request.data.init_conn.dcname); + if (strlen(state->request.data.init_conn.dcname) > 0) { + fstrcpy(domain->dcname, state->request.data.init_conn.dcname); + } if (strlen(domain->dcname) > 0) { if (!resolve_name(domain->dcname, &ipaddr, 0x20)) { @@ -504,7 +506,7 @@ DOM_SID our_sid; if (!secrets_fetch_domain_sid(lp_workgroup(), &our_sid)) { - DEBUG(0, ("Could not fetch our SID - did we join?\n")); + smb_panic("Could not fetch our SID - did we join?\n"); } domain = add_trusted_domain( lp_workgroup(), lp_realm(), @@ -803,7 +805,7 @@ return False; } -/* Parse a string of the form DOMAIN/user into a domain and a user */ +/* Parse a string of the form DOMAIN\user into a domain and a user */ BOOL parse_domain_user(const char *domuser, fstring domain, fstring user) { @@ -857,6 +859,7 @@ fstring tmp_user; fstrcpy(tmp_user, user); + strlower_m(tmp_user); if (assume_domain(domain)) { strlcpy(name, user, sizeof(fstring)); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/param/loadparm.c samba-3.0.20a/source/param/loadparm.c --- samba-3.0.20/source/param/loadparm.c 2005-07-28 08:19:44.000000000 -0500 +++ samba-3.0.20a/source/param/loadparm.c 2005-09-29 16:52:42.581856000 -0500 @@ -2004,9 +2004,9 @@ FN_LOCAL_INTEGER(lp_csc_policy, iCSCPolicy) FN_LOCAL_INTEGER(lp_write_cache_size, iWriteCacheSize) FN_LOCAL_INTEGER(lp_block_size, iBlock_size) -FN_LOCAL_INTEGER(lp_allocation_roundup_size, iallocation_roundup_size); -FN_LOCAL_INTEGER(lp_aio_read_size, iAioReadSize); -FN_LOCAL_INTEGER(lp_aio_write_size, iAioWriteSize); +FN_LOCAL_INTEGER(lp_allocation_roundup_size, iallocation_roundup_size) +FN_LOCAL_INTEGER(lp_aio_read_size, iAioReadSize) +FN_LOCAL_INTEGER(lp_aio_write_size, iAioWriteSize) FN_LOCAL_CHAR(lp_magicchar, magic_char) FN_GLOBAL_INTEGER(lp_winbind_cache_time, &Globals.winbind_cache_time) FN_GLOBAL_INTEGER(lp_winbind_max_idle_children, &Globals.winbind_max_idle_children) diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/passdb/pdb_ldap.c samba-3.0.20a/source/passdb/pdb_ldap.c --- samba-3.0.20/source/passdb/pdb_ldap.c 2005-07-28 08:19:48.000000000 -0500 +++ samba-3.0.20a/source/passdb/pdb_ldap.c 2005-09-29 16:52:45.658384000 -0500 @@ -3692,23 +3692,24 @@ return False; } - vals = ldap_get_values(ld, entry, "cn"); - if ((vals == NULL) || (vals[0] == NULL)) { - DEBUG(5, ("\"cn\" not found\n")); - return False; - } - pull_utf8_talloc(mem_ctx, - CONST_DISCARD(char **, &result->account_name), - vals[0]); - ldap_value_free(vals); + /* display name is the NT group name */ vals = ldap_get_values(ld, entry, "displayName"); - if ((vals == NULL) || (vals[0] == NULL)) + if ((vals == NULL) || (vals[0] == NULL)) { DEBUG(8, ("\"displayName\" not found\n")); - else - pull_utf8_talloc(mem_ctx, - CONST_DISCARD(char **, &result->fullname), - vals[0]); + + /* fallback to the 'cn' attribute */ + vals = ldap_get_values(ld, entry, "cn"); + if ((vals == NULL) || (vals[0] == NULL)) { + DEBUG(5, ("\"cn\" not found\n")); + return False; + } + pull_utf8_talloc(mem_ctx, CONST_DISCARD(char **, &result->account_name), vals[0]); + } + else { + pull_utf8_talloc(mem_ctx, CONST_DISCARD(char **, &result->account_name), vals[0]); + } + ldap_value_free(vals); vals = ldap_get_values(ld, entry, "description"); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/passdb/pdb_nds.c samba-3.0.20a/source/passdb/pdb_nds.c --- samba-3.0.20/source/passdb/pdb_nds.c 2005-07-28 08:19:48.000000000 -0500 +++ samba-3.0.20a/source/passdb/pdb_nds.c 2005-09-29 16:52:45.716375000 -0500 @@ -227,7 +227,7 @@ size_t *retDataLen, void *retData ) { - int rc=0, err = 0; + int err = 0; BerElement *replyBer = NULL; char *retOctStr = NULL; size_t retOctStrLen = 0; @@ -248,7 +248,7 @@ goto Cleanup; } - if( (rc = ber_scanf(replyBer, "{iis}", serverVersion, &err, retOctStr, &retOctStrLen)) != -1) + if(ber_scanf(replyBer, "{iis}", serverVersion, &err, retOctStr, &retOctStrLen) != -1) { if (*retDataLen >= retOctStrLen) { @@ -268,7 +268,7 @@ } else { - if( (rc = ber_scanf(replyBer, "{ii}", serverVersion, &err)) == -1) + if(ber_scanf(replyBer, "{ii}", serverVersion, &err) == -1) { if (!err) { @@ -663,7 +663,7 @@ int pdb_nds_get_password( struct smbldap_state *ldap_state, char *object_dn, - int *pwd_len, + size_t *pwd_len, char *pwd ) { LDAP *ld = ldap_state->ldap_struct; @@ -714,9 +714,13 @@ if (rc == LDAP_SUCCESS) { DEBUG(5,("NDS Universal Password changed for user %s\n", object_dn)); } else { + char *ld_error = NULL; + ldap_get_option(ld, LDAP_OPT_ERROR_STRING, &ld_error); + /* This will fail if Universal Password is not enabled for the user's context */ - DEBUG(3,("NDS Universal Password could not be changed for user %s: %d\n", - object_dn, rc)); + DEBUG(3,("NDS Universal Password could not be changed for user %s: %s (%s)\n", + object_dn, ldap_err2string(rc), ld_error?ld_error:"unknown")); + SAFE_FREE(ld_error); } /* Set eDirectory Password */ @@ -757,7 +761,7 @@ LDAPMessage *entry = NULL; const char **attr_list; size_t pwd_len; - uchar clear_text_pw[512]; + char clear_text_pw[512]; const char *p = NULL; LDAP *ld = NULL; int ldap_port = 0; @@ -800,7 +804,7 @@ got_clear_text_pw = True; } } else { - generate_random_buffer(clear_text_pw, 24); + generate_random_buffer((unsigned char *)clear_text_pw, 24); clear_text_pw[24] = '\0'; DEBUG(5,("pdb_nds_update_login_attempts: using random password %s\n", clear_text_pw)); } diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/passdb/pdb_pgsql.c samba-3.0.20a/source/passdb/pdb_pgsql.c --- samba-3.0.20/source/passdb/pdb_pgsql.c 2005-08-07 18:09:55.000000000 -0500 +++ samba-3.0.20a/source/passdb/pdb_pgsql.c 2005-09-29 16:52:45.730373000 -0500 @@ -231,8 +231,6 @@ } talloc_free(query); - if ( data->pwent != NULL ) - PQclear( data->pwent ) ; return retval ; } diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/passdb/pdb_sql.c samba-3.0.20a/source/passdb/pdb_sql.c --- samba-3.0.20/source/passdb/pdb_sql.c 2005-07-28 08:19:48.000000000 -0500 +++ samba-3.0.20a/source/passdb/pdb_sql.c 2005-09-29 16:52:45.746371000 -0500 @@ -318,7 +318,7 @@ CONFIG_TABLE_DEFAULT)); } - if (IS_SAM_CHANGED(newpwd, PDB_ACCTCTRL)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_ACCTCTRL)) { some_field_affected = 1; pdb_sql_int_field(query, config_value_write(location, "acct ctrl column", @@ -326,7 +326,7 @@ pdb_get_acct_ctrl(newpwd)); } - if (IS_SAM_CHANGED(newpwd, PDB_LOGONTIME)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_LOGONTIME)) { some_field_affected = 1; pdb_sql_int_field(query, config_value_write(location, @@ -335,7 +335,7 @@ pdb_get_logon_time(newpwd)); } - if (IS_SAM_CHANGED(newpwd, PDB_LOGOFFTIME)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_LOGOFFTIME)) { some_field_affected = 1; pdb_sql_int_field(query, config_value_write(location, @@ -344,7 +344,7 @@ pdb_get_logoff_time(newpwd)); } - if (IS_SAM_CHANGED(newpwd, PDB_KICKOFFTIME)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_KICKOFFTIME)) { some_field_affected = 1; pdb_sql_int_field(query, config_value_write(location, @@ -353,7 +353,7 @@ pdb_get_kickoff_time(newpwd)); } - if (IS_SAM_CHANGED(newpwd, PDB_CANCHANGETIME)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_CANCHANGETIME)) { some_field_affected = 1; pdb_sql_int_field(query, config_value_write(location, @@ -362,7 +362,7 @@ pdb_get_pass_can_change_time(newpwd)); } - if (IS_SAM_CHANGED(newpwd, PDB_MUSTCHANGETIME)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_MUSTCHANGETIME)) { some_field_affected = 1; pdb_sql_int_field(query, config_value_write(location, @@ -371,7 +371,7 @@ pdb_get_pass_must_change_time(newpwd)); } - if (IS_SAM_CHANGED(newpwd, PDB_PASSLASTSET)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_PASSLASTSET)) { some_field_affected = 1; pdb_sql_int_field(query, config_value_write(location, @@ -380,7 +380,7 @@ pdb_get_pass_last_set_time(newpwd)); } - if (IS_SAM_CHANGED(newpwd, PDB_HOURSLEN)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_HOURSLEN)) { some_field_affected = 1; pdb_sql_int_field(query, config_value_write(location, @@ -389,7 +389,7 @@ pdb_get_hours_len(newpwd)); } - if (IS_SAM_CHANGED(newpwd, PDB_LOGONDIVS)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_LOGONDIVS)) { some_field_affected = 1; pdb_sql_int_field(query, config_value_write(location, @@ -398,7 +398,7 @@ pdb_get_logon_divs(newpwd)); } - if (IS_SAM_CHANGED(newpwd, PDB_USERSID)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_USERSID)) { some_field_affected = 1; pdb_sql_string_field(query, config_value_write(location, "user sid column", @@ -407,7 +407,7 @@ pdb_get_user_sid(newpwd))); } - if (IS_SAM_CHANGED(newpwd, PDB_GROUPSID)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_GROUPSID)) { some_field_affected = 1; pdb_sql_string_field(query, config_value_write(location, "group sid column", @@ -416,7 +416,7 @@ pdb_get_group_sid(newpwd))); } - if (IS_SAM_CHANGED(newpwd, PDB_USERNAME)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_USERNAME)) { some_field_affected = 1; pdb_sql_string_field(query, config_value_write(location, "username column", @@ -424,7 +424,7 @@ pdb_get_username(newpwd)); } - if (IS_SAM_CHANGED(newpwd, PDB_DOMAIN)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_DOMAIN)) { some_field_affected = 1; pdb_sql_string_field(query, config_value_write(location, "domain column", @@ -432,7 +432,7 @@ pdb_get_domain(newpwd)); } - if (IS_SAM_CHANGED(newpwd, PDB_USERNAME)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_USERNAME)) { some_field_affected = 1; pdb_sql_string_field(query, config_value_write(location, @@ -441,7 +441,7 @@ pdb_get_nt_username(newpwd)); } - if (IS_SAM_CHANGED(newpwd, PDB_FULLNAME)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_FULLNAME)) { some_field_affected = 1; pdb_sql_string_field(query, config_value_write(location, "fullname column", @@ -449,7 +449,7 @@ pdb_get_fullname(newpwd)); } - if (IS_SAM_CHANGED(newpwd, PDB_LOGONSCRIPT)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_LOGONSCRIPT)) { some_field_affected = 1; pdb_sql_string_field(query, config_value_write(location, @@ -458,7 +458,7 @@ pdb_get_logon_script(newpwd)); } - if (IS_SAM_CHANGED(newpwd, PDB_PROFILE)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_PROFILE)) { some_field_affected = 1; pdb_sql_string_field(query, config_value_write(location, @@ -467,7 +467,7 @@ pdb_get_profile_path(newpwd)); } - if (IS_SAM_CHANGED(newpwd, PDB_DRIVE)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_DRIVE)) { some_field_affected = 1; pdb_sql_string_field(query, config_value_write(location, "dir drive column", @@ -475,7 +475,7 @@ pdb_get_dir_drive(newpwd)); } - if (IS_SAM_CHANGED(newpwd, PDB_SMBHOME)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_SMBHOME)) { some_field_affected = 1; pdb_sql_string_field(query, config_value_write(location, "home dir column", @@ -483,7 +483,7 @@ pdb_get_homedir(newpwd)); } - if (IS_SAM_CHANGED(newpwd, PDB_WORKSTATIONS)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_WORKSTATIONS)) { some_field_affected = 1; pdb_sql_string_field(query, config_value_write(location, @@ -492,7 +492,7 @@ pdb_get_workstations(newpwd)); } - if (IS_SAM_CHANGED(newpwd, PDB_UNKNOWNSTR)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_UNKNOWNSTR)) { some_field_affected = 1; pdb_sql_string_field(query, config_value_write(location, @@ -501,7 +501,7 @@ pdb_get_workstations(newpwd)); } - if (IS_SAM_CHANGED(newpwd, PDB_LMPASSWD)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_LMPASSWD)) { some_field_affected = 1; pdb_sethexpwd(temp, pdb_get_lanman_passwd(newpwd), pdb_get_acct_ctrl(newpwd)); @@ -511,7 +511,7 @@ CONFIG_LM_PW_DEFAULT), temp); } - if (IS_SAM_CHANGED(newpwd, PDB_NTPASSWD)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_NTPASSWD)) { some_field_affected = 1; pdb_sethexpwd(temp, pdb_get_nt_passwd(newpwd), pdb_get_acct_ctrl(newpwd)); @@ -520,7 +520,7 @@ CONFIG_NT_PW_DEFAULT), temp); } - if (IS_SAM_CHANGED(newpwd, PDB_HOURS)) { + if (!isupdate || IS_SAM_CHANGED(newpwd, PDB_HOURS)) { some_field_affected = 1; pdb_sql_string_field(query, config_value_write(location, diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/printing/nt_printing.c samba-3.0.20a/source/printing/nt_printing.c --- samba-3.0.20/source/printing/nt_printing.c 2005-08-07 18:09:53.000000000 -0500 +++ samba-3.0.20a/source/printing/nt_printing.c 2005-09-29 16:52:42.304898000 -0500 @@ -342,7 +342,8 @@ SEC_DESC *sec, *new_sec; TALLOC_CTX *ctx = state; int result, i; - uint32 sd_size, size_new_sec; + uint32 sd_size; + size_t size_new_sec; DOM_SID sid; if (!data.dptr || data.dsize == 0) @@ -1394,12 +1395,19 @@ *perr = WERR_INVALID_PARAM; /* If architecture is Windows 95/98/ME, the version is always 0. */ - if (strcmp(architecture, "WIN40") == 0) { + if (strcmp(architecture, SPL_ARCH_WIN40) == 0) { DEBUG(10,("get_correct_cversion: Driver is Win9x, cversion = 0\n")); *perr = WERR_OK; return 0; } + /* If architecture is Windows x64, the version is always 3. */ + if (strcmp(architecture, SPL_ARCH_X64) == 0) { + DEBUG(10,("get_correct_cversion: Driver is x64, cversion = 3\n")); + *perr = WERR_OK; + return 3; + } + /* * Connect to the print$ share under the same account as the user connected * to the rpc pipe. Note we must still be root to do this. diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/printing/printing.c samba-3.0.20a/source/printing/printing.c --- samba-3.0.20/source/printing/printing.c 2005-08-19 12:16:26.000000000 -0500 +++ samba-3.0.20a/source/printing/printing.c 2005-09-29 16:52:42.278902000 -0500 @@ -91,7 +91,7 @@ if (rap_jobid == 0) rap_jobid = ++next_rap_jobid; SSVAL(buf,0,rap_jobid); - data.dptr = buf; + data.dptr = (char*)buf; data.dsize = sizeof(rap_jobid); tdb_store(rap_tdb, key, data, TDB_REPLACE); tdb_store(rap_tdb, data, key, TDB_REPLACE); @@ -112,7 +112,7 @@ return False; SSVAL(buf,0,rap_jobid); - key.dptr = buf; + key.dptr = (char*)buf; key.dsize = sizeof(rap_jobid); data = tdb_fetch(rap_tdb, key); if ( data.dptr && data.dsize == sizeof(struct rap_jobid_key) ) @@ -164,7 +164,7 @@ rap_jobid = SVAL(data.dptr, 0); SAFE_FREE(data.dptr); SSVAL(buf,0,rap_jobid); - data.dptr=buf; + data.dptr = (char*)buf; data.dsize = sizeof(rap_jobid); tdb_delete(rap_tdb, key); tdb_delete(rap_tdb, data); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/python/setup.py samba-3.0.20a/source/python/setup.py --- samba-3.0.20/source/python/setup.py 2005-07-28 08:19:41.000000000 -0500 +++ samba-3.0.20a/source/python/setup.py 2005-09-29 16:52:39.643307000 -0500 @@ -56,6 +56,9 @@ if lib[0:2] == "-l": libraries.append(lib[2:]) continue + if lib[0:8] == "-pthread": + libraries.append(lib[2:]) + continue if lib[0:2] == "-L": library_dirs.append(lib[2:]) continue diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/registry/reg_db.c samba-3.0.20a/source/registry/reg_db.c --- samba-3.0.20/source/registry/reg_db.c 2005-08-07 18:09:57.000000000 -0500 +++ samba-3.0.20a/source/registry/reg_db.c 2005-09-29 16:52:48.672922000 -0500 @@ -49,6 +49,7 @@ "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib\\009", "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors", "HKLM\\SYSTEM\\CurrentControlSet\\Control\\ProductOptions", + "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\DefaultUserConfiguration", "HKLM\\SYSTEM\\CurrentControlSet\\Services\\TcpIp\\Parameters", "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Netlogon\\Parameters", "HKU", @@ -149,6 +150,11 @@ regval_ctr_init( &values ); regdb_fetch_values( builtin_registry_values[i].path, &values ); + + /* preserve existing values across restarts. Only add new ones */ + + if ( !regval_ctr_key_exists( &values, builtin_registry_values[i].valuename ) ) + { switch( builtin_registry_values[i].type ) { case REG_DWORD: regval_ctr_addvalue( &values, @@ -172,6 +178,7 @@ builtin_registry_values[i].type)); } regdb_store_values( builtin_registry_values[i].path, &values ); + } regval_ctr_destroy( &values ); } @@ -191,8 +198,6 @@ if ( tdb_reg ) return True; - /* placeholder tdb; reinit upon startup */ - if ( !(tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR, 0600)) ) { tdb_reg = tdb_open_log(lock_path("registry.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); @@ -209,14 +214,15 @@ vers_id = tdb_fetch_int32(tdb_reg, vstring); if ( vers_id != REGVER_V1 ) { + /* any upgrade code here if needed */ + } - /* create the registry here */ + /* always setup the necessary keys and values */ if ( !init_registry_data() ) { DEBUG(0,("init_registry: Failed to initiailize data in registry!\n")); return False; } - } return True; } @@ -480,7 +486,6 @@ { TDB_DATA data; pstring keystr; - int len; DEBUG(10,("regdb_fetch_values: Looking for value of key [%s] \n", key)); @@ -494,7 +499,7 @@ return 0; } - len = regdb_unpack_values( values, data.dptr, data.dsize ); + regdb_unpack_values( values, data.dptr, data.dsize ); SAFE_FREE( data.dptr ); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/registry/regfio.c samba-3.0.20a/source/registry/regfio.c --- samba-3.0.20/source/registry/regfio.c 2005-07-28 08:19:53.000000000 -0500 +++ samba-3.0.20a/source/registry/regfio.c 2005-09-29 16:52:48.686920000 -0500 @@ -85,7 +85,7 @@ if ( (size_t)file_offset >= sbuf.st_size ) return -1; - /* if block_size == 0, we are parsnig HBIN records and need + /* if block_size == 0, we are parsing HBIN records and need to read some of the header to get the block_size from there */ if ( block_size == 0 ) { @@ -533,7 +533,7 @@ } /******************************************************************* - Input a randon offset and receive the correpsonding HBIN + Input a random offset and receive the corresponding HBIN block for it *******************************************************************/ @@ -549,7 +549,7 @@ } /******************************************************************* - Input a randon offset and receive the correpsonding HBIN + Input a random offset and receive the corresponding HBIN block for it *******************************************************************/ @@ -1030,7 +1030,7 @@ if ( curr_off == 0 ) prs_set_offset( ps, HBIN_HEADER_REC_SIZE ); - /* assume that the current offset is at the reacord header + /* assume that the current offset is at the record header and we need to backup to read the record size */ curr_off -= sizeof(uint32); @@ -1670,7 +1670,7 @@ static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 ) { - return StrnCaseCmp( h1->keycheck, h2->keycheck, sizeof(uint32) ); + return StrCaseCmp( h1->fullname, h2->fullname ); } /******************************************************************* @@ -1722,6 +1722,7 @@ hash->nk_off = prs_offset( &nk->hbin->ps ) + nk->hbin->first_hbin_off - HBIN_HDR_SIZE; memcpy( hash->keycheck, name, sizeof(uint32) ); + hash->fullname = talloc_strdup( file->mem_ctx, name ); parent->subkey_index++; /* sort the list by keyname */ @@ -1767,22 +1768,28 @@ DLIST_ADD_END( file->sec_desc_list, nk->sec_desc, tmp ); - /* initialize offsets */ - - nk->sec_desc->prev_sk_off = nk->sec_desc->sk_off; - nk->sec_desc->next_sk_off = nk->sec_desc->sk_off; - - /* now update the offsets for us and the previous sd in the list */ + /* update the offsets for us and the previous sd in the list. + if this is the first record, then just set the next and prev + offsets to ourself. */ if ( nk->sec_desc->prev ) { REGF_SK_REC *prev = nk->sec_desc->prev; nk->sec_desc->prev_sk_off = prev->hbin_off + prev->hbin->first_hbin_off - HBIN_HDR_SIZE; - prev->next_sk_off = nk->sk_off; + prev->next_sk_off = nk->sec_desc->sk_off; + + /* the end must loop around to the front */ + nk->sec_desc->next_sk_off = file->sec_desc_list->sk_off; + + /* and first must loop around to the tail */ + file->sec_desc_list->prev_sk_off = nk->sec_desc->sk_off; + } else { + nk->sec_desc->prev_sk_off = nk->sec_desc->sk_off; + nk->sec_desc->next_sk_off = nk->sec_desc->sk_off; } } - /* dump the reference count */ + /* bump the reference count +1 */ nk->sk_off = nk->sec_desc->sk_off; nk->sec_desc->ref_count++; @@ -1852,8 +1859,8 @@ nk->max_bytes_valuename = namelen * 2; datalen = regval_size( r ); - if ( datalen*2 > nk->max_bytes_value ) - nk->max_bytes_value = datalen * 2; + if ( datalen > nk->max_bytes_value ) + nk->max_bytes_value = datalen; } } diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/rpc_client/cli_netlogon.c samba-3.0.20a/source/rpc_client/cli_netlogon.c --- samba-3.0.20/source/rpc_client/cli_netlogon.c 2005-07-28 08:19:41.000000000 -0500 +++ samba-3.0.20a/source/rpc_client/cli_netlogon.c 2005-09-29 16:52:39.797283000 -0500 @@ -931,7 +931,6 @@ { /* report error code */ DEBUG(0,("cli_net_srv_pwset: %s\n", nt_errstr(nt_status))); - goto done; } /* Update the credentials. */ diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/rpc_parse/parse_lsa.c samba-3.0.20a/source/rpc_parse/parse_lsa.c --- samba-3.0.20/source/rpc_parse/parse_lsa.c 2005-07-28 08:19:48.000000000 -0500 +++ samba-3.0.20a/source/rpc_parse/parse_lsa.c 2005-09-29 16:52:46.057323000 -0500 @@ -3036,7 +3036,6 @@ default: DEBUG(0,("unsupported info-level: %d\n", info->info_class)); return False; - break; } return True; diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/rpc_parse/parse_net.c samba-3.0.20a/source/rpc_parse/parse_net.c --- samba-3.0.20/source/rpc_parse/parse_net.c 2005-08-07 18:09:55.000000000 -0500 +++ samba-3.0.20a/source/rpc_parse/parse_net.c 2005-09-29 16:52:46.511253000 -0500 @@ -1626,7 +1626,7 @@ if(!smb_io_unistr2("uni_logon_srv", &usr->uni_logon_srv, usr->hdr_logon_srv.buffer, ps, depth)) /* logon server unicode string */ return False; - if(!smb_io_unistr2("uni_logon_dom", &usr->uni_logon_dom, usr->hdr_logon_srv.buffer, ps, depth)) /* logon domain unicode string */ + if(!smb_io_unistr2("uni_logon_dom", &usr->uni_logon_dom, usr->hdr_logon_dom.buffer, ps, depth)) /* logon domain unicode string */ return False; if(!smb_io_dom_sid2("", &usr->dom_sid, ps, depth)) /* domain SID */ diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/rpc_parse/parse_prs.c samba-3.0.20a/source/rpc_parse/parse_prs.c --- samba-3.0.20/source/rpc_parse/parse_prs.c 2005-07-28 08:19:48.000000000 -0500 +++ samba-3.0.20a/source/rpc_parse/parse_prs.c 2005-09-29 16:52:46.000332000 -0500 @@ -529,8 +529,10 @@ * If reading, ensure that we can read the requested size item. */ if (ps->data_offset + extra_size > ps->buffer_size) { - DEBUG(0,("prs_mem_get: reading data of size %u would overrun buffer.\n", - (unsigned int)extra_size )); + DEBUG(0,("prs_mem_get: reading data of size %u would overrun " + "buffer by %u bytes.\n", + (unsigned int)extra_size, + (unsigned int)(ps->data_offset + extra_size - ps->buffer_size) )); return NULL; } } else { diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/rpc_parse/parse_reg.c samba-3.0.20a/source/rpc_parse/parse_reg.c --- samba-3.0.20/source/rpc_parse/parse_reg.c 2005-07-28 08:19:48.000000000 -0500 +++ samba-3.0.20a/source/rpc_parse/parse_reg.c 2005-09-29 16:52:46.034326000 -0500 @@ -227,7 +227,7 @@ q_c->ptr2 = 1; init_buf_hdr(&q_c->hdr_sec, sec_buf->len, sec_buf->len); q_c->ptr3 = 1; - q_c->unknown_2 = 0x00000000; + q_c->disposition = TALLOC_P( get_talloc_ctx(), uint32 ); } /******************************************************************* @@ -259,7 +259,7 @@ if(!prs_align(ps)) return False; - if(!prs_uint32("reserved", ps, depth, &q_u->reserved)) + if(!prs_uint32("options", ps, depth, &q_u->options)) return False; if(!prs_uint32("access", ps, depth, &q_u->access)) return False; @@ -267,16 +267,15 @@ if(!prs_pointer("sec_info", ps, depth, (void**)&q_u->sec_info, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if(!prs_uint32("ptr2", ps, depth, &q_u->ptr2)) - return False; - if(!reg_io_hdrbuf_sec(q_u->ptr2, &q_u->ptr3, &q_u->hdr_sec, q_u->data, - ps, depth)) - return False; + if ( q_u->sec_info ) { + if(!prs_uint32("ptr2", ps, depth, &q_u->ptr2)) + return False; + if(!reg_io_hdrbuf_sec(q_u->ptr2, &q_u->ptr3, &q_u->hdr_sec, q_u->data, ps, depth)) + return False; + } -#if 0 - if(!prs_uint32("unknown_2", ps, depth, &q_u->unknown_2)) + if(!prs_pointer("disposition", ps, depth, (void**)&q_u->disposition, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; -#endif return True; } @@ -1485,8 +1484,18 @@ q_u->server = TALLOC_P( get_talloc_ctx(), uint16 ); *q_u->server = 0x1; - q_u->message = TALLOC_P( get_talloc_ctx(), UNISTR4 ); - init_unistr4( q_u->message, msg, UNI_FLAGS_NONE ); + q_u->message = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR4 ); + + if ( msg && *msg ) { + init_unistr4( q_u->message, msg, UNI_FLAGS_NONE ); + + /* Win2000 is apparently very sensitive to these lengths */ + /* do a special case here */ + + q_u->message->string->uni_max_len++; + q_u->message->size += 2; + + } q_u->timeout = timeout; @@ -1536,6 +1545,8 @@ if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; + if (!prs_align(ps)) + return False; if (!prs_pointer("message", ps, depth, (void**)&q_u->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) return False; @@ -1594,6 +1605,8 @@ if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; + if (!prs_align(ps)) + return False; if (!prs_pointer("message", ps, depth, (void**)&q_u->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) return False; @@ -1667,6 +1680,8 @@ if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; + if (!prs_align(ps)) + return False; return True; } diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/rpc_parse/parse_shutdown.c samba-3.0.20a/source/rpc_parse/parse_shutdown.c --- samba-3.0.20/source/rpc_parse/parse_shutdown.c 2005-04-18 11:38:20.000000000 -0500 +++ samba-3.0.20a/source/rpc_parse/parse_shutdown.c 2005-09-29 16:52:46.009330000 -0500 @@ -34,8 +34,17 @@ q_s->server = TALLOC_P( get_talloc_ctx(), uint16 ); *q_s->server = 0x1; - q_s->message = TALLOC_P( get_talloc_ctx(), UNISTR4 ); - init_unistr4( q_s->message, msg, UNI_FLAGS_NONE ); + q_s->message = TALLOC_ZERO_P( get_talloc_ctx(), UNISTR4 ); + + if ( msg && *msg ) { + init_unistr4( q_s->message, msg, UNI_FLAGS_NONE ); + + /* Win2000 is apparently very sensitive to these lengths */ + /* do a special case here */ + + q_s->message->string->uni_max_len++; + q_s->message->size += 2; + } q_s->timeout = timeout; @@ -84,6 +93,8 @@ if (!prs_pointer("server", ps, depth, (void**)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; + if (!prs_align(ps)) + return False; if (!prs_pointer("message", ps, depth, (void**)&q_s->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) return False; @@ -99,7 +110,6 @@ if (!prs_uint8("reboot ", ps, depth, &(q_s->reboot))) return False; - return True; } @@ -142,6 +152,8 @@ if (!prs_pointer("server", ps, depth, (void**)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; + if (!prs_align(ps)) + return False; if (!prs_pointer("message", ps, depth, (void**)&q_s->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) return False; @@ -214,6 +226,8 @@ if (!prs_pointer("server", ps, depth, (void**)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; + if (!prs_align(ps)) + return False; return True; } diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/rpc_server/srv_netlog_nt.c samba-3.0.20a/source/rpc_server/srv_netlog_nt.c --- samba-3.0.20/source/rpc_server/srv_netlog_nt.c 2005-08-19 12:16:27.000000000 -0500 +++ samba-3.0.20a/source/rpc_server/srv_netlog_nt.c 2005-09-29 16:52:44.676535000 -0500 @@ -449,7 +449,6 @@ if (!(p->dc.authenticated && deal_with_creds(p->dc.sess_key, &p->dc.clnt_cred, &q_u->clnt_id.cred, &srv_cred))) return NT_STATUS_INVALID_HANDLE; - reseed_client_creds(&p->dc.clnt_cred, &q_u->clnt_id.cred); memcpy(&p->dc.srv_cred, &p->dc.clnt_cred, sizeof(p->dc.clnt_cred)); DEBUG(5,("_net_srv_pwset: %d\n", __LINE__)); @@ -547,7 +546,6 @@ return NT_STATUS_INVALID_HANDLE; /* what happens if we get a logoff for an unknown user? */ - reseed_client_creds(&p->dc.clnt_cred, &q_u->sam_id.client.cred); memcpy(&p->dc.srv_cred, &p->dc.clnt_cred, sizeof(p->dc.clnt_cred)); /* XXXX maybe we want to say 'no', reject the client's credentials */ @@ -606,6 +604,8 @@ if (!(p->dc.authenticated && deal_with_creds(p->dc.sess_key, &p->dc.clnt_cred, &q_u->sam_id.client.cred, &srv_cred))) return NT_STATUS_INVALID_HANDLE; + memcpy(&p->dc.srv_cred, &p->dc.clnt_cred, sizeof(p->dc.clnt_cred)); + r_u->buffer_creds = 1; /* yes, we have valid server credentials */ memcpy(&r_u->srv_creds, &srv_cred, sizeof(r_u->srv_creds)); @@ -729,12 +729,6 @@ return status; } - /* moved from right after deal_with_creds above, since we weren't - supposed to update unless logon was successful */ - - reseed_client_creds(&p->dc.clnt_cred, &q_u->sam_id.client.cred); - memcpy(&p->dc.srv_cred, &p->dc.clnt_cred, sizeof(p->dc.clnt_cred)); - if (server_info->guest) { /* We don't like guest domain logons... */ DEBUG(5,("_net_sam_logon: Attempted domain logon as GUEST denied.\n")); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/rpc_server/srv_reg_nt.c samba-3.0.20a/source/rpc_server/srv_reg_nt.c --- samba-3.0.20/source/rpc_server/srv_reg_nt.c 2005-08-07 18:09:55.000000000 -0500 +++ samba-3.0.20a/source/rpc_server/srv_reg_nt.c 2005-09-29 16:52:44.415575000 -0500 @@ -44,6 +44,12 @@ { NTSTATUS result; + if ( geteuid() == sec_initial_uid() ) { + DEBUG(5,("registry_access_check: access check bypassed for 'root'\n")); + *access_granted = REG_KEY_ALL; + return NT_STATUS_OK; + } + se_map_generic( &access_desired, ®_generic_map ); se_access_check( sec_desc, token, access_desired, access_granted, &result ); @@ -798,7 +804,7 @@ for ( i=0; inum_values; i++ ) { regval_ctr_addvalue( &values, key->values[i].valuename, key->values[i].type, - key->values[i].data, (key->values[i].data_size & ~VK_DATA_IN_OFFSET) ); + (char*)key->values[i].data, (key->values[i].data_size & ~VK_DATA_IN_OFFSET) ); } /* copy subkeys into the REGSUBKEY_CTR */ @@ -1067,8 +1073,6 @@ DEBUG(2,("_reg_save_key: Saving [%s] to %s in share %s\n", regkey->name, filename, lp_servicename(snum) )); return backup_registry_key( regkey, filename ); - - return WERR_OK; } /******************************************************************* @@ -1204,7 +1208,7 @@ fetch_reg_values( key, &values ); - regval_ctr_addvalue( &values, valuename, q_u->type, q_u->value.buffer, q_u->value.buf_len ); + regval_ctr_addvalue( &values, valuename, q_u->type, (char*)q_u->value.buffer, q_u->value.buf_len ); /* now write to the registry backend */ diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/rpc_server/srv_samr_nt.c samba-3.0.20a/source/rpc_server/srv_samr_nt.c --- samba-3.0.20/source/rpc_server/srv_samr_nt.c 2005-08-07 18:09:55.000000000 -0500 +++ samba-3.0.20a/source/rpc_server/srv_samr_nt.c 2005-09-29 16:52:45.551400000 -0500 @@ -804,7 +804,6 @@ uint32 num_account = 0; enum remote_arch_types ra_type = get_remote_arch(); int max_sam_entries = (ra_type == RA_WIN95) ? MAX_SAM_ENTRIES_W95 : MAX_SAM_ENTRIES_W2K; - DOM_SID domain_sid; struct samr_displayentry *entries = NULL; DEBUG(5, ("samr_reply_query_dispinfo: %d\n", __LINE__)); @@ -814,8 +813,6 @@ if (!find_policy_by_hnd(p, &q_u->domain_pol, (void **)&info)) return NT_STATUS_INVALID_HANDLE; - domain_sid = info->sid; - /* * calculate how many entries we will return. * based on @@ -3927,6 +3924,8 @@ GROUP_MAP map; GROUP_INFO_CTR *ctr; uint32 acc_granted; + BOOL ret; + BOOL can_mod_accounts; if (!get_lsa_policy_samr_sid(p, &q_u->pol, &group_sid, &acc_granted)) return NT_STATUS_INVALID_HANDLE; @@ -3951,11 +3950,21 @@ return NT_STATUS_INVALID_INFO_CLASS; } - if(!pdb_update_group_mapping_entry(&map)) { - return NT_STATUS_NO_SUCH_GROUP; - } + can_mod_accounts = user_has_privileges( p->pipe_user.nt_user_token, &se_add_users ); - return NT_STATUS_OK; + /******** BEGIN SeAddUsers BLOCK *********/ + + if ( can_mod_accounts ) + become_root(); + + ret = pdb_update_group_mapping_entry(&map); + + if ( can_mod_accounts ) + unbecome_root(); + + /******** End SeAddUsers BLOCK *********/ + + return ret ? NT_STATUS_OK : NT_STATUS_ACCESS_DENIED; } /********************************************************************* @@ -3970,6 +3979,8 @@ struct acct_info info; ALIAS_INFO_CTR *ctr; uint32 acc_granted; + BOOL ret; + BOOL can_mod_accounts; if (!get_lsa_policy_samr_sid(p, &q_u->alias_pol, &group_sid, &acc_granted)) return NT_STATUS_INVALID_HANDLE; @@ -3992,11 +4003,21 @@ return NT_STATUS_INVALID_INFO_CLASS; } - if(!pdb_set_aliasinfo(&group_sid, &info)) { - return NT_STATUS_ACCESS_DENIED; - } + can_mod_accounts = user_has_privileges( p->pipe_user.nt_user_token, &se_add_users ); - return NT_STATUS_OK; + /******** BEGIN SeAddUsers BLOCK *********/ + + if ( can_mod_accounts ) + become_root(); + + ret = pdb_set_aliasinfo( &group_sid, &info ); + + if ( can_mod_accounts ) + unbecome_root(); + + /******** End SeAddUsers BLOCK *********/ + + return ret ? NT_STATUS_OK : NT_STATUS_ACCESS_DENIED; } /********************************************************************* diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/rpc_server/srv_spoolss_nt.c samba-3.0.20a/source/rpc_server/srv_spoolss_nt.c --- samba-3.0.20/source/rpc_server/srv_spoolss_nt.c 2005-08-19 12:16:27.000000000 -0500 +++ samba-3.0.20a/source/rpc_server/srv_spoolss_nt.c 2005-09-29 16:52:45.609392000 -0500 @@ -1668,7 +1668,7 @@ if (printer_default->access_required & ~(SERVER_ACCESS_ADMINISTER | SERVER_ACCESS_ENUMERATE)) { - DEBUG(3, ("access DENIED for non-printserver bits")); + DEBUG(3, ("access DENIED for non-printserver bits\n")); close_printer_handle(p, handle); return WERR_ACCESS_DENIED; } diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/rpc_server/srv_srvsvc_nt.c samba-3.0.20a/source/rpc_server/srv_srvsvc_nt.c --- samba-3.0.20/source/rpc_server/srv_srvsvc_nt.c 2005-07-28 08:19:47.000000000 -0500 +++ samba-3.0.20a/source/rpc_server/srv_srvsvc_nt.c 2005-09-29 16:52:44.652538000 -0500 @@ -1597,11 +1597,9 @@ DEBUG(3, ("_srv_net_share_set_info: client is trying to change csc policy from the network; must be done with smb.conf\n")); return WERR_ACCESS_DENIED; } - break; case 1006: case 1007: return WERR_ACCESS_DENIED; - break; case 1501: pstrcpy(pathname, lp_pathname(snum)); fstrcpy(comment, lp_comment(snum)); @@ -1753,7 +1751,6 @@ case 1006: case 1007: return WERR_ACCESS_DENIED; - break; case 1501: /* DFS only level. */ return WERR_ACCESS_DENIED; diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/rpc_server/srv_svcctl_nt.c samba-3.0.20a/source/rpc_server/srv_svcctl_nt.c --- samba-3.0.20/source/rpc_server/srv_svcctl_nt.c 2005-08-07 18:09:55.000000000 -0500 +++ samba-3.0.20a/source/rpc_server/srv_svcctl_nt.c 2005-09-29 16:52:45.515406000 -0500 @@ -59,11 +59,15 @@ uint32 access_desired, uint32 *access_granted ) { NTSTATUS result; - - /* maybe add privilege checks in here later */ + + if ( geteuid() == sec_initial_uid() ) { + DEBUG(5,("svcctl_access_check: access check bypassed for 'root'\n")); + *access_granted = access_desired; + return NT_STATUS_OK; + } se_access_check( sec_desc, token, access_desired, access_granted, &result ); - + return result; } @@ -756,7 +760,6 @@ { POLICY_HND *handle; SERVICE_INFO *service_info; - uint32 level; SERVICE_INFO *info = find_service_info_by_hnd( p, &q_u->handle ); /* perform access checks */ @@ -789,10 +792,8 @@ in the *r_query_config2 marshalling routine... */ - level = q_u->info_level; - #if 0 - if (SERVICE_CONFIG_DESCRIPTION == level) { + if (SERVICE_CONFIG_DESCRIPTION == q_u->info_level) { if (service_info && service_info->shortdescription) { /* length of the string, plus the terminator... */ string_buffer_size = strlen(service_info->shortdescription)+1; diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/sam/idmap_rid.c samba-3.0.20a/source/sam/idmap_rid.c --- samba-3.0.20/source/sam/idmap_rid.c 2005-07-28 08:19:49.000000000 -0500 +++ samba-3.0.20a/source/sam/idmap_rid.c 2005-09-29 16:52:46.710223000 -0500 @@ -159,11 +159,10 @@ char **trusted_domain_names; DOM_SID *trusted_domain_sids; uint32 enum_ctx = 0; - DOM_SID builtin_sid; int own_domains = 2; /* put the results together */ - *num_domains = 1; + *num_domains = 2; *domain_names = SMB_MALLOC_ARRAY(fstring, *num_domains); *domain_sids = SMB_MALLOC_ARRAY(DOM_SID, *num_domains); @@ -177,6 +176,10 @@ } sid_copy(&(*domain_sids)[0], &sid); + /* add BUILTIN */ + fstrcpy((*domain_names)[1], "BUILTIN"); + sid_copy(&(*domain_sids)[1], &global_sid_Builtin); + return NT_STATUS_OK; } @@ -286,9 +289,8 @@ sid_copy(&(*domain_sids)[0], domain_sid); /* then add BUILTIN */ - string_to_sid(&builtin_sid, "S-1-5-32"); fstrcpy((*domain_names)[1], "BUILTIN"); - sid_copy(&(*domain_sids)[1], &builtin_sid); + sid_copy(&(*domain_sids)[1], &global_sid_Builtin); /* then add my local sid */ if (!sid_equal(domain_sid, get_global_sam_sid())) { diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/script/mkproto.awk samba-3.0.20a/source/script/mkproto.awk --- samba-3.0.20/source/script/mkproto.awk 2005-07-28 08:19:52.000000000 -0500 +++ samba-3.0.20a/source/script/mkproto.awk 2005-09-29 16:52:48.513946000 -0500 @@ -136,7 +136,7 @@ gotstart = 1; } - if( $0 ~ /^NODE_STATUS_STRUCT/ ) { + if( $0 ~ /^NODE_STATUS_STRUCT|SMB_STRUCT_DIR/ ) { gotstart = 1; } diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/smbd/chgpasswd.c samba-3.0.20a/source/smbd/chgpasswd.c --- samba-3.0.20/source/smbd/chgpasswd.c 2005-07-28 08:19:42.000000000 -0500 +++ samba-3.0.20a/source/smbd/chgpasswd.c 2005-09-29 16:52:41.130079000 -0500 @@ -64,7 +64,7 @@ { int master; static fstring line; - DIR *dirp; + SMB_STRUCT_DIR *dirp; const char *dpname; #if defined(HAVE_GRANTPT) @@ -93,7 +93,7 @@ fstrcpy(line, "/dev/ptyXX"); - dirp = opendir("/dev"); + dirp = sys_opendir("/dev"); if (!dirp) return (-1); while ((dpname = readdirname(dirp)) != NULL) @@ -110,12 +110,12 @@ DEBUG(3, ("pty: opened %s\n", line)); line[5] = 't'; *slave = line; - closedir(dirp); + sys_closedir(dirp); return (master); } } } - closedir(dirp); + sys_closedir(dirp); return (-1); } diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/smbd/dir.c samba-3.0.20a/source/smbd/dir.c --- samba-3.0.20/source/smbd/dir.c 2005-07-28 08:19:43.000000000 -0500 +++ samba-3.0.20a/source/smbd/dir.c 2005-09-29 16:52:41.607005000 -0500 @@ -42,7 +42,7 @@ struct smb_Dir { connection_struct *conn; - DIR *dir; + SMB_STRUCT_DIR *dir; long offset; char *dir_path; struct name_cache_entry *name_cache; @@ -378,6 +378,7 @@ one byte long. If old_handle is false we allocate from the range 256 - MAX_DIRECTORY_HANDLES. We bias the number we return by 1 to ensure a directory handle is never zero. + wcard must not be zero. ****************************************************************************/ int dptr_create(connection_struct *conn, pstring path, BOOL old_handle, BOOL expect_close,uint16 spid, @@ -389,6 +390,10 @@ DEBUG(5,("dptr_create dir=%s\n", path)); + if (!wcard) { + return -1; + } + if (!check_name(path,conn)) return(-2); /* Code to say use a unix error return code. */ @@ -485,24 +490,21 @@ dptr->dir_hnd = dir_hnd; dptr->spid = spid; dptr->expect_close = expect_close; - if (wcard) { - dptr->wcard = SMB_STRDUP(wcard); - if (!dptr->wcard) { - bitmap_clear(dptr_bmap, dptr->dnum - 1); - SAFE_FREE(dptr); - CloseDir(dir_hnd); - return -1; - } - } else { - dptr->wcard = NULL; + dptr->wcard = SMB_STRDUP(wcard); + if (!dptr->wcard) { + bitmap_clear(dptr_bmap, dptr->dnum - 1); + SAFE_FREE(dptr); + CloseDir(dir_hnd); + return -1; } - dptr->attr = attr; - if (lp_posix_pathnames() || (wcard && (wcard[0] == '.' && wcard[1] == 0))) { + if (lp_posix_pathnames() || (wcard[0] == '.' && wcard[1] == 0)) { dptr->has_wild = True; } else { dptr->has_wild = ms_has_wild(wcard); } + dptr->attr = attr; + DLIST_ADD(dirptrs, dptr); DEBUG(3,("creating new dirptr %d for path %s, expect_close = %d\n", @@ -1098,6 +1100,9 @@ } dirp->file_number++; return n; + } else if (*poffset == END_OF_DIRECTORY_OFFSET) { + *poffset = dirp->offset = END_OF_DIRECTORY_OFFSET; + return NULL; } else { /* A real offset, seek to it. */ SeekDir(dirp, *poffset); @@ -1120,7 +1125,7 @@ dirp->file_number++; return e->name; } - dirp->offset = END_OF_DIRECTORY_OFFSET; + *poffset = dirp->offset = END_OF_DIRECTORY_OFFSET; return NULL; } @@ -1143,8 +1148,25 @@ void SeekDir(struct smb_Dir *dirp, long offset) { if (offset != dirp->offset) { - if (offset == START_OF_DIRECTORY_OFFSET || offset == DOT_DOT_DIRECTORY_OFFSET) { + if (offset == START_OF_DIRECTORY_OFFSET) { RewindDir(dirp, &offset); + /* + * Ok we should really set the file number here + * to 1 to enable ".." to be returned next. Trouble + * is I'm worried about callers using SeekDir(dirp,0) + * as equivalent to RewindDir(). So leave this alone + * for now. + */ + } else if (offset == DOT_DOT_DIRECTORY_OFFSET) { + RewindDir(dirp, &offset); + /* + * Set the file number to 2 - we want to get the first + * real file entry (the one we return after "..") + * on the next ReadDir. + */ + dirp->file_number = 2; + } else if (offset == END_OF_DIRECTORY_OFFSET) { + ; /* Don't seek in this case. */ } else { SMB_VFS_SEEKDIR(dirp->conn, dirp->dir, offset); } diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/smbd/dosmode.c samba-3.0.20a/source/smbd/dosmode.c --- samba-3.0.20/source/smbd/dosmode.c 2005-07-28 08:19:43.000000000 -0500 +++ samba-3.0.20a/source/smbd/dosmode.c 2005-09-29 16:52:42.249907000 -0500 @@ -297,27 +297,28 @@ return 0; } - /* Get the DOS attributes from an EA by preference. */ - if (get_ea_dos_attribute(conn, path, sbuf, &result)) { - result |= set_sparse_flag(sbuf); - return result; - } - - result = dos_mode_from_sbuf(conn, path, sbuf); - - /* Now do any modifications that depend on the path name. */ + /* First do any modifications that depend on the path name. */ /* hide files with a name starting with a . */ if (lp_hide_dot_files(SNUM(conn))) { const char *p = strrchr_m(path,'/'); - if (p) + if (p) { p++; - else + } else { p = path; + } - if (p[0] == '.' && p[1] != '.' && p[1] != 0) + if (p[0] == '.' && p[1] != '.' && p[1] != 0) { result |= aHIDDEN; + } } + /* Get the DOS attributes from an EA by preference. */ + if (get_ea_dos_attribute(conn, path, sbuf, &result)) { + result |= set_sparse_flag(sbuf); + } else { + result |= dos_mode_from_sbuf(conn, path, sbuf); + } + /* Optimization : Only call is_hidden_path if it's not already hidden. */ if (!(result & aHIDDEN) && IS_HIDDEN_PATH(conn,path)) { @@ -451,6 +452,17 @@ errno = 0; ZERO_STRUCT(sbuf); + /* Don't update the time on read-only shares */ + /* We need this as set_filetime (which can be called on + close and other paths) can end up calling this function + without the NEED_WRITE protection. Found by : + Leo Weppelman + */ + + if (!CAN_WRITE(conn)) { + return 0; + } + if(SMB_VFS_UTIME(conn,fname, times) == 0) return 0; diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/smbd/mangle_hash.c samba-3.0.20a/source/smbd/mangle_hash.c --- samba-3.0.20/source/smbd/mangle_hash.c 2005-07-28 08:19:42.000000000 -0500 +++ samba-3.0.20a/source/smbd/mangle_hash.c 2005-09-29 16:52:40.517173000 -0500 @@ -167,10 +167,6 @@ if (strcmp_wa(fname, ".")==0 || strcmp_wa(fname, "..")==0) return NT_STATUS_OK; - /* Name cannot start with '.' */ - if (*fname == UCS2_CHAR('.')) - return NT_STATUS_UNSUCCESSFUL; - if (only_8_3) { ret = has_valid_83_chars(fname, allow_wildcards); if (!NT_STATUS_IS_OK(ret)) @@ -247,6 +243,10 @@ if (strcmp_wa(fname, ".") == 0 || strcmp_wa(fname, "..") == 0) return NT_STATUS_OK; + /* Name cannot start with '.' */ + if (*fname == UCS2_CHAR('.')) + return NT_STATUS_UNSUCCESSFUL; + if (!NT_STATUS_IS_OK(is_valid_name(fname, allow_wildcards, True))) goto done; diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/smbd/msdfs.c samba-3.0.20a/source/smbd/msdfs.c --- samba-3.0.20/source/smbd/msdfs.c 2005-08-07 18:09:53.000000000 -0500 +++ samba-3.0.20a/source/smbd/msdfs.c 2005-09-29 16:52:40.529171000 -0500 @@ -1010,7 +1010,7 @@ static int form_junctions(TALLOC_CTX *ctx, int snum, struct junction_map *jucn, int jn_remain) { int cnt = 0; - DIR *dirp; + SMB_STRUCT_DIR *dirp; char* dname; pstring connect_path; char* service_name = lp_servicename(snum); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/smbd/open.c samba-3.0.20a/source/smbd/open.c --- samba-3.0.20/source/smbd/open.c 2005-07-28 08:19:42.000000000 -0500 +++ samba-3.0.20a/source/smbd/open.c 2005-09-29 16:52:40.239215000 -0500 @@ -1046,13 +1046,13 @@ /* Create the NT compatible access_mask. */ switch (GET_OPENX_MODE(deny_mode)) { + case DOS_OPEN_EXEC: /* Implies read-only - used to be FILE_READ_DATA */ case DOS_OPEN_RDONLY: access_mask = FILE_GENERIC_READ; break; case DOS_OPEN_WRONLY: access_mask = FILE_GENERIC_WRITE; break; - case DOS_OPEN_EXEC: /* This used to be FILE_READ_DATA... */ case DOS_OPEN_RDWR: case DOS_OPEN_FCB: access_mask = FILE_GENERIC_READ|FILE_GENERIC_WRITE; @@ -1585,6 +1585,15 @@ fsp_open = open_file(fsp,conn,fname,psbuf,flags|flags2,unx_mode,access_mask); + if (!fsp_open && (flags2 & O_EXCL) && (errno == EEXIST)) { + /* + * Two smbd's tried to open exclusively, but only one of them + * succeeded. + */ + file_free(fsp); + return NULL; + } + if (!fsp_open && (flags == O_RDWR) && (errno != ENOENT)) { if((fsp_open = open_file(fsp,conn,fname,psbuf, O_RDONLY,unx_mode,access_mask)) == True) { diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/smbd/posix_acls.c samba-3.0.20a/source/smbd/posix_acls.c --- samba-3.0.20/source/smbd/posix_acls.c 2005-07-28 08:19:42.000000000 -0500 +++ samba-3.0.20a/source/smbd/posix_acls.c 2005-09-29 16:52:40.499175000 -0500 @@ -1548,8 +1548,12 @@ * entries can be converted to *_OBJ. Usually we will already have these * entries in the Default ACL, and the Access ACL will not have them. */ - check_owning_objs(file_ace, pfile_owner_sid, pfile_grp_sid); - check_owning_objs(dir_ace, pfile_owner_sid, pfile_grp_sid); + if (file_ace) { + check_owning_objs(file_ace, pfile_owner_sid, pfile_grp_sid); + } + if (dir_ace) { + check_owning_objs(dir_ace, pfile_owner_sid, pfile_grp_sid); + } } *ppfile_ace = file_ace; @@ -2801,7 +2805,7 @@ if (count_canon_ace_list(file_ace) == 0) { DEBUG(0,("get_nt_acl : No ACLs on file (%s) !\n", fsp->fsp_name )); - return 0; + goto done; } if (fsp->is_directory && def_acl) { @@ -2950,33 +2954,37 @@ if(!psd) { DEBUG(0,("get_nt_acl: Unable to malloc space for security descriptor.\n")); sd_size = 0; - } else { - /* - * Windows 2000: The DACL_PROTECTED flag in the security - * descriptor marks the ACL as non-inheriting, i.e., no - * ACEs from higher level directories propagate to this - * ACL. In the POSIX ACL model permissions are only - * inherited at file create time, so ACLs never contain - * any ACEs that are inherited dynamically. The DACL_PROTECTED - * flag doesn't seem to bother Windows NT. - * Always set this if map acl inherit is turned off. - */ - if (get_protected_flag(pal) || !lp_map_acl_inherit(SNUM(conn))) { - psd->type |= SE_DESC_DACL_PROTECTED; - } + goto done; } - if (psd->dacl) + /* + * Windows 2000: The DACL_PROTECTED flag in the security + * descriptor marks the ACL as non-inheriting, i.e., no + * ACEs from higher level directories propagate to this + * ACL. In the POSIX ACL model permissions are only + * inherited at file create time, so ACLs never contain + * any ACEs that are inherited dynamically. The DACL_PROTECTED + * flag doesn't seem to bother Windows NT. + * Always set this if map acl inherit is turned off. + */ + if (get_protected_flag(pal) || !lp_map_acl_inherit(SNUM(conn))) { + psd->type |= SE_DESC_DACL_PROTECTED; + } + + if (psd->dacl) { dacl_sort_into_canonical_order(psd->dacl->ace, (unsigned int)psd->dacl->num_aces); + } *ppdesc = psd; done: - if (posix_acl) + if (posix_acl) { SMB_VFS_SYS_ACL_FREE_ACL(conn, posix_acl); - if (def_acl) + } + if (def_acl) { SMB_VFS_SYS_ACL_FREE_ACL(conn, def_acl); + } free_canon_ace_list(file_ace); free_canon_ace_list(dir_ace); free_inherited_info(pal); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/smbd/process.c samba-3.0.20a/source/smbd/process.c --- samba-3.0.20/source/smbd/process.c 2005-08-07 18:09:53.000000000 -0500 +++ samba-3.0.20a/source/smbd/process.c 2005-09-29 16:52:41.122080000 -0500 @@ -897,7 +897,7 @@ uint16 session_tag = (lp_security() == SEC_SHARE) ? UID_FIELD_INVALID : SVAL(inbuf,smb_uid); connection_struct *conn = conn_find(SVAL(inbuf,smb_tid)); - DEBUG(3,("switch message %s (pid %d) conn 0x%x\n",smb_fn_name(type),(int)pid,(unsigned int)conn)); + DEBUG(3,("switch message %s (pid %d) conn 0x%lx\n",smb_fn_name(type),(int)pid,(unsigned long)conn)); smb_dump(smb_fn_name(type), 1, inbuf, size); if(global_oplock_break) { diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/smbd/reply.c samba-3.0.20a/source/smbd/reply.c --- samba-3.0.20/source/smbd/reply.c 2005-07-28 08:19:42.000000000 -0500 +++ samba-3.0.20a/source/smbd/reply.c 2005-09-29 16:52:41.181071000 -0500 @@ -1610,7 +1610,7 @@ create_disposition = FILE_CREATE; } else { /* Create if file doesn't exist, truncate if it does. */ - create_disposition = FILE_OPEN_IF; + create_disposition = FILE_OVERWRITE_IF; } /* Open file using ntcreate. */ diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/smbd/server.c samba-3.0.20a/source/smbd/server.c --- samba-3.0.20/source/smbd/server.c 2005-07-28 08:19:43.000000000 -0500 +++ samba-3.0.20a/source/smbd/server.c 2005-09-29 16:52:41.557013000 -0500 @@ -22,6 +22,10 @@ #include "includes.h" +#ifdef HAVE_SYS_PRCTL_H +#include +#endif + static int am_parent = 1; /* the last message the was processed */ @@ -915,6 +919,14 @@ * everything after this point is run after the fork() */ +#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) + /* On Linux we lose the ability to dump core when we change our user + * ID. We know how to dump core safely, so let's make sure we have our + * dumpable flag set. + */ + prctl(PR_SET_DUMPABLE, 1); +#endif + /* Initialise the password backed before the global_sam_sid to ensure that we fetch from ldap before we make a domain sid up */ diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/smbd/statcache.c samba-3.0.20a/source/smbd/statcache.c --- samba-3.0.20/source/smbd/statcache.c 2005-07-28 08:19:43.000000000 -0500 +++ samba-3.0.20a/source/smbd/statcache.c 2005-09-29 16:52:41.514020000 -0500 @@ -136,8 +136,8 @@ if (tdb_store_bystring(tdb_stat_cache, original_path, data_val, TDB_REPLACE) != 0) { DEBUG(0,("stat_cache_add: Error storing entry %s -> %s\n", original_path, translated_path)); } else { - DEBUG(5,("stat_cache_add: Added entry (%x:size%x) %s -> %s\n", - (unsigned int)data_val.dptr, data_val.dsize, original_path, translated_path)); + DEBUG(5,("stat_cache_add: Added entry (%lx:size%x) %s -> %s\n", + (unsigned long)data_val.dptr, (unsigned int)data_val.dsize, original_path, translated_path)); } SAFE_FREE(original_path); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/smbd/trans2.c samba-3.0.20a/source/smbd/trans2.c --- samba-3.0.20/source/smbd/trans2.c 2005-08-19 12:16:26.000000000 -0500 +++ samba-3.0.20a/source/smbd/trans2.c 2005-09-29 16:52:41.598007000 -0500 @@ -135,7 +135,7 @@ return False; } - DEBUG(10,("get_ea_value: EA %s is of length %d: ", ea_name, sizeret)); + DEBUG(10,("get_ea_value: EA %s is of length %u: ", ea_name, (unsigned int)sizeret)); dump_data(10, val, sizeret); pea->flags = 0; @@ -188,7 +188,7 @@ if (sizeret == -1) return NULL; - DEBUG(10,("get_ea_list_from_file: ea_namelist size = %d\n", sizeret )); + DEBUG(10,("get_ea_list_from_file: ea_namelist size = %u\n", (unsigned int)sizeret )); if (sizeret) { for (p = ea_namelist; p - ea_namelist < sizeret; p += strlen(p) + 1) { @@ -210,7 +210,7 @@ push_ascii_fstring(dos_ea_name, listp->ea.name); *pea_total_len += 4 + strlen(dos_ea_name) + 1 + listp->ea.value.length; DEBUG(10,("get_ea_list_from_file: total_len = %u, %s, val len = %u\n", - *pea_total_len, dos_ea_name, + (unsigned int)*pea_total_len, dos_ea_name, (unsigned int)listp->ea.value.length )); } DLIST_ADD_END(ea_list_head, listp, tmp); @@ -221,7 +221,7 @@ } } - DEBUG(10,("get_ea_list_from_file: total_len = %u\n", *pea_total_len)); + DEBUG(10,("get_ea_list_from_file: total_len = %u\n", (unsigned int)*pea_total_len)); return ea_list_head; } @@ -329,7 +329,7 @@ canonicalize_ea_name(conn, fsp, fname, unix_ea_name); - DEBUG(10,("set_ea: ea_name %s ealen = %u\n", unix_ea_name, ea_list->ea.value.length)); + DEBUG(10,("set_ea: ea_name %s ealen = %u\n", unix_ea_name, (unsigned int)ea_list->ea.value.length)); if (samba_private_attr_name(unix_ea_name)) { DEBUG(10,("set_ea: ea name %s is a private Samba name.\n", unix_ea_name)); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/smbd/vfs-wrap.c samba-3.0.20a/source/smbd/vfs-wrap.c --- samba-3.0.20/source/smbd/vfs-wrap.c 2005-07-28 08:19:43.000000000 -0500 +++ samba-3.0.20a/source/smbd/vfs-wrap.c 2005-09-29 16:52:41.537016000 -0500 @@ -88,9 +88,9 @@ /* Directory operations */ -DIR *vfswrap_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) +SMB_STRUCT_DIR *vfswrap_opendir(vfs_handle_struct *handle, connection_struct *conn, const char *fname, const char *mask, uint32 attr) { - DIR *result; + SMB_STRUCT_DIR *result; START_PROFILE(syscall_opendir); result = sys_opendir(fname); @@ -98,7 +98,7 @@ return result; } -SMB_STRUCT_DIRENT *vfswrap_readdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +SMB_STRUCT_DIRENT *vfswrap_readdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) { SMB_STRUCT_DIRENT *result; @@ -108,14 +108,14 @@ return result; } -void vfswrap_seekdir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp, long offset) +void vfswrap_seekdir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp, long offset) { START_PROFILE(syscall_seekdir); sys_seekdir(dirp, offset); END_PROFILE(syscall_seekdir); } -long vfswrap_telldir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +long vfswrap_telldir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) { long result; START_PROFILE(syscall_telldir); @@ -124,7 +124,7 @@ return result; } -void vfswrap_rewinddir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +void vfswrap_rewinddir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) { START_PROFILE(syscall_rewinddir); sys_rewinddir(dirp); @@ -170,7 +170,7 @@ return result; } -int vfswrap_closedir(vfs_handle_struct *handle, connection_struct *conn, DIR *dirp) +int vfswrap_closedir(vfs_handle_struct *handle, connection_struct *conn, SMB_STRUCT_DIR *dirp) { int result; @@ -1063,7 +1063,7 @@ return sys_aio_write(aiocb); } -int vfswrap_aio_return(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) +ssize_t vfswrap_aio_return(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb) { return sys_aio_return(aiocb); } diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/smbwrapper/smbw_dir.c samba-3.0.20a/source/smbwrapper/smbw_dir.c --- samba-3.0.20/source/smbwrapper/smbw_dir.c 2005-02-25 11:59:24.000000000 -0600 +++ samba-3.0.20a/source/smbwrapper/smbw_dir.c 2005-09-29 16:52:39.821279000 -0500 @@ -188,7 +188,7 @@ goto failed; } - dir = (struct smbw_dir *)malloc(sizeof(*dir)); + dir = SMB_MALLOC_P(struct smbw_dir); if (!dir) { errno = ENOMEM; goto failed; @@ -265,7 +265,7 @@ dir->fd = fd; dir->srv = srv; - dir->path = strdup(s); + dir->path = SMB_STRDUP(s); DEBUG(4,(" -> %d\n", dir->count)); @@ -578,7 +578,7 @@ if (!buf) { if (size <= 0) size = strlen(smbw_cwd)+1; - buf = (char *)malloc(size); + buf = SMB_MALLOC_ARRAY(char, size); if (!buf) { errno = ENOMEM; smbw_busy--; diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/tdb/tdb.c samba-3.0.20a/source/tdb/tdb.c --- samba-3.0.20/source/tdb/tdb.c 2005-08-07 18:09:57.000000000 -0500 +++ samba-3.0.20a/source/tdb/tdb.c 2005-09-29 16:52:49.122853000 -0500 @@ -1248,6 +1248,54 @@ /* Lock each chain from the start one. */ for (; tlock->hash < tdb->header.hash_size; tlock->hash++) { + + /* this is an optimisation for the common case where + the hash chain is empty, which is particularly + common for the use of tdb with ldb, where large + hashes are used. In that case we spend most of our + time in tdb_brlock(), locking empty hash chains. + + To avoid this, we do an unlocked pre-check to see + if the hash chain is empty before starting to look + inside it. If it is empty then we can avoid that + hash chain. If it isn't empty then we can't believe + the value we get back, as we read it without a + lock, so instead we get the lock and re-fetch the + value below. + + Notice that not doing this optimisation on the + first hash chain is critical. We must guarantee + that we have done at least one fcntl lock at the + start of a search to guarantee that memory is + coherent on SMP systems. If records are added by + others during the search then thats OK, and we + could possibly miss those with this trick, but we + could miss them anyway without this trick, so the + semantics don't change. + + With a non-indexed ldb search this trick gains us a + factor of around 80 in speed on a linux 2.6.x + system (testing using ldbtest). + */ + if (!tlock->off && tlock->hash != 0) { + u32 off; + if (tdb->map_ptr) { + for (;tlock->hash < tdb->header.hash_size;tlock->hash++) { + if (0 != *(u32 *)(TDB_HASH_TOP(tlock->hash) + (unsigned char *)tdb->map_ptr)) { + break; + } + } + if (tlock->hash == tdb->header.hash_size) { + continue; + } + } else { + if (ofs_read(tdb, TDB_HASH_TOP(tlock->hash), &off) == 0 && + off == 0) { + continue; + } + } + } + if (tdb_lock(tdb, tlock->hash, F_WRLCK) == -1) return -1; @@ -2023,6 +2071,11 @@ TDB_LOG((tdb, 0, "tdb_reopen: open failed (%s)\n", strerror(errno))); goto fail; } + if ((tdb->flags & TDB_CLEAR_IF_FIRST) && + (tdb_brlock(tdb, ACTIVE_LOCK, F_RDLCK, F_SETLKW, 0) == -1)) { + TDB_LOG((tdb, 0, "tdb_reopen: failed to obtain active lock\n")); + goto fail; + } if (fstat(tdb->fd, &st) != 0) { TDB_LOG((tdb, 0, "tdb_reopen: fstat failed (%s)\n", strerror(errno))); goto fail; @@ -2032,10 +2085,6 @@ goto fail; } tdb_mmap(tdb); - if ((tdb->flags & TDB_CLEAR_IF_FIRST) && (tdb_brlock(tdb, ACTIVE_LOCK, F_RDLCK, F_SETLKW, 0) == -1)) { - TDB_LOG((tdb, 0, "tdb_reopen: failed to obtain active lock\n")); - goto fail; - } return 0; @@ -2050,8 +2099,6 @@ TDB_CONTEXT *tdb; for (tdb=tdbs; tdb; tdb = tdb->next) { - /* Ensure no clear-if-first. */ - tdb->flags &= ~TDB_CLEAR_IF_FIRST; if (tdb_reopen(tdb) != 0) return -1; } diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/utils/net_rpc.c samba-3.0.20a/source/utils/net_rpc.c --- samba-3.0.20/source/utils/net_rpc.c 2005-08-07 18:09:56.000000000 -0500 +++ samba-3.0.20a/source/utils/net_rpc.c 2005-09-29 16:52:48.341973000 -0500 @@ -131,6 +131,8 @@ if (!(conn_flags & NET_FLAGS_NO_PIPE)) { if (!cli_nt_session_open(cli, pipe_idx)) { DEBUG(0, ("Could not initialise pipe\n")); + cli_shutdown(cli); + return -1; } } @@ -4469,7 +4471,10 @@ if (opt_comment) { msg = opt_comment; + } else { + msg = ""; } + if (opt_timeout) { timeout = opt_timeout; } @@ -5959,12 +5964,13 @@ d_printf(" net rpc shutdown \t\tto shutdown a remote server\n"); d_printf(" net rpc rights\t\tto manage privileges assigned to SIDs\n"); d_printf(" net rpc registry\t\tto manage registry hives\n"); + d_printf(" net rpc service\t\tto start, stop and query services\n"); d_printf("\n"); d_printf("'net rpc shutdown' also accepts the following miscellaneous options:\n"); /* misc options */ d_printf("\t-r or --reboot\trequest remote server reboot on shutdown\n"); d_printf("\t-f or --force\trequest the remote server force its shutdown\n"); d_printf("\t-t or --timeout=\tnumber of seconds before shutdown\n"); - d_printf("\t-c or --comment=\ttext message to display on impending shutdown\n"); + d_printf("\t-C or --comment=\ttext message to display on impending shutdown\n"); return -1; } diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/utils/net_rpc_service.c samba-3.0.20a/source/utils/net_rpc_service.c --- samba-3.0.20/source/utils/net_rpc_service.c 2005-04-18 11:38:21.000000000 -0500 +++ samba-3.0.20a/source/utils/net_rpc_service.c 2005-09-29 16:52:48.269984000 -0500 @@ -499,7 +499,7 @@ d_printf("net rpc service start Start a service\n"); d_printf("net rpc service stop Stop a service\n"); d_printf("net rpc service pause Pause a service\n"); - d_printf("net rpc service resume Resume a paused a service\n"); + d_printf("net rpc service resume Resume a paused service\n"); d_printf("net rpc service status View the current status of a service\n"); return -1; diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/utils/pdbedit.c samba-3.0.20a/source/utils/pdbedit.c --- samba-3.0.20/source/utils/pdbedit.c 2005-07-28 08:19:51.000000000 -0500 +++ samba-3.0.20a/source/utils/pdbedit.c 2005-09-29 16:52:48.276982000 -0500 @@ -235,7 +235,7 @@ static int print_users_list (struct pdb_context *in, BOOL verbosity, BOOL smbpwdstyle) { SAM_ACCOUNT *sam_pwent=NULL; - BOOL check, ret; + BOOL check; check = NT_STATUS_IS_OK(in->pdb_setsampwent(in, False, 0)); if (!check) { @@ -245,7 +245,7 @@ check = True; if (!(NT_STATUS_IS_OK(pdb_init_sam(&sam_pwent)))) return 1; - while (check && (ret = NT_STATUS_IS_OK(in->pdb_getsampwent (in, sam_pwent)))) { + while (check && NT_STATUS_IS_OK(in->pdb_getsampwent (in, sam_pwent))) { if (verbosity) printf ("---------------\n"); print_sam_info (sam_pwent, verbosity, smbpwdstyle); @@ -264,7 +264,7 @@ static int fix_users_list (struct pdb_context *in) { SAM_ACCOUNT *sam_pwent=NULL; - BOOL check, ret; + BOOL check; check = NT_STATUS_IS_OK(in->pdb_setsampwent(in, False, 0)); if (!check) { @@ -274,7 +274,7 @@ check = True; if (!(NT_STATUS_IS_OK(pdb_init_sam(&sam_pwent)))) return 1; - while (check && (ret = NT_STATUS_IS_OK(in->pdb_getsampwent (in, sam_pwent)))) { + while (check && NT_STATUS_IS_OK(in->pdb_getsampwent (in, sam_pwent))) { printf("Updating record for user %s\n", pdb_get_username(sam_pwent)); if (!pdb_update_sam_account(sam_pwent)) { @@ -430,12 +430,12 @@ const char *profile, char *user_sid, char *group_sid) { SAM_ACCOUNT *sam_pwent=NULL; - NTSTATUS nt_status; + char *password1, *password2, *staticpass; get_global_sam_sid(); - if (!NT_STATUS_IS_OK(nt_status = pdb_init_sam_new(&sam_pwent, username, 0))) { + if (!NT_STATUS_IS_OK(pdb_init_sam_new(&sam_pwent, username, 0))) { DEBUG(0, ("could not create account to add new user %s\n", username)); return -1; } diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/utils/status.c samba-3.0.20a/source/utils/status.c --- samba-3.0.20/source/utils/status.c 2005-07-28 08:19:51.000000000 -0500 +++ samba-3.0.20a/source/utils/status.c 2005-09-29 16:52:48.224990000 -0500 @@ -128,7 +128,8 @@ } } d_printf("0x%-8x ",(unsigned int)e->access_mask); - if (e->access_mask & (FILE_READ_DATA|FILE_WRITE_DATA)) { + if ((e->access_mask & (FILE_READ_DATA|FILE_WRITE_DATA))== + (FILE_READ_DATA|FILE_WRITE_DATA)) { d_printf("RDWR "); } else if (e->access_mask & FILE_WRITE_DATA) { d_printf("WRONLY "); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/VERSION samba-3.0.20a/source/VERSION --- samba-3.0.20/source/VERSION 2005-08-19 12:16:29.000000000 -0500 +++ samba-3.0.20a/source/VERSION 2005-09-29 16:52:40.151229000 -0500 @@ -31,7 +31,7 @@ # e.g. SAMBA_VERSION_REVISION=a # # -> "2.2.8a" # ######################################################## -SAMBA_VERSION_REVISION= +SAMBA_VERSION_REVISION=a ######################################################## # For 'pre' releases the version will be # diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/source/web/swat.c samba-3.0.20a/source/web/swat.c --- samba-3.0.20/source/web/swat.c 2005-08-19 12:16:28.000000000 -0500 +++ samba-3.0.20a/source/web/swat.c 2005-09-29 16:52:45.768367000 -0500 @@ -1331,13 +1331,12 @@ **/ int main(int argc, char *argv[]) { - int opt; const char *page; poptContext pc; struct poptOption long_options[] = { POPT_AUTOHELP { "disable-authentication", 'a', POPT_ARG_VAL, &demo_mode, True, "Disable authentication (demo mode)" }, - { "password-menu-only", 'P', POPT_ARG_VAL, &passwd_only, True, "Show only change password menu" }, + { "password-menu-only", 'P', POPT_ARG_VAL, &passwd_only, True, "Show only change password menu" }, POPT_COMMON_SAMBA POPT_TABLEEND }; @@ -1368,7 +1367,7 @@ /* Parse command line options */ - while((opt = poptGetNextOpt(pc)) != -1) { } + while(poptGetNextOpt(pc) != -1) { } poptFreeContext(pc); diff -u -r --new-file --exclude .svn --exclude CVS samba-3.0.20/WHATSNEW.txt samba-3.0.20a/WHATSNEW.txt --- samba-3.0.20/WHATSNEW.txt 2005-08-19 13:39:22.000000000 -0500 +++ samba-3.0.20a/WHATSNEW.txt 2005-09-29 17:34:51.390033000 -0500 @@ -1,14 +1,167 @@ + =============================== + Release Notes for Samba 3.0.20a + Sept 30, 2005 + =============================== + +This is the latest stable release of Samba. This is the version +that production Samba servers should be running for all current +bug-fixes. Please read the following important changes in this +release. + +Common bugs fixed in 3.0.20a include: + + o Stability problems with winbindd. + o Crash bugs caused by incompatibilities on 64-bit systems. + o Missing files from directory listings on AIX servers + o User Manager interoperability problems. + o Minor build difficulties on various platforms such as + Solaris and OpenBSD, + + +Winbind, security = domain, and Active Directory +================================================ + +Recent security updates for Windows 2000 and Windows 2003 have +changed the fashion in which user and group lists can be obtained +from domain controllers. In short, the RPC mechanisms used by +"security = domain" to retrieve users and groups is not compatible +with these changes. The "security = ads" configuration is not +affected by the Windows protocol changes. + +Samba developers are actively working to correct this problem in +the 3.0.21 release. In the meantime, Administrators who are unable +to migrate to "security = ads" and must continue using "security = +domain", can define credentials to be used by winbindd for account +enumeration by executing the following command as root. + + wbinfo --set-auth-user='DOMAIN\username%password' + + + +###################################################################### +Changes +####### + + +Changes since 3.0.20 +-------------------- + +commits +------- + +o Jeremy Allison + * BUG 3065: Fix for legacy clients retrieving a listing of + an empty directory. + * Added external library for accessing Samba's share mode + database. + * Fix winbindd credentials chain which caused logon failures + after attempting to authenticate an unknown user. + * Fix recursive looping bug in winbindd. + * Fix build errors on 64-bit systems. + * Posix ACL memory leak and crash bug fixes. + * BUG 3044: Ensure OPEN-EXEC is honored as read-only. + * BUG 3060: Ensure SMBcreate truncates the file if it exists. + * Hide dot files and directory logic fixes. + * Correct display of open file modes by smbstatus. + * BUG 3010: Fix missing files bug on AIX systems. + + +o Gerald (Jerry) Carter + * Allow the root user to automatically pass se_access_checks() + in the registry and service control server code. + * Ensure that winbindd uses the correct name in the net_auth2() + request when running on a Samba PDC. + * Fix linking problem with tdb utilities. + * BUG 3080: Fix regression in 'net rpc shutdown' command. + * Fix segv in 'net rpc' when the pipe open fails. + * Fix upload bug when installing 64-bit Windows printer drivers. + * Fix regression in the smburi syntax used by smbspool. + * Fix sorting of subkey hash records in registry files. + * Correct REG_CREATE_KEY_EX parsing error. + * Interoperability issues with usrmgr.exe and Samba groups. + * Use the display names and not the Unix names when enumerating + groups in the ldapsam passdb backend. + * Ensure that Windows domain user names are converted to lower case. + + +o Guenther Deschner + * Prevent BUILTIN sids returned in the user's token from + a Windows DC from being applied to any local group mappings + on the Samba host. + * Plug memory leaks in the kerberos keytab code. + * Ensure BUILTIN groups are returned from winbindd's idmap_rid + backend when 'winbind nested groups' is enabled. + * Fix crash bug in winbindd caused by 64-bit build issues. + * Improve debug messages in smbspool. + * Give better error-message when "NDS Universal Password" change fails. + * Fix password history error in the eDirectory schema file. + * Ensure that Windows domain group names are converted to lower case. + + +o Steve French + * Allow disabling mandatory byte range lock mount flag, and fix + corresponding entry in mtab. + + +o Volker Lendecke + * Fix race condition in the NTcreate&X open code when the + disposition is NTCREATEX_DISP_CREATE. + * Correct logic error when checking the pid for pending print + change notify messages. + * Ensure that winbindd child process complete startup even when + the parent is receiving authentication requests. + * Return the full NTSTATUS code to ntlm_auth and pam_winbindd + when authentication fails. + + +o Jason Mader + * Compile warning fixes. + + +o Uli Meis + * Patches for pdb_*sql.c + + +o Luke Mewburn + * Autoconf syntax fixes. + + +o James Peach + * Correct problem with creating a core file in Linux. + + +o Stefan Metzmacher + * Quota fixes in smbd. + + +o Peter Rindfuss + * Patches for pdb_*sql.c + + +o Jiri Sasek + * Solaris toolchain patches for autoconf scripts. + + +o Andrew Tridgell + * Fix for tdb clear-if-first race condition. + + +o Leo Weppelman + * BUG 3104: Don't allow time updates to files on read-only shares. + + +o Steve Williams + * BUG 3052: Fix compile issues on OpenBSD. + + +Release Notes for older release follow: + + -------------------------------------------------- ============================== Release Notes for Samba 3.0.20 Aug 19, 2005 ============================== -This is the latest stable release of Samba. This is the version -that production Samba servers should be running for all current -bug-fixes. This is a substantial upgrade from previous Samba -3.0.x releases. Please read the section "What happened to 3.0.15 - -3.0.19?" and the other major change descriptions. - Additional features introduced in Samba 3.0.20 include: o Support for several new Win32 rpc pipes. @@ -81,8 +234,6 @@ settings. - - ###################################################################### Changes ####### @@ -109,66 +260,6 @@ winbindd nss info New -Changes since 3.0.20rc2 ------------------------- - -commits -------- - -o Jeremy Allison - * Fix minor compiler warnings in printing/printing.c. - * Merge new DOS error code from SAMBA_4. - * Fix issue when non-English characters in filenames and - directories. - * Fix bogus error message in smbstatus about unknown share modes. - - -o Gerald (Jerry) Carter - * Fix error in EnumPrinterData() reported by valgrind. - * Fix broken help links in SWAT editor caused by new doc layout. - * Ensure that a domain structure in winbind is initialized prior - to assigning the methods for communicating to a DC. - * BUG 3000: Remove background updates of winbind cache and allow - child processes to immediately update and expired cache entry. - - -o Guenther Deschner - * Allow admins to uncheck the "User must change Password at - next Logon" checkbox in User manager (merge from trunk). - - -o Steve French - * Fix minor compiler warnings in the mount.cifs helper. - - -o John Janosik - * BUG 2976: Mark logons for unknown domains with a - non-authoritative response. - - -o Marcel - * Fix regression in OS/2 trans2 open code. - - -o Jim McDonough - * BUG 2953: Additional fixes for domain trusts. Also clears - up the "bad stub" error when attempting to logon to a Samba - domain with a bad username. - - -o Luke Mewburn - * Compiler warning fixes. - - -o James Peach - * BUG 2314: Fix const compiler warnings in the quota code. - - -o Ed Plese - * Fix faulty logic which caused winbindd to return failure - when a user possessed no supplementary groups. - - Changes since 3.0.14a --------------------- @@ -301,6 +392,11 @@ in corrupted tdb files. * Allow someone with SeTakeOwnershipPrivilege to chown the user of a file to herself. + * Fix minor compiler warnings in printing/printing.c. + * Merge new DOS error code from SAMBA_4. + * Fix issue when non-English characters in filenames and + directories. + * Fix bogus error message in smbstatus about unknown share modes. o Andrew Bartlett @@ -445,6 +541,12 @@ modified now. * Remove over-paranoid assert() call when checking spoolss buffer pointers + * Fix error in EnumPrinterData() reported by valgrind. + * Fix broken help links in SWAT editor caused by new doc layout. + * Ensure that a domain structure in winbind is initialized prior + to assigning the methods for communicating to a DC. + * BUG 3000: Remove background updates of winbind cache and allow + child processes to immediately update and expired cache entry. o David.Collier-Brown @@ -514,6 +616,8 @@ * Cleanup "net share migrate" code. * Allow to touch mtime in vfs-recycle with "recycle:touch_mtime = true". + * Allow admins to uncheck the "User must change Password at + next Logon" checkbox in User manager (merge from trunk). o Renaud Duhaut @@ -549,6 +653,7 @@ mount. * Lock mtab when updating it during umount.cifs, also delete only one matching entry at a time. + * Fix minor compiler warnings in the mount.cifs helper. o Deryck Hodge @@ -573,6 +678,8 @@ o John Janosik * BUG 2077: Correctly fill in the correct server name when processing trusted domain logins. + * BUG 2976: Mark logons for unknown domains with a + non-authoritative response. o William Jojo @@ -683,6 +790,10 @@ * BUG 2527, 2538: Removed unused variables. +o Marcel + * Fix regression in OS/2 trans2 open code. + + o Jim McDonough * Fixes for samr_lookup_rids() when using ldapsam:trusted=yes (in conjunction with Volker). @@ -693,6 +804,13 @@ ldif file instead of actually writing to the passdb. * BUG 2736: Add retries to workaround winbind race condition with detecting idle clients. + * BUG 2953: Additional fixes for domain trusts. Also clears + up the "bad stub" error when attempting to logon to a Samba + domain with a bad username. + + +o Luke Mewburn + * Compiler warning fixes. o Kalim Moghul @@ -738,6 +856,12 @@ * BUG 2596: Fix become_root link issues and one IRIX stack backtrace bug. * Fix for null pointer ACL free. + * BUG 2314: Fix const compiler warnings in the quota code. + + +o Ed Plese + * Fix faulty logic which caused winbindd to return failure + when a user possessed no supplementary groups. o Marcin Porwit @@ -862,8 +986,8 @@ commits ------- -o Jeremy Allison - * Fixed invalid SMB_ASSERT() triggered by checking access on +o Jeremy Allison + * Fixed invalid SMB_ASSERT() triggered by checking access on ACL'd files.