1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-03 12:58:35 +03:00

Merge branch 'v3-2-test' of ssh://jra@git.samba.org/data/git/samba into v3-2-test

This commit is contained in:
Jeremy Allison 2008-01-15 10:19:47 -08:00
commit 6e17a56039
35 changed files with 1509 additions and 212 deletions

View 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
@ -340,13 +341,13 @@ LIBADDNS_OBJ0 = libaddns/dnsrecord.o libaddns/dnsutils.o libaddns/dnssock.o \
libaddns/dnsgss.o libaddns/dnsmarshall.o
LIBADDNS_OBJ = $(LIBADDNS_OBJ0) $(TALLOC_OBJ)
LIBWBCLIENT_OBJ = nsswitch/libwbclient/wbclient.o \
LIBWBCLIENT_OBJ0 = nsswitch/libwbclient/wbclient.o \
nsswitch/libwbclient/wbc_util.o \
nsswitch/libwbclient/wbc_pwd.o \
nsswitch/libwbclient/wbc_idmap.o \
nsswitch/libwbclient/wbc_sid.o \
nsswitch/libwbclient/wbc_pam.o
LIBWBCLIENT_OBJ = $(LIBWBCLIENT_OBJ0) $(WBCOMMON_OBJ) $(TALLOC_OBJ) $(LIBREPLACE_OBJ)
LIBGPO_OBJ0 = libgpo/gpo_ldap.o libgpo/gpo_ini.o libgpo/gpo_util.o \
libgpo/gpo_fetch.o libgpo/gpo_filesync.o libgpo/gpo_sec.o
@ -503,6 +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_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
@ -671,7 +673,7 @@ RPCCLIENT_OBJ = $(RPCCLIENT_OBJ1) \
$(SMBLDAP_OBJ) $(DCUTIL_OBJ) $(LDB_OBJ)
PAM_WINBIND_OBJ = nsswitch/pam_winbind.o $(WBCOMMON_OBJ) \
$(LIBREPLACE_OBJ) $(SOCKET_WRAPPER_OBJ) @BUILD_INIPARSER@
$(LIBREPLACE_OBJ) @BUILD_INIPARSER@
LIBSMBCLIENT_OBJ = libsmb/libsmbclient.o libsmb/libsmb_compat.o \
libsmb/libsmb_cache.o \
@ -928,7 +930,7 @@ WBINFO_OBJ = nsswitch/wbinfo.o $(LIBSAMBA_OBJ) $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) \
$(SECRETS_OBJ) $(POPT_LIB_OBJ) $(AFS_SETTOKEN_OBJ) $(RPC_PARSE_OBJ1) \
$(DOSERR_OBJ) lib/winbind_util.o @LIBWBCLIENT_STATIC@
WINBIND_NSS_OBJ = $(WBCOMMON_OBJ) $(LIBREPLACE_OBJ) $(SOCKET_WRAPPER_OBJ) @WINBIND_NSS_EXTRA_OBJS@
WINBIND_NSS_OBJ = $(WBCOMMON_OBJ) $(LIBREPLACE_OBJ) @WINBIND_NSS_EXTRA_OBJS@
LDB_COMMON_OBJ=lib/ldb/common/ldb.o lib/ldb/common/ldb_ldif.o \
lib/ldb/common/ldb_parse.o lib/ldb/common/ldb_msg.o lib/ldb/common/ldb_utf8.o \
@ -966,7 +968,7 @@ LDBDEL_OBJ = $(LDB_CMDLINE_OBJ) lib/ldb/tools/ldbdel.o
LDBMODIFY_OBJ = $(LDB_CMDLINE_OBJ) lib/ldb/tools/ldbmodify.o
WINBIND_KRB5_LOCATOR_OBJ1 = nsswitch/winbind_krb5_locator.o
WINBIND_KRB5_LOCATOR_OBJ = $(WINBIND_KRB5_LOCATOR_OBJ1) $(WBCOMMON_OBJ) $(LIBREPLACE_OBJ) $(SOCKET_WRAPPER_OBJ)
WINBIND_KRB5_LOCATOR_OBJ = $(WINBIND_KRB5_LOCATOR_OBJ1) $(WBCOMMON_OBJ) $(LIBREPLACE_OBJ)
POPT_OBJ=popt/findme.o popt/popt.o popt/poptconfig.o \
popt/popthelp.o popt/poptparse.o
@ -1060,7 +1062,7 @@ modules: SHOWFLAGS $(MODULES)
## Perl IDL Compiler
IDL_FILES = unixinfo.idl lsa.idl dfs.idl echo.idl winreg.idl initshutdown.idl \
srvsvc.idl svcctl.idl eventlog.idl wkssvc.idl netlogon.idl notify.idl \
epmapper.idl messaging.idl
epmapper.idl messaging.idl xattr.idl
idl:
@IDL_FILES="$(IDL_FILES)" CPP="$(CPP)" PERL="$(PERL)" \
@ -1396,15 +1398,15 @@ bin/ldbdel: $(BINARY_PREREQS) $(LDBDEL_OBJ) @BUILD_POPT@ @LIBWBCLIENT_SHARED@
@POPTLIBS@ $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \
$(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) @WINBIND_LIBS@
bin/libwbclient.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBWBCLIENT_OBJ) nsswitch/wb_common.o $(LIBSAMBAUTIL_OBJ)
bin/libwbclient.@SHLIBEXT@: $(BINARY_PREREQS) $(LIBWBCLIENT_OBJ)
@echo Linking shared library $@
@$(SHLD_DSO) $(LIBWBCLIENT_OBJ) nsswitch/wb_common.o $(LIBSAMBAUTIL_OBJ) \
@$(SHLD_DSO) $(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 $@
@ -1684,6 +1686,10 @@ bin/afsacl.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_AFSACL_OBJ)
@echo "Building plugin $@"
@$(SHLD_MODULE) $(VFS_AFSACL_OBJ)
bin/xattr_tdb.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_XATTR_TDB_OBJ)
@echo "Building plugin $@"
@$(SHLD_MODULE) $(VFS_XATTR_TDB_OBJ)
bin/posixacl.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_POSIXACL_OBJ)
@echo "Building plugin $@"
@$(SHLD_MODULE) $(VFS_POSIXACL_OBJ)
@ -1884,9 +1890,10 @@ installlibaddns: installdirs libaddns
-$(INSTALLLIBCMD_A) bin/libaddns.a $(DESTDIR)$(LIBDIR)
installlibwbclient: installdirs libwbclient
@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(LIBDIR) $(INCLUDEDIR)/samba
@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(LIBDIR)
-$(INSTALLLIBCMD_SH) bin/libwbclient.@SHLIBEXT@ $(DESTDIR)$(LIBDIR)
-$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/nsswitch/libwbclient/wbclient.h $(DESTDIR)${prefix}/include/samba
@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) ${prefix}/include
-$(INSTALLCMD) -m $(INSTALLPERMS_DATA) $(srcdir)/nsswitch/libwbclient/wbclient.h $(DESTDIR)${prefix}/include
installlibnetapi: installdirs libnetapi
@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(LIBDIR)

