]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
sync source for 3.0.1rc2
authorGerald Carter <jerry@samba.org>
Wed, 10 Dec 2003 04:34:09 +0000 (04:34 +0000)
committerGerald Carter <jerry@samba.org>
Wed, 10 Dec 2003 04:34:09 +0000 (04:34 +0000)
13 files changed:
source/Makefile.in
source/VERSION
source/auth/auth_util.c
source/configure.in
source/lib/access.c
source/lib/substitute.c
source/lib/util.c
source/lib/util_sock.c
source/libsmb/namequery.c
source/rpc_parse/parse_net.c
source/rpcclient/cmd_spoolss.c
source/smbd/sesssetup.c
source/tdb/spinlock.c

index 7ac07dbad726b37ad6132a8324f3723d3242188c..e1087b9eb589343afd5f660744d5424392e005d8 100644 (file)
@@ -9,7 +9,6 @@
 
 prefix=@prefix@
 exec_prefix=@exec_prefix@
-mandir=@mandir@
 
 LIBS=@LIBS@
 CC=@CC@
@@ -1244,6 +1243,7 @@ installswat: installdirs installmsg
        @$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir)
 
 installclientlib: installdirs libsmbclient
+       @$(SHELL) $(srcdir)/script/installdirs.sh $(DESTDIR)${prefix}/lib
        -$(INSTALLCLIENTCMD_SH) bin/libsmbclient.@SHLIBEXT@ $(DESTDIR)${prefix}/lib
        -$(INSTALLCLIENTCMD_A) bin/libsmbclient.a $(DESTDIR)${prefix}/lib
        @$(SHELL) $(srcdir)/script/installdirs.sh $(DESTDIR)${prefix}/include
@@ -1292,12 +1292,16 @@ installman: installdirs
 
 showlayout: 
        @echo "Samba will be installed into:"
-       @echo "  basedir: $(BASEDIR)"
-       @echo "  bindir:  $(BINDIR)"
-       @echo "  sbindir: $(SBINDIR)"
-       @echo "  libdir:  $(LIBDIR)"
-       @echo "  vardir:  $(VARDIR)"
-       @echo "  mandir:  $(MANDIR)"
+       @echo "  basedir:     $(BASEDIR)"
+       @echo "  bindir:      $(BINDIR)"
+       @echo "  sbindir:     $(SBINDIR)"
+       @echo "  libdir:      $(LIBDIR)"
+       @echo "  vardir:      $(VARDIR)"
+       @echo "  mandir:      $(MANDIR)"
+       @echo "  privatedir:  $(PRIVATE_DIR)"
+       @echo "  configdir:   $(CONFIGDIR)"
+       @echo "  lockdir:     $(LOCKDIR)"
+       @echo "  piddir:      $(PIDDIR)"
 
 
 uninstall: uninstallman uninstallbin uninstallscripts uninstallmodules
index d727326a6ac96e9d38d78aa81b76408a103f2d3f..24e340b7b3b147fb5a5f5288e547f1f3c3d5b679 100644 (file)
@@ -51,7 +51,7 @@ SAMBA_VERSION_PRE_RELEASE=
 # e.g. SAMBA_VERSION_RC_RELEASE=1                      #
 #  ->  "3.0.0rc1"                                      #
 ########################################################
-SAMBA_VERSION_RC_RELEASE=1
+SAMBA_VERSION_RC_RELEASE=2
 
 ########################################################
 # For 'beta' releases the version will be              #
