Merge branch 'v3-2-test' of git://git.samba.org/samba into v3-2-test
authorDerrell Lipman <derrell.lipman@unwireduniverse.com>
Wed, 16 Jan 2008 00:45:06 +0000 (00:45 +0000)
committerDerrell Lipman <derrell.lipman@unwireduniverse.com>
Wed, 16 Jan 2008 00:45:06 +0000 (00:45 +0000)
(This used to be commit f963d57096184dd9381fcc5f175150d27460ea7a)

29 files changed:
release-scripts/create-tarball [new file with mode: 0755]
source3/Makefile.in
source3/configure.in
source3/groupdb/mapping_ldb.c
source3/groupdb/mapping_tdb.c
source3/include/smb.h
source3/libnet/libnet.h
source3/libnet/libnet_join.c
source3/libnet/libnet_join.h [deleted file]
source3/librpc/gen_ndr/libnet_join.h [new file with mode: 0644]
source3/librpc/gen_ndr/ndr_libnet_join.c [new file with mode: 0644]
source3/librpc/gen_ndr/ndr_libnet_join.h [new file with mode: 0644]
source3/librpc/idl/libnet_join.idl [new file with mode: 0644]
source3/librpc/ndr/libndr.h
source3/librpc/ndr/ndr_basic.c
source3/librpc/ndr/ndr_misc.c
source3/libsmb/libsmbclient.c
source3/libsmb/smbencrypt.c
source3/modules/vfs_xattr_tdb.c [moved from source3/modules/vfs_ea_tdb.c with 68% similarity]
source3/rpc_client/cli_lsarpc.c
source3/rpcclient/cmd_lsarpc.c
source3/rpcclient/rpcclient.c
source3/script/tests/selftest.sh
source3/utils/net.h
source3/utils/net_ads.c
source3/utils/net_domain.c
source3/utils/net_rpc.c
source3/utils/net_rpc_join.c
source3/winbindd/winbindd_cm.c

diff --git a/release-scripts/create-tarball b/release-scripts/create-tarball
new file mode 100755 (executable)
index 0000000..4592272
--- /dev/null
@@ -0,0 +1,85 @@
+#!/bin/bash
+
+TOPDIR="`dirname $0`/.."
+
+cd $TOPDIR
+
+echo -n "Please enter branch to cut tarball from: "
+read branch
+
+if [ "x$branch" = "x" ]; then
+   echo "You must enter a name!  Exiting...."
+   exit 1
+fi
+
+git-checkout $branch
+if [ $? -ne 0 ]; then
+   echo "Invalid branch name!  Exiting...."
+   exit 2
+fi
+
+VER_H=source/include/version.h
+(cd source && ./autogen.sh)
+
+if [ ! -f $VER_H ]; then
+   echo "Failed to find $VER_H!  Exiting...."
+   exit 1
+fi
+
+version=`grep SAMBA_VERSION_OFFICIAL_STRING $VER_H | awk '{print $3}'`
+version="$version-`grep SAMBA_VERSION_VENDOR_SUFFIX $VER_H | awk '{print $3}'`"
+version=`echo $version | sed 's/\"//g'`
+
+echo "Creating release tarball for Samba $version"
+
+/bin/rm -rf ../samba-${version}
+git-archive --format=tar --prefix=samba-${version}/ HEAD | (cd .. && tar xf -)
+
+pushd ../samba-${version}
+
+echo "Enter the absolute path to the generated Samba docs directory."
+echo -n "Just hit return to exclude the docs from the generate tarball: "
+read docsdir
+
+if [ "x$docsdir" != "x" ]; then
+   if [ ! -d "$docsdir" ]; then
+      echo "$docsdir does not exist!  Exiting...."
+      exit 1
+   fi
+
+   /bin/rm -rf docs
+   mkdir docs
+   rsync -a $docsdir/ docs/
+
+   cd docs
+   /bin/rm -rf test.pdf Samba4*pdf htmldocs/Samba4* htmldocs/test
+   /bin/mv manpages-3 manpages
+   /bin/mv htmldocs/manpages-3 htmldocs/manpages
+   cd ..
+fi
+
+cd ..
+tar cf samba-${version}.tar --exclude=.git* --exclude=CVS --exclude=.svn samba-${version}
+gpg --detach-sign --armor samba-${version}.tar
+gzip -9 samba-${version}.tar
+
+popd
+echo -n "Enter tag name (or hit <enter> to skip): "
+read tagname
+
+if [ "x$tagname" != "x" ]; then
+   if [ "x`git-tag -l $tagname`" != "x" ]; then
+      echo -n "Tag exists.  Do you wish to overwrite? (y/N): "
+      read answer
+
+      if [ "x$answer" != "xy" ]; then
+        echo "Tag creation aborted."
+        exit 1
+      fi
+   fi
+
+   git-tag -s ${tagname}
+fi
+
+echo "Done!"
+exit 0
index 53fd669b4c1cf3692311d9c2083d8dcb8ceedc87..46f733c0bcd641f32d9afc394f92f738e5666d72 100644 (file)
@@ -268,7 +268,8 @@ LIBNDR_GEN_OBJ = librpc/gen_ndr/ndr_wkssvc.o \
                 librpc/gen_ndr/ndr_srvsvc.o \
                 librpc/gen_ndr/ndr_svcctl.o \
                 librpc/gen_ndr/ndr_eventlog.o \
-                librpc/gen_ndr/ndr_notify.o
+                librpc/gen_ndr/ndr_notify.o \
+                librpc/gen_ndr/ndr_libnet_join.o
 
 RPC_PARSE_OBJ0 = rpc_parse/parse_prs.o rpc_parse/parse_misc.o
 
@@ -503,7 +504,7 @@ VFS_CAP_OBJ = modules/vfs_cap.o
 VFS_EXPAND_MSDFS_OBJ = modules/vfs_expand_msdfs.o
 VFS_SHADOW_COPY_OBJ = modules/vfs_shadow_copy.o
 VFS_AFSACL_OBJ = modules/vfs_afsacl.o
-VFS_EA_TDB_OBJ = modules/vfs_ea_tdb.o librpc/gen_ndr/ndr_xattr.o
+VFS_XATTR_TDB_OBJ = modules/vfs_xattr_tdb.o librpc/gen_ndr/ndr_xattr.o
 VFS_POSIXACL_OBJ = modules/vfs_posixacl.o
 VFS_AIXACL_OBJ = modules/vfs_aixacl.o modules/vfs_aixacl_util.o
 VFS_AIXACL2_OBJ = modules/vfs_aixacl2.o modules/vfs_aixacl_util.o modules/nfs4_acls.o
@@ -1403,9 +1404,9 @@ bin/libwbclient.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBWBCLIENT_OBJ)
                @SONAMEFLAG@`basename $@`.$(SONAME_VER)
        @ln -s -f `basename $@` $@.$(SONAME_VER)
 
-bin/libwbclient.a: $(BINARY_PREREQS) $(LIBWBCLIENT_OBJ)
+bin/libwbclient.a: $(BINARY_PREREQS) $(LIBWBCLIENT_OBJ0)
        @echo Linking non-shared library $@
-       @-$(AR) -rc $@ $(LIBWBCLIENT_OBJ)
+       @-$(AR) -rc $@ $(LIBWBCLIENT_OBJ0)
 
 bin/libaddns.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBADDNS_OBJ)
        @echo Linking shared library $@
@@ -1433,9 +1434,9 @@ bin/libsmbclient.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBSMBCLIENT_OBJ)
                $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) \
                @SONAMEFLAG@`basename $@`.$(SONAME_VER)
 
-bin/libsmbclient.a: $(BINARY_PREREQS) $(LIBSMBCLIENT_OBJ0)
+bin/libsmbclient.a: $(BINARY_PREREQS) $(LIBSMBCLIENT_OBJ)
        @echo Linking non-shared library $@
-       @-$(AR) -rc $@ $(LIBSMBCLIENT_OBJ0)
+       @-$(AR) -rc $@ $(LIBSMBCLIENT_OBJ)
 
 bin/libsmbsharemodes.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBSMBSHAREMODES_OBJ)
        @echo Linking shared library $@
@@ -1685,9 +1686,9 @@ bin/afsacl.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_AFSACL_OBJ)
        @echo "Building plugin $@"
        @$(SHLD_MODULE) $(VFS_AFSACL_OBJ)
 
-bin/ea_tdb.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_EA_TDB_OBJ)
+bin/xattr_tdb.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_XATTR_TDB_OBJ)
        @echo "Building plugin $@"
-       @$(SHLD_MODULE) $(VFS_EA_TDB_OBJ)
+       @$(SHLD_MODULE) $(VFS_XATTR_TDB_OBJ)
 
 bin/posixacl.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_POSIXACL_OBJ)
        @echo "Building plugin $@"
index 4ddc64407c8502d7c7d91e7b34760eba6b1fc17f..cd04b598c024f44793386f83e1bb24b6560407cc 100644 (file)
@@ -707,7 +707,7 @@ dnl These have to be built static:
 default_static_modules="pdb_smbpasswd pdb_tdbsam rpc_lsa rpc_samr rpc_winreg rpc_initshutdown rpc_lsa_ds rpc_wkssvc rpc_svcctl2 rpc_ntsvcs rpc_net rpc_netdfs rpc_srvsvc2 rpc_spoolss rpc_eventlog2 auth_sam auth_unix auth_winbind auth_server auth_domain auth_builtin vfs_default nss_info_template"
 
 dnl These are preferably build shared, and static if dlopen() is not available
-default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap vfs_expand_msdfs vfs_shadow_copy charset_CP850 charset_CP437 auth_script vfs_readahead vfs_syncops vfs_ea_tdb"
+default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap vfs_expand_msdfs vfs_shadow_copy charset_CP850 charset_CP437 auth_script vfs_readahead vfs_syncops vfs_xattr_tdb"
 
 if test "x$developer" = xyes; then
    default_static_modules="$default_static_modules rpc_rpcecho"