View 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"
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,6 +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_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)
@ -6656,7 +6657,10 @@ AC_SUBST(SMBD_LIBS)
AC_OUTPUT(Makefile library-versions
script/findsmb smbadduser script/gen-8bit-gap.sh script/installbin.sh script/uninstallbin.sh
lib/netapi/examples/Makefile
pkgconfig/smbclient.pc pkgconfig/netapi.pc pkgconfig/smbsharemodes.pc
pkgconfig/smbclient.pc
pkgconfig/wbclient.pc
pkgconfig/netapi.pc
pkgconfig/smbsharemodes.pc
)
#################################################

View 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;

View 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"

View File

@ -107,10 +107,6 @@ static ADS_STATUS libnet_join_connect_ads(TALLOC_CTX *mem_ctx,
{
ADS_STATUS status;
if (r->in.ads) {
ads_destroy(&r->in.ads);
}
status = libnet_connect_ads(r->in.domain_name,
r->in.domain_name,
r->in.dc_name,
@ -134,10 +130,6 @@ static ADS_STATUS libnet_unjoin_connect_ads(TALLOC_CTX *mem_ctx,
{
ADS_STATUS status;
if (r->in.ads) {
ads_destroy(&r->in.ads);
}
status = libnet_connect_ads(r->in.domain_name,
r->in.domain_name,
r->in.dc_name,
@ -244,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);
@ -1013,6 +1004,58 @@ static WERROR do_UnjoinConfig(struct libnet_UnjoinCtx *r)
/****************************************************************
****************************************************************/
static WERROR libnet_join_pre_processing(TALLOC_CTX *mem_ctx,
struct libnet_JoinCtx *r)
{
if (!r->in.domain_name) {
return WERR_INVALID_PARAM;
}
if (r->in.modify_config && !lp_include_registry_globals()) {
return WERR_NOT_SUPPORTED;
}
if (IS_DC) {
return WERR_SETUP_DOMAIN_CONTROLLER;
}
if (!secrets_init()) {
libnet_join_set_error_string(mem_ctx, r,
"Unable to open secrets database");
return WERR_CAN_NOT_COMPLETE;
}
return WERR_OK;
}
/****************************************************************
****************************************************************/
static WERROR libnet_join_post_processing(TALLOC_CTX *mem_ctx,
struct libnet_JoinCtx *r)
{
WERROR werr;
if (!W_ERROR_IS_OK(r->out.result)) {
return r->out.result;
}
werr = do_JoinConfig(r);
if (!W_ERROR_IS_OK(werr)) {
return werr;
}
if (r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) {
saf_store(r->in.domain_name, r->in.dc_name);
}
return WERR_OK;
}
/****************************************************************
****************************************************************/
static int libnet_destroy_JoinCtx(struct libnet_JoinCtx *r)
{
if (r->in.ads) {
@ -1170,30 +1213,30 @@ WERROR libnet_Join(TALLOC_CTX *mem_ctx,
{
WERROR werr;
if (!r->in.domain_name) {
return WERR_INVALID_PARAM;
if (r->in.debug) {
NDR_PRINT_IN_DEBUG(libnet_JoinCtx, r);
}
if (r->in.modify_config && !lp_include_registry_globals()) {
return WERR_NOT_SUPPORTED;
}
if (IS_DC) {
return WERR_SETUP_DOMAIN_CONTROLLER;
werr = libnet_join_pre_processing(mem_ctx, r);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
if (r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) {
werr = libnet_DomainJoin(mem_ctx, r);
if (!W_ERROR_IS_OK(werr)) {
return werr;
goto done;
}
}
werr = do_JoinConfig(r);
werr = libnet_join_post_processing(mem_ctx, r);
if (!W_ERROR_IS_OK(werr)) {
return werr;
goto done;
}
done:
if (r->in.debug) {
NDR_PRINT_OUT_DEBUG(libnet_JoinCtx, r);
}
return werr;
}
@ -1205,6 +1248,29 @@ static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx,
{
NTSTATUS status;
if (!r->in.dc_name) {
struct DS_DOMAIN_CONTROLLER_INFO *info;
status = dsgetdcname(mem_ctx,
NULL,
r->in.domain_name,
NULL,
NULL,
DS_DIRECTORY_SERVICE_REQUIRED |
DS_WRITABLE_REQUIRED |
DS_RETURN_DNS_NAME,
&info);
if (!NT_STATUS_IS_OK(status)) {
libnet_unjoin_set_error_string(mem_ctx, r,
"failed to find DC: %s",
nt_errstr(status));
return WERR_DOMAIN_CONTROLLER_NOT_FOUND;
}
r->in.dc_name = talloc_strdup(mem_ctx,
info->domain_controller_name);
W_ERROR_HAVE_NO_MEMORY(r->in.dc_name);
}
status = libnet_join_unjoindomain_rpc(mem_ctx, r);
if (!NT_STATUS_IS_OK(status)) {
libnet_unjoin_set_error_string(mem_ctx, r,
@ -1237,26 +1303,54 @@ static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx,
/****************************************************************
****************************************************************/
static WERROR libnet_unjoin_pre_processing(TALLOC_CTX *mem_ctx,
struct libnet_UnjoinCtx *r)
{
if (r->in.modify_config && !lp_include_registry_globals()) {
return WERR_NOT_SUPPORTED;
}
if (!secrets_init()) {
libnet_unjoin_set_error_string(mem_ctx, r,
"Unable to open secrets database");
return WERR_CAN_NOT_COMPLETE;
}
return WERR_OK;
}
/****************************************************************
****************************************************************/
WERROR libnet_Unjoin(TALLOC_CTX *mem_ctx,
struct libnet_UnjoinCtx *r)
{
WERROR werr;
if (r->in.modify_config && !lp_include_registry_globals()) {
return WERR_NOT_SUPPORTED;
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;
}
if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) {
werr = libnet_DomainUnjoin(mem_ctx, r);
if (!W_ERROR_IS_OK(werr)) {
do_UnjoinConfig(r);
return werr;
goto done;
}
}
werr = do_UnjoinConfig(r);
if (!W_ERROR_IS_OK(werr)) {
return werr;
goto done;
}
done:
if (r->in.debug) {
NDR_PRINT_OUT_DEBUG(libnet_UnjoinCtx, r);
}
return werr;

View File

@ -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

View File

@ -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 */

View File

@ -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--;
}

View File

@ -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 */

View File

@ -0,0 +1,102 @@
/* parser auto-generated by pidl */
#include "includes.h"
#include "librpc/gen_ndr/ndr_xattr.h"
_PUBLIC_ enum ndr_err_code ndr_push_tdb_xattr(struct ndr_push *ndr, int ndr_flags, const struct tdb_xattr *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
{
uint32_t _flags_save_string = ndr->flags;
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->name));
ndr->flags = _flags_save_string;
}
NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->value));
}
if (ndr_flags & NDR_BUFFERS) {
}
return NDR_ERR_SUCCESS;
}
_PUBLIC_ enum ndr_err_code ndr_pull_tdb_xattr(struct ndr_pull *ndr, int ndr_flags, struct tdb_xattr *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
{
uint32_t _flags_save_string = ndr->flags;
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM);
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->name));
ndr->flags = _flags_save_string;
}
NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->value));
}
if (ndr_flags & NDR_BUFFERS) {
}
return NDR_ERR_SUCCESS;
}
_PUBLIC_ void ndr_print_tdb_xattr(struct ndr_print *ndr, const char *name, const struct tdb_xattr *r)
{
ndr_print_struct(ndr, name, "tdb_xattr");
ndr->depth++;
ndr_print_string(ndr, "name", r->name);
ndr_print_DATA_BLOB(ndr, "value", r->value);
ndr->depth--;
}
_PUBLIC_ enum ndr_err_code ndr_push_tdb_xattrs(struct ndr_push *ndr, int ndr_flags, const struct tdb_xattrs *r)
{
uint32_t cntr_xattrs_0;
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_xattrs));
for (cntr_xattrs_0 = 0; cntr_xattrs_0 < r->num_xattrs; cntr_xattrs_0++) {
NDR_CHECK(ndr_push_tdb_xattr(ndr, NDR_SCALARS, &r->xattrs[cntr_xattrs_0]));
}
}
if (ndr_flags & NDR_BUFFERS) {
}
return NDR_ERR_SUCCESS;
}
_PUBLIC_ enum ndr_err_code ndr_pull_tdb_xattrs(struct ndr_pull *ndr, int ndr_flags, struct tdb_xattrs *r)
{
uint32_t cntr_xattrs_0;
TALLOC_CTX *_mem_save_xattrs_0;
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_xattrs));
NDR_PULL_ALLOC_N(ndr, r->xattrs, r->num_xattrs);
_mem_save_xattrs_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->xattrs, 0);
for (cntr_xattrs_0 = 0; cntr_xattrs_0 < r->num_xattrs; cntr_xattrs_0++) {
NDR_CHECK(ndr_pull_tdb_xattr(ndr, NDR_SCALARS, &r->xattrs[cntr_xattrs_0]));
}
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_xattrs_0, 0);
}
if (ndr_flags & NDR_BUFFERS) {
}
return NDR_ERR_SUCCESS;
}
_PUBLIC_ void ndr_print_tdb_xattrs(struct ndr_print *ndr, const char *name, const struct tdb_xattrs *r)
{
uint32_t cntr_xattrs_0;
ndr_print_struct(ndr, name, "tdb_xattrs");
ndr->depth++;
ndr_print_uint32(ndr, "num_xattrs", r->num_xattrs);
ndr->print(ndr, "%s: ARRAY(%d)", "xattrs", r->num_xattrs);
ndr->depth++;
for (cntr_xattrs_0=0;cntr_xattrs_0<r->num_xattrs;cntr_xattrs_0++) {
char *idx_0=NULL;
asprintf(&idx_0, "[%d]", cntr_xattrs_0);
if (idx_0) {
ndr_print_tdb_xattr(ndr, "xattrs", &r->xattrs[cntr_xattrs_0]);
free(idx_0);
}
}
ndr->depth--;
ndr->depth--;
}