index 5d3f8f02777b2b120bd45b2ce65418283704aa4b..3dc0fdbe4640312b1f0a2f5d1529c8189389cc39 100644 (file)
@@ -965,7 +965,7 @@ static NTSTATUS fill_sam_account(TALLOC_CTX *mem_ctx,
  
 struct passwd *smb_getpwnam( char *domuser )
 {
-       struct passwd *pw;
+       struct passwd *pw = NULL;
        char *p;
        fstring mapped_username;
 
@@ -981,10 +981,24 @@ struct passwd *smb_getpwnam( char *domuser )
                p += 1;
                fstrcpy( mapped_username, p );
                map_username( mapped_username );        
-               return Get_Pwnam(mapped_username);
+               pw = Get_Pwnam(mapped_username);
+               if (!pw) {
+                       /* Don't add a machine account. */
+                       if (mapped_username[strlen(mapped_username)-1] == '$')
+                               return NULL;
+
+                       /* Create local user if requested. */
+                       p = strchr( mapped_username, *lp_winbind_separator() );
+                       if (p)
+                               p += 1;
+                       else
+                               p = mapped_username;
+                       auth_add_user_script(NULL, p);
+                       return Get_Pwnam(p);
+               }
        }
 
-       return NULL;
+       return pw;
 }
 
 /***************************************************************************
index 174a48b87e3566c6476f4ab079f458dcdda25116..15defbe8f1235a1d7be4711de68325daecdeeecf 100644 (file)
@@ -17,8 +17,9 @@ AC_PREFIX_DEFAULT(/usr/local/samba)
 AC_ARG_WITH(fhs, 
 [  --with-fhs              Use FHS-compliant paths (default=no)],
     configdir="${sysconfdir}/samba"
-    lockdir="\${VARDIR}/cache/samba"
-    piddir="\${VARDIR}/run/samba"
+    lockdir="\${VARDIR}/lib/samba"
+    piddir="\${VARDIR}/run"
+    mandir="\${prefix}/share/man"
     logfilebase="\${VARDIR}/log/samba"
     privatedir="\${CONFIGDIR}/private"
     libdir="\${prefix}/lib/samba"
@@ -27,6 +28,7 @@ AC_ARG_WITH(fhs,
     logfilebase="\${VARDIR}"
     lockdir="\${VARDIR}/locks"
     piddir="\${VARDIR}/locks"
+    mandir="\${prefix}/man"
     privatedir="\${prefix}/private"
     swatdir="\${prefix}/swat")
 
@@ -78,6 +80,23 @@ AC_ARG_WITH(piddir,
     ;;
   esac])
 
+#################################################
+# set pid directory location
+AC_ARG_WITH(piddir,
+[  --with-mandir=DIR       Where to put man pages ($ac_default_prefix/man)],
+[ case "$withval" in
+  yes|no)
+  #
+  # Just in case anybody calls it without argument
+  #
+    AC_MSG_WARN([--with-mandir called without argument - will use default])
+  ;;
+  * )
+    piddir="$withval"
+    ;;
+  esac])
+
+
 #################################################
 # set SWAT directory location
 AC_ARG_WITH(swatdir,
@@ -148,6 +167,7 @@ done
 AC_SUBST(configdir)
 AC_SUBST(lockdir)
 AC_SUBST(piddir)
+AC_SUBST(mandir)
 AC_SUBST(logfilebase)
 AC_SUBST(privatedir)
 AC_SUBST(swatdir)
@@ -1993,6 +2013,14 @@ if test x"$samba_cv_SYSCONF_SC_NGROUPS_MAX" = x"yes"; then
     AC_DEFINE(SYSCONF_SC_NGROUPS_MAX,1,[Whether sysconf(_SC_NGROUPS_MAX) is available])
 fi
 
+AC_CACHE_CHECK([for sysconf(_SC_NPROC_ONLN)],samba_cv_SYSCONF_SC_NPROC_ONLN,[
+AC_TRY_RUN([#include <unistd.h>
+main() { exit(sysconf(_SC_NPROC_ONLN) == -1 ? 1 : 0); }],
+samba_cv_SYSCONF_SC_NPROC_ONLN=yes,samba_cv_SYSCONF_SC_NPROC_ONLN=no,samba_cv_SYSCONF_SC_NPROC_ONLN=cross)])
+if test x"$samba_cv_SYSCONF_SC_NPROC_ONLN" = x"yes"; then
+    AC_DEFINE(SYSCONF_SC_NPROC_ONLN,1,[Whether sysconf(_SC_NPROC_ONLN) is available])
+fi
+
 AC_CACHE_CHECK([for root],samba_cv_HAVE_ROOT,[
 AC_TRY_RUN([main() { exit(getuid() != 0); }],
            samba_cv_HAVE_ROOT=yes,samba_cv_HAVE_ROOT=no,samba_cv_HAVE_ROOT=cross)])
index 81eab7c738e81e339d13f000e235ae13f9386cec..f03f5daf333b3cf908333f0daf43274cb49f7b95 100644 (file)
@@ -43,7 +43,7 @@ static BOOL masked_match(const char *tok, const char *slash, const char *s)
                return (False);
        }
        
-       return ((addr & mask) == net);
+       return ((addr & mask) == (net & mask));
 }
 
 /* string_match - match string against token */
