prefix=@prefix@
exec_prefix=@exec_prefix@
-mandir=@mandir@
LIBS=@LIBS@
CC=@CC@
@$(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
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
# 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 #
struct passwd *smb_getpwnam( char *domuser )
{
- struct passwd *pw;
+ struct passwd *pw = NULL;
char *p;
fstring mapped_username;
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;
}
/***************************************************************************
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"
logfilebase="\${VARDIR}"
lockdir="\${VARDIR}/locks"
piddir="\${VARDIR}/locks"
+ mandir="\${prefix}/man"
privatedir="\${prefix}/private"
swatdir="\${prefix}/swat")
;;
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,
AC_SUBST(configdir)
AC_SUBST(lockdir)
AC_SUBST(piddir)
+AC_SUBST(mandir)
AC_SUBST(logfilebase)
AC_SUBST(privatedir)
AC_SUBST(swatdir)
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)])
return (False);
}
- return ((addr & mask) == net);
+ return ((addr & mask) == (net & mask));
}
/* string_match - match string against token */
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"));
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 );
}
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));
}
/*******************************************************************
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;
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);
}
}
- 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");
}
}
} else {
(*return_iplist)->ip.s_addr = allones ? 0xFFFFFFFF : 0;
- *return_count = 1;
}
- return True;
+ *return_count = 1;
+ return True;
}
/* Check name cache */
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)
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);
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();
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);
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;
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);
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 );
+ }
}
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)
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
}
/*