View File

@ -0,0 +1,16 @@
/* header auto-generated by pidl */
#include "librpc/ndr/libndr.h"
#include "librpc/gen_ndr/xattr.h"
#ifndef _HEADER_NDR_xattr
#define _HEADER_NDR_xattr
#define NDR_XATTR_CALL_COUNT (0)
enum ndr_err_code ndr_push_tdb_xattr(struct ndr_push *ndr, int ndr_flags, const struct tdb_xattr *r);
enum ndr_err_code ndr_pull_tdb_xattr(struct ndr_pull *ndr, int ndr_flags, struct tdb_xattr *r);
void ndr_print_tdb_xattr(struct ndr_print *ndr, const char *name, const struct tdb_xattr *r);
enum ndr_err_code ndr_push_tdb_xattrs(struct ndr_push *ndr, int ndr_flags, const struct tdb_xattrs *r);
enum ndr_err_code ndr_pull_tdb_xattrs(struct ndr_pull *ndr, int ndr_flags, struct tdb_xattrs *r);
void ndr_print_tdb_xattrs(struct ndr_print *ndr, const char *name, const struct tdb_xattrs *r);
#endif /* _HEADER_NDR_xattr */

View File

@ -0,0 +1,18 @@
/* header auto-generated by pidl */
#include <stdint.h>
#ifndef _HEADER_xattr
#define _HEADER_xattr
struct tdb_xattr {
const char * name;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
DATA_BLOB value;
}/* [public] */;
struct tdb_xattrs {
uint32_t num_xattrs;
struct tdb_xattr *xattrs;
}/* [public] */;
#endif /* _HEADER_xattr */