index ee342964d0ff9f1475c78f6834bac4fdcb7cde30..5dec9808101d957d7340364367183f68167e177b 100644 (file)
@@ -494,6 +494,13 @@ char *alloc_sub_basic(const char *smb_name, const char *str)
        struct passwd *pass;
        const char *local_machine_name = get_local_machine_name();
 
+       /* workaround to prevent a crash while lookinf at bug #687 */
+       
+       if ( !str ) {
+               DEBUG(0,("alloc_sub_basic: NULL source string!  This should not happen\n"));
+               return NULL;
+       }
+       
        a_string = strdup(str);
        if (a_string == NULL) {
                DEBUG(0, ("alloc_sub_specified: Out of memory!\n"));
index 39515c65991e0ad66859fe88c52d1ae788f36180..4f4e0eb5d7b54c7c2fb43a8eddcc1dfa22db74ce 100644 (file)
@@ -1751,13 +1751,15 @@ BOOL is_myworkgroup(const char *s)
    Win2k => "Windows 2000 5.0"
    NT4   => "Windows NT 4.0" 
    Win9x => "Windows 4.0"
+ Windows 2003 doesn't set the native lan manager string but 
+ they do set the domain to "Windows 2003 5.2" (probably a bug).
 ********************************************************************/
 
 void ra_lanman_string( const char *native_lanman )
 {               
-       if ( 0 == strcmp( native_lanman, "Windows 2002 5.1" ) )
+       if ( strcmp( native_lanman, "Windows 2002 5.1" ) == 0 )
                set_remote_arch( RA_WINXP );
-       else if ( 0 == strcmp( native_lanman, "Windows .NET 5.2" ) )
+       else if ( strcmp( native_lanman, "Windows Server 2003 5.2" ) == 0 )
                set_remote_arch( RA_WIN2K3 );
 }
 
@@ -1772,33 +1774,35 @@ void set_remote_arch(enum remote_arch_types type)
        switch( type ) {
        case RA_WFWG:
                fstrcpy(remote_arch, "WfWg");
-               return;
+               break;
        case RA_OS2:
                fstrcpy(remote_arch, "OS2");
-               return;
+               break;
        case RA_WIN95:
                fstrcpy(remote_arch, "Win95");
-               return;
+               break;
        case RA_WINNT:
                fstrcpy(remote_arch, "WinNT");
-               return;
+               break;
        case RA_WIN2K:
                fstrcpy(remote_arch, "Win2K");
-               return;
+               break;
        case RA_WINXP:
                fstrcpy(remote_arch, "WinXP");
-               return;
+               break;
        case RA_WIN2K3:
                fstrcpy(remote_arch, "Win2K3");
-               return;
+               break;
        case RA_SAMBA:
                fstrcpy(remote_arch,"Samba");
-               return;
+               break;
        default:
                ra_type = RA_UNKNOWN;
                fstrcpy(remote_arch, "UNKNOWN");
                break;
        }
+
+       DEBUG(10,("set_remote_arch: Client arch is \'%s\'\n", remote_arch));
 }
 
 /*******************************************************************
index 1d62da53c5bf484199d9bf6b120886e405e96d42..328ca92727731f34f8deb5749d13c04940cc6f0e 100644 (file)
@@ -874,6 +874,7 @@ static BOOL matchname(char *remotehost,struct in_addr  addr)
 char *get_peer_name(int fd, BOOL force_lookup)
 {
        static pstring name_buf;
+       pstring tmp_name;
        static fstring addr_buf;
        struct hostent *hp;
        struct in_addr addr;
@@ -890,10 +891,12 @@ char *get_peer_name(int fd, BOOL force_lookup)
        p = get_peer_addr(fd);
 
        /* it might be the same as the last one - save some DNS work */
-       if (strcmp(p, addr_buf) == 0) return name_buf;
+       if (strcmp(p, addr_buf) == 0) 
+               return name_buf;
 
        pstrcpy(name_buf,"UNKNOWN");
-       if (fd == -1) return name_buf;
+       if (fd == -1) 
+               return name_buf;
 
        fstrcpy(addr_buf, p);
 
@@ -911,7 +914,12 @@ char *get_peer_name(int fd, BOOL force_lookup)
                }
        }
 
-       alpha_strcpy(name_buf, name_buf, "_-.", sizeof(name_buf));
+       /* can't pass the same source and dest strings in when you 
+          use --enable-developer or the clobber_region() call will 
+          get you */
+       
+       pstrcpy( tmp_name, name_buf );
+       alpha_strcpy(name_buf, tmp_name, "_-.", sizeof(name_buf));
        if (strstr(name_buf,"..")) {
                pstrcpy(name_buf, "UNKNOWN");
        }