@@ -6489,7 +6489,7 @@ SMB_MODULE(vfs_cap, \$(VFS_CAP_OBJ), "bin/cap.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_expand_msdfs, \$(VFS_EXPAND_MSDFS_OBJ), "bin/expand_msdfs.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_shadow_copy, \$(VFS_SHADOW_COPY_OBJ), "bin/shadow_copy.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_afsacl, \$(VFS_AFSACL_OBJ), "bin/afsacl.$SHLIBEXT", VFS)
-SMB_MODULE(vfs_ea_tdb, \$(VFS_EA_TDB_OBJ), "bin/ea_tdb.$SHLIBEXT", VFS)
+SMB_MODULE(vfs_xattr_tdb, \$(VFS_XATTR_TDB_OBJ), "bin/xattr_tdb.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_posixacl, \$(VFS_POSIXACL_OBJ), "bin/posixacl.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_aixacl, \$(VFS_AIXACL_OBJ), "bin/aixacl.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_aixacl2, \$(VFS_AIXACL2_OBJ), "bin/aixacl2.$SHLIBEXT", VFS)
index 05056eabd20e16faec7af5ce83a8ff34ab801010..454fe467a97a39a5336600e1fbdf9b70a49aa824 100644 (file)
@@ -492,7 +492,7 @@ static NTSTATUS enum_aliasmem(const DOM_SID *alias, DOM_SID **sids, size_t *num)
                NULL
        };
        int ret, i;
-       NTSTATUS status;
+       NTSTATUS status = NT_STATUS_OK;
        struct ldb_result *res=NULL;
        struct ldb_dn *dn;
        struct ldb_message_element *el;
index 21a4f95383bc2f1fe7330ce86a2ee78b55cea96d..67e377c338c12b4e3e8f7fbc6101d38dff1b8893 100644 (file)
@@ -394,7 +394,7 @@ static NTSTATUS one_alias_membership(const DOM_SID *member,
        char *string_sid;
        TDB_DATA dbuf;
        const char *p;
-       NTSTATUS status;
+       NTSTATUS status = NT_STATUS_OK;
        TALLOC_CTX *frame;
 
        slprintf(key, sizeof(key), "%s%s", MEMBEROF_PREFIX,
index 49245eaa8302c5ce65d7aba832fa22762cdbec94..744acd719f874ebd2f4640c2a9c9957eff42e1d2 100644 (file)
@@ -322,6 +322,8 @@ struct id_map {
 #include "librpc/gen_ndr/wkssvc.h"
 #include "librpc/gen_ndr/echo.h"
 #include "librpc/gen_ndr/svcctl.h"
+#include "librpc/gen_ndr/libnet_join.h"
+
 
 struct lsa_dom_info {
        bool valid;
index d6238ca98209c5277d68ef1aeda62fa4e15407e3..97e720f61769efdd76ed8396382f84f06e255b4d 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef __LIBNET_H__
 #define __LIBNET_H__
 
-#include "libnet/libnet_join.h"
+#include "librpc/gen_ndr/libnet_join.h"
 #include "libnet/libnet_conf.h"
 #include "libnet/libnet_proto.h"
 
index c60f4c98035ca00fda2304518a3933361e386779..a189a38ea3f0c2cdf6f80b16f39ac426021548f0 100644 (file)
@@ -236,7 +236,6 @@ static ADS_STATUS libnet_join_find_machine_acct(TALLOC_CTX *mem_ctx,
                goto done;
        }
 
-       TALLOC_FREE(r->out.dn);
        r->out.dn = talloc_strdup(mem_ctx, dn);
        if (!r->out.dn) {
                status = ADS_ERROR_LDAP(LDAP_NO_MEMORY);
@@ -1214,6 +1213,10 @@ WERROR libnet_Join(TALLOC_CTX *mem_ctx,
 {
        WERROR werr;
 
+       if (r->in.debug) {
+               NDR_PRINT_IN_DEBUG(libnet_JoinCtx, r);
+       }
+
        werr = libnet_join_pre_processing(mem_ctx, r);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -1231,6 +1234,9 @@ WERROR libnet_Join(TALLOC_CTX *mem_ctx,
                goto done;
        }
  done:
+       if (r->in.debug) {
+               NDR_PRINT_OUT_DEBUG(libnet_JoinCtx, r);
+       }
        return werr;
 }
 
@@ -1321,6 +1327,10 @@ WERROR libnet_Unjoin(TALLOC_CTX *mem_ctx,
 {
        WERROR werr;
 
+       if (r->in.debug) {
+               NDR_PRINT_IN_DEBUG(libnet_UnjoinCtx, r);
+       }
+
        werr = libnet_unjoin_pre_processing(mem_ctx, r);
        if (!W_ERROR_IS_OK(werr)) {
                goto done;
@@ -1339,5 +1349,9 @@ WERROR libnet_Unjoin(TALLOC_CTX *mem_ctx,
        }
 
  done:
+       if (r->in.debug) {
+               NDR_PRINT_OUT_DEBUG(libnet_UnjoinCtx, r);
+       }
+
        return werr;
 }
diff --git a/source3/libnet/libnet_join.h b/source3/libnet/libnet_join.h
deleted file mode 100644 (file)
index c47e8d9..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *  Unix SMB/CIFS implementation.
- *  libnet Join Support
- *  Copyright (C) Guenther Deschner 2007-2008
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program 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 General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __LIBNET_JOIN_H__
-#define __LIBNET_JOIN_H__
-
-struct libnet_JoinCtx {
-       struct {
-               const char *dc_name;
-               const char *machine_name;
-               const char *domain_name;
-               const char *account_ou;
-               const char *admin_account;
-               const char *admin_password;
-               const char *machine_password;
-               uint32_t join_flags;
-               const char *os_version;
-               const char *os_name;
-               bool create_upn;
-               const char *upn;
-               bool modify_config;
-               struct ads_struct *ads;
-               bool debug;
-       } in;
-
-       struct {
-               char *account_name;
-               char *netbios_domain_name;
-               char *dns_domain_name;
-               char *dn;
-               struct dom_sid *domain_sid;
-               bool modified_config;
-               WERROR result;
-               char *error_string;
-               bool domain_is_ad;
-       } out;
-};
-
-struct libnet_UnjoinCtx {
-       struct {
-               const char *dc_name;
-               const char *machine_name;
-               const char *domain_name;
-               const char *admin_account;
-               const char *admin_password;
-               uint32_t unjoin_flags;
-               bool modify_config;
-               struct dom_sid *domain_sid;
-               struct ads_struct *ads;
-       } in;
-
-       struct {
-               bool modified_config;
-               WERROR result;
-               char *error_string;
-       } out;
-};
-
-#endif
diff --git a/source3/librpc/gen_ndr/libnet_join.h b/source3/librpc/gen_ndr/libnet_join.h
new file mode 100644 (file)
index 0000000..40759cb
--- /dev/null
@@ -0,0 +1,73 @@
+/* header auto-generated by pidl */
+
+#include <stdint.h>
+
+#include "librpc/gen_ndr/wkssvc.h"
+#include "librpc/gen_ndr/security.h"
+#ifndef _HEADER_libnetjoin
+#define _HEADER_libnetjoin
+
+;
+
+
+struct libnet_JoinCtx {
+       struct {
+               const char * dc_name;
+               const char * machine_name;
+               const char * domain_name;/* [ref] */
+               const char * account_ou;
+               const char * admin_account;
+               const char * admin_password;
+               const char * machine_password;
+               uint32_t join_flags;
+               const char * os_version;
+               const char * os_name;
+               uint8_t create_upn;
+               const char * upn;
+               uint8_t modify_config;
+               struct ads_struct *ads;/* [ref] */
+               uint8_t debug;
+       } in;
+
+       struct {
+               const char * account_name;
+               const char * netbios_domain_name;
+               const char * dns_domain_name;
+               const char * dn;
+               struct dom_sid *domain_sid;/* [ref] */
+               uint8_t modified_config;
+               const char * error_string;
+               uint8_t domain_is_ad;
+               WERROR result;
+       } out;
+
+};
+
+
+struct libnet_UnjoinCtx {
+       struct {
+               const char * dc_name;
+               const char * machine_name;
+               const char * domain_name;
+               const char * account_ou;
+               const char * admin_account;
+               const char * admin_password;
+               const char * machine_password;
+               uint32_t unjoin_flags;
+               uint8_t modify_config;
+               struct dom_sid *domain_sid;/* [ref] */
+               struct ads_struct *ads;/* [ref] */
+               uint8_t debug;
+       } in;
+
+       struct {
+               const char * netbios_domain_name;
+               const char * dns_domain_name;
+               uint8_t modified_config;
+               const char * error_string;
+               WERROR result;
+       } out;
+
+};
+
+#endif /* _HEADER_libnetjoin */
diff --git a/source3/librpc/gen_ndr/ndr_libnet_join.c b/source3/librpc/gen_ndr/ndr_libnet_join.c
new file mode 100644 (file)
index 0000000..5345bc0
--- /dev/null
@@ -0,0 +1,103 @@
+/* parser auto-generated by pidl */
+
+#include "includes.h"
+#include "librpc/gen_ndr/ndr_libnet_join.h"
+
+#include "librpc/gen_ndr/ndr_wkssvc.h"
+#include "librpc/gen_ndr/ndr_security.h"
+_PUBLIC_ void ndr_print_libnet_JoinCtx(struct ndr_print *ndr, const char *name, int flags, const struct libnet_JoinCtx *r)
+{
+       ndr_print_struct(ndr, name, "libnet_JoinCtx");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "libnet_JoinCtx");
+               ndr->depth++;
+               ndr_print_string(ndr, "dc_name", r->in.dc_name);
+               ndr_print_string(ndr, "machine_name", r->in.machine_name);
+               ndr_print_ptr(ndr, "domain_name", r->in.domain_name);
+               ndr->depth++;
+               ndr_print_string(ndr, "domain_name", r->in.domain_name);
+               ndr->depth--;
+               ndr_print_string(ndr, "account_ou", r->in.account_ou);
+               ndr_print_string(ndr, "admin_account", r->in.admin_account);
+               ndr_print_string(ndr, "admin_password", r->in.admin_password);
+               ndr_print_string(ndr, "machine_password", r->in.machine_password);
+               ndr_print_wkssvc_joinflags(ndr, "join_flags", r->in.join_flags);
+               ndr_print_string(ndr, "os_version", r->in.os_version);
+               ndr_print_string(ndr, "os_name", r->in.os_name);
+               ndr_print_uint8(ndr, "create_upn", r->in.create_upn);
+               ndr_print_string(ndr, "upn", r->in.upn);
+               ndr_print_uint8(ndr, "modify_config", r->in.modify_config);
+               ndr_print_ptr(ndr, "ads", r->in.ads);
+               ndr->depth++;
+               ndr_print_ads_struct(ndr, "ads", r->in.ads);
+               ndr->depth--;
+               ndr_print_uint8(ndr, "debug", r->in.debug);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "libnet_JoinCtx");
+               ndr->depth++;
+               ndr_print_string(ndr, "account_name", r->out.account_name);
+               ndr_print_string(ndr, "netbios_domain_name", r->out.netbios_domain_name);
+               ndr_print_string(ndr, "dns_domain_name", r->out.dns_domain_name);
+               ndr_print_string(ndr, "dn", r->out.dn);
+               ndr_print_ptr(ndr, "domain_sid", r->out.domain_sid);
+               ndr->depth++;
+               ndr_print_dom_sid(ndr, "domain_sid", r->out.domain_sid);
+               ndr->depth--;
+               ndr_print_uint8(ndr, "modified_config", r->out.modified_config);
+               ndr_print_string(ndr, "error_string", r->out.error_string);
+               ndr_print_uint8(ndr, "domain_is_ad", r->out.domain_is_ad);
+               ndr_print_WERROR(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
+_PUBLIC_ void ndr_print_libnet_UnjoinCtx(struct ndr_print *ndr, const char *name, int flags, const struct libnet_UnjoinCtx *r)
+{
+       ndr_print_struct(ndr, name, "libnet_UnjoinCtx");
+       ndr->depth++;
+       if (flags & NDR_SET_VALUES) {
+               ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+       }
+       if (flags & NDR_IN) {
+               ndr_print_struct(ndr, "in", "libnet_UnjoinCtx");
+               ndr->depth++;
+               ndr_print_string(ndr, "dc_name", r->in.dc_name);
+               ndr_print_string(ndr, "machine_name", r->in.machine_name);
+               ndr_print_string(ndr, "domain_name", r->in.domain_name);
+               ndr_print_string(ndr, "account_ou", r->in.account_ou);
+               ndr_print_string(ndr, "admin_account", r->in.admin_account);
+               ndr_print_string(ndr, "admin_password", r->in.admin_password);
+               ndr_print_string(ndr, "machine_password", r->in.machine_password);
+               ndr_print_wkssvc_joinflags(ndr, "unjoin_flags", r->in.unjoin_flags);
+               ndr_print_uint8(ndr, "modify_config", r->in.modify_config);
+               ndr_print_ptr(ndr, "domain_sid", r->in.domain_sid);
+               ndr->depth++;
+               ndr_print_dom_sid(ndr, "domain_sid", r->in.domain_sid);
+               ndr->depth--;
+               ndr_print_ptr(ndr, "ads", r->in.ads);
+               ndr->depth++;
+               ndr_print_ads_struct(ndr, "ads", r->in.ads);
+               ndr->depth--;
+               ndr_print_uint8(ndr, "debug", r->in.debug);
+               ndr->depth--;
+       }
+       if (flags & NDR_OUT) {
+               ndr_print_struct(ndr, "out", "libnet_UnjoinCtx");
+               ndr->depth++;
+               ndr_print_string(ndr, "netbios_domain_name", r->out.netbios_domain_name);
+               ndr_print_string(ndr, "dns_domain_name", r->out.dns_domain_name);
+               ndr_print_uint8(ndr, "modified_config", r->out.modified_config);
+               ndr_print_string(ndr, "error_string", r->out.error_string);
+               ndr_print_WERROR(ndr, "result", r->out.result);
+               ndr->depth--;
+       }
+       ndr->depth--;
+}
+
diff --git a/source3/librpc/gen_ndr/ndr_libnet_join.h b/source3/librpc/gen_ndr/ndr_libnet_join.h
new file mode 100644 (file)
index 0000000..4a5fdf0
--- /dev/null
@@ -0,0 +1,20 @@
+/* header auto-generated by pidl */
+
+#include "librpc/ndr/libndr.h"
+#include "librpc/gen_ndr/libnet_join.h"
+
+#ifndef _HEADER_NDR_libnetjoin
+#define _HEADER_NDR_libnetjoin
+
+#define NDR_LIBNET_JOINCTX (0x00)
+
+#define NDR_LIBNET_UNJOINCTX (0x01)
+
+#define NDR_LIBNETJOIN_CALL_COUNT (2)
+enum ndr_err_code ndr_push_libnet_JoinCtx(struct ndr_push *ndr, int flags, const struct libnet_JoinCtx *r);
+enum ndr_err_code ndr_pull_libnet_JoinCtx(struct ndr_pull *ndr, int flags, struct libnet_JoinCtx *r);
+void ndr_print_libnet_JoinCtx(struct ndr_print *ndr, const char *name, int flags, const struct libnet_JoinCtx *r);
+enum ndr_err_code ndr_push_libnet_UnjoinCtx(struct ndr_push *ndr, int flags, const struct libnet_UnjoinCtx *r);
+enum ndr_err_code ndr_pull_libnet_UnjoinCtx(struct ndr_pull *ndr, int flags, struct libnet_UnjoinCtx *r);
+void ndr_print_libnet_UnjoinCtx(struct ndr_print *ndr, const char *name, int flags, const struct libnet_UnjoinCtx *r);
+#endif /* _HEADER_NDR_libnetjoin */
diff --git a/source3/librpc/idl/libnet_join.idl b/source3/librpc/idl/libnet_join.idl
new file mode 100644 (file)
index 0000000..2741b7b
--- /dev/null
@@ -0,0 +1,60 @@
+#include "idl_types.h"
+
+import "wkssvc.idl", "security.idl";
+
+/*
+  libnetjoin interface definition
+*/
+
+[
+       pointer_default(unique)
+]
+interface libnetjoin
+{
+       typedef bitmap wkssvc_joinflags wkssvc_joinflags;
+
+       [nopush,nopull] WERROR libnet_JoinCtx(
+               [in] string dc_name,
+               [in] string machine_name,
+               [in,ref] string *domain_name,
+               [in] string account_ou,
+               [in] string admin_account,
+               [in] string admin_password,
+               [in] string machine_password,
+               [in] wkssvc_joinflags join_flags,
+               [in] string os_version,
+               [in] string os_name,
+               [in] boolean8 create_upn,
+               [in] string upn,
+               [in] boolean8 modify_config,
+               [in] ads_struct *ads,
+               [in] boolean8 debug,
+               [out] string account_name,
+               [out] string netbios_domain_name,
+               [out] string dns_domain_name,
+               [out] string dn,
+               [out] dom_sid *domain_sid,
+               [out] boolean8 modified_config,
+               [out] string error_string,
+               [out] boolean8 domain_is_ad
+               );
+
+       [nopush,nopull] WERROR libnet_UnjoinCtx(
+               [in] string dc_name,
+               [in] string machine_name,
+               [in] string domain_name,
+               [in] string account_ou,
+               [in] string admin_account,
+               [in] string admin_password,
+               [in] string machine_password,
+               [in] wkssvc_joinflags unjoin_flags,
+               [in] boolean8 modify_config,
+               [in] dom_sid *domain_sid,
+               [in] ads_struct *ads,
+               [in] boolean8 debug,
+               [out] string netbios_domain_name,
+               [out] string dns_domain_name,
+               [out] boolean8 modified_config,
+               [out] string error_string
+               );
+}
index 6341e20b650255fb28df949c898e8fb8af9102bc..d0c2c74db94e792e5ccdde5cca155642c74ee3ac 100644 (file)
@@ -149,7 +149,7 @@ struct ndr_print {
 /* set to avoid recursion in ndr_size_*() calculation */
 #define LIBNDR_FLAG_NO_NDR_SIZE                (1<<31)
 
-/* useful macro for debugging */
+/* useful macro for debugging with DEBUG */
 #define NDR_PRINT_DEBUG(type, p) ndr_print_debug((ndr_print_fn_t)ndr_print_ ##type, #p, p)
 #define NDR_PRINT_UNION_DEBUG(type, level, p) ndr_print_union_debug((ndr_print_fn_t)ndr_print_ ##type, #p, level, p)
 #define NDR_PRINT_FUNCTION_DEBUG(type, flags, p) ndr_print_function_debug((ndr_print_function_t)ndr_print_ ##type, #type, flags, p)
@@ -157,6 +157,14 @@ struct ndr_print {
 #define NDR_PRINT_OUT_DEBUG(type, p) NDR_PRINT_FUNCTION_DEBUG(type, NDR_OUT, p)
 #define NDR_PRINT_IN_DEBUG(type, p) NDR_PRINT_FUNCTION_DEBUG(type, NDR_IN | NDR_SET_VALUES, p)
 
+/* useful macro for debugging in strings */
+#define NDR_PRINT_STRUCT_STRING(ctx, type, p) ndr_print_struct_string(ctx, (ndr_print_fn_t)ndr_print_ ##type, #p, p)
+#define NDR_PRINT_UNION_STRING(ctx, type, level, p) ndr_print_union_string(ctx, (ndr_print_fn_t)ndr_print_ ##type, #p, level, p)
+#define NDR_PRINT_FUNCTION_STRING(ctx, type, flags, p) ndr_print_function_string(ctx, (ndr_print_function_t)ndr_print_ ##type, #type, flags, p)
+#define NDR_PRINT_BOTH_STRING(ctx, type, p) NDR_PRINT_FUNCTION_STRING(ctx, type, NDR_BOTH, p)
+#define NDR_PRINT_OUT_STRING(ctx, type, p) NDR_PRINT_FUNCTION_STRING(ctx, type, NDR_OUT, p)
+#define NDR_PRINT_IN_STRING(ctx, type, p) NDR_PRINT_FUNCTION_STRING(ctx, type, NDR_IN | NDR_SET_VALUES, p)
+
 #define NDR_BE(ndr) (((ndr)->flags & (LIBNDR_FLAG_BIGENDIAN|LIBNDR_FLAG_LITTLE_ENDIAN)) == LIBNDR_FLAG_BIGENDIAN)
 
 enum ndr_err_code {
index 0ef78a2a5497e2e2be759f6b5e1c74e9dd66d705..54397c9469b9442f08be3d33e2969ab29cd51df3 100644 (file)
@@ -847,3 +847,14 @@ _PUBLIC_ uint32_t ndr_size_DATA_BLOB(int ret, const DATA_BLOB *data, int flags)
        if (!data) return ret;
        return ret + data->length;
 }
+
+_PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool b)
+{
+       ndr->print(ndr, "%-25s: %s", name, b?"true":"false");
+}
+
+_PUBLIC_ void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss)
+{
+       char addr[INET6_ADDRSTRLEN];
+       ndr->print(ndr, "%-25s: %s", name, print_sockaddr(addr, sizeof(addr), ss));
+}
index 2ca0cf08e8ef3d80452013d8356a02050206bebc..245ba452158ba4c0fb4544108caf047848b74547 100644 (file)
@@ -153,3 +153,84 @@ void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct s
 #endif
        ndr->depth--;
 }
+
+void ndr_print_ads_struct(struct ndr_print *ndr, const char *name, const struct ads_struct *r)
+{
+       if (!r) { return; }
+
+       ndr_print_struct(ndr, name, "ads_struct");
+       ndr->depth++;
+       ndr_print_bool(ndr, "is_mine", r->is_mine);
+       ndr_print_struct(ndr, name, "server");
+       ndr->depth++;
+       ndr_print_string(ndr, "realm", r->server.realm);
+       ndr_print_string(ndr, "workgroup", r->server.workgroup);
+       ndr_print_string(ndr, "ldap_server", r->server.ldap_server);
+       ndr_print_bool(ndr, "foreign", r->server.foreign);
+       ndr->depth--;
+       ndr_print_struct(ndr, name, "auth");
+       ndr->depth++;
+       ndr_print_string(ndr, "realm", r->auth.realm);
+#ifdef DEBUG_PASSWORD
+       ndr_print_string(ndr, "password", r->auth.password);
+#else
+       ndr_print_string(ndr, "password", "(PASSWORD ommited)");
+#endif
+       ndr_print_string(ndr, "user_name", r->auth.user_name);
+       ndr_print_string(ndr, "kdc_server", r->auth.kdc_server);
+       ndr_print_uint32(ndr, "flags", r->auth.flags);
+       ndr_print_uint32(ndr, "time_offset", r->auth.time_offset);
+       ndr_print_time_t(ndr, "tgt_expire", r->auth.tgt_expire);
+       ndr_print_time_t(ndr, "tgs_expire", r->auth.tgs_expire);
+       ndr_print_time_t(ndr, "renewable", r->auth.renewable);
+       ndr->depth--;
+       ndr_print_struct(ndr, name, "config");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "flags", r->config.flags);
+       ndr_print_string(ndr, "realm", r->config.realm);
+       ndr_print_string(ndr, "bind_path", r->config.bind_path);
+       ndr_print_string(ndr, "ldap_server_name", r->config.ldap_server_name);
+       ndr_print_string(ndr, "server_site_name", r->config.server_site_name);
+       ndr_print_string(ndr, "client_site_name", r->config.client_site_name);
+       ndr_print_time_t(ndr, "current_time", r->config.current_time);
+       ndr_print_bool(ndr, "tried_closest_dc", r->config.tried_closest_dc);
+       ndr_print_string(ndr, "schema_path", r->config.schema_path);
+       ndr_print_string(ndr, "config_path", r->config.config_path);
+       ndr->depth--;
+#ifdef HAVE_LDAP
+       ndr_print_struct(ndr, name, "ldap");
+       ndr->depth++;
+       ndr_print_ptr(ndr, "ld", r->ldap.ld);
+       ndr_print_sockaddr_storage(ndr, "ss", &r->ldap.ss);
+       ndr_print_time_t(ndr, "last_attempt", r->ldap.last_attempt);
+       ndr_print_uint32(ndr, "port", r->ldap.port);
+       ndr_print_uint16(ndr, "wrap_type", r->ldap.wrap_type);
+#ifdef HAVE_LDAP_SASL_WRAPPING
+       ndr_print_ptr(ndr, "sbiod", r->ldap.sbiod);
+#endif /* HAVE_LDAP_SASL_WRAPPING */
+       ndr_print_ptr(ndr, "mem_ctx", r->ldap.mem_ctx);
+       ndr_print_ptr(ndr, "wrap_ops", r->ldap.wrap_ops);
+       ndr_print_ptr(ndr, "wrap_private_data", r->ldap.wrap_private_data);
+       ndr_print_struct(ndr, name, "in");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "ofs", r->ldap.in.ofs);
+       ndr_print_uint32(ndr, "needed", r->ldap.in.needed);
+       ndr_print_uint32(ndr, "left", r->ldap.in.left);
+       ndr_print_uint32(ndr, "max_wrapped", r->ldap.in.max_wrapped);
+       ndr_print_uint32(ndr, "min_wrapped", r->ldap.in.min_wrapped);
+       ndr_print_uint32(ndr, "size", r->ldap.in.size);
+       ndr_print_array_uint8(ndr, "buf", r->ldap.in.buf, r->ldap.in.size);
+       ndr->depth--;
+       ndr_print_struct(ndr, name, "out");
+       ndr->depth++;
+       ndr_print_uint32(ndr, "ofs", r->ldap.out.ofs);
+       ndr_print_uint32(ndr, "left", r->ldap.out.left);
+       ndr_print_uint32(ndr, "max_unwrapped", r->ldap.out.max_unwrapped);
+       ndr_print_uint32(ndr, "sig_size", r->ldap.out.sig_size);
+       ndr_print_uint32(ndr, "size", r->ldap.out.size);
+       ndr_print_array_uint8(ndr, "buf", r->ldap.out.buf, r->ldap.out.size);
+       ndr->depth--;
+       ndr->depth--;
+#endif /* HAVE_LDAP */
+       ndr->depth--;
+}
index 179f6eba5dd06400bc0b7eecf4405d60061b5fd3..fb04d143a588836226f1ad0d0991acc3464dbc28 100644 (file)
@@ -592,13 +592,58 @@ smbc_remove_unused_server(SMBCCTX * context,
        return 0;
 }
 
+/****************************************************************
+ * Call the auth_fn with fixed size (fstring) buffers.
+ ***************************************************************/
+
+static void call_auth_fn(TALLOC_CTX *ctx,
+                       SMBCCTX *context,
+                       const char *server,
+                       const char *share,
+                       char **pp_workgroup,
+                       char **pp_username,
+                       char **pp_password)
+{
+       fstring workgroup;
+       fstring username;
+       fstring password;
+
+       strlcpy(workgroup, *pp_workgroup, sizeof(workgroup));
+       strlcpy(username, *pp_username, sizeof(username));
+       strlcpy(password, *pp_password, sizeof(password));
+
+       if (context->internal->_auth_fn_with_context != NULL) {
+                       (context->internal->_auth_fn_with_context)(
+                               context,
+                               server, share,
+                               workgroup, sizeof(workgroup),
+                               username, sizeof(username),
+                               password, sizeof(password));
+       } else {
+               (context->callbacks.auth_fn)(
+                       server, share,
+                       workgroup, sizeof(workgroup),
+                       username, sizeof(username),
+                       password, sizeof(password));
+       }
+
+       TALLOC_FREE(*pp_workgroup);
+       TALLOC_FREE(*pp_username);
+       TALLOC_FREE(*pp_password);
+
+       *pp_workgroup = talloc_strdup(ctx, workgroup);
+       *pp_username = talloc_strdup(ctx, username);
+       *pp_password = talloc_strdup(ctx, password);
+}
+
 static SMBCSRV *
-find_server(SMBCCTX *context,
+find_server(TALLOC_CTX *ctx,
+               SMBCCTX *context,
                const char *server,
                const char *share,
-               char *workgroup,
-               char *username,
-               char *password)
+               char **pp_workgroup,
+               char **pp_username,
+               char **pp_password)
 {
         SMBCSRV *srv;
         int auth_called = 0;
@@ -606,22 +651,15 @@ find_server(SMBCCTX *context,
  check_server_cache:
 
        srv = (context->callbacks.get_cached_srv_fn)(context, server, share,
-                                                     workgroup, username);
-
-       if (!auth_called && !srv && (!username[0] || !password[0])) {
-                if (context->internal->_auth_fn_with_context != NULL) {
-                        (context->internal->_auth_fn_with_context)(
-                                context,
-                                server, share,
-                                workgroup, strlen(workgroup)+1,
-                                username, strlen(username)+1,
-                                password, strlen(password)+1);
-                } else {
-                        (context->callbacks.auth_fn)(
-                                server, share,
-                                workgroup, strlen(workgroup)+1,
-                                username, strlen(username)+1,
-                                password, strlen(password)+1);
+                                               *pp_workgroup, *pp_username);
+
+       if (!auth_called && !srv && (!*pp_username || !(*pp_username)[0] ||
+                               !*pp_password || !(*pp_password)[0])) {
+               call_auth_fn(ctx, context, server, share,
+                               pp_workgroup, pp_username, pp_password);
+
+               if (!pp_workgroup || !pp_username || !pp_password) {
+                       return NULL;
                }
 
                /*
@@ -652,12 +690,12 @@ find_server(SMBCCTX *context,
                                (context->callbacks.remove_cached_srv_fn)(context,
                                                                           srv);
                        }
-                       
+
                        /*
                          * Maybe there are more cached connections to this
                          * server
                          */
-                       goto check_server_cache; 
+                       goto check_server_cache;
                }
 
                return srv;
@@ -678,13 +716,14 @@ find_server(SMBCCTX *context,
  */
 
 static SMBCSRV *
-smbc_server(SMBCCTX *context,
+smbc_server(TALLOC_CTX *ctx,
+               SMBCCTX *context,
                bool connect_if_not_found,
                const char *server,
                const char *share,
-               char *workgroup,
-               char *username,
-               char *password)
+               char **pp_workgroup,
+               char **pp_username,
+               char **pp_password)
 {
        SMBCSRV *srv=NULL;
        struct cli_state *c;
@@ -706,8 +745,8 @@ smbc_server(SMBCCTX *context,
        }
 
         /* Look for a cached connection */
-        srv = find_server(context, server, share,
-                          workgroup, username, password);
+        srv = find_server(ctx, context, server, share,
+                          pp_workgroup, pp_username, pp_password);
 
         /*
          * If we found a connection and we're only allowed one share per
@@ -725,20 +764,17 @@ smbc_server(SMBCCTX *context,
                  */
                 if (srv->cli->cnum == (uint16) -1) {
                         /* Ensure we have accurate auth info */
-                        if (context->internal->_auth_fn_with_context != NULL) {
-                                (context->internal->_auth_fn_with_context)(
-                                        context,
-                                        server, share,
-                                        workgroup, strlen(workgroup)+1,
-                                        username, strlen(username)+1,
-                                        password, strlen(password)+1);
-                        } else {
-                                (context->callbacks.auth_fn)(
-                                        server, share,
-                                        workgroup, strlen(workgroup)+1,
-                                        username, strlen(username)+1,
-                                        password, strlen(password)+1);
-                        }
+                       call_auth_fn(ctx, context, server, share,
+                               pp_workgroup, pp_username, pp_password);
+
+                       if (!*pp_workgroup || !*pp_username || !*pp_password) {
+                               errno = ENOMEM;
+                               cli_shutdown(srv->cli);
+                               srv->cli = NULL;
+                               (context->callbacks.remove_cached_srv_fn)(context,
+                                                                       srv);
+                               return NULL;
+                       }
 
                        /*
                         * We don't need to renegotiate encryption
@@ -746,8 +782,9 @@ smbc_server(SMBCCTX *context,
                         * tid.
                         */
 
-                        if (! cli_send_tconX(srv->cli, share, "?????",
-                                             password, strlen(password)+1)) {
+                       if (!cli_send_tconX(srv->cli, share, "?????",
+                                               *pp_password,
+                                               strlen(*pp_password)+1)) {
 
                                 errno = smbc_errno(context, srv->cli);
                                 cli_shutdown(srv->cli);
@@ -781,6 +818,11 @@ smbc_server(SMBCCTX *context,
                 return NULL;
         }
 
+       if (!*pp_workgroup || !*pp_username || !*pp_password) {
+               errno = ENOMEM;
+               return NULL;
+       }
+
        make_nmb_name(&calling, context->netbios_name, 0x0);
        make_nmb_name(&called , server, 0x20);
 
@@ -877,21 +919,21 @@ smbc_server(SMBCCTX *context,
                return NULL;
        }
 
-        username_used = username;
+        username_used = *pp_username;
 
        if (!NT_STATUS_IS_OK(cli_session_setup(c, username_used,
-                                              password, strlen(password),
-                                              password, strlen(password),
-                                              workgroup))) {
+                                              *pp_password, strlen(*pp_password),
+                                              *pp_password, strlen(*pp_password),
+                                              *pp_workgroup))) {
 
                 /* Failed.  Try an anonymous login, if allowed by flags. */
                 username_used = "";
 
                 if ((context->flags & SMBCCTX_FLAG_NO_AUTO_ANONYMOUS_LOGON) ||
                      !NT_STATUS_IS_OK(cli_session_setup(c, username_used,
-                                                       password, 1,
-                                                       password, 0,
-                                                       workgroup))) {
+                                                       *pp_password, 1,
+                                                       *pp_password, 0,
+                                                       *pp_workgroup))) {
 
                         cli_shutdown(c);
                         errno = EPERM;
@@ -902,7 +944,7 @@ smbc_server(SMBCCTX *context,
        DEBUG(4,(" session setup ok\n"));
 
        if (!cli_send_tconX(c, share, "?????",
-                           password, strlen(password)+1)) {
+                           *pp_password, strlen(*pp_password)+1)) {
                errno = smbc_errno(context, c);
                cli_shutdown(c);
                return NULL;
@@ -914,8 +956,8 @@ smbc_server(SMBCCTX *context,
                /* Attempt UNIX smb encryption. */
                if (!NT_STATUS_IS_OK(cli_force_encryption(c,
                                                username_used,
-                                               password,
-                                               workgroup))) {
+                                               *pp_password,
+                                               *pp_workgroup))) {
 
                        /*
                         * context->internal->_smb_encryption_level == 1
@@ -956,8 +998,9 @@ smbc_server(SMBCCTX *context,
        /* Let the cache function set errno if it wants to */
        errno = 0;
        if ((context->callbacks.add_cached_srv_fn)(context, srv,
-                                                   server, share,
-                                                   workgroup, username)) {
+                                               server, share,
+                                               *pp_workgroup,
+                                               *pp_username)) {
                int saved_errno = errno;
                DEBUG(3, (" Failed to add server to cache\n"));
                errno = saved_errno;
@@ -988,13 +1031,14 @@ smbc_server(SMBCCTX *context,
  * connection.  This works similarly to smbc_server().
  */
 static SMBCSRV *
-smbc_attr_server(SMBCCTX *context,
-                 const char *server,
-                 const char *share,
-                 char *workgroup,
-                 char *username,
-                 char *password,
-                 POLICY_HND *pol)
+smbc_attr_server(TALLOC_CTX *ctx,
+               SMBCCTX *context,
+               const char *server,
+               const char *share,
+               char **pp_workgroup,
+               char **pp_username,
+               char **pp_password,
+               POLICY_HND *pol)
 {
         int flags;
         struct sockaddr_storage ss;
@@ -1008,27 +1052,19 @@ smbc_attr_server(SMBCCTX *context,
          * our "special" share name '*IPC$', which is an impossible real share
          * name due to the leading asterisk.
          */
-        ipc_srv = find_server(context, server, "*IPC$",
-                              workgroup, username, password);
+        ipc_srv = find_server(ctx, context, server, "*IPC$",
+                              pp_workgroup, pp_username, pp_password);
         if (!ipc_srv) {
 
                 /* We didn't find a cached connection.  Get the password */
-                if (*password == '\0') {
+               if (!*pp_password || (*pp_password)[0] == '\0') {
                         /* ... then retrieve it now. */
-                        if (context->internal->_auth_fn_with_context != NULL) {
-                                (context->internal->_auth_fn_with_context)(
-                                        context,
-                                        server, share,
-                                        workgroup, strlen(workgroup)+1,
-                                        username, strlen(username)+1,
-                                        password, strlen(password)+1);
-                        } else {
-                                (context->callbacks.auth_fn)(
-                                        server, share,
-                                        workgroup, strlen(workgroup)+1,
-                                        username, strlen(username)+1,
-                                        password, strlen(password)+1);
-                        }
+                       call_auth_fn(ctx, context, server, share,
+                               pp_workgroup, pp_username, pp_password);
+                       if (!*pp_workgroup || !*pp_username || !*pp_password) {
+                               errno = ENOMEM;
+                               return NULL;
+                       }
                 }
 
                 flags = 0;
@@ -1038,11 +1074,13 @@ smbc_attr_server(SMBCCTX *context,
 
                 zero_addr(&ss);
                 nt_status = cli_full_connection(&ipc_cli,
-                                                global_myname(), server,
-                                                &ss, 0, "IPC$", "?????",
-                                                username, workgroup,
-                                                password, flags,
-                                                Undefined, NULL);
+                                               global_myname(), server,
+                                               &ss, 0, "IPC$", "?????",
+                                               *pp_username,
+                                               *pp_workgroup,
+                                               *pp_password,
+                                               flags,
+                                               Undefined, NULL);
                 if (! NT_STATUS_IS_OK(nt_status)) {
                         DEBUG(1,("cli_full_connection failed! (%s)\n",
                                  nt_errstr(nt_status)));
@@ -1053,9 +1091,9 @@ smbc_attr_server(SMBCCTX *context,
                if (context->internal->_smb_encryption_level) {
                        /* Attempt UNIX smb encryption. */
                        if (!NT_STATUS_IS_OK(cli_force_encryption(ipc_cli,
-                                               username,
-                                               password,
-                                               workgroup))) {
+                                               *pp_username,
+                                               *pp_password,
+                                               *pp_workgroup))) {
 
                                /*
                                 * context->internal->_smb_encryption_level == 1
@@ -1101,14 +1139,14 @@ smbc_attr_server(SMBCCTX *context,
                          * SEC_RIGHTS_MAXIMUM_ALLOWED, but NT sends 0x2000000
                          * so we might as well do it too.
                          */
-        
+
                         nt_status = rpccli_lsa_open_policy(
                                 pipe_hnd,
                                 talloc_tos(),
-                                True, 
+                                True,
                                 GENERIC_EXECUTE_ACCESS,
                                 pol);
-        
+
                         if (!NT_STATUS_IS_OK(nt_status)) {
                                 errno = smbc_errno(context, ipc_srv->cli);
                                 cli_shutdown(ipc_srv->cli);
@@ -1120,10 +1158,10 @@ smbc_attr_server(SMBCCTX *context,
 
                 errno = 0;      /* let cache function set errno if it likes */
                 if ((context->callbacks.add_cached_srv_fn)(context, ipc_srv,
-                                                           server,
-                                                           "*IPC$",
-                                                           workgroup,
-                                                           username)) {
+                                                       server,
+                                                       "*IPC$",
+                                                       *pp_workgroup,
+                                                       *pp_username)) {
                         DEBUG(3, (" Failed to add server to cache\n"));
                         if (errno == 0) {
                                 errno = ENOMEM;
@@ -1149,10 +1187,10 @@ smbc_open_ctx(SMBCCTX *context,
               int flags,
               mode_t mode)
 {
-       char *server, *share, *user, *password, *workgroup;
-       char *path;
+       char *server = NULL, *share = NULL, *user = NULL, *password = NULL, *workgroup = NULL;
+       char *path = NULL;
        char *targetpath = NULL;
-       struct cli_state *targetcli;
+       struct cli_state *targetcli = NULL;
        SMBCSRV *srv   = NULL;
        SMBCFILE *file = NULL;
        int fd;
@@ -1199,8 +1237,8 @@ smbc_open_ctx(SMBCCTX *context,
                }
        }
 
-       srv = smbc_server(context, True,
-                          server, share, workgroup, user, password);
+       srv = smbc_server(frame, context, True,
+                          server, share, &workgroup, &user, &password);
 
        if (!srv) {
                if (errno == EPERM) errno = EACCES;
@@ -1343,10 +1381,10 @@ smbc_read_ctx(SMBCCTX *context,
               size_t count)
 {
        int ret;
-       char *server, *share, *user, *password;
-       char *path;
+       char *server = NULL, *share = NULL, *user = NULL, *password = NULL;
+       char *path = NULL;
        char *targetpath = NULL;
-       struct cli_state *targetcli;
+       struct cli_state *targetcli = NULL;
        TALLOC_CTX *frame = talloc_stackframe();
 
         /*
@@ -1444,10 +1482,10 @@ smbc_write_ctx(SMBCCTX *context,
 {
        int ret;
         off_t offset;
-       char *server, *share, *user, *password;
-       char *path;
+       char *server = NULL, *share = NULL, *user = NULL, *password = NULL;
+       char *path = NULL;
        char *targetpath = NULL;
-       struct cli_state *targetcli;
+       struct cli_state *targetcli = NULL;
        TALLOC_CTX *frame = talloc_stackframe();
 
        /* First check all pointers before dereferencing them */
@@ -1526,10 +1564,10 @@ smbc_close_ctx(SMBCCTX *context,
                SMBCFILE *file)
 {
         SMBCSRV *srv;
-       char *server, *share, *user, *password;
-       char *path;
+       char *server = NULL, *share = NULL, *user = NULL, *password = NULL;
+       char *path = NULL;
        char *targetpath = NULL;
-       struct cli_state *targetcli;
+       struct cli_state *targetcli = NULL;
        TALLOC_CTX *frame = talloc_stackframe();
 
        if (!context || !context->internal ||
@@ -1618,9 +1656,9 @@ smbc_getatr(SMBCCTX * context,
             struct timespec *change_time_ts,
             SMB_INO_T *ino)
 {
-       char *fixedpath;
+       char *fixedpath = NULL;
        char *targetpath = NULL;
-       struct cli_state *targetcli;
+       struct cli_state *targetcli = NULL;
        time_t write_time;
        TALLOC_CTX *frame = talloc_stackframe();
 
@@ -1689,11 +1727,11 @@ smbc_getatr(SMBCCTX * context,
                 if (create_time_ts != NULL) {
                         *create_time_ts = w_time_ts;
                 }
-                
+
                 if (access_time_ts != NULL) {
                         *access_time_ts = w_time_ts;
                 }
-                
+
                 if (change_time_ts != NULL) {
                         *change_time_ts = w_time_ts;
                 }
@@ -1804,10 +1842,10 @@ static int
 smbc_unlink_ctx(SMBCCTX *context,
                 const char *fname)
 {
-       char *server, *share, *user, *password, *workgroup;
-       char *path;
-       char *targetpath;
-       struct cli_state *targetcli;
+       char *server = NULL, *share = NULL, *user = NULL, *password = NULL, *workgroup = NULL;
+       char *path = NULL;
+       char *targetpath = NULL;
+       struct cli_state *targetcli = NULL;
        SMBCSRV *srv = NULL;
        TALLOC_CTX *frame = talloc_stackframe();
 
@@ -1850,8 +1888,8 @@ smbc_unlink_ctx(SMBCCTX *context,
                }
        }
 
-       srv = smbc_server(context, True,
-                          server, share, workgroup, user, password);
+       srv = smbc_server(frame, context, True,
+                          server, share, &workgroup, &user, &password);
 
        if (!srv) {
                TALLOC_FREE(frame);
@@ -1926,21 +1964,21 @@ smbc_rename_ctx(SMBCCTX *ocontext,
                 SMBCCTX *ncontext,
                 const char *nname)
 {
-       char *server1;
-        char *share1;
-        char *server2;
-        char *share2;
-        char *user1;
-        char *user2;
-        char *password1;
-        char *password2;
-        char *workgroup;
-       char *path1;
-        char *path2;
-        char *targetpath1;
-        char *targetpath2;
-       struct cli_state *targetcli1;
-        struct cli_state *targetcli2;
+       char *server1 = NULL;
+        char *share1 = NULL;
+        char *server2 = NULL;
+        char *share2 = NULL;
+        char *user1 = NULL;
+        char *user2 = NULL;
+        char *password1 = NULL;
+        char *password2 = NULL;
+        char *workgroup = NULL;
+       char *path1 = NULL;
+        char *path2 = NULL;
+        char *targetpath1 = NULL;
+        char *targetpath2 = NULL;
+       struct cli_state *targetcli1 = NULL;
+        struct cli_state *targetcli2 = NULL;
        SMBCSRV *srv = NULL;
        TALLOC_CTX *frame = talloc_stackframe();
 
@@ -2017,8 +2055,8 @@ smbc_rename_ctx(SMBCCTX *ocontext,
                return -1;
        }
 
-       srv = smbc_server(ocontext, True,
-                          server1, share1, workgroup, user1, password1);
+       srv = smbc_server(frame, ocontext, True,
+                          server1, share1, &workgroup, &user1, &password1);
        if (!srv) {
                TALLOC_FREE(frame);
                return -1;
@@ -2080,10 +2118,10 @@ smbc_lseek_ctx(SMBCCTX *context,
                int whence)
 {
        SMB_OFF_T size;
-       char *server, *share, *user, *password;
-       char *path;
-       char *targetpath;
-       struct cli_state *targetcli;
+       char *server = NULL, *share = NULL, *user = NULL, *password = NULL;
+       char *path = NULL;
+       char *targetpath = NULL;
+       struct cli_state *targetcli = NULL;
        TALLOC_CTX *frame = talloc_stackframe();
 
        if (!context || !context->internal ||
@@ -2253,13 +2291,13 @@ smbc_stat_ctx(SMBCCTX *context,
               const char *fname,
               struct stat *st)
 {
-       SMBCSRV *srv;
-       char *server;
-       char *share;
-       char *user;
-       char *password;
-       char *workgroup;
-       char *path;
+       SMBCSRV *srv = NULL;
+       char *server = NULL;
+       char *share = NULL;
+       char *user = NULL;
+       char *password = NULL;
+       char *workgroup = NULL;
+       char *path = NULL;
        struct timespec write_time_ts;
         struct timespec access_time_ts;
         struct timespec change_time_ts;
@@ -2308,8 +2346,8 @@ smbc_stat_ctx(SMBCCTX *context,
                }
        }
 
-       srv = smbc_server(context, True,
-                          server, share, workgroup, user, password);
+       srv = smbc_server(frame, context, True,
+                          server, share, &workgroup, &user, &password);
 
        if (!srv) {
                TALLOC_FREE(frame);
@@ -2355,13 +2393,13 @@ smbc_fstat_ctx(SMBCCTX *context,
         struct timespec write_time_ts;
        SMB_OFF_T size;
        uint16 mode;
-       char *server;
-       char *share;
-       char *user;
-       char *password;
-       char *path;
-        char *targetpath;
-       struct cli_state *targetcli;
+       char *server = NULL;
+       char *share = NULL;
+       char *user = NULL;
+       char *password = NULL;
+       char *path = NULL;
+        char *targetpath = NULL;
+       struct cli_state *targetcli = NULL;
        SMB_INO_T ino = 0;
        TALLOC_CTX *frame = talloc_stackframe();
 
@@ -2743,14 +2781,14 @@ smbc_opendir_ctx(SMBCCTX *context,
                  const char *fname)
 {
         int saved_errno;
-       char *server, *share, *user, *password, *options;
-       char *workgroup;
-       char *path;
+       char *server = NULL, *share = NULL, *user = NULL, *password = NULL, *options = NULL;
+       char *workgroup = NULL;
+       char *path = NULL;
         uint16 mode;
-        char *p;
+        char *p = NULL;
        SMBCSRV *srv  = NULL;
        SMBCFILE *dir = NULL;
-        struct _smbc_callbacks *cb;
+        struct _smbc_callbacks *cb = NULL;
        struct sockaddr_storage rem_ss;
        TALLOC_CTX *frame = talloc_stackframe();
 
@@ -2939,8 +2977,8 @@ smbc_opendir_ctx(SMBCCTX *context,
                          * workgroups/domains that it knows about.
                          */
 
-                        srv = smbc_server(context, True, server, "IPC$",
-                                          workgroup, user, password);
+                        srv = smbc_server(frame, context, True, server, "IPC$",
+                                          &workgroup, &user, &password);
                         if (!srv) {
                                 continue;
                         }
@@ -2993,8 +3031,8 @@ smbc_opendir_ctx(SMBCCTX *context,
                          * establish a connection if one does not already
                          * exist.
                          */
-                        srv = smbc_server(context, False, server, "IPC$",
-                                          workgroup, user, password);
+                        srv = smbc_server(frame, context, False, server, "IPC$",
+                                          &workgroup, &user, &password);
 
                         /*
                          * If no existing server and not an IP addr, look for
@@ -3032,9 +3070,9 @@ smbc_opendir_ctx(SMBCCTX *context,
                                  * Get a connection to IPC$ on the server if
                                  * we do not already have one
                                  */
-                               srv = smbc_server(context, True,
+                               srv = smbc_server(frame, context, True,
                                                   buserver, "IPC$",
-                                                  workgroup, user, password);
+                                                  &workgroup, &user, &password);
                                if (!srv) {
                                        DEBUG(0, ("got no contact to IPC$\n"));
                                        if (dir) {
@@ -3065,10 +3103,10 @@ smbc_opendir_ctx(SMBCCTX *context,
 
                                 /* If we hadn't found the server, get one now */
                                 if (!srv) {
-                                        srv = smbc_server(context, True,
+                                        srv = smbc_server(frame, context, True,
                                                           server, "IPC$",
-                                                          workgroup,
-                                                          user, password);
+                                                          &workgroup,
+                                                          &user, &password);
                                 }
 
                                 if (!srv) {
@@ -3127,8 +3165,8 @@ smbc_opendir_ctx(SMBCCTX *context,
                        /* We connect to the server and list the directory */
                        dir->dir_type = SMBC_FILE_SHARE;
 
-                       srv = smbc_server(context, True, server, share,
-                                          workgroup, user, password);
+                       srv = smbc_server(frame, context, True, server, share,
+                                          &workgroup, &user, &password);
 
                        if (!srv) {
                                if (dir) {
@@ -3495,15 +3533,15 @@ smbc_mkdir_ctx(SMBCCTX *context,
                const char *fname,
                mode_t mode)
 {
-       SMBCSRV *srv;
-       char *server;
-        char *share;
-        char *user;
-        char *password;
-        char *workgroup;
-       char *path;
-       char *targetpath;
-       struct cli_state *targetcli;
+       SMBCSRV *srv = NULL;
+       char *server = NULL;
+        char *share = NULL;
+        char *user = NULL;
+        char *password = NULL;
+        char *workgroup = NULL;
+       char *path = NULL;
+       char *targetpath = NULL;
+       struct cli_state *targetcli = NULL;
        TALLOC_CTX *frame = talloc_stackframe();
 
        if (!context || !context->internal ||
@@ -3545,8 +3583,8 @@ smbc_mkdir_ctx(SMBCCTX *context,
                }
        }
 
-       srv = smbc_server(context, True,
-                          server, share, workgroup, user, password);
+       srv = smbc_server(frame, context, True,
+                          server, share, &workgroup, &user, &password);
 
        if (!srv) {
 
@@ -3603,15 +3641,15 @@ static int
 smbc_rmdir_ctx(SMBCCTX *context,
                const char *fname)
 {
-       SMBCSRV *srv;
-       char *server;
-        char *share;
-        char *user;
-        char *password;
-        char *workgroup;
-       char *path;
-        char *targetpath;
-       struct cli_state *targetcli;
+       SMBCSRV *srv = NULL;
+       char *server = NULL;
+        char *share = NULL;
+        char *user = NULL;
+        char *password = NULL;
+        char *workgroup = NULL;
+       char *path = NULL;
+        char *targetpath = NULL;
+       struct cli_state *targetcli = NULL;
        TALLOC_CTX *frame = talloc_stackframe();
 
        if (!context || !context->internal ||
@@ -3653,8 +3691,8 @@ smbc_rmdir_ctx(SMBCCTX *context,
                }
        }
 
-       srv = smbc_server(context, True,
-                          server, share, workgroup, user, password);
+       srv = smbc_server(frame, context, True,
+                          server, share, &workgroup, &user, &password);
 
        if (!srv) {
 
@@ -3888,13 +3926,13 @@ smbc_chmod_ctx(SMBCCTX *context,
                const char *fname,
                mode_t newmode)
 {
-        SMBCSRV *srv;
-       char *server;
-        char *share;
-        char *user;
-        char *password;
-        char *workgroup;
-       char *path;
+        SMBCSRV *srv = NULL;
+       char *server = NULL;
+        char *share = NULL;
+        char *user = NULL;
+        char *password = NULL;
+        char *workgroup = NULL;
+       char *path = NULL;
        uint16 mode;
        TALLOC_CTX *frame = talloc_stackframe();
 
@@ -3937,8 +3975,8 @@ smbc_chmod_ctx(SMBCCTX *context,
                }
        }
 
-       srv = smbc_server(context, True,
-                          server, share, workgroup, user, password);
+       srv = smbc_server(frame, context, True,
+                          server, share, &workgroup, &user, &password);
 
        if (!srv) {
                TALLOC_FREE(frame);
@@ -3967,13 +4005,13 @@ smbc_utimes_ctx(SMBCCTX *context,
                 const char *fname,
                 struct timeval *tbuf)
 {
-        SMBCSRV *srv;
-       char *server;
-       char *share;
-       char *user;
-       char *password;
-       char *workgroup;
-       char *path;
+        SMBCSRV *srv = NULL;
+       char *server = NULL;
+       char *share = NULL;
+       char *user = NULL;
+       char *password = NULL;
+       char *workgroup = NULL;
+       char *path = NULL;
         time_t access_time;
         time_t write_time;
        TALLOC_CTX *frame = talloc_stackframe();
@@ -4043,8 +4081,8 @@ smbc_utimes_ctx(SMBCCTX *context,
                }
        }
 
-       srv = smbc_server(context, True,
-                          server, share, workgroup, user, password);
+       srv = smbc_server(frame, context, True,
+                          server, share, &workgroup, &user, &password);
 
        if (!srv) {
                TALLOC_FREE(frame);
@@ -5679,16 +5717,16 @@ smbc_setxattr_ctx(SMBCCTX *context,
 {
         int ret;
         int ret2;
-        SMBCSRV *srv;
-        SMBCSRV *ipc_srv;
-       char *server;
-       char *share;
-       char *user;
-       char *password;
-       char *workgroup;
-       char *path;
+        SMBCSRV *srv = NULL;
+        SMBCSRV *ipc_srv = NULL;
+       char *server = NULL;
+       char *share = NULL;
+       char *user = NULL;
+       char *password = NULL;
+       char *workgroup = NULL;
+       char *path = NULL;
         POLICY_HND pol;
-        DOS_ATTR_DESC *dad;
+        DOS_ATTR_DESC *dad = NULL;
         struct {
                 const char * create_time_attr;
                 const char * access_time_attr;
@@ -5737,16 +5775,16 @@ smbc_setxattr_ctx(SMBCCTX *context,
                }
        }
 
-       srv = smbc_server(context, True,
-                          server, share, workgroup, user, password);
+       srv = smbc_server(frame, context, True,
+                          server, share, &workgroup, &user, &password);
        if (!srv) {
                TALLOC_FREE(frame);
                return -1;  /* errno set by smbc_server */
        }
 
         if (! srv->no_nt_session) {
-                ipc_srv = smbc_attr_server(context, server, share,
-                                           workgroup, user, password,
+                ipc_srv = smbc_attr_server(frame, context, server, share,
+                                           &workgroup, &user, &password,
                                            &pol);
                 if (! ipc_srv) {
                         srv->no_nt_session = True;
@@ -5977,14 +6015,14 @@ smbc_getxattr_ctx(SMBCCTX *context,
                   size_t size)
 {
         int ret;
-        SMBCSRV *srv;
-        SMBCSRV *ipc_srv;
-       char *server;
-       char *share;
-       char *user;
-       char *password;
-       char *workgroup;
-       char *path;
+        SMBCSRV *srv = NULL;
+        SMBCSRV *ipc_srv = NULL;
+       char *server = NULL;
+       char *share = NULL;
+       char *user = NULL;
+       char *password = NULL;
+       char *workgroup = NULL;
+       char *path = NULL;
         POLICY_HND pol;
         struct {
                 const char * create_time_attr;
@@ -6033,16 +6071,16 @@ smbc_getxattr_ctx(SMBCCTX *context,
                }
        }
 
-        srv = smbc_server(context, True,
-                          server, share, workgroup, user, password);
+        srv = smbc_server(frame, context, True,
+                          server, share, &workgroup, &user, &password);
         if (!srv) {
                TALLOC_FREE(frame);
                 return -1;  /* errno set by smbc_server */
         }
 
         if (! srv->no_nt_session) {
-                ipc_srv = smbc_attr_server(context, server, share,
-                                           workgroup, user, password,
+                ipc_srv = smbc_attr_server(frame, context, server, share,
+                                           &workgroup, &user, &password,
                                            &pol);
                 if (! ipc_srv) {
                         srv->no_nt_session = True;
@@ -6119,14 +6157,14 @@ smbc_removexattr_ctx(SMBCCTX *context,
                      const char *name)
 {
         int ret;
-        SMBCSRV *srv;
-        SMBCSRV *ipc_srv;
-       char *server;
-       char *share;
-       char *user;
-       char *password;
-       char *workgroup;
-       char *path;
+        SMBCSRV *srv = NULL;
+        SMBCSRV *ipc_srv = NULL;
+       char *server = NULL;
+       char *share = NULL;
+       char *user = NULL;
+       char *password = NULL;
+       char *workgroup = NULL;
+       char *path = NULL;
         POLICY_HND pol;
        TALLOC_CTX *frame = talloc_stackframe();
 
@@ -6169,16 +6207,16 @@ smbc_removexattr_ctx(SMBCCTX *context,
                }
        }
 
-        srv = smbc_server(context, True,
-                          server, share, workgroup, user, password);
+        srv = smbc_server(frame, context, True,
+                          server, share, &workgroup, &user, &password);
         if (!srv) {
                TALLOC_FREE(frame);
                 return -1;  /* errno set by smbc_server */
         }
 
         if (! srv->no_nt_session) {
-                ipc_srv = smbc_attr_server(context, server, share,
-                                           workgroup, user, password,
+                ipc_srv = smbc_attr_server(frame, context, server, share,
+                                           &workgroup, &user, &password,
                                            &pol);
                 if (! ipc_srv) {
                         srv->no_nt_session = True;
@@ -6314,11 +6352,11 @@ static SMBCFILE *
 smbc_open_print_job_ctx(SMBCCTX *context,
                         const char *fname)
 {
-       char *server;
-       char *share;
-       char *user;
-       char *password;
-       char *path;
+       char *server = NULL;
+       char *share = NULL;
+       char *user = NULL;
+       char *password = NULL;
+       char *path = NULL;
        TALLOC_CTX *frame = talloc_stackframe();
 
         if (!context || !context->internal ||
@@ -6457,13 +6495,13 @@ smbc_list_print_jobs_ctx(SMBCCTX *context,
                          const char *fname,
                          smbc_list_print_job_fn fn)
 {
-       SMBCSRV *srv;
-       char *server;
-       char *share;
-       char *user;
-       char *password;
-       char *workgroup;
-       char *path;
+       SMBCSRV *srv = NULL;
+       char *server = NULL;
+       char *share = NULL;
+       char *user = NULL;
+       char *password = NULL;
+       char *workgroup = NULL;
+       char *path = NULL;
        TALLOC_CTX *frame = talloc_stackframe();
 
         if (!context || !context->internal ||
@@ -6505,8 +6543,8 @@ smbc_list_print_jobs_ctx(SMBCCTX *context,
                }
        }
 
-        srv = smbc_server(context, True,
-                          server, share, workgroup, user, password);
+        srv = smbc_server(frame, context, True,
+                          server, share, &workgroup, &user, &password);
 
         if (!srv) {
                TALLOC_FREE(frame);
@@ -6534,13 +6572,13 @@ smbc_unlink_print_job_ctx(SMBCCTX *context,
                           const char *fname,
                           int id)
 {
-       SMBCSRV *srv;
-       char *server;
-       char *share;
-       char *user;
-       char *password;
-       char *workgroup;
-       char *path;
+       SMBCSRV *srv = NULL;
+       char *server = NULL;
+       char *share = NULL;
+       char *user = NULL;
+       char *password = NULL;
+       char *workgroup = NULL;
+       char *path = NULL;
         int err;
        TALLOC_CTX *frame = talloc_stackframe();
 
@@ -6583,8 +6621,8 @@ smbc_unlink_print_job_ctx(SMBCCTX *context,
                }
        }
 
-        srv = smbc_server(context, True,
-                          server, share, workgroup, user, password);
+        srv = smbc_server(frame, context, True,
+                          server, share, &workgroup, &user, &password);
 
         if (!srv) {
 
index d7f6f604f7f42e2605daba1ddde0a2a823168825..c547a4a0034c22589594bad6dbf32ba37edfde65 100644 (file)
@@ -443,7 +443,7 @@ bool SMBNTLMv2encrypt_hash(const char *user, const char *domain, const uchar nt_
           the username and domain.
           This prevents username swapping during the auth exchange
        */
-       if (!ntv2_owf_gen(nt_hash, user, domain, True, ntlm_v2_hash)) {
+       if (!ntv2_owf_gen(nt_hash, user, domain, False, ntlm_v2_hash)) {
                return False;
        }
        
similarity index 68%
rename from source3/modules/vfs_ea_tdb.c
rename to source3/modules/vfs_xattr_tdb.c
index 8cf04d79ad935ae4f60b2beffab368372316ed8e..3a72831b5b9c67760f27c07f2d8198100fce2478 100644 (file)
@@ -28,9 +28,9 @@
  * unmarshall tdb_xattrs
  */
 
-static NTSTATUS ea_tdb_pull_attrs(TALLOC_CTX *mem_ctx,
-                                 const TDB_DATA *data,
-                                 struct tdb_xattrs **presult)
+static NTSTATUS xattr_tdb_pull_attrs(TALLOC_CTX *mem_ctx,
+                                    const TDB_DATA *data,
+                                    struct tdb_xattrs **presult)
 {
        DATA_BLOB blob;
        enum ndr_err_code ndr_err;
@@ -66,9 +66,9 @@ static NTSTATUS ea_tdb_pull_attrs(TALLOC_CTX *mem_ctx,
  * marshall tdb_xattrs
  */
 
-static NTSTATUS ea_tdb_push_attrs(TALLOC_CTX *mem_ctx,
-                                 const struct tdb_xattrs *attribs,
-                                 TDB_DATA *data)
+static NTSTATUS xattr_tdb_push_attrs(TALLOC_CTX *mem_ctx,
+                                    const struct tdb_xattrs *attribs,
+                                    TDB_DATA *data)
 {
        DATA_BLOB blob;
        enum ndr_err_code ndr_err;
@@ -91,10 +91,10 @@ static NTSTATUS ea_tdb_push_attrs(TALLOC_CTX *mem_ctx,
  * Load tdb_xattrs for a file from the tdb
  */
 
-static NTSTATUS ea_tdb_load_attrs(TALLOC_CTX *mem_ctx,
-                                 struct db_context *db_ctx,
-                                 const struct file_id *id,
-                                 struct tdb_xattrs **presult)
+static NTSTATUS xattr_tdb_load_attrs(TALLOC_CTX *mem_ctx,
+                                    struct db_context *db_ctx,
+                                    const struct file_id *id,
+                                    struct tdb_xattrs **presult)
 {
        uint8 id_buf[16];
        NTSTATUS status;
@@ -108,7 +108,7 @@ static NTSTATUS ea_tdb_load_attrs(TALLOC_CTX *mem_ctx,
                return NT_STATUS_INTERNAL_DB_CORRUPTION;
        }
 
-       status = ea_tdb_pull_attrs(mem_ctx, &data, presult);
+       status = xattr_tdb_pull_attrs(mem_ctx, &data, presult);
        TALLOC_FREE(data.dptr);
        return NT_STATUS_OK;
 }
@@ -117,9 +117,9 @@ static NTSTATUS ea_tdb_load_attrs(TALLOC_CTX *mem_ctx,
  * fetch_lock the tdb_ea record for a file
  */
 
-static struct db_record *ea_tdb_lock_attrs(TALLOC_CTX *mem_ctx,
-                                          struct db_context *db_ctx,
-                                          const struct file_id *id)
+static struct db_record *xattr_tdb_lock_attrs(TALLOC_CTX *mem_ctx,
+                                             struct db_context *db_ctx,
+                                             const struct file_id *id)
 {
        uint8 id_buf[16];
        push_file_id_16((char *)id_buf, id);
@@ -131,16 +131,16 @@ static struct db_record *ea_tdb_lock_attrs(TALLOC_CTX *mem_ctx,
  * Save tdb_xattrs to a previously fetch_locked record
  */
 
-static NTSTATUS ea_tdb_save_attrs(struct db_record *rec,
-                                 const struct tdb_xattrs *attribs)
+static NTSTATUS xattr_tdb_save_attrs(struct db_record *rec,
+                                    const struct tdb_xattrs *attribs)
 {
        TDB_DATA data;
        NTSTATUS status;
 
-       status = ea_tdb_push_attrs(talloc_tos(), attribs, &data);
+       status = xattr_tdb_push_attrs(talloc_tos(), attribs, &data);
 
        if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(0, ("ea_tdb_push_attrs failed: %s\n",
+               DEBUG(0, ("xattr_tdb_push_attrs failed: %s\n",
                          nt_errstr(status)));
                return status;
        }
@@ -156,19 +156,19 @@ static NTSTATUS ea_tdb_save_attrs(struct db_record *rec,
  * Worker routine for getxattr and fgetxattr
  */
 
-static ssize_t ea_tdb_getattr(struct db_context *db_ctx,
-                             const struct file_id *id,
-                             const char *name, void *value, size_t size)
+static ssize_t xattr_tdb_getattr(struct db_context *db_ctx,
+                                const struct file_id *id,
+                                const char *name, void *value, size_t size)
 {
        struct tdb_xattrs *attribs;
        uint32_t i;
        ssize_t result = -1;
        NTSTATUS status;
 
-       status = ea_tdb_load_attrs(talloc_tos(), db_ctx, id, &attribs);
+       status = xattr_tdb_load_attrs(talloc_tos(), db_ctx, id, &attribs);
 
        if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(10, ("ea_tdb_fetch_attrs failed: %s\n",
+               DEBUG(10, ("xattr_tdb_fetch_attrs failed: %s\n",
                           nt_errstr(status)));
                errno = EINVAL;
                return -1;
@@ -199,9 +199,9 @@ static ssize_t ea_tdb_getattr(struct db_context *db_ctx,
        return result;
 }
 
-static ssize_t ea_tdb_getxattr(struct vfs_handle_struct *handle,
-                              const char *path, const char *name,
-                              void *value, size_t size)
+static ssize_t xattr_tdb_getxattr(struct vfs_handle_struct *handle,
+                                 const char *path, const char *name,
+                                 void *value, size_t size)
 {
        SMB_STRUCT_STAT sbuf;
        struct file_id id;
@@ -215,12 +215,12 @@ static ssize_t ea_tdb_getxattr(struct vfs_handle_struct *handle,
 
        id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
 
-       return ea_tdb_getattr(db, &id, name, value, size);
+       return xattr_tdb_getattr(db, &id, name, value, size);
 }
 
-static ssize_t ea_tdb_fgetxattr(struct vfs_handle_struct *handle,
-                               struct files_struct *fsp,
-                               const char *name, void *value, size_t size)
+static ssize_t xattr_tdb_fgetxattr(struct vfs_handle_struct *handle,
+                                  struct files_struct *fsp,
+                                  const char *name, void *value, size_t size)
 {
        SMB_STRUCT_STAT sbuf;
        struct file_id id;
@@ -234,34 +234,34 @@ static ssize_t ea_tdb_fgetxattr(struct vfs_handle_struct *handle,
 
        id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
 
-       return ea_tdb_getattr(db, &id, name, value, size);
+       return xattr_tdb_getattr(db, &id, name, value, size);
 }
 
 /*
  * Worker routine for setxattr and fsetxattr
  */
 
-static int ea_tdb_setattr(struct db_context *db_ctx,
-                         const struct file_id *id, const char *name,
-                         const void *value, size_t size, int flags)
+static int xattr_tdb_setattr(struct db_context *db_ctx,
+                            const struct file_id *id, const char *name,
+                            const void *value, size_t size, int flags)
 {
        NTSTATUS status;
        struct db_record *rec;
        struct tdb_xattrs *attribs;
        uint32_t i;
 
-       rec = ea_tdb_lock_attrs(talloc_tos(), db_ctx, id);
+       rec = xattr_tdb_lock_attrs(talloc_tos(), db_ctx, id);
 
        if (rec == NULL) {
-               DEBUG(0, ("ea_tdb_lock_attrs failed\n"));
+               DEBUG(0, ("xattr_tdb_lock_attrs failed\n"));
                errno = EINVAL;
                return -1;
        }
 
-       status = ea_tdb_pull_attrs(rec, &rec->value, &attribs);
+       status = xattr_tdb_pull_attrs(rec, &rec->value, &attribs);
 
        if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(10, ("ea_tdb_fetch_attrs failed: %s\n",
+               DEBUG(10, ("xattr_tdb_fetch_attrs failed: %s\n",
                           nt_errstr(status)));
                TALLOC_FREE(rec);
                return -1;
@@ -295,7 +295,7 @@ static int ea_tdb_setattr(struct db_context *db_ctx,
        attribs->xattrs[i].value.data = CONST_DISCARD(uint8 *, value);
        attribs->xattrs[i].value.length = size;
 
-       status = ea_tdb_save_attrs(rec, attribs);
+       status = xattr_tdb_save_attrs(rec, attribs);
 
        TALLOC_FREE(rec);
 
@@ -307,9 +307,9 @@ static int ea_tdb_setattr(struct db_context *db_ctx,
        return 0;
 }
 
-static int ea_tdb_setxattr(struct vfs_handle_struct *handle,
-                          const char *path, const char *name,
-                          const void *value, size_t size, int flags)
+static int xattr_tdb_setxattr(struct vfs_handle_struct *handle,
+                             const char *path, const char *name,
+                             const void *value, size_t size, int flags)
 {
        SMB_STRUCT_STAT sbuf;
        struct file_id id;
@@ -323,13 +323,13 @@ static int ea_tdb_setxattr(struct vfs_handle_struct *handle,
 
        id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
 
-       return ea_tdb_setattr(db, &id, name, value, size, flags);
+       return xattr_tdb_setattr(db, &id, name, value, size, flags);
 }
 
-static int ea_tdb_fsetxattr(struct vfs_handle_struct *handle,
-                           struct files_struct *fsp,
-                           const char *name, const void *value,
-                           size_t size, int flags)
+static int xattr_tdb_fsetxattr(struct vfs_handle_struct *handle,
+                              struct files_struct *fsp,
+                              const char *name, const void *value,
+                              size_t size, int flags)
 {
        SMB_STRUCT_STAT sbuf;
        struct file_id id;
@@ -343,37 +343,38 @@ static int ea_tdb_fsetxattr(struct vfs_handle_struct *handle,
 
        id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
 
-       return ea_tdb_setattr(db, &id, name, value, size, flags);
+       return xattr_tdb_setattr(db, &id, name, value, size, flags);
 }
 
 /*
  * Worker routine for listxattr and flistxattr
  */
 
-static ssize_t ea_tdb_listattr(struct db_context *db_ctx,
-                              const struct file_id *id, char *list,
-                              size_t size)
+static ssize_t xattr_tdb_listattr(struct db_context *db_ctx,
+                                 const struct file_id *id, char *list,
+                                 size_t size)
 {
        NTSTATUS status;
        struct tdb_xattrs *attribs;
        uint32_t i;
        size_t len = 0;
 
-       status = ea_tdb_load_attrs(talloc_tos(), db_ctx, id, &attribs);
+       status = xattr_tdb_load_attrs(talloc_tos(), db_ctx, id, &attribs);
 
        if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(10, ("ea_tdb_fetch_attrs failed: %s\n",
+               DEBUG(10, ("xattr_tdb_fetch_attrs failed: %s\n",
                           nt_errstr(status)));
                errno = EINVAL;
                return -1;
        }
 
-       DEBUG(10, ("ea_tdb_listattr: Found %d xattrs\n", attribs->num_xattrs));
+       DEBUG(10, ("xattr_tdb_listattr: Found %d xattrs\n",
+                  attribs->num_xattrs));
 
        for (i=0; i<attribs->num_xattrs; i++) {
                size_t tmp;
 
-               DEBUG(10, ("ea_tdb_listattr: xattrs[i].name: %s\n",
+               DEBUG(10, ("xattr_tdb_listattr: xattrs[i].name: %s\n",
                           attribs->xattrs[i].name));
 
                tmp = strlen(attribs->xattrs[i].name);
@@ -412,8 +413,8 @@ static ssize_t ea_tdb_listattr(struct db_context *db_ctx,
        return len;
 }
 
-static ssize_t ea_tdb_listxattr(struct vfs_handle_struct *handle,
-                               const char *path, char *list, size_t size)
+static ssize_t xattr_tdb_listxattr(struct vfs_handle_struct *handle,
+                                  const char *path, char *list, size_t size)
 {
        SMB_STRUCT_STAT sbuf;
        struct file_id id;
@@ -427,12 +428,12 @@ static ssize_t ea_tdb_listxattr(struct vfs_handle_struct *handle,
 
        id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
 
-       return ea_tdb_listattr(db, &id, list, size);
+       return xattr_tdb_listattr(db, &id, list, size);
 }
 
-static ssize_t ea_tdb_flistxattr(struct vfs_handle_struct *handle,
-                                struct files_struct *fsp, char *list,
-                                size_t size)
+static ssize_t xattr_tdb_flistxattr(struct vfs_handle_struct *handle,
+                                   struct files_struct *fsp, char *list,
+                                   size_t size)
 {
        SMB_STRUCT_STAT sbuf;
        struct file_id id;
@@ -446,33 +447,33 @@ static ssize_t ea_tdb_flistxattr(struct vfs_handle_struct *handle,
 
        id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
 
-       return ea_tdb_listattr(db, &id, list, size);
+       return xattr_tdb_listattr(db, &id, list, size);
 }
 
 /*
  * Worker routine for removexattr and fremovexattr
  */
 
-static int ea_tdb_removeattr(struct db_context *db_ctx,
-                            const struct file_id *id, const char *name)
+static int xattr_tdb_removeattr(struct db_context *db_ctx,
+                               const struct file_id *id, const char *name)
 {
        NTSTATUS status;
        struct db_record *rec;
        struct tdb_xattrs *attribs;
        uint32_t i;
 
-       rec = ea_tdb_lock_attrs(talloc_tos(), db_ctx, id);
+       rec = xattr_tdb_lock_attrs(talloc_tos(), db_ctx, id);
 
        if (rec == NULL) {
-               DEBUG(0, ("ea_tdb_lock_attrs failed\n"));
+               DEBUG(0, ("xattr_tdb_lock_attrs failed\n"));
                errno = EINVAL;
                return -1;
        }
 
-       status = ea_tdb_pull_attrs(rec, &rec->value, &attribs);
+       status = xattr_tdb_pull_attrs(rec, &rec->value, &attribs);
 
        if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(10, ("ea_tdb_fetch_attrs failed: %s\n",
+               DEBUG(10, ("xattr_tdb_fetch_attrs failed: %s\n",
                           nt_errstr(status)));
                TALLOC_FREE(rec);
                return -1;
@@ -500,7 +501,7 @@ static int ea_tdb_removeattr(struct db_context *db_ctx,
                return 0;
        }
 
-       status = ea_tdb_save_attrs(rec, attribs);
+       status = xattr_tdb_save_attrs(rec, attribs);
 
        TALLOC_FREE(rec);
 
@@ -512,8 +513,8 @@ static int ea_tdb_removeattr(struct db_context *db_ctx,
        return 0;
 }
 
-static int ea_tdb_removexattr(struct vfs_handle_struct *handle,
-                             const char *path, const char *name)
+static int xattr_tdb_removexattr(struct vfs_handle_struct *handle,
+                                const char *path, const char *name)
 {
        SMB_STRUCT_STAT sbuf;
        struct file_id id;
@@ -527,11 +528,11 @@ static int ea_tdb_removexattr(struct vfs_handle_struct *handle,
 
        id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
 
-       return ea_tdb_removeattr(db, &id, name);
+       return xattr_tdb_removeattr(db, &id, name);
 }
 
-static int ea_tdb_fremovexattr(struct vfs_handle_struct *handle,
-                              struct files_struct *fsp, const char *name)
+static int xattr_tdb_fremovexattr(struct vfs_handle_struct *handle,
+                                 struct files_struct *fsp, const char *name)
 {
        SMB_STRUCT_STAT sbuf;
        struct file_id id;
@@ -545,14 +546,14 @@ static int ea_tdb_fremovexattr(struct vfs_handle_struct *handle,
 
        id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
 
-       return ea_tdb_removeattr(db, &id, name);
+       return xattr_tdb_removeattr(db, &id, name);
 }
 
 /*
  * Open the tdb file upon VFS_CONNECT
  */
 
-static bool ea_tdb_init(int snum, struct db_context **p_db)
+static bool xattr_tdb_init(int snum, struct db_context **p_db)
 {
        struct db_context *db;
        const char *dbname;
@@ -580,7 +581,7 @@ static bool ea_tdb_init(int snum, struct db_context **p_db)
 /*
  * On unlink we need to delete the tdb record
  */
-static int ea_tdb_unlink(vfs_handle_struct *handle, const char *path)
+static int xattr_tdb_unlink(vfs_handle_struct *handle, const char *path)
 {
        SMB_STRUCT_STAT sbuf;
        struct file_id id;
@@ -602,7 +603,7 @@ static int ea_tdb_unlink(vfs_handle_struct *handle, const char *path)
 
        id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
 
-       rec = ea_tdb_lock_attrs(talloc_tos(), db, &id);
+       rec = xattr_tdb_lock_attrs(talloc_tos(), db, &id);
 
        /*
         * If rec == NULL there's not much we can do about it
@@ -619,7 +620,7 @@ static int ea_tdb_unlink(vfs_handle_struct *handle, const char *path)
 /*
  * On rmdir we need to delete the tdb record
  */
-static int ea_tdb_rmdir(vfs_handle_struct *handle, const char *path)
+static int xattr_tdb_rmdir(vfs_handle_struct *handle, const char *path)
 {
        SMB_STRUCT_STAT sbuf;
        struct file_id id;
@@ -641,7 +642,7 @@ static int ea_tdb_rmdir(vfs_handle_struct *handle, const char *path)
 
        id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
 
-       rec = ea_tdb_lock_attrs(talloc_tos(), db, &id);
+       rec = xattr_tdb_lock_attrs(talloc_tos(), db, &id);
 
        /*
         * If rec == NULL there's not much we can do about it
@@ -665,7 +666,7 @@ static void close_ea_db(void **data)
        TALLOC_FREE(*p_db);
 }
 
-static int ea_tdb_connect(vfs_handle_struct *handle, const char *service,
+static int xattr_tdb_connect(vfs_handle_struct *handle, const char *service,
                          const char *user)
 {
        fstring sname;
@@ -686,7 +687,7 @@ static int ea_tdb_connect(vfs_handle_struct *handle, const char *service,
                return 0;
        }
 
-       if (!ea_tdb_init(snum, &db)) {
+       if (!xattr_tdb_init(snum, &db)) {
                DEBUG(5, ("Could not init ea tdb\n"));
                lp_do_parameter(snum, "ea support", "False");
                return 0;
@@ -702,35 +703,35 @@ static int ea_tdb_connect(vfs_handle_struct *handle, const char *service,
 
 /* VFS operations structure */
 
-static const vfs_op_tuple ea_tdb_ops[] = {
-       {SMB_VFS_OP(ea_tdb_getxattr), SMB_VFS_OP_GETXATTR,
+static const vfs_op_tuple xattr_tdb_ops[] = {
+       {SMB_VFS_OP(xattr_tdb_getxattr), SMB_VFS_OP_GETXATTR,
         SMB_VFS_LAYER_TRANSPARENT},
-       {SMB_VFS_OP(ea_tdb_fgetxattr), SMB_VFS_OP_FGETXATTR,
+       {SMB_VFS_OP(xattr_tdb_fgetxattr), SMB_VFS_OP_FGETXATTR,
         SMB_VFS_LAYER_TRANSPARENT},
-       {SMB_VFS_OP(ea_tdb_setxattr), SMB_VFS_OP_SETXATTR,
+       {SMB_VFS_OP(xattr_tdb_setxattr), SMB_VFS_OP_SETXATTR,
         SMB_VFS_LAYER_TRANSPARENT},
-       {SMB_VFS_OP(ea_tdb_fsetxattr), SMB_VFS_OP_FSETXATTR,
+       {SMB_VFS_OP(xattr_tdb_fsetxattr), SMB_VFS_OP_FSETXATTR,
         SMB_VFS_LAYER_TRANSPARENT},
-       {SMB_VFS_OP(ea_tdb_listxattr), SMB_VFS_OP_LISTXATTR,
+       {SMB_VFS_OP(xattr_tdb_listxattr), SMB_VFS_OP_LISTXATTR,
         SMB_VFS_LAYER_TRANSPARENT},
-       {SMB_VFS_OP(ea_tdb_flistxattr), SMB_VFS_OP_FLISTXATTR,
+       {SMB_VFS_OP(xattr_tdb_flistxattr), SMB_VFS_OP_FLISTXATTR,
         SMB_VFS_LAYER_TRANSPARENT},
-       {SMB_VFS_OP(ea_tdb_removexattr), SMB_VFS_OP_REMOVEXATTR,
+       {SMB_VFS_OP(xattr_tdb_removexattr), SMB_VFS_OP_REMOVEXATTR,
         SMB_VFS_LAYER_TRANSPARENT},
-       {SMB_VFS_OP(ea_tdb_fremovexattr), SMB_VFS_OP_FREMOVEXATTR,
+       {SMB_VFS_OP(xattr_tdb_fremovexattr), SMB_VFS_OP_FREMOVEXATTR,
         SMB_VFS_LAYER_TRANSPARENT},
-       {SMB_VFS_OP(ea_tdb_unlink), SMB_VFS_OP_UNLINK,
+       {SMB_VFS_OP(xattr_tdb_unlink), SMB_VFS_OP_UNLINK,
         SMB_VFS_LAYER_TRANSPARENT},
-       {SMB_VFS_OP(ea_tdb_rmdir), SMB_VFS_OP_RMDIR,
+       {SMB_VFS_OP(xattr_tdb_rmdir), SMB_VFS_OP_RMDIR,
         SMB_VFS_LAYER_TRANSPARENT},
-       {SMB_VFS_OP(ea_tdb_connect), SMB_VFS_OP_CONNECT,
+       {SMB_VFS_OP(xattr_tdb_connect), SMB_VFS_OP_CONNECT,
         SMB_VFS_LAYER_TRANSPARENT},
        {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP}
 };
 
-NTSTATUS vfs_ea_tdb_init(void);
-NTSTATUS vfs_ea_tdb_init(void)
+NTSTATUS vfs_xattr_tdb_init(void);
+NTSTATUS vfs_xattr_tdb_init(void)
 {
-       return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "ea_tdb",
-                               ea_tdb_ops);
+       return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "xattr_tdb",
+                               xattr_tdb_ops);
 }
index 77ade5cba1b3f19aa02b22bd39818a9362082403..286cc210e281ebc895ac2523a511dbd4f9dfcb11 100644 (file)
@@ -542,7 +542,8 @@ NTSTATUS rpccli_lsa_query_info_policy2_new(struct rpc_pipe_client *cli, TALLOC_C
 NTSTATUS rpccli_lsa_query_info_policy(struct rpc_pipe_client *cli,
                                      TALLOC_CTX *mem_ctx,
                                      POLICY_HND *pol, uint16 info_class,
-                                     char **domain_name, DOM_SID **domain_sid)
+                                     const char **domain_name,
+                                     DOM_SID **domain_sid)
 {
        prs_struct qbuf, rbuf;
        LSA_Q_QUERY_INFO q;
@@ -632,8 +633,9 @@ NTSTATUS rpccli_lsa_query_info_policy(struct rpc_pipe_client *cli,
 NTSTATUS rpccli_lsa_query_info_policy2(struct rpc_pipe_client *cli,
                                       TALLOC_CTX *mem_ctx,
                                       POLICY_HND *pol, uint16 info_class,
-                                      char **domain_name, char **dns_name,
-                                      char **forest_name,
+                                      const char **domain_name,
+                                      const char **dns_name,
+                                      const char **forest_name,
                                       struct GUID **domain_guid,
                                       DOM_SID **domain_sid)
 {
index 7743269ce0eb145a1206a195c3d55d2c8e2cb91c..05269d771128ca3ecde403fa5bc634b48f1f78fb 100644 (file)
@@ -916,7 +916,8 @@ static void display_trust_dom_info_4(struct lsa_TrustDomainInfoPassword *p, cons
        data_blob_free(&data_old);
 }
 
-static void display_trust_dom_info(union lsa_TrustedDomainInfo *info,
+static void display_trust_dom_info(TALLOC_CTX *mem_ctx,
+                                  union lsa_TrustedDomainInfo *info,
                                   enum lsa_TrustDomInfoEnum info_class,
                                   const char *pass)
 {
@@ -924,12 +925,17 @@ static void display_trust_dom_info(union lsa_TrustedDomainInfo *info,
                case LSA_TRUSTED_DOMAIN_INFO_PASSWORD:
                        display_trust_dom_info_4(&info->password, pass);
                        break;
-               default:
-                       NDR_PRINT_UNION_DEBUG(lsa_TrustedDomainInfo,
-                                             info_class, info);
+               default: {
+                       const char *str = NULL;
+                       str = NDR_PRINT_UNION_STRING(mem_ctx,
+                                                    lsa_TrustedDomainInfo,
+                                                    info_class, info);
+                       if (str) {
+                               d_printf("%s\n", str);
+                       }
                        break;
+               }
        }
-
 }
 
 static NTSTATUS cmd_lsa_query_trustdominfobysid(struct rpc_pipe_client *cli,
@@ -967,7 +973,7 @@ static NTSTATUS cmd_lsa_query_trustdominfobysid(struct rpc_pipe_client *cli,
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       display_trust_dom_info(&info, info_class, cli->pwd.password);
+       display_trust_dom_info(mem_ctx, &info, info_class, cli->pwd.password);
 
  done:
        if (&pol)
@@ -1015,7 +1021,7 @@ static NTSTATUS cmd_lsa_query_trustdominfobyname(struct rpc_pipe_client *cli,
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       display_trust_dom_info(&info, info_class, cli->pwd.password);
+       display_trust_dom_info(mem_ctx, &info, info_class, cli->pwd.password);
 
  done:
        if (&pol)
@@ -1069,7 +1075,7 @@ static NTSTATUS cmd_lsa_query_trustdominfo(struct rpc_pipe_client *cli,
        if (!NT_STATUS_IS_OK(result))
                goto done;
 
-       display_trust_dom_info(&info, info_class, cli->pwd.password);
+       display_trust_dom_info(mem_ctx, &info, info_class, cli->pwd.password);
 
  done:
        if (&pol)
index dd8b911bb8d11a925961a8d19369dfae24c9ff72..081e0fb15e9aa80e26d10d46897ae15b4961b1f5 100644 (file)
@@ -134,7 +134,7 @@ static void fetch_machine_sid(struct cli_state *cli)
        POLICY_HND pol;
        NTSTATUS result = NT_STATUS_OK;
        uint32 info_class = 5;
-       char *domain_name = NULL;
+       const char *domain_name = NULL;
        static bool got_domain_sid;
        TALLOC_CTX *mem_ctx;
        DOM_SID *dom_sid = NULL;
index 08bfdf601c83999db3fb7f383207e367e761c002..5a170b21172d7ee5f9887ca6a527fc2c7d78072a 100755 (executable)
@@ -186,7 +186,7 @@ cat >$SERVERCONFFILE<<EOF
        map hidden = yes
        map system = yes
        create mask = 755
-       vfs objects = $BINDIR/ea_tdb.so
+       vfs objects = $BINDIR/xattr_tdb.so
 [hideunread]
        copy = tmp
        hide unreadable = yes
index 2ffa4d77b199c9bf453576ef511154e03386f4d8..3a4b1da7b08773392bb20077ebd6a27163ab4e4a 100644 (file)
@@ -42,7 +42,7 @@ struct rpc_sh_ctx {
        struct cli_state *cli;
 
        DOM_SID *domain_sid;
-       char *domain_name;
+       const char *domain_name;
 
        const char *whoami;
        const char *thiscmd;
index 0a9020bcfd219d43309534254fa2a87802bac2ef..732ba8d8b6c313ce8a3998375309e0803bf45932 100644 (file)
@@ -817,7 +817,7 @@ static int net_ads_leave(int argc, const char **argv)
        struct cli_state *cli = NULL;
        TALLOC_CTX *ctx;
        DOM_SID *dom_sid = NULL;
-       char *short_domain_name = NULL;
+       const char *short_domain_name = NULL;
 
        if (!secrets_init()) {
                DEBUG(1,("Failed to initialise secrets database\n"));
@@ -961,7 +961,8 @@ static NTSTATUS check_ads_config( void )
  ********************************************************************/
 
 static NTSTATUS net_join_domain(TALLOC_CTX *ctx, const char *servername,
-                               struct sockaddr_storage *pss, char **domain,
+                               struct sockaddr_storage *pss,
+                               const char **domain,
                                DOM_SID **dom_sid,
                                const char *password)
 {
@@ -1445,7 +1446,7 @@ int net_ads_join(int argc, const char **argv)
        ADS_STRUCT *ads = NULL;
        ADS_STATUS status;
        NTSTATUS nt_status;
-       char *short_domain_name = NULL;
+       const char *short_domain_name = NULL;
        char *tmp_password, *password;
        TALLOC_CTX *ctx = NULL;
        DOM_SID *domain_sid = NULL;
index 3f1908e242d7d5531f80465ee1142d2e443cc0d3..da5e61caf0610702d67cda1fb0efaf8ff9049139 100644 (file)
@@ -157,7 +157,7 @@ int netdom_store_machine_account( const char *domain, DOM_SID *sid, const char *
  ********************************************************************/
 
 NTSTATUS netdom_get_domain_sid( TALLOC_CTX *mem_ctx, struct cli_state *cli, 
-                               char **domain, DOM_SID **sid )
+                               const char **domain, DOM_SID **sid )
 {
        struct rpc_pipe_client *pipe_hnd = NULL;
        POLICY_HND lsa_pol;
index 2bd867fff3fea7a6a8ce66720bea508c8775388d..677924649cad14fcd1a1932061964c6a2183863b 100644 (file)
@@ -51,7 +51,8 @@ static bool sync_files(struct copy_clistate *cp_clistate, const char *mask);
  **/
 
 NTSTATUS net_get_remote_domain_sid(struct cli_state *cli, TALLOC_CTX *mem_ctx,
-                                  DOM_SID **domain_sid, char **domain_name)
+                                  DOM_SID **domain_sid,
+                                  const char **domain_name)
 {
        struct rpc_pipe_client *lsa_pipe;
        POLICY_HND pol;
@@ -112,7 +113,7 @@ int run_rpc_command(struct cli_state *cli_arg,
        TALLOC_CTX *mem_ctx;
        NTSTATUS nt_status;
        DOM_SID *domain_sid;
-       char *domain_name;
+       const char *domain_name;
 
        /* make use of cli_state handed over as an argument, if possible */
        if (!cli_arg) {
@@ -5607,7 +5608,7 @@ static int rpc_trustdom_establish(int argc, const char **argv)
        DOM_SID *domain_sid;
 
        char* domain_name;
-       char* domain_name_pol;
+       const char* domain_name_pol;
        char* acct_name;
        fstring pdc_name;
        char *dc_name;
@@ -5917,7 +5918,7 @@ static int rpc_trustdom_vampire(int argc, const char **argv)
        DOM_SID *domain_sids;
        char **trusted_dom_names;
        fstring pdc_name;
-       char *dummy;
+       const char *dummy;
 
        /*
         * Listing trusted domains (stored in secrets.tdb, if local)
@@ -6057,7 +6058,7 @@ static int rpc_trustdom_list(int argc, const char **argv)
        DOM_SID *domain_sids;
        char **trusted_dom_names;
        fstring pdc_name;
-       char *dummy;
+       const char *dummy;
        
        /* trusting domains listing variables */
        POLICY_HND domain_hnd;
index 0c25a5336528229bee7798d49b393d7d0561d37f..6e37f3c84c472d08a511f004adcd83dcf54606e0 100644 (file)
@@ -155,7 +155,7 @@ int net_rpc_join_newstyle(int argc, const char **argv)
 
        NTSTATUS result;
        int retval = 1;
-       char *domain = NULL;
+       const char *domain = NULL;
        uint32 num_rids, *name_types, *user_rids;
        uint32 flags = 0x3e8;
        char *acct_name;
@@ -413,7 +413,7 @@ int net_rpc_join_newstyle(int argc, const char **argv)
 
        /* Now store the secret in the secrets database */
 
-       strupper_m(domain);
+       strupper_m(CONST_DISCARD(char *, domain));
 
        if (!secrets_store_domain_sid(domain, domain_sid)) {
                DEBUG(0, ("error storing domain sid for %s\n", domain));
index a9155a57633d69b1f55f889a85763b639cf87e10..908228717e686e901783d5090de55a0d3caebfb1 100644 (file)
@@ -1799,9 +1799,9 @@ static void set_dc_type_and_flags_connect( struct winbindd_domain *domain )
        struct rpc_pipe_client  *cli;
        POLICY_HND pol;
 
-       char *domain_name = NULL;
-       char *dns_name = NULL;
-       char *forest_name = NULL;       
+       const char *domain_name = NULL;
+       const char *dns_name = NULL;
+       const char *forest_name = NULL;
        DOM_SID *dom_sid = NULL;        
 
        ZERO_STRUCT( ctr );