View File

@ -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
);
}

View File

@ -0,0 +1,23 @@
#include "idl_types.h"
/*
IDL structures for xattrs
*/
[
pointer_default(unique)
]
interface xattr
{
/* xattrs for file systems that don't have any */
typedef [public] struct {
utf8string name;
DATA_BLOB value;
} tdb_xattr;
typedef [public] struct {
uint32 num_xattrs;
tdb_xattr xattrs[num_xattrs];
} tdb_xattrs;
}

View 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));
}

View 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--;
}

View File

@ -404,6 +404,9 @@ ssize_t cli_write(struct cli_state *cli,
mpx = 1;
}
/* Default (small) writesize. */
writesize = (cli->max_xmit - (smb_size+32)) & ~1023;
if (write_mode == 0 &&
!client_is_signing_on(cli) &&
!cli_encryption_on(cli) &&
@ -415,11 +418,11 @@ ssize_t cli_write(struct cli_state *cli,
} else if (cli->capabilities & CAP_LARGE_WRITEX) {
if (cli->is_samba) {
writesize = CLI_SAMBA_MAX_LARGE_WRITEX_SIZE;
} else {
} else if (!client_is_signing_on(cli)) {
/* Windows restricts signed writes to max_xmit.
* Found by Volker. */
writesize = CLI_WINDOWS_MAX_LARGE_WRITEX_SIZE;
}
} else {
writesize = (cli->max_xmit - (smb_size+32)) & ~1023;
}
blocks = (size + (writesize-1)) / writesize;

View File

@ -0,0 +1,737 @@
/*
* Store posix-level xattrs in a tdb
*
* Copyright (C) Volker Lendecke, 2007
*
* 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/>.
*/
#include "includes.h"
#include "librpc/gen_ndr/xattr.h"
#include "librpc/gen_ndr/ndr_xattr.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_VFS
/*
* unmarshall tdb_xattrs
*/
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;
struct tdb_xattrs *result;
if (!(result = TALLOC_ZERO_P(mem_ctx, struct tdb_xattrs))) {
return NT_STATUS_NO_MEMORY;
}
if (data->dsize == 0) {
*presult = result;
return NT_STATUS_OK;
}
blob = data_blob_const(data->dptr, data->dsize);
ndr_err = ndr_pull_struct_blob(
&blob, result, result,
(ndr_pull_flags_fn_t)ndr_pull_tdb_xattrs);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
DEBUG(0, ("ndr_pull_tdb_xattrs failed: %s\n",
ndr_errstr(ndr_err)));
TALLOC_FREE(result);
return ndr_map_error2ntstatus(ndr_err);;
}
*presult = result;
return NT_STATUS_OK;
}
/*
* marshall tdb_xattrs
*/
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;
ndr_err = ndr_push_struct_blob(
&blob, mem_ctx, attribs,
(ndr_push_flags_fn_t)ndr_push_tdb_xattrs);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
DEBUG(0, ("ndr_push_tdb_xattrs failed: %s\n",
ndr_errstr(ndr_err)));
return ndr_map_error2ntstatus(ndr_err);;
}
*data = make_tdb_data(blob.data, blob.length);
return NT_STATUS_OK;
}
/*
* Load tdb_xattrs for a file from the tdb
*/
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;
TDB_DATA data;
push_file_id_16((char *)id_buf, id);
if (db_ctx->fetch(db_ctx, mem_ctx,
make_tdb_data(id_buf, sizeof(id_buf)),
&data) == -1) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
status = xattr_tdb_pull_attrs(mem_ctx, &data, presult);
TALLOC_FREE(data.dptr);
return NT_STATUS_OK;
}
/*
* fetch_lock the tdb_ea record for a file
*/
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);
return db_ctx->fetch_locked(db_ctx, mem_ctx,
make_tdb_data(id_buf, sizeof(id_buf)));
}
/*
* Save tdb_xattrs to a previously fetch_locked record
*/
static NTSTATUS xattr_tdb_save_attrs(struct db_record *rec,
const struct tdb_xattrs *attribs)
{
TDB_DATA data;
NTSTATUS status;
status = xattr_tdb_push_attrs(talloc_tos(), attribs, &data);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("xattr_tdb_push_attrs failed: %s\n",
nt_errstr(status)));
return status;
}
status = rec->store(rec, data, 0);
TALLOC_FREE(data.dptr);
return status;
}
/*
* Worker routine for getxattr and fgetxattr
*/
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 = xattr_tdb_load_attrs(talloc_tos(), db_ctx, id, &attribs);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("xattr_tdb_fetch_attrs failed: %s\n",
nt_errstr(status)));
errno = EINVAL;
return -1;
}
for (i=0; i<attribs->num_xattrs; i++) {
if (strcmp(attribs->xattrs[i].name, name) == 0) {
break;
}
}
if (i == attribs->num_xattrs) {
errno = ENOATTR;
goto fail;
}
if (attribs->xattrs[i].value.length > size) {
errno = ERANGE;
goto fail;
}
memcpy(value, attribs->xattrs[i].value.data,
attribs->xattrs[i].value.length);
result = attribs->xattrs[i].value.length;
fail:
TALLOC_FREE(attribs);
return result;
}
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;
struct db_context *db;
SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1);
if (SMB_VFS_STAT(handle->conn, path, &sbuf) == -1) {
return -1;
}
id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
return xattr_tdb_getattr(db, &id, name, value, 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;
struct db_context *db;
SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1);
if (SMB_VFS_FSTAT(fsp, &sbuf) == -1) {
return -1;
}
id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
return xattr_tdb_getattr(db, &id, name, value, size);
}
/*
* Worker routine for setxattr and fsetxattr
*/
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 = xattr_tdb_lock_attrs(talloc_tos(), db_ctx, id);
if (rec == NULL) {
DEBUG(0, ("xattr_tdb_lock_attrs failed\n"));
errno = EINVAL;
return -1;
}
status = xattr_tdb_pull_attrs(rec, &rec->value, &attribs);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("xattr_tdb_fetch_attrs failed: %s\n",
nt_errstr(status)));
TALLOC_FREE(rec);
return -1;
}
for (i=0; i<attribs->num_xattrs; i++) {
if (strcmp(attribs->xattrs[i].name, name) == 0) {
break;
}
}
if (i == attribs->num_xattrs) {
struct tdb_xattr *tmp;
tmp = TALLOC_REALLOC_ARRAY(
attribs, attribs->xattrs, struct tdb_xattr,
attribs->num_xattrs + 1);
if (tmp == NULL) {
DEBUG(0, ("TALLOC_REALLOC_ARRAY failed\n"));
TALLOC_FREE(rec);
errno = ENOMEM;
return -1;
}
attribs->xattrs = tmp;
attribs->num_xattrs += 1;
}
attribs->xattrs[i].name = name;
attribs->xattrs[i].value.data = CONST_DISCARD(uint8 *, value);
attribs->xattrs[i].value.length = size;
status = xattr_tdb_save_attrs(rec, attribs);
TALLOC_FREE(rec);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("save failed: %s\n", nt_errstr(status)));
return -1;
}
return 0;
}
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;
struct db_context *db;
SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1);
if (SMB_VFS_STAT(handle->conn, path, &sbuf) == -1) {
return -1;
}
id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
return xattr_tdb_setattr(db, &id, name, value, size, 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;
struct db_context *db;
SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1);
if (SMB_VFS_FSTAT(fsp, &sbuf) == -1) {
return -1;
}
id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
return xattr_tdb_setattr(db, &id, name, value, size, flags);
}
/*
* Worker routine for listxattr and flistxattr
*/
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 = xattr_tdb_load_attrs(talloc_tos(), db_ctx, id, &attribs);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("xattr_tdb_fetch_attrs failed: %s\n",
nt_errstr(status)));
errno = EINVAL;
return -1;
}
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, ("xattr_tdb_listattr: xattrs[i].name: %s\n",
attribs->xattrs[i].name));
tmp = strlen(attribs->xattrs[i].name);
/*
* Try to protect against overflow
*/
if (len + (tmp+1) < len) {
TALLOC_FREE(attribs);
errno = EINVAL;
return -1;
}
/*
* Take care of the terminating NULL
*/
len += (tmp + 1);
}
if (len > size) {
TALLOC_FREE(attribs);
errno = ERANGE;
return -1;
}
len = 0;
for (i=0; i<attribs->num_xattrs; i++) {
strlcpy(list+len, attribs->xattrs[i].name,
size-len);
len += (strlen(attribs->xattrs[i].name) + 1);
}
TALLOC_FREE(attribs);
return len;
}
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;
struct db_context *db;
SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1);
if (SMB_VFS_STAT(handle->conn, path, &sbuf) == -1) {
return -1;
}
id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
return xattr_tdb_listattr(db, &id, list, 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;
struct db_context *db;
SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1);
if (SMB_VFS_FSTAT(fsp, &sbuf) == -1) {
return -1;
}
id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
return xattr_tdb_listattr(db, &id, list, size);
}
/*
* Worker routine for removexattr and fremovexattr
*/
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 = xattr_tdb_lock_attrs(talloc_tos(), db_ctx, id);
if (rec == NULL) {
DEBUG(0, ("xattr_tdb_lock_attrs failed\n"));
errno = EINVAL;
return -1;
}
status = xattr_tdb_pull_attrs(rec, &rec->value, &attribs);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(10, ("xattr_tdb_fetch_attrs failed: %s\n",
nt_errstr(status)));
TALLOC_FREE(rec);
return -1;
}
for (i=0; i<attribs->num_xattrs; i++) {
if (strcmp(attribs->xattrs[i].name, name) == 0) {
break;
}
}
if (i == attribs->num_xattrs) {
TALLOC_FREE(rec);
errno = ENOATTR;
return -1;
}
attribs->xattrs[i] =
attribs->xattrs[attribs->num_xattrs-1];
attribs->num_xattrs -= 1;
if (attribs->num_xattrs == 0) {
rec->delete_rec(rec);
TALLOC_FREE(rec);
return 0;
}
status = xattr_tdb_save_attrs(rec, attribs);
TALLOC_FREE(rec);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("save failed: %s\n", nt_errstr(status)));
return -1;
}
return 0;
}
static int xattr_tdb_removexattr(struct vfs_handle_struct *handle,
const char *path, const char *name)
{
SMB_STRUCT_STAT sbuf;
struct file_id id;
struct db_context *db;
SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1);
if (SMB_VFS_STAT(handle->conn, path, &sbuf) == -1) {
return -1;
}
id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
return xattr_tdb_removeattr(db, &id, 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;
struct db_context *db;
SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1);
if (SMB_VFS_FSTAT(fsp, &sbuf) == -1) {
return -1;
}
id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
return xattr_tdb_removeattr(db, &id, name);
}
/*
* Open the tdb file upon VFS_CONNECT
*/
static bool xattr_tdb_init(int snum, struct db_context **p_db)
{
struct db_context *db;
const char *dbname;
dbname = lp_parm_const_string(snum, "ea", "tdb", lock_path("eas.tdb"));
if (dbname == NULL) {
errno = ENOTSUP;
return false;
}
become_root();
db = db_open(NULL, dbname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
unbecome_root();
if (db == NULL) {
errno = ENOTSUP;
return false;
}
*p_db = db;
return true;
}
/*
* On unlink we need to delete the tdb record
*/
static int xattr_tdb_unlink(vfs_handle_struct *handle, const char *path)
{
SMB_STRUCT_STAT sbuf;
struct file_id id;
struct db_context *db;
struct db_record *rec;
int ret;
SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1);
if (SMB_VFS_STAT(handle->conn, path, &sbuf) == -1) {
return -1;
}
ret = SMB_VFS_NEXT_UNLINK(handle, path);
if (ret == -1) {
return -1;
}
id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
rec = xattr_tdb_lock_attrs(talloc_tos(), db, &id);
/*
* If rec == NULL there's not much we can do about it
*/
if (rec != NULL) {
rec->delete_rec(rec);
TALLOC_FREE(rec);
}
return 0;
}
/*
* On rmdir we need to delete the tdb record
*/
static int xattr_tdb_rmdir(vfs_handle_struct *handle, const char *path)
{
SMB_STRUCT_STAT sbuf;
struct file_id id;
struct db_context *db;
struct db_record *rec;
int ret;
SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1);
if (SMB_VFS_STAT(handle->conn, path, &sbuf) == -1) {
return -1;
}
ret = SMB_VFS_NEXT_RMDIR(handle, path);
if (ret == -1) {
return -1;
}
id = SMB_VFS_FILE_ID_CREATE(handle->conn, sbuf.st_dev, sbuf.st_ino);
rec = xattr_tdb_lock_attrs(talloc_tos(), db, &id);
/*
* If rec == NULL there's not much we can do about it
*/
if (rec != NULL) {
rec->delete_rec(rec);
TALLOC_FREE(rec);
}
return 0;
}
/*
* Destructor for the VFS private data
*/
static void close_ea_db(void **data)
{
struct db_context **p_db = (struct db_context **)data;
TALLOC_FREE(*p_db);
}
static int xattr_tdb_connect(vfs_handle_struct *handle, const char *service,
const char *user)
{
fstring sname;
int res, snum;
struct db_context *db;
res = SMB_VFS_NEXT_CONNECT(handle, service, user);
if (res < 0) {
return res;
}
fstrcpy(sname, service);
snum = find_service(sname);
if (snum == -1) {
/*
* Should not happen, but we should not fail just *here*.
*/
return 0;
}
if (!xattr_tdb_init(snum, &db)) {
DEBUG(5, ("Could not init ea tdb\n"));
lp_do_parameter(snum, "ea support", "False");
return 0;
}
lp_do_parameter(snum, "ea support", "True");
SMB_VFS_HANDLE_SET_DATA(handle, db, close_ea_db,
struct db_context, return -1);
return 0;
}
/* VFS operations structure */
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(xattr_tdb_fgetxattr), SMB_VFS_OP_FGETXATTR,
SMB_VFS_LAYER_TRANSPARENT},
{SMB_VFS_OP(xattr_tdb_setxattr), SMB_VFS_OP_SETXATTR,
SMB_VFS_LAYER_TRANSPARENT},
{SMB_VFS_OP(xattr_tdb_fsetxattr), SMB_VFS_OP_FSETXATTR,
SMB_VFS_LAYER_TRANSPARENT},
{SMB_VFS_OP(xattr_tdb_listxattr), SMB_VFS_OP_LISTXATTR,
SMB_VFS_LAYER_TRANSPARENT},
{SMB_VFS_OP(xattr_tdb_flistxattr), SMB_VFS_OP_FLISTXATTR,
SMB_VFS_LAYER_TRANSPARENT},
{SMB_VFS_OP(xattr_tdb_removexattr), SMB_VFS_OP_REMOVEXATTR,
SMB_VFS_LAYER_TRANSPARENT},
{SMB_VFS_OP(xattr_tdb_fremovexattr), SMB_VFS_OP_FREMOVEXATTR,
SMB_VFS_LAYER_TRANSPARENT},
{SMB_VFS_OP(xattr_tdb_unlink), SMB_VFS_OP_UNLINK,
SMB_VFS_LAYER_TRANSPARENT},
{SMB_VFS_OP(xattr_tdb_rmdir), SMB_VFS_OP_RMDIR,
SMB_VFS_LAYER_TRANSPARENT},
{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_xattr_tdb_init(void);
NTSTATUS vfs_xattr_tdb_init(void)
{
return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "xattr_tdb",
xattr_tdb_ops);
}