index 1de74137117191840af849b2eb02b47074eff443..c7cc4848b7013b218df436a2d5424f0711717eae 100644 (file)
@@ -1006,9 +1006,9 @@ static BOOL internal_resolve_name(const char *name, int name_type,
                }
        } else {
                (*return_iplist)->ip.s_addr = allones ? 0xFFFFFFFF : 0;
-               *return_count = 1;
        }
-    return True;
+       *return_count = 1;
+       return True;
   }
   
   /* Check name cache */
index ad0a91e7ea5998f42fe3b57c4fc2e03b34dae67a..5df75fc5f6e2381e725f883a68d7a66dc16f8108 100644 (file)
@@ -2283,12 +2283,12 @@ static BOOL net_io_sam_alias_mem_info(const char *desc, SAM_ALIAS_MEM_INFO * inf
        if (!prs_uint32("ptr_members", ps, depth, &info->ptr_members))
                 return False;
 
+       if (ps->data_offset + 16 > ps->buffer_size)
+               return False;
+       ps->data_offset += 16;
+
        if (info->ptr_members != 0)
        {
-                if (ps->data_offset + 16 > ps->buffer_size)
-                        return False;
-                ps->data_offset += 16;
-
                if (!prs_uint32("num_sids", ps, depth, &info->num_sids))
                         return False;
                if (info->num_sids != info->num_members)
index 798949fae92f448ac400204d2ad34d6366a5ca6e..f5a440c024c455ffb36168555aa55a3f236660b1 100644 (file)
@@ -1336,7 +1336,7 @@ static WERROR cmd_spoolss_addprinterex(struct cli_state *cli,
         slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
         strupper_m(servername);
 
-       /* Fill in the DRIVER_INFO_3 struct */
+       /* Fill in the DRIVER_INFO_2 struct */
        ZERO_STRUCT(info2);
 #if 0  /* JERRY */
        init_unistr( &info2.servername,         servername);
index ec01a330ee255d8f568dfa84a7e6d8297b218ae9..da48c81fc19cb619a1d54a5556803647d9bd11d0 100644 (file)
@@ -463,7 +463,7 @@ static int reply_sesssetup_and_X_spnego(connection_struct *conn, char *inbuf,
        DATA_BLOB blob1;
        int ret;
        size_t bufrem;
-       fstring native_os, native_lanman;
+       fstring native_os, native_lanman, primary_domain;
        char *p2;
        uint16 data_blob_len = SVAL(inbuf, smb_vwv7);
        enum remote_arch_types ra_type = get_remote_arch();
@@ -497,11 +497,20 @@ static int reply_sesssetup_and_X_spnego(connection_struct *conn, char *inbuf,
        p2 = inbuf + smb_vwv13 + data_blob_len;
        p2 += srvstr_pull_buf(inbuf, native_os, p2, sizeof(native_os), STR_TERMINATE);
        p2 += srvstr_pull_buf(inbuf, native_lanman, p2, sizeof(native_lanman), STR_TERMINATE);
-       DEBUG(3,("NativeOS=[%s] NativeLanMan=[%s]\n", native_os, native_lanman));
-
-       if ( ra_type == RA_WIN2K )
-               ra_lanman_string( native_lanman );
+       p2 += srvstr_pull_buf(inbuf, primary_domain, p2, sizeof(primary_domain), STR_TERMINATE);
+       DEBUG(3,("NativeOS=[%s] NativeLanMan=[%s] PrimaryDomain=[%s]\n", 
+               native_os, native_lanman, primary_domain));
 
+       if ( ra_type == RA_WIN2K ) {
+               /* Windows 2003 doesn't set the native lanman string, 
+                  but does set primary domain which is a bug I think */
+                          
+               if ( !strlen(native_lanman) )
+                       ra_lanman_string( primary_domain );
+               else
+                       ra_lanman_string( native_lanman );
+       }
+               
        if (blob1.data[0] == ASN1_APPLICATION(0)) {
                /* its a negTokenTarg packet */
                ret = reply_spnego_negotiate(conn, inbuf, outbuf, length, bufsize, blob1);
@@ -556,6 +565,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,
        fstring domain;
        fstring native_os;
        fstring native_lanman;
+       fstring primary_domain;
        static BOOL done_sesssetup = False;
        extern BOOL global_encrypted_passwords_negotiated;
        extern BOOL global_spnego_negotiated;
@@ -619,6 +629,9 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,
                uint16 passlen2 = SVAL(inbuf,smb_vwv8);
                enum remote_arch_types ra_type = get_remote_arch();
                char *p = smb_buf(inbuf);    
+               char *save_p = smb_buf(inbuf);
+               uint16 byte_count;
+                       
 
                if(global_client_caps == 0) {
                        global_client_caps = IVAL(inbuf,smb_vwv11);
@@ -689,11 +702,28 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,
                p += srvstr_pull_buf(inbuf, domain, p, sizeof(domain), STR_TERMINATE);
                p += srvstr_pull_buf(inbuf, native_os, p, sizeof(native_os), STR_TERMINATE);
                p += srvstr_pull_buf(inbuf, native_lanman, p, sizeof(native_lanman), STR_TERMINATE);
-               DEBUG(3,("Domain=[%s]  NativeOS=[%s] NativeLanMan=[%s]\n",
-                        domain,native_os,native_lanman));
 
-               if ( ra_type == RA_WIN2K )
-                       ra_lanman_string( native_lanman );
+               /* not documented or decoded by Ethereal but there is one more string 
+                  in the extra bytes which is the same as the PrimaryDomain when using 
+                  extended security.  Windows NT 4 and 2003 use this string to store 
+                  the native lanman string. Windows 9x does not include a string here 
+                  at all so we have to check if we have any extra bytes left */
+               
+               byte_count = SVAL(inbuf, smb_vwv13);
+               if ( PTR_DIFF(p, save_p) < byte_count)
+                       p += srvstr_pull_buf(inbuf, primary_domain, p, sizeof(primary_domain), STR_TERMINATE);
+               else 
+                       fstrcpy( primary_domain, "null" );
+
+               DEBUG(3,("Domain=[%s]  NativeOS=[%s] NativeLanMan=[%s] PrimaryDomain=[%s]\n",
+                        domain, native_os, native_lanman, primary_domain));
+
+               if ( ra_type == RA_WIN2K ) {
+                       if ( strlen(native_lanman) == 0 )
+                               ra_lanman_string( primary_domain );
+                       else
+                               ra_lanman_string( native_lanman );
+               }
 
        }
 
index 3fddeafb2c1a3412a9d3d309c68a0242eafc9e86..3b3ebefded302d6738620508d050b09c8adf30c7 100644 (file)
@@ -143,6 +143,47 @@ static inline int __spin_is_locked(spinlock_t *lock)
        return (*lock != 1);
 }
 
+#elif defined(MIPS_SPINLOCKS) && defined(sgi) && (_COMPILER_VERSION >= 730)
+
+/* Implement spinlocks on IRIX using the MIPSPro atomic fetch operations. See
+ * sync(3) for the details of the intrinsic operations.
+ *
+ * "sgi" and "_COMPILER_VERSION" are always defined by MIPSPro.
+ */
+
+#if defined(STANDALONE)
+
+/* MIPSPro 7.3 has "__inline" as an extension, but not "inline. */
+#define inline __inline
+
+#endif /* STANDALONE */
+
+/* Returns 0 if the lock is acquired, EBUSY otherwise. */
+static inline int __spin_trylock(spinlock_t *lock)
+{
+        unsigned int val;
+        val = __lock_test_and_set(lock, 1);
+        return val == 0 ? 0 : EBUSY;
+}
+
+static inline void __spin_unlock(spinlock_t *lock)
+{
+        __lock_release(lock);
+}
+
+static inline void __spin_lock_init(spinlock_t *lock)
+{
+        __lock_release(lock);
+}
+
+/* Returns 1 if the lock is held, 0 otherwise. */
+static inline int __spin_is_locked(spinlock_t *lock)
+{
+        unsigned int val;
+        val = __add_and_fetch(lock, 0);
+       return val;
+}
+
 #elif defined(MIPS_SPINLOCKS) 
 
 static inline unsigned int load_linked(unsigned long addr)
@@ -221,7 +262,11 @@ static void yield_cpu(void)
 
 static int this_is_smp(void)
 {
+#if defined(HAVE_SYSCONF) && defined(SYSCONF_SC_NPROC_ONLN)
+        return (sysconf(_SC_NPROC_ONLN) > 1) ? 1 : 0;
+#else
        return 0;
+#endif
 }
 
 /*