View File

@ -1,51 +0,0 @@
/*
Unix SMB/CIFS implementation.
Winbind client API
Copyright (C) Gerald (Jerry) Carter 2007
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _WBC_ERR_H
#define _WBC_ERR_H
/* Define error types */
/**
* @brief Status codes returned from wbc functions
**/
enum _wbcErrType {
WBC_ERR_SUCCESS = 0, /**< Successful completion **/
WBC_ERR_NOT_IMPLEMENTED,/**< Function not implemented **/
WBC_ERR_UNKNOWN_FAILURE,/**< General failure **/
WBC_ERR_NO_MEMORY, /**< Memory allocation error **/
WBC_ERR_INVALID_SID, /**< Invalid SID format **/
WBC_ERR_INVALID_PARAM, /**< An Invalid parameter was supplied **/
WBC_ERR_WINBIND_NOT_AVAILABLE, /**< Winbind daemon is not available **/
WBC_ERR_DOMAIN_NOT_FOUND, /**< Domain is not trusted or cannot be found **/
WBC_INVALID_RESPONSE, /**< Winbind returned an invalid response **/
WBC_ERR_NSS_ERROR /**< NSS_STATUS error **/
};
typedef enum _wbcErrType wbcErr;
#define WBC_ERROR_IS_OK(x) ((x) == WBC_ERR_SUCCESS)
char *wbcErrorString(wbcErr error);
#endif /* _WBC_ERR_H */

View File

@ -23,7 +23,32 @@
#define _WBCLIENT_H
#include <pwd.h>
#include <nsswitch/libwbclient/wbc_err.h>
#include <grp.h>
/* Define error types */
/**
* @brief Status codes returned from wbc functions
**/
enum _wbcErrType {
WBC_ERR_SUCCESS = 0, /**< Successful completion **/
WBC_ERR_NOT_IMPLEMENTED,/**< Function not implemented **/
WBC_ERR_UNKNOWN_FAILURE,/**< General failure **/
WBC_ERR_NO_MEMORY, /**< Memory allocation error **/
WBC_ERR_INVALID_SID, /**< Invalid SID format **/
WBC_ERR_INVALID_PARAM, /**< An Invalid parameter was supplied **/
WBC_ERR_WINBIND_NOT_AVAILABLE, /**< Winbind daemon is not available **/
WBC_ERR_DOMAIN_NOT_FOUND, /**< Domain is not trusted or cannot be found **/
WBC_INVALID_RESPONSE, /**< Winbind returned an invalid response **/
WBC_ERR_NSS_ERROR /**< NSS_STATUS error **/
};
typedef enum _wbcErrType wbcErr;
#define WBC_ERROR_IS_OK(x) ((x) == WBC_ERR_SUCCESS)
char *wbcErrorString(wbcErr error);
/*
* Data types used by the Winbind Client API

View File

@ -27,6 +27,14 @@
#undef SIZEOF_LONG
#endif
/*
* we don't need socket wrapper
* nor nss wrapper here and we don't
* want to depend on swrap_close()
* so we better disable both
*/
#define SOCKET_WRAPPER_NOT_REPLACE
#define NSS_WRAPPER_NOT_REPLACE
/* Include header files from data in config.h file */

View File

@ -0,0 +1,13 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: Samba libwbclient
Description: A library to access winbindd
Version: 0
URL: http://www.samba.org/
#Libs: -L@libdir@ -lwbclient
Libs: -lwbclient
Libs.private: -lwbclient
Cflags: -I@includedir@

View File

@ -1,4 +1,4 @@
/*
/*
* Unix SMB/CIFS implementation.
* Virtual Windows Registry Layer
* Copyright (C) Volker Lendecke 2006
@ -7,12 +7,12 @@
* 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/>.
*/
@ -140,7 +140,7 @@ static WERROR regkey_open_onelevel(TALLOC_CTX *mem_ctx,
result = WERR_BADFILE;
goto done;
}
/* check if the path really exists; failed is indicated by -1 */
/* if the subkey count failed, bail out */
@ -153,7 +153,7 @@ static WERROR regkey_open_onelevel(TALLOC_CTX *mem_ctx,
result = WERR_BADFILE;
goto done;
}
TALLOC_FREE( subkeys );
if ( !regkey_access_check( key, access_desired, &key->access_granted,
@ -302,7 +302,7 @@ WERROR reg_enumvalue(TALLOC_CTX *mem_ctx, struct registry_key *key,
SAFE_FREE(val);
return WERR_NOMEM;
}
*pval = val;
return WERR_OK;
}
@ -494,7 +494,6 @@ WERROR reg_createkey(TALLOC_CTX *ctx, struct registry_key *parent,
TALLOC_FREE(mem_ctx);
return err;
}
WERROR reg_deletekey(struct registry_key *parent, const char *path)
{
@ -712,8 +711,8 @@ WERROR reg_open_path(TALLOC_CTX *mem_ctx, const char *orig_path,
}
/*
* Utility function to delete a registry key with all its subkeys.
* Note that reg_deletekey returns ACCESS_DENIED when called on a
* Utility function to delete a registry key with all its subkeys.
* Note that reg_deletekey returns ACCESS_DENIED when called on a
* key that has subkeys.
*/
WERROR reg_deletekey_recursive_internal(TALLOC_CTX *ctx,
@ -739,11 +738,11 @@ WERROR reg_deletekey_recursive_internal(TALLOC_CTX *ctx,
}
while (W_ERROR_IS_OK(werr = reg_enumkey(mem_ctx, key, 0,
&subkey_name, NULL)))
&subkey_name, NULL)))
{
werr = reg_deletekey_recursive_internal(mem_ctx, key,
subkey_name,
True);
true);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
@ -771,12 +770,12 @@ WERROR reg_deletekey_recursive(TALLOC_CTX *ctx,
struct registry_key *parent,
const char *path)
{
return reg_deletekey_recursive_internal(ctx, parent, path, True);
return reg_deletekey_recursive_internal(ctx, parent, path, true);
}
WERROR reg_deletesubkeys_recursive(TALLOC_CTX *ctx,
struct registry_key *parent,
const char *path)
{
return reg_deletekey_recursive_internal(ctx, parent, path, False);
return reg_deletekey_recursive_internal(ctx, parent, path, false);
}

View 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)
{

View 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;

19
source/script/fix_bool.pl Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/perl -w
open(INFILE, "$ARGV[0]") || die $@;
open(OUTFILE, ">$ARGV[0].new") || die $@;
while (<INFILE>) {
$_ =~ s/True/true/;
$_ =~ s/False/false/;
print OUTFILE "$_";
}
close(INFILE);
close(OUTFILE);
rename("$ARGV[0].new", "$ARGV[0]") || die @_;
exit(0);

View File

@ -186,6 +186,7 @@ cat >$SERVERCONFFILE<<EOF
map hidden = yes
map system = yes
create mask = 755
vfs objects = $BINDIR/xattr_tdb.so
[hideunread]
copy = tmp
hide unreadable = yes

View File

@ -47,7 +47,7 @@ unix="UNIX-INFO2"
tests="$base $raw $rpc $unix"
skipped="BASE-CHARSET BASE-DELAYWRITE BASE-TCONDEV"
skipped="$skipped RAW-ACLS RAW-COMPOSITE RAW-CONTEXT RAW-EAS"
skipped="$skipped RAW-ACLS RAW-COMPOSITE RAW-CONTEXT"
skipped="$skipped RAW-IOCTL"
skipped="$skipped RAW-QFILEINFO RAW-QFSINFO RAW-SEARCH"
skipped="$skipped RAW-SFILEINFO RAW-STREAMS"

View 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;

View 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)
{
@ -1294,14 +1295,13 @@ static bool net_derive_salting_principal( TALLOC_CTX *ctx, ADS_STRUCT *ads )
#if defined(WITH_DNS_UPDATES)
#include "dns.h"
DNS_ERROR DoDNSUpdate(char *pszServerName,
const char *pszDomainName,
const char *pszHostName,
const struct in_addr *iplist, int num_addrs );
const char *pszDomainName, const char *pszHostName,
const struct sockaddr_storage *sslist,
size_t num_addrs );
static NTSTATUS net_update_dns_internal(TALLOC_CTX *ctx, ADS_STRUCT *ads,
const char *machine_name,
const struct in_addr *addrs,
const struct sockaddr_storage *addrs,
int num_addrs)
{
struct dns_rr_ns *nameservers = NULL;
@ -1390,7 +1390,7 @@ done:
static NTSTATUS net_update_dns(TALLOC_CTX *mem_ctx, ADS_STRUCT *ads)
{
int num_addrs;
struct in_addr *iplist = NULL;
struct sockaddr_storage *iplist = NULL;
fstring machine_name;
NTSTATUS status;
@ -1446,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;

View File

@ -32,7 +32,8 @@
DNS_ERROR DoDNSUpdate(char *pszServerName,
const char *pszDomainName, const char *pszHostName,
const struct sockaddr_storage *sslist, size_t num_addrs );
const struct sockaddr_storage *sslist,
size_t num_addrs );
/*********************************************************************
*********************************************************************/

View 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;

View 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;

View 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));

View 